/*
  Archive design tokens.

  Two palettes. The game palette (--g-*) is sampled from owner-supplied
  screenshots and is fixed in every theme. The archive palette (--a-*) carries
  semantic roles and has light and dark values. The story player keeps its own
  styles; none of these tokens reach it.
*/

:root {
  /* Game palette: sampled values, see docs/planning/current/story-player-design-system.md */
  --g-white: #ffffff;
  --g-paper: #fffdfc;          /* modal and dialogue body */
  --g-cream: #fefdf9;          /* list frame fill */
  --g-gold: #d7b98a;           /* outer trim on frames and buttons */
  --g-gold-deep: #aa926f;      /* trim shadow line, chevron stroke */
  --g-gold-pale: #ffe8b4;      /* inner trim, nav tab top */
  --g-navy: #2e3d78;           /* row titles, choice text */
  --g-navy-deep: #1f2a5c;      /* text outline on blue */
  --g-ink: #3a3a48;            /* modal body text */
  --g-blue: #4a71c3;           /* primary button fill */
  --g-blue-deep: #42579b;      /* primary button edge */
  --g-blue-band: #5285d4;      /* modal header band */
  --g-blue-lattice: #5591e1;   /* lattice lines in the band */
  --g-blue-thumb: #6eabf1;     /* scroll thumb, progress fill */
  --g-edge: #8291c0;           /* solid lower edge of rows */
  --g-edge-pale: #afb6c6;      /* row frame line */
  --g-dots: #a9c3ec;           /* dotted rule under row titles */
  --g-track: #c9ccd8;          /* scroll track */
  --g-pink: #f8518d;           /* name plate, separators, completion arrow */
  --g-pink-deep: #c93a6e;      /* name plate edge */
  --g-green: #c8eb92;          /* active tab */
  --g-orange: #f29a2e;         /* NEW */
  --g-red: #e23b3b;            /* warnings */
  --g-brown: #4f2c23;          /* page title ink */
  --g-lavender: #f4f5fc;       /* ground behind panels */
  --g-lattice: #e6e8f3;        /* diamond lattice on the ground */

  /* Archive palette: light */
  --a-ground: #faf6ec;         /* page */
  --a-sunk: #f1ead9;           /* wells, loading rows */
  --a-panel: #ffffff;          /* rows, dialogue box, inputs */
  --a-ink: #26305f;            /* text */
  --a-ink-2: #5d6286;          /* secondary text */
  --a-trim: #c4a165;           /* gold hairlines and frames */
  --a-rule: #e3d9c2;           /* dividers */
  --a-edge: #b3bce0;           /* solid lower edge */
  --a-action: #3e6fc8;         /* links, primary actions */
  --a-action-ink: #ffffff;
  --a-speaker: #f8518d;        /* name plate, new */
  --a-progress: #3e6fc8;       /* filled spine, in-progress edge */
  --a-read: #b08a43;           /* finished marks */
  --a-focus: #1f2a5c;
  --a-focus-halo: #ffe8b4;
  --a-placeholder: #e9e3d3;

  /* Type */
  /* Labels, titles and controls: Nunito Bold for Latin, UD Marugo Bold for Japanese. Weight 700 only. */
  --font-display: "Nunito", "UD Marugo", "Noto Sans JP", system-ui, sans-serif;
  /* Reading text in both languages. Weights 400 to 600. */
  --font-reading: "Noto Sans JP", system-ui, sans-serif;

  --t-display: clamp(2.25rem, 1.4rem + 3.6vw, 4.25rem);
  --t-h1: clamp(1.875rem, 1.5rem + 1.6vw, 2.75rem);
  --t-h2: 1.5rem;
  --t-h3: 1.1875rem;
  --t-body: 1rem;
  --t-meta: 0.875rem;
  --t-small: 0.8125rem;
  --t-site-dialogue: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);

  /* Spacing, 4 px base */
  --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;

  /* Radii */
  --r-chip: 4px;
  --r-row: 8px;
  --r-button: 10px;
  --r-panel: 14px;
  --r-box: 16px;
  --r-round: 999px;

  /* Borders and trim */
  --trim-w: 2px;
  --trim-frame: 0 0 0 var(--trim-w) var(--g-gold), inset 0 0 0 2px var(--g-white), inset 0 0 0 3px var(--g-gold-pale);
  --trim-button: 0 0 0 var(--trim-w) var(--g-gold), inset 0 0 0 2px var(--g-white);
  --edge-row: 0 4px 0 var(--g-edge);
  --rule-dotted: 2px dotted var(--g-dots);

  /* Elevation: solid offsets only, never blurred glows */
  --e-0: none;
  --e-1: 0 3px 0 var(--a-edge);
  --e-2: 0 5px 0 var(--a-edge);
  --e-3: 0 8px 0 rgb(31 42 92 / 0.18);

  /* Motion */
  --reveal-cps: 13;            /* native rate: 13 UTF-16 units per second */
  --dur-press: 80ms;
  --dur-hover: 160ms;
  --dur-arrow: 400ms;          /* completion arrow, ping-pong */
  --dur-expand: 560ms;         /* row art to full screen */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.2, 1);
  --ease-expand: cubic-bezier(0.3, 0, 0.1, 1);
  --ease-linear: linear;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --a-ground: #141a33;
    --a-sunk: #1a2142;
    --a-panel: #1f2850;
    --a-ink: #f4efe1;
    --a-ink-2: #b3b6cf;
    --a-trim: #d6b773;
    --a-rule: #313a66;
    --a-edge: #0c1024;
    --a-action: #8fb2f4;
    --a-action-ink: #141a33;
    --a-speaker: #ff79a8;
    --a-progress: #8fb2f4;
    --a-read: #d6b773;
    --a-focus: #ffe8b4;
    --a-focus-halo: #141a33;
    --a-placeholder: #283160;
    --e-3: 0 8px 0 rgb(0 0 0 / 0.35);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --a-ground: #141a33;
  --a-sunk: #1a2142;
  --a-panel: #1f2850;
  --a-ink: #f4efe1;
  --a-ink-2: #b3b6cf;
  --a-trim: #d6b773;
  --a-rule: #313a66;
  --a-edge: #0c1024;
  --a-action: #8fb2f4;
  --a-action-ink: #141a33;
  --a-speaker: #ff79a8;
  --a-progress: #8fb2f4;
  --a-read: #d6b773;
  --a-focus: #ffe8b4;
  --a-focus-halo: #141a33;
  --a-placeholder: #283160;
  --e-3: 0 8px 0 rgb(0 0 0 / 0.35);
  color-scheme: dark;
}

@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="full"]) {
    --dur-expand: 200ms;
  }
}

:root[data-motion="reduced"] {
  --dur-expand: 200ms;
}
