/* Design tokens (PLAN 7.5, research/ui.md 3). Light is the default (as in the reference); dark follows the system
   unless the visitor picked a theme (html[data-theme]). Studio may override only --accent, --accent-soft and
   --accent-ink (validated hex, applied through CSSOM by app/main.js). */

:root {
  color-scheme: light;

  /* colour: light */
  --bg: #F3F3F5;
  --surface: #FFFFFF;
  --surface-2: #E9E9EE;
  --ink: #111114;
  --ink-2: #4B4B57;
  --ink-3: #6B6B78;
  --line: rgba(17, 17, 20, .10);
  --accent: #2A55E5;
  --accent-soft: #E6ECFF;
  --accent-ink: #1E40C8;
  --on-band: #FFFFFF;
  --scrim-top: rgba(8, 8, 12, .55);
  --scrim-bottom: rgba(8, 8, 12, .20);
  --tab-pill: rgba(0, 0, 0, .45);
  --danger: #C62828;
  --ok: #1B7F3B;
  --sponsored: var(--ink-3);
  --art: #3A3F55;

  /* type */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-display: clamp(2.25rem, 1.2rem + 2.6vw, 4rem);
  --fw-display: 800;
  --lh-display: 1.04;
  --ls-display: -0.025em;
  --fs-h1: clamp(1.75rem, 1rem + 1.6vw, 2.75rem);
  --fw-h1: 800;
  --lh-h1: 1.08;
  --ls-h1: -0.02em;
  --fs-h2: clamp(1.375rem, 1rem + .8vw, 1.875rem);
  --fw-h2: 700;
  --lh-h2: 1.15;
  --ls-h2: -0.015em;
  --fs-h3: 1.25rem;
  --fw-h3: 600;
  --lh-h3: 1.25;
  --fs-body: 1rem;
  --fw-body: 400;
  --lh-body: 1.5;
  --fs-label: 1.0625rem;
  --fw-label: 500;
  --fs-small: .875rem;
  --fw-small: 500;
  --fs-micro: .75rem;
  --fw-micro: 600;
  --ls-micro: .06em;

  /* spacing: 4 8 12 16 24 32 48 64 96 */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;
  --gutter: 16px;
  --band-h: clamp(220px, 44vh, 520px);

  /* radii */
  --r-tile: 4px;            /* phone: 4 px + 8 px gap; flush (0) from 600 px up */
  --r-card: 4px;
  --r-ctl: 8px;
  --r-pill: 999px;
  --r-avatar: 50%;
  --tile-gap: 8px;

  /* shadows */
  --sh-1: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .04);
  --sh-2: 0 8px 24px rgba(0, 0, 0, .22);
  --sh-3: 0 18px 48px rgba(0, 0, 0, .28);
  --sh-player: 0 -1px 0 var(--line), 0 -8px 24px rgba(0, 0, 0, .06);

  /* motion */
  --dur-press: 90ms;
  --dur-focus: 160ms;
  --dur-ui: 220ms;
  --dur-route: 240ms;
  --dur-band: 600ms;
  --dur-hero: 320ms;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-io: cubic-bezier(.4, 0, .2, 1);

  /* stacking */
  --z-band: 0;
  --z-content: 1;
  --z-focus: 2;
  --z-topbar: 10;
  --z-player: 20;
  --z-bottomnav: 21;
  --z-sheet: 30;
  --z-toast: 40;

  /* sizes (research/ui.md 3.4; phone first) */
  --hero-cover: 112px;
  --tile: 144px;
  --tile-min: 144px;
  --card-w: 100%;
  --mini-h: 64px;
  --bottomnav-h: 56px;
  --row-h: 64px;
  --avatar-xl: 120px;
}

/* tablet 600-1023 */
@media (min-width: 600px) {
  :root {
    --gutter: 24px;
    --r-tile: 0;
    --tile-gap: 0px;
    --hero-cover: 240px;
    --tile: 176px;
    --tile-min: 176px;
    --card-w: minmax(280px, 1fr);
    --mini-h: 72px;
    --bottomnav-h: 0px;
    --row-h: 56px;
  }
}

/* desktop 1024-1919 */
@media (min-width: 1024px) {
  :root {
    --gutter: clamp(32px, 5.2vw, 96px);
    --hero-cover: clamp(300px, 26.5vw, 440px);
    --tile: clamp(180px, 15.6vw, 260px);
    --tile-min: 200px;
    --card-w: clamp(260px, 19.25vw, 320px);
    --mini-h: 80px;
    --avatar-xl: 200px;
  }
}

/* large >= 1920 */
@media (min-width: 1920px) {
  :root {
    --hero-cover: 26.5vw;
    --tile: 15.6vw;
    --tile-min: 240px;
    --card-w: 19.25vw;
    --mini-h: 96px;
  }
}

/* dark: follows the system unless the visitor picked light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0E0E12;
    --surface: #16161B;
    --surface-2: #1C1C22;
    --ink: #FFFFFF;
    --ink-2: #B8B8C4;
    --ink-3: #9A9AA6;
    --line: rgba(255, 255, 255, .10);
    --accent: #7A8CFF;
    --accent-soft: #1E2550;
    --accent-ink: #C9D2FF;
    --sh-1: 0 1px 2px rgba(0, 0, 0, .096), 0 2px 8px rgba(0, 0, 0, .064);
    --sh-2: 0 8px 24px rgba(0, 0, 0, .35);
    --sh-3: 0 18px 48px rgba(0, 0, 0, .45);
    --sh-player: 0 -1px 0 var(--line), 0 -8px 24px rgba(0, 0, 0, .096);
  }
}

/* dark picked by the visitor */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E0E12;
  --surface: #16161B;
  --surface-2: #1C1C22;
  --ink: #FFFFFF;
  --ink-2: #B8B8C4;
  --ink-3: #9A9AA6;
  --line: rgba(255, 255, 255, .10);
  --accent: #7A8CFF;
  --accent-soft: #1E2550;
  --accent-ink: #C9D2FF;
  --sh-1: 0 1px 2px rgba(0, 0, 0, .096), 0 2px 8px rgba(0, 0, 0, .064);
  --sh-2: 0 8px 24px rgba(0, 0, 0, .35);
  --sh-3: 0 18px 48px rgba(0, 0, 0, .45);
  --sh-player: 0 -1px 0 var(--line), 0 -8px 24px rgba(0, 0, 0, .096);
}

/* light picked by the visitor (explicit, so a dark system never wins) */
:root[data-theme="light"] {
  color-scheme: light;
}
