/* ============================================================
   OBSIDIAN UI — Design Tokens
   Extracted: 2026-10-07
   Source: public component-library site (scrubbed)

   Light-first, with a real dark theme. The whole system is one
   ink colour at different opacities over a page colour — there
   is no brand accent. "Glass" panels blur what is behind them.

   Usage:
     <html data-theme="light">   (default, signature)
     <html data-theme="dark">
     document.documentElement.dataset.theme = 'dark'
   ============================================================ */

/* ─── Fonts ──────────────────────────────────────────────────────────────
   Source: Inter (UI, body, numerals, mono) · "Google Sans" (display) ·
   a self-hosted Inter Medium for headings. All on Google Fonts.          */
@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@400..700&family=Inter:wght@300..700&family=Instrument+Sans:wght@400;500;600&display=swap');

/* ─── LIGHT (default) ─────────────────────────────────────────────────── */
:root,
[data-theme="light"] {
  color-scheme: light;

  /* ── Core palette (source names kept — the component CSS composes
        every tint as rgba(var(--ink-rgb), alpha)) ───────────────────── */
  --bg:           #ffffff;   /* page */
  --surface:      #f7f7f6;   /* raised blocks, demo canvas */
  --surface-2:    #f1f1f0;
  --surface-3:    #ecebe7;
  --board:        #ffffff;   /* demo board */
  --card:         #f7f7f6;   /* card fill reference */
  --solid:        #0e0f11;   /* dark-tone card / stage */
  --solid-ink:    #f4f3f1;

  --ink:          #17181a;   /* primary text + fills */
  --ink-2:        #3c3b37;   /* secondary text, control labels */
  --ink-3:        #5c5b56;   /* icon buttons, nav links at rest */
  --ink-4:        #6f6e68;   /* muted text, descriptions, placeholders */
  --ink-5:        #85847e;   /* faint — 3.74:1 on page: NOT for body text */
  --lock:         #adaca6;   /* locked / inert glyphs (decorative only) */
  --on-ink:       #ffffff;   /* text on an ink fill */

  --ink-rgb:      23, 24, 26;
  --on-ink-rgb:   255, 255, 255;
  --surface-rgb:  247, 247, 246;
  --elev-rgb:     255, 255, 255;  /* elevated / glass panel base */
  --glass-rgb:    255, 255, 255;
  --shadow-rgb:   23, 24, 26;

  --wash:         .06;       /* the universal tint: rgba(ink, wash) */

  /* Slab = the strongest fill (buttons, tooltips, active chips) */
  --slab:         var(--ink);
  --on-slab:      var(--on-ink);
  --on-slab-rgb:  var(--on-ink-rgb);
  --slab-dark:    #0e0f11;

  --pill-thumb:   #ffffff;
  --inlay:        #ffffff8c;
  --inlay-hi:     #ffffffc7;

  /* ── Status / signal ──────────────────────────────────────────────── */
  --ok:           #15803d;   /* success (copied, added) */
  --no:           #b42318;   /* error */
  --ember:        #b8431c;   /* warning / destructive menu rows */
  --pick:         #0d99ff;   /* input focus ring colour */
  --pick-rgb:     13, 153, 255;
  --signal:       #2231dd;   /* keyboard focus outline (sort, menu) */
  --guide:        #ff3b6b;

  /* ── Required semantic aliases (kit convention) ───────────────────── */
  --colour-bg-page:          #ffffff;
  --colour-bg-surface:       #f7f7f6;
  --colour-bg-elevated:      #ffffff;
  --colour-bg-card:          #f7f7f6;
  --colour-text-primary:     #17181a;
  --colour-text-secondary:   #3c3b37;
  --colour-text-muted:       #6f6e68;
  --colour-text-disabled:    #85847e;
  --colour-border:           #e3e3e3;   /* rgba(ink,.12) flattened on page */
  --colour-brand-accent:     #17181a;   /* monochrome system — ink is the accent */
  --colour-action-bg:        #17181a;
  --colour-action-bg-hover:  #373839;   /* ink at 86% opacity on page */
  --colour-action-text:      #ffffff;
  --colour-focus-ring:       #aeaeaf;   /* rgba(ink,.35) flattened on page */
  --colour-link:             #3c3b37;
  --colour-success:          #15803d;
  --colour-warning:          #b8431c;
  --colour-error:            #b42318;
  --colour-info:             #0d99ff;

  /* ── Typography ───────────────────────────────────────────────────── */
  --font-ui:    "Inter", "Instrument Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-head:  "Google Sans", "Inter", var(--font-ui);
  --font-mono:  var(--font-ui);          /* source sets numerals in the UI face */
  --font-num:   var(--font-ui);
  --font-code:  ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  /* Measured sizes — not rounded */
  --text-2xs:     11px;     /* tag */
  --text-xs:      11.5px;   /* tooltip, kbd, fine print */
  --text-sm:      12px;     /* code, field labels */
  --text-ctl:     12.5px;   /* segmented buttons, slider values, card name */
  --text-base:    13px;     /* body, buttons, descriptions */
  --text-label:   13.5px;   /* control labels */
  --text-md:      14px;     /* nav links, chips, inputs, menu rows */
  --text-lg:      15px;     /* hero subtitle, large button */
  --text-title:   17px;     /* panel title */
  --text-h3:      18px;     /* empty-state line */
  --text-h2:      21px;     /* sheet title */
  --text-h2-mid:  32px;     /* centred sheet title */
  --text-display: 40px;     /* hero headline (desktop) */
  --text-display-lg: 46px;  /* hero headline (display face) */

  --weight-regular: 400;
  --weight-book:    450;    /* tooltips, menu rows */
  --weight-medium:  500;
  --weight-semibold:600;

  --leading-none:   1;
  --leading-display:1.06;
  --leading-title:  1.25;
  --leading-tip:    1.35;
  --leading-body:   1.45;
  --leading-base:   19.5px; /* 13px × 1.5 */

  --tracking-display: -.022em;
  --tracking-title:   -.02em;
  --tracking-tight:   -.01em;
  --tracking-btn:     -.006em;
  --tracking-body:    -.005em;
  --tracking-tag:      .01em;
  --tracking-kbd:      .02em;

  /* ── Spacing (value-named — the source is not on a strict grid) ───── */
  --space-2:  2px;
  --space-3:  3px;
  --space-4:  4px;
  --space-5:  5px;
  --space-6:  6px;
  --space-8:  8px;
  --space-10: 10px;
  --space-12: 12px;
  --space-13: 13px;
  --space-14: 14px;
  --space-16: 16px;
  --space-18: 18px;
  --space-20: 20px;
  --space-24: 24px;
  --space-28: 28px;
  --space-32: 32px;
  --space-36: 36px;
  --space-54: 54px;
  --space-72: 72px;

  /* ── Radius ───────────────────────────────────────────────────────── */
  --radius-pill:  999px;
  --radius-card:  28px;   /* cards, modal stage, modal panel */
  --radius-sheet: 24px;   /* auth sheet, slide grip */
  --radius-menu:  22px;   /* wide menu */
  --radius-row:   18px;   /* wide menu rows, 5+ option segmented */
  --radius-popover: 14px; /* sort menu */
  --radius-input: 12px;   /* inputs, code cells, mobile buttons */
  --radius-bar:   10px;   /* slider bar, code block, tooltip (under) */
  --radius-item:  9px;    /* menu items */
  --radius-tip:   8px;    /* tooltip */
  --radius-kbd:   7px;

  /* ── Shadows (all layers preserved) ───────────────────────────────── */
  --shadow-focus:  0 0 0 2px var(--bg), 0 0 0 4px rgba(var(--ink-rgb), .35);
  --shadow-focus-card: 0 0 0 2px var(--card), 0 0 0 4px rgba(var(--ink-rgb), .35);
  --shadow-ring:   0 0 0 1px rgba(var(--ink-rgb), .06);
  --shadow-menu:   0 0 0 1px rgba(var(--ink-rgb), .06), 0 12px 32px #17181a24;
  --shadow-sheet:  0 24px 70px rgba(var(--shadow-rgb), .22);
  --shadow-tip:    0 6px 20px rgba(var(--shadow-rgb), .18);
  --shadow-knob:   0 1px 2px rgba(var(--shadow-rgb), .2);
  --shadow-thumb:  0 1px 2px rgba(var(--shadow-rgb), .09), 0 0 0 .5px rgba(var(--shadow-rgb), .05);
  --shadow-search: 0 0 0 1px rgba(var(--ink-rgb), .06), 0 2px 10px rgba(var(--shadow-rgb), .06);
  --shadow-search-open: 0 6px 24px rgba(var(--shadow-rgb), .1);
  --shadow-input-focus: 0 0 0 3px rgba(var(--pick-rgb), .18);

  /* ── Blur (glass) ─────────────────────────────────────────────────── */
  --blur-panel:  blur(14px) saturate(150%);
  --blur-scrim:  blur(22px) saturate(130%);
  --blur-glass:  blur(10px) saturate(150%);
  --blur-search: blur(8px) saturate(160%);
  --blur-sheet:  blur(4px);

  /* ── Motion ───────────────────────────────────────────────────────── */
  --ease:          cubic-bezier(.33, .55, .2, 1);   /* modal morph, slide settle */
  --ease-out:      cubic-bezier(.22, 1, .36, 1);    /* rise-in, tooltips, menus */
  --ease-spring:   cubic-bezier(.28, 1.4, .36, 1);  /* press scale */
  --ease-pop:      cubic-bezier(.3, 1.12, .4, 1);   /* icon-button halo */
  --ease-veil:     cubic-bezier(.28, 1.3, .36, 1);  /* card veil, glass buttons */
  --ease-stretch:  cubic-bezier(.32, .72, .24, 1);  /* pill indicator phase 1 */
  --ease-settle:   cubic-bezier(.28, 1.28, .36, 1); /* pill indicator phase 2 */
  --ease-settle-w: cubic-bezier(.24, 1.34, .38, 1);
  --ease-logo:     cubic-bezier(.34, 1.56, .5, 1);
  --ease-sheet-in: cubic-bezier(.22, .9, .28, 1);

  --dur-90:  90ms;
  --dur-120: 120ms;
  --dur-140: 140ms;
  --dur-150: 150ms;
  --dur-160: 160ms;
  --dur-180: 180ms;
  --dur-200: 200ms;
  --dur-240: 240ms;
  --dur-260: 260ms;
  --dur-280: 280ms;
  --dur-320: 320ms;
  --dur-420: 420ms;
  --dur-620: 620ms;
  --dur-700: 700ms;

  --morph: 320ms;          /* modal open/close morph (source sets this from JS) */

  /* ── Layout ───────────────────────────────────────────────────────── */
  --nav-h:        72px;
  --page-pad:     20px;
  --modal-max-w:  1000px;
  --modal-max-h:  640px;
  --modal-side:   300px;
  --modal-gap:    12px;
  --modal-inset:  24px;
  --sheet-w:      420px;
  --sheet-h:      600px;
  --ctl-line:     44px;     /* tune-panel row height */
}

/* ─── DARK ────────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  color-scheme: dark;

  --bg:           #000000;
  --surface:      #0f0f0f;
  --surface-2:    #181818;
  --surface-3:    #202020;
  --board:        #1a1a1a;
  --card:         #0a0a0a;
  --solid:        #000000;
  --solid-ink:    #ffffff;

  --ink:          #ffffff;
  --ink-2:        #b4b4b4;
  --ink-3:        #9a9a9a;
  --ink-4:        #878787;   /* source #828282 — lifted 5 levels so muted text
                                clears 4.5:1 on the glass panel (#1c1c1c) */
  --ink-5:        #6b6b6b;
  --lock:         #525252;
  --on-ink:       #000000;

  --ink-rgb:      255, 255, 255;
  --on-ink-rgb:   0, 0, 0;
  --surface-rgb:  15, 15, 15;
  --elev-rgb:     32, 32, 32;
  --glass-rgb:    255, 255, 255;
  --shadow-rgb:   0, 0, 0;

  --wash:         .09;

  --slab:         var(--board);
  --on-slab:      var(--ink);
  --on-slab-rgb:  var(--ink-rgb);
  --slab-dark:    #262626;

  --pill-thumb:   #ffffff29;
  --inlay:        #ffffff12;
  --inlay-hi:     #ffffff1f;

  --ok:           #34d17a;
  --pick:         #3aa9ff;
  --pick-rgb:     58, 169, 255;
  --guide:        #ff5c84;

  --colour-bg-page:          #000000;
  --colour-bg-surface:       #0f0f0f;
  --colour-bg-elevated:      #202020;
  --colour-bg-card:          #0a0a0a;
  --colour-text-primary:     #ffffff;
  --colour-text-secondary:   #b4b4b4;
  --colour-text-muted:       #878787;
  --colour-text-disabled:    #6b6b6b;
  --colour-border:           #1f1f1f;
  --colour-brand-accent:     #ffffff;
  --colour-action-bg:        #ffffff;
  --colour-action-bg-hover:  #dbdbdb;
  --colour-action-text:      #000000;
  --colour-focus-ring:       #595959;
  --colour-link:             #b4b4b4;
  --colour-success:          #34d17a;
  --colour-warning:          #b8431c;
  --colour-error:            #b42318;
  --colour-info:             #3aa9ff;
}

/* ─── Fill scopes ──────────────────────────────────────────────────────
   A demo stage can carry its own fill independent of the page theme
   (the "Fill: Light / Dark" control in the tune panel).                 */
[data-fill="light"] {
  --fill-slab: #ffffff; --fill-on: #17181a; --fill-on-rgb: 23, 24, 26;
  --ink: #17181a; --ink-rgb: 23, 24, 26; --ink-2: #3c3b37; --ink-3: #5c5b56;
  --ink-4: #6f6e68; --ink-5: #85847e; --on-ink: #ffffff; --on-ink-rgb: 255, 255, 255;
  --board: #ffffff; --card: #f7f7f6; --surface: #f7f7f6; --surface-2: #f1f1f0;
  --surface-3: #ecebe7; --elev-rgb: 255, 255, 255; --glass-rgb: 255, 255, 255;
  --pill-thumb: #ffffff; --inlay: #ffffff8c; --slab-btn: #ffffff;
}
[data-fill="dark"] {
  --fill-slab: var(--slab-dark); --fill-on: #ffffff; --fill-on-rgb: 255, 255, 255;
  --ink: #ffffff; --ink-rgb: 255, 255, 255; --ink-2: #b4b4b4; --ink-3: #9a9a9a;
  --ink-4: #878787; --ink-5: #6b6b6b; --on-ink: #000000; --on-ink-rgb: 0, 0, 0;
  --board: #1a1a1a; --card: #0a0a0a; --surface: #0f0f0f; --surface-2: #181818;
  --surface-3: #202020; --elev-rgb: 32, 32, 32; --glass-rgb: 255, 255, 255;
  --pill-thumb: #ffffff29; --inlay: #ffffff1a; --slab-btn: var(--slab-dark);
}
[data-surface="flat"] {
  --pane: var(--fill-slab, var(--board));
  --pane-edge: rgba(var(--ink-rgb), .08);
  --pane-thumb: rgba(var(--ink-rgb), .07);
  --inlay: rgba(var(--ink-rgb), .05);
  --inlay-hi: rgba(var(--ink-rgb), .09);
}

/* ─── Base ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: var(--leading-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: inherit; }
button, input, select, textarea { font: inherit; color: inherit; margin: 0; }
button { cursor: pointer; }
img, svg { display: block; vertical-align: middle; }
img { max-width: 100%; height: auto; }

/* Reduced motion: every transition and animation in the kit collapses to 1ms */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-90: 1ms; --dur-120: 1ms; --dur-140: 1ms; --dur-150: 1ms; --dur-160: 1ms;
    --dur-180: 1ms; --dur-200: 1ms; --dur-240: 1ms; --dur-260: 1ms; --dur-280: 1ms;
    --dur-320: 1ms; --dur-420: 1ms; --dur-620: 1ms; --dur-700: 1ms; --morph: 1ms;
  }
}
