/* ==========================================================================
   Kinetic · design tokens
   Every colour is a registered custom property so theme changes (accent,
   surface, light/dark) interpolate smoothly instead of popping.
   theme.js overwrites these on <html> at runtime; the values below are the
   no-JS / first-paint defaults (light · warm · signal blue).
   ========================================================================== */

@property --bg      { syntax: '<color>'; inherits: true; initial-value: #F6F6F3; }
@property --tray    { syntax: '<color>'; inherits: true; initial-value: #EDEDE9; }
@property --card    { syntax: '<color>'; inherits: true; initial-value: #FFFFFF; }
@property --raise   { syntax: '<color>'; inherits: true; initial-value: #F4F4F1; }
@property --track   { syntax: '<color>'; inherits: true; initial-value: #E2E2DD; }
@property --line    { syntax: '<color>'; inherits: true; initial-value: rgba(20,20,22,.08); }
@property --ink     { syntax: '<color>'; inherits: true; initial-value: #141416; }
@property --ink2    { syntax: '<color>'; inherits: true; initial-value: #46464A; }
@property --mut     { syntax: '<color>'; inherits: true; initial-value: #8A8A85; }
@property --mut2    { syntax: '<color>'; inherits: true; initial-value: #B6B6B1; }
@property --acc     { syntax: '<color>'; inherits: true; initial-value: #2F5BFF; }
@property --acc2    { syntax: '<color>'; inherits: true; initial-value: #6E8BFF; }
@property --acc3    { syntax: '<color>'; inherits: true; initial-value: #B7C6FF; }
@property --tint    { syntax: '<color>'; inherits: true; initial-value: #EEF2FF; }
@property --acc-ink { syntax: '<color>'; inherits: true; initial-value: #FFFFFF; }
@property --dk      { syntax: '<color>'; inherits: true; initial-value: #0F0F12; }
@property --dk1     { syntax: '<color>'; inherits: true; initial-value: #1C1C21; }
@property --dk2     { syntax: '<color>'; inherits: true; initial-value: #2B2B31; }
@property --dk-fg   { syntax: '<color>'; inherits: true; initial-value: #FFFFFF; }
@property --dk-mut  { syntax: '<color>'; inherits: true; initial-value: #8B8B93; }

:root {
  --bg: #F6F6F3; --tray: #EDEDE9; --card: #FFFFFF; --raise: #F4F4F1; --track: #E2E2DD;
  --line: rgba(20,20,22,.08);
  --ink: #141416; --ink2: #46464A; --mut: #7D7D78; --mut2: #ADADA8;
  --acc: #2F5BFF; --acc2: #6E8BFF; --acc3: #B7C6FF; --tint: #EEF2FF; --acc-ink: #FFFFFF;
  --dk: #0F0F12; --dk1: #1C1C21; --dk2: #2B2B31; --dk-fg: #FFFFFF; --dk-mut: #8B8B93;

  /* fixed semantic colours */
  --ok: #17A673; --bad: #E5484D; --warn: #F2A516;

  /* radius scale (Sharp .45 · Soft 1 · Round 1.35) */
  --rk: 1;
  --r-tray: calc(22px * var(--rk));
  --r-card: calc(14px * var(--rk));
  --r-sm:   calc(10px * var(--rk));
  --r-xs:   calc(7px * var(--rk));
  --r-pill: 999px;

  /* type */
  --font-ui: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-num: var(--font-ui);
  --font-mono: ui-monospace, 'SF Mono', Menlo, monospace;
  --feat: "cv11", "ss01";
  --num-w: 600;
  --num-ls: -0.035em;
  --num-scale: 1;

  /* elevation (light) */
  --sh-card: 0 1px 2px rgba(20,20,30,.05), 0 8px 24px rgba(20,20,30,.05);
  --sh-in:   0 1px 2px rgba(20,20,30,.06), 0 4px 14px rgba(20,20,30,.05);
  --sh-hover: 0 2px 4px rgba(20,20,30,.05), 0 14px 34px rgba(20,20,30,.09);
  --sh-pop:  0 18px 50px rgba(20,20,40,.16), 0 3px 10px rgba(20,20,40,.07);
  --hair: inset 0 0 0 0 transparent;

  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.3, 1.35, .45, 1);

  color-scheme: light;
}

:root[data-mode="dark"] {
  --sh-card: inset 0 1px 0 rgba(255,255,255,.035), 0 0 0 1px rgba(255,255,255,.04);
  --sh-in:   inset 0 1px 0 rgba(255,255,255,.045), 0 1px 2px rgba(0,0,0,.4);
  --sh-hover: inset 0 1px 0 rgba(255,255,255,.05), 0 0 0 1px rgba(255,255,255,.07), 0 18px 40px rgba(0,0,0,.45);
  --sh-pop:  0 24px 60px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.07);
  --hair: inset 0 1px 0 rgba(255,255,255,.04);
  color-scheme: dark;
}

/* Smooth retint: every token interpolates. Disabled during view transitions. */
html {
  transition:
    --bg .5s ease, --tray .5s ease, --card .5s ease, --raise .5s ease, --track .5s ease, --line .5s ease,
    --ink .5s ease, --ink2 .5s ease, --mut .5s ease, --mut2 .5s ease,
    --acc .5s ease, --acc2 .5s ease, --acc3 .5s ease, --tint .5s ease, --acc-ink .5s ease,
    --dk .5s ease, --dk1 .5s ease, --dk2 .5s ease, --dk-fg .5s ease, --dk-mut .5s ease;
}
html.instant { transition: none !important; }

/* ---- Card tones: widgets only ever read these local variables ---- */
.tone-tray {
  --s0: var(--tray); --s1: var(--card); --s2: var(--track);
  --fg: var(--ink); --fg2: var(--ink2); --mu: var(--mut); --mu2: var(--mut2);
  --ln: var(--line); --sh1: var(--sh-in); --tx: var(--tint);
}
.tone-card {
  --s0: var(--card); --s1: var(--raise); --s2: var(--track);
  --fg: var(--ink); --fg2: var(--ink2); --mu: var(--mut); --mu2: var(--mut2);
  --ln: var(--line); --sh1: var(--hair); --tx: var(--tint);
}
.tone-ink {
  --s0: var(--dk); --s1: var(--dk1); --s2: var(--dk2);
  --fg: var(--dk-fg); --fg2: color-mix(in oklab, var(--dk-fg) 72%, transparent);
  --mu: var(--dk-mut); --mu2: color-mix(in oklab, var(--dk-mut) 55%, transparent);
  --ln: color-mix(in oklab, var(--dk-fg) 9%, transparent); --sh1: none;
  --tx: color-mix(in oklab, var(--acc) 22%, transparent);
}
