/* ============================================================
   Hearth Design System — tokens
   Two surfaces, one voice.
   Night  — photograph + glass. Home, Work carousel, chat.
   Paper  — warm off-white, ink, hairlines. Case studies, long-form, print.
   Link this file, then set data-surface="night" | "paper" on any container.
   Fonts load from a <link> in each page's <head>, not an @import here, so the
   request is not chained behind this stylesheet.
   Copies: src/styles/tokens.css and public/work/shared/tokens.css — keep identical.
   ============================================================ */

:root {
  /* ---------- Core palette ---------- */
  --ink:          #090909;   /* Night ground, Paper text */
  --ink-2:        #101012;   /* Night raised surface (work panel) */
  --ink-3:        #0d0d0f;   /* Night recessed surface */
  --paper:        #f2efe8;   /* Paper ground, Night text */
  --paper-warm:   #f7f1e8;   /* Selection text, document fg */
  --paper-2:      #f9f6ee;   /* Media wells on either surface */
  --paper-3:      #e9e4da;   /* Paper recessed fill (table stripe, input fill) */

  --rust:         #b7503d;   /* Signal Rust — on paper, wordmark dot */
  --rust-bright:  #d06b55;   /* Signal Rust on night fills (contrast-lifted) */
  --rust-deep:    #8f3b2c;   /* Rust hover / pressed on paper */

  /* ---------- Paper text + lines ---------- */
  --paper-fg-1:   #090909;   /* Headlines */
  --paper-fg-2:   #423f3a;   /* Body */
  --paper-fg-3:   #635f59;   /* Muted, captions, labels (4.9:1 on paper) */
  --paper-line:   rgba(9, 9, 9, 0.25);  /* Structural hairline */
  --paper-line-soft: rgba(9, 9, 9, 0.12);
  --paper-line-solid: #c8c3ba;          /* Chart baselines, table rules */
  --paper-fill-data: #b9b3a9;           /* Neutral data fill */

  /* ---------- Night text + lines (on photograph / glass) ---------- */
  --night-fg-1:   rgba(242, 239, 232, 0.92);
  --night-fg-2:   rgba(242, 239, 232, 0.76);
  --night-fg-3:   rgba(242, 239, 232, 0.55);  /* Readability floor */
  --night-line:   rgba(255, 255, 255, 0.16);
  --night-line-soft: rgba(242, 239, 232, 0.08);

  /* ---------- Glass ---------- */
  --glass-panel:  rgba(10, 5, 15, 0.55);
  --glass-drop:   rgba(10, 5, 15, 0.4);
  --glass-pill:   rgba(10, 5, 15, 0.72);
  --glass-bubble: rgba(0, 0, 0, 0.5);
  --glass-bubble-user: rgba(255, 255, 255, 0.12);
  --glass-blur:   blur(28px) saturate(180%);

  /* ---------- Status ---------- */
  --night-alert:  rgb(255, 170, 170);
  --night-strong: rgba(130, 230, 170, 0.95);
  --night-mid:    rgba(255, 220, 140, 0.95);
  --paper-ok:     #3f6b4f;
  --paper-warn:   #8a6a2e;
  --paper-err:    #8f3b2c;

  /* ---------- Data palette (charts only) ---------- */
  --data-1: #536779;  /* slate */
  --data-2: #b28a45;  /* ochre */
  --data-3: #87977b;  /* sage */
  --data-4: #6f7880;  /* steel */
  --data-5: #7f627a;  /* plum */

  /* ---------- Type families (three jobs) ---------- */
  --font-identity: "Space Grotesk", sans-serif;               /* name, headlines, numbers */
  --font-voice:    "Cormorant Garamond", Georgia, serif;      /* always italic */
  --font-ui:       Inter, ui-sans-serif, system-ui, sans-serif;

  /* ---------- Type scale ---------- */
  --fs-wordmark: clamp(27px, 2.175vw, 33px);
  --fs-hero-stat: min(48vw, 520px);
  --fs-headline: clamp(36px, 4.3vw, 64px);
  --fs-stat:     clamp(48px, 4.4vw, 64px);
  --fs-title:    clamp(28px, 2.8vw, 44px);
  --fs-deck:     clamp(24px, 2.2vw, 32px);
  --fs-tagline:  clamp(23px, 1.95vw, 30px);
  --fs-subhead:  24px;
  --fs-item:     clamp(22px, 1.9vw, 28px);
  --fs-body-lg:  18px;
  --fs-body:     16px;
  --fs-body-sm:  14px;
  --fs-chat:     13px;
  --fs-caption:  14px;
  --fs-label:    12px;
  --fs-micro:    10px;

  --track-identity: -0.035em;
  --track-voice:    -0.015em;
  --track-label:    0.1em;
  --track-micro:    0.14em;

  /* ---------- Spacing ---------- */
  --space-1: 4px;  --space-2: 6px;  --space-3: 8px;  --space-4: 12px;
  --space-5: 16px; --space-6: 24px; --space-7: 32px; --space-8: 48px;
  --space-9: 64px; --space-10: 96px; --space-11: 128px;
  --edge: clamp(32px, 4.35vw, 66px);         /* shared by wordmark, chapter, content */
  --edge-mobile: 28px;
  --frame-inset: clamp(12px, 1.5vw, 23px);
  --measure: 62ch;

  /* ---------- Radii: glass is soft, paper is square ---------- */
  --radius-0: 0;          /* paper surfaces, tables, charts */
  --radius-sm: 4px;       /* bubble tail, scrollbar */
  --radius-control: 10px; /* icon buttons */
  --radius-card: 12px;    /* drop zone, glass cards */
  --radius-panel: 18px;   /* chat input bar */
  --radius-stage: clamp(18px, 2vw, 30px); /* work panel */
  --radius-pill: 9999px;  /* every button and chip, both surfaces */

  /* ---------- Elevation (night only) ---------- */
  --shadow-panel: inset 0 1px 0 rgba(255,255,255,0.12), 0 12px 40px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.3);
  --shadow-pill:  inset 0 1px 0 rgba(255,255,255,0.12), 0 8px 28px rgba(0,0,0,0.35);
  --shadow-text:  0 1px 14px rgba(4,4,4,0.76), 0 -1px 5px rgba(4,4,4,0.42);

  /* ---------- Motion ---------- */
  --ease-out:  cubic-bezier(0.23, 1, 0.32, 1);
  --ease-wave: cubic-bezier(0.45, 0, 0.28, 1);
  --dur-press: 120ms;
  --dur-fast:  140ms;
  --dur-base:  200ms;
  --dur-enter: 300ms;
  --dur-stage: 420ms;
}

/* ---------- Surfaces ---------- */
[data-surface="night"] {
  --bg: var(--ink); --fg-1: var(--night-fg-1); --fg-2: var(--night-fg-2); --fg-3: var(--night-fg-3);
  --line: var(--night-line); --accent: var(--rust-bright); --body-weight: 300;
  background: var(--bg); color: var(--fg-1);
}
[data-surface="paper"] {
  --bg: var(--paper); --fg-1: var(--paper-fg-1); --fg-2: var(--paper-fg-2); --fg-3: var(--paper-fg-3);
  --line: var(--paper-line); --accent: var(--rust); --body-weight: 400;
  background: var(--bg); color: var(--fg-1);
}

/* ---------- Roles ---------- */
.h-wordmark { font: 700 var(--fs-wordmark)/1 var(--font-identity); letter-spacing: var(--track-identity); text-transform: uppercase; }
.h-wordmark span { display: inline-block; margin-left: .08em; color: var(--rust); font-size: 300%; line-height: 0; }
.h-headline { font: 600 var(--fs-headline)/1.02 var(--font-identity); letter-spacing: var(--track-identity); text-wrap: balance; }
.h-subhead  { font: 600 var(--fs-subhead)/1.15 var(--font-identity); letter-spacing: -0.025em; }
.h-stat     { font: 600 var(--fs-stat)/.9 var(--font-identity); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.h-title    { font: italic 600 var(--fs-title)/1.02 var(--font-voice); letter-spacing: -0.03em; }
.h-deck     { font: italic 500 var(--fs-deck)/1.25 var(--font-voice); letter-spacing: var(--track-voice); }
.h-tagline  { font: italic 700 var(--fs-tagline)/1.26 var(--font-voice); letter-spacing: -0.018em; }
.h-item     { font: italic 600 var(--fs-item)/1.15 var(--font-voice); letter-spacing: -0.01em; }
.h-body     { font: var(--body-weight, 400) var(--fs-body)/1.6 var(--font-ui); color: var(--fg-2); max-width: var(--measure); text-wrap: pretty; }
.h-caption  { font: 400 var(--fs-caption)/1.6 var(--font-ui); color: var(--fg-3); }
.h-label    { font: 500 var(--fs-label)/1.3 var(--font-ui); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--fg-3); }
.h-micro    { font: 500 var(--fs-micro)/1.2 var(--font-ui); letter-spacing: var(--track-micro); text-transform: uppercase; color: var(--fg-3); }

/* ---------- Browser surfaces ---------- */
::selection { background: rgba(183, 80, 61, 0.55); color: var(--paper-warm); }
[data-surface="paper"] ::selection { background: var(--rust); color: var(--paper); }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* ---------- Print: every surface prints as Paper ---------- */
@media print {
  :root { --edge: 18mm; }
  html, body, [data-surface] {
    background: #fff !important; color: var(--ink) !important;
    --fg-1: var(--ink); --fg-2: #2f2d29; --fg-3: #55514b; --line: rgba(9,9,9,.35); --body-weight: 400;
  }
  body { font: 400 10.5pt/1.5 var(--font-ui); }
  .h-headline { font-size: 30pt; } .h-subhead { font-size: 14pt; } .h-stat { font-size: 32pt; }
  .h-deck, .h-title { font-size: 16pt; } .h-item { font-size: 13pt; } .h-label, .h-micro { font-size: 7.5pt; }
  [data-glass], video, [data-no-print] { display: none !important; }
  * { box-shadow: none !important; backdrop-filter: none !important; text-shadow: none !important; }
  a { color: inherit; text-decoration: underline; }
  h1, h2, h3, figure, table, tr { break-inside: avoid; page-break-inside: avoid; }
}
