/* The JOV Control Pad's preview (family/apps/control.js): the pad in its own warm look (the
   colours of the app's design/tokens.json, copper accent), light and dark with the page, and
   beside it a small drawing of the paired Mac. On phones the Mac sits above the pad. */

.ct {
  --ct-bg: #f3f1ec; --ct-surface: #f9f8f4; --ct-raised: #ffffff; --ct-sunken: #e3dfd7; --ct-line: #d6d2c9;
  --ct-text: #1b1c1e; --ct-muted: #5e5c57; --ct-accent: #a95f33; --ct-on-accent: #ffffff;
  --ct-ok: #2f8a55; --ct-danger: #c0473a;
  flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 12px; background: var(--ct-bg); color: var(--ct-text);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ct {
    --ct-bg: #121315; --ct-surface: #17181b; --ct-raised: #1e2023; --ct-sunken: #0b0c0d; --ct-line: #2a2c30;
    --ct-text: #eceae4; --ct-muted: #9d9b94; --ct-accent: #d99a6c; --ct-on-accent: #141414;
    --ct-ok: #7cc495; --ct-danger: #e5776a;
  }
}
:root[data-theme="dark"] .ct {
  --ct-bg: #121315; --ct-surface: #17181b; --ct-raised: #1e2023; --ct-sunken: #0b0c0d; --ct-line: #2a2c30;
  --ct-text: #eceae4; --ct-muted: #9d9b94; --ct-accent: #d99a6c; --ct-on-accent: #141414;
  --ct-ok: #7cc495; --ct-danger: #e5776a;
}
.ct .fam-banner { margin-bottom: 10px; }
.ct-wrap { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; }
.ct-pad { min-height: 0; overflow: auto; padding: 14px; border-radius: 16px; background: var(--ct-surface); border: 1px solid var(--ct-line); }
.ct-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ct-logo { font-weight: 600; letter-spacing: .14em; font-size: 15px; }
.ct-logo i { font-style: normal; color: var(--ct-accent); }
.ct-title { font-size: 15px; font-weight: 600; flex: 1; min-width: 8em; }
.ct-paired { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ct-muted); padding: 4px 10px; border-radius: 999px; background: var(--ct-raised); border: 1px solid var(--ct-line); }
.ct-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ct-ok); }
.ct-profiles { display: flex; gap: 6px; margin: 14px 0 6px; overflow-x: auto; }
.ct-profile {
  flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--ct-line);
  background: var(--ct-raised); color: var(--ct-muted); font-size: 13px; font-weight: 500;
}
.ct-profile[aria-selected="true"] { background: var(--ct-accent); border-color: transparent; color: var(--ct-on-accent); }
.ct-sections { display: grid; gap: 16px; margin-top: 10px; }
.ct-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ct-muted); margin-bottom: 8px; }
.ct-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.ct-tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 10px;
  min-height: 84px; padding: 12px; border-radius: 12px; border: 1px solid var(--ct-line); background: var(--ct-raised);
  color: var(--ct-text); text-align: start; font-size: 13px; overflow: hidden;
  transition: transform .12s ease, background-color .12s ease, border-color .12s ease;
}
button.ct-tile:hover { border-color: color-mix(in srgb, var(--ct-accent) 55%, var(--ct-line)); }
button.ct-tile:active { transform: scale(.97); }
.ct-tile[aria-pressed="true"] { border-color: var(--ct-accent); background: color-mix(in srgb, var(--ct-accent) 12%, var(--ct-raised)); }
.ct-tile.is-tapped { animation: ct-tap .35s ease; }
@keyframes ct-tap { 0% { transform: scale(.94); } 60% { transform: scale(1.02); } 100% { transform: scale(1); } }
.ct-tile-icon { color: var(--ct-accent); display: flex; }
.ct-tile-label { font-weight: 500; line-height: 1.25; }
.ct-wide { grid-column: span 2; }
.ct-danger .ct-tile-icon { color: var(--ct-danger); }
.ct-tile:disabled { opacity: .5; }
.ct-tile.is-running { border-color: var(--ct-accent); }
.ct-slider { flex-direction: row; align-items: center; }
.ct-slider-main { flex: 1; min-width: 0; display: grid; gap: 6px; }
.ct-range { width: 100%; min-height: 28px; accent-color: var(--ct-accent); }
.ct-value { font-variant-numeric: tabular-nums; color: var(--ct-muted); min-width: 3em; text-align: end; }
.ct-app { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; color: #fff; background: #6b7280; }
.ct-app-mail { background: #2f7ae5; } .ct-app-calendar { background: #e5483d; } .ct-app-notes { background: #c99a06; }
.ct-app-safari { background: #1690d8; } .ct-app-terminal { background: #2b2b2b; } .ct-app-finder { background: #3b82c4; } .ct-app-music { background: #e9445a; }
.ct-flow-bar { position: absolute; inset: auto 0 0; height: 4px; background: var(--ct-sunken); }
.ct-flow-bar span { display: block; height: 100%; background: var(--ct-accent); transform-origin: left center; transition: transform .3s ease; }
[dir="rtl"] .ct-flow-bar span { transform-origin: right center; }
.ct-now { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; background: var(--ct-raised); border: 1px solid var(--ct-line); }
.ct-art { flex: none; width: 64px; height: 64px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: linear-gradient(140deg, var(--ct-accent), #6b3a1e); }
.ct-track { font-weight: 600; font-size: 15px; }
.ct-artist { color: var(--ct-muted); font-size: 13px; }
.ct-confirm { margin-top: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--ct-danger); background: color-mix(in srgb, var(--ct-danger) 9%, var(--ct-raised)); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ct-confirm-t { font-weight: 600; }
.ct-confirm-a { display: flex; gap: 8px; }
.ct .btn-primary { background: var(--ct-accent); color: var(--ct-on-accent); }

/* The paired Mac (a drawing that shows what each tap does) */
.ct-mac { min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.ct-mac-h { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ct-muted); }
.ct-m-frame { padding: 8px; border-radius: 12px; background: #1d1e21; box-shadow: 0 10px 24px -12px rgb(0 0 0 / 50%); }
.ct-m-stand { width: 34%; height: 14px; margin: 8px auto -8px; border-radius: 0 0 6px 6px; background: linear-gradient(#2b2c30, #1a1b1e); }
.ct-m-screen {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 4px; color: #1b1c1e;
  background: linear-gradient(150deg, #e8c9a8, #9fb7d6 55%, #6f87b5);
}
.ct-m-bar { display: flex; align-items: center; gap: 6px; height: 14px; padding: 0 6px; font-size: 8px; font-weight: 600; background: rgb(255 255 255 / 55%); }
.ct-m-logo { width: 7px; height: 7px; border-radius: 2px; background: #1b1c1e; }
.ct-m-spacer { flex: 1; }
.ct-m-rec { color: #d1352b; font-variant-numeric: tabular-nums; }
.ct-m-desk { position: absolute; inset: 14px 0 0; }
.ct-m-win {
  position: absolute; display: flex; flex-direction: column; border-radius: 4px; overflow: hidden;
  background: #fbfaf7; box-shadow: 0 6px 14px rgb(0 0 0 / 28%);
  transition: inset .35s cubic-bezier(.2, .7, .2, 1);
}
.ct-m-win[data-layout="center"] { inset: 14% 22% 18%; }
.ct-m-win[data-layout="left"] { inset: 3% 50.5% 3% 1.5%; }
.ct-m-win[data-layout="right"] { inset: 3% 1.5% 3% 50.5%; }
.ct-m-win[data-layout="max"] { inset: 3% 1.5%; }
.ct-m-wbar { display: flex; align-items: center; gap: 3px; height: 12px; padding: 0 5px; background: #eceae4; font-size: 7px; }
.ct-m-wbar i { width: 5px; height: 5px; border-radius: 50%; background: #e5776a; }
.ct-m-wbar i:nth-child(2) { background: #e0b860; } .ct-m-wbar i:nth-child(3) { background: #7cc495; }
.ct-m-wtitle { margin-inline-start: 6px; font-weight: 600; white-space: nowrap; overflow: hidden; }
.ct-m-wbody { flex: 1; padding: 6px; display: grid; gap: 4px; align-content: start; }
.ct-m-wbody b { display: block; height: 4px; border-radius: 2px; background: #dcd8cf; }
.ct-m-wbody b:nth-child(2) { width: 80%; } .ct-m-wbody b:nth-child(3) { width: 55%; }
.ct-m-win[data-app="music"] .ct-m-wbody b { background: #f2b8c1; }
.ct-m-win[data-app="mail"] .ct-m-wbody b { background: #b9d2f5; }
.ct-m-win[data-app="calendar"] .ct-m-wbody b { background: #f3c1bc; }
.ct-m-win[data-app="notes"] .ct-m-wbody b { background: #f0dc9c; }
.ct-m-win[data-app="terminal"] { background: #232323; }
.ct-m-win[data-app="terminal"] .ct-m-wbody b { background: #4caf50; }
.ct-m-hud {
  position: absolute; left: 50%; top: 50%; width: 46%; min-height: 40%; transform: translate(-50%, -50%) scale(.9);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px;
  border-radius: 12px; background: rgb(30 30 32 / 78%); color: #fff; opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease; text-align: center;
}
.ct-m-hud.is-on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.ct-m-hud-t { font-size: 9px; line-height: 1.3; }
.ct-m-level { width: 80%; height: 4px; border-radius: 2px; background: rgb(255 255 255 / 25%); overflow: hidden; }
.ct-m-level span { display: block; height: 100%; background: #fff; transform-origin: left center; }
[dir="rtl"] .ct-m-level span { transform-origin: right center; }
.ct-m-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.ct-m-flash.is-on { animation: ct-flash .5s ease-out; }
@keyframes ct-flash { 0% { opacity: .95; } 100% { opacity: 0; } }
.ct-m-thumb {
  position: absolute; inset-inline-end: 4%; bottom: 6%; width: 24%; aspect-ratio: 16 / 10; border-radius: 3px;
  border: 2px solid #fff; background: linear-gradient(150deg, #e8c9a8, #9fb7d6); box-shadow: 0 4px 10px rgb(0 0 0 / 35%);
  opacity: 0; transform: translateY(30%); pointer-events: none;
}
.ct-m-thumb.is-on { animation: ct-thumb 2.4s ease forwards; }
@keyframes ct-thumb { 0% { opacity: 0; transform: translateY(30%); } 12%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateX(20%); } }
.ct-m-sleep {
  position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: #eceae4; font-size: 9px; text-align: center; padding: 8px;
}
.ct-m-screen.is-asleep .ct-m-sleep { display: flex; }
.ct-m-sleep[data-mode="lock"] { background: linear-gradient(150deg, #3a3f4c, #1d2028); }
.ct-m-sleep[data-mode="sleep"], .ct-m-sleep[data-mode="display"] { background: #050506; }
.ct-m-sleep .btn { font-size: 11px; }
.ct-status { min-height: 3em; font-size: 12.5px; line-height: 1.45; color: var(--ct-text); padding: 8px 10px; border-radius: 10px; background: var(--ct-surface); border: 1px solid var(--ct-line); }
.ct-status:empty { visibility: hidden; }

@media (max-width: 819.98px), (pointer: coarse) {
  .ct { padding: 0; }
  .ct-wrap { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 8px; }
  .ct-mac { order: -1; display: grid; grid-template-columns: 44% 1fr; align-items: center; gap: 10px; }
  .ct-mac-h { grid-column: 1 / -1; }
  .ct-m-frame { padding: 5px; }
  .ct-m-stand { display: none; }
  .ct-status { min-height: 0; font-size: 12px; }
  .ct-pad { padding: 12px; }
  .ct-tile, .ct-profile { min-height: 48px; }
  .ct-tiles { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .ct-tile, .ct-m-win, .ct-m-hud, .ct-flow-bar span { transition: none; }
  .ct-tile.is-tapped, .ct-m-flash.is-on, .ct-m-thumb.is-on { animation-duration: .01s; }
}
