/*
 * The viewer's design tokens (07 sections 6.1, 6.4, and 6.5; M3-01 item 8). A static file with a stable path, so W04's
 * own markup (`404.html`) gets the same colours and spacing as the app without a hashed stylesheet name. `styles.css`
 * uses these variables and declares no colour of its own; the dark values follow `prefers-color-scheme` (designed
 * dark-first, 07 section 6).
 *
 * The four safe-area variables wrap `env(safe-area-inset-*)` once, so a region pads with `calc(... + var(--safe-top))`
 * and a test can emulate an inset by setting the variable (WEB-032). `viewport-fit=cover` is in the page's viewport meta.
 */

/*
 * The self-hosted fonts (07 section 6.3, UX-062), in the subset 04 section 9's budget allows: at most two WOFF2 files and
 * 70 KB together, one preloaded. That leaves Instrument Serif roman and the Inter variable face, both latin only; 07's
 * italic serif and latin-ext ranges do not fit, and fall back to the next family in `--font-display` / `--font-ui`.
 * `src` is a stable path rather than a hashed asset, so `index.html` can preload the same filename, and 04 section 11's
 * no-third-party-origin rule holds: both files come from this origin. The licence text is `/fonts/LICENSE.txt`.
 */
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/instrument-serif-roman.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/inter-variable.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light dark;

  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #eeebe4;
  --text: #1b1b1e;
  --text-2: #55534f;
  --text-3: #69665f;
  --line: #dcd8cf;
  --line-strong: #8c887f;
  --accent: #c8441d;
  --on-accent: #ffffff;
  --accent-text: #b23c17;
  --success: #276f44;
  --warning: #8f5300;
  --danger: #b83227;
  --focus: #1f5fd1;
  --scrim: rgb(0 0 0 / 60%);
  --glass: rgb(255 255 255 / 88%);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;

  --r-xs: 4px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;

  --e1: 0 1px 2px rgb(0 0 0 / 12%), 0 4px 12px -4px rgb(0 0 0 / 18%);
  --e2: 0 10px 30px -10px rgb(0 0 0 / 45%);
  --e3: 0 24px 60px -12px rgb(0 0 0 / 55%);

  --motion-fast: 120ms;
  --motion-base: 200ms;
  --motion-panel: 320ms;
  --motion-reveal: 450ms;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-panel: cubic-bezier(0.3, 0, 0, 1);

  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Instrument Serif", "Iowan Old Style", Palatino, Georgia, "Noto Serif", serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101114;
    --surface: #18191d;
    --surface-2: #212328;
    --text: #f2efe8;
    --text-2: #b9b5ac;
    --text-3: #9a968e;
    --line: #2e3036;
    --line-strong: #76736c;
    --accent-text: #ff8d6b;
    --success: #5bc488;
    --warning: #f2b54a;
    --danger: #ff7a6e;
    --focus: #8cb8ff;
    --glass: rgb(24 25 29 / 88%);
  }
}

@media (prefers-contrast: more) {
  :root {
    --text-2: var(--text);
    --text-3: var(--text);
    --line: var(--line-strong);
    --glass: var(--surface);
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-fast: 0ms;
    --motion-base: 0ms;
    --motion-panel: 150ms;
    --motion-reveal: 150ms;
  }
}
