/*
 * WebWolf design tokens ("Veillée").
 *
 * One table under three skies. The palette is the same warm, bistre-tinted
 * family throughout; only lightness and chroma move with the hour:
 *
 *   dusk   home, lobby, card reveal   the default, set on :root
 *   night  the night phase            darker still, and the ink dims with it
 *   day    discussion, vote, result   pale paper: every phone brightens at once
 *
 * Night sits below the usual 12-18% band for a dark surface on purpose. A
 * table full of face-up phones must not glow while eyes are meant to be shut.
 *
 * styles.css references these by name. It never writes a colour or a font of
 * its own, nor a gap or padding that is off the scale below; a value that is
 * missing gets added here first. One-off dimensions - how wide a card is drawn,
 * how long a toggle's track - stay beside the thing they size.
 */

:root {
  /* Sky: dusk ------------------------------------------------------------ */
  --color-paper: oklch(19% 0.013 60);
  --color-paper-2: oklch(23.5% 0.015 60); /* raised: fields, notices */
  --color-paper-3: oklch(28% 0.017 60); /* raised again: the sheet */
  --color-rule: oklch(36% 0.017 60); /* hairlines between sections */
  --color-rule-2: oklch(30% 0.015 60); /* hairlines between rows */
  --color-edge: oklch(56% 0.02 62); /* control boundaries, 3:1 on paper */
  --color-muted: oklch(74% 0.015 68);
  --color-ink-2: oklch(85% 0.014 76);
  --color-ink: oklch(94% 0.014 82);

  /* Braise: the one accent. It marks what is live or chosen, nothing else. */
  --color-accent: oklch(77% 0.14 58);
  --color-accent-ink: oklch(18% 0.03 55);
  --color-focus: oklch(82% 0.13 66);

  /* Sang: elimination, the stop control, errors. Never decoration. */
  --color-danger: oklch(72% 0.15 27);
  --color-danger-ink: oklch(16% 0.03 27);
  --color-danger-rule: oklch(46% 0.09 27); /* the quiet outline */

  /* A card: cream face, inked back. The one object that survives every sky. */
  --color-card: oklch(93% 0.03 86);
  --color-card-ink: oklch(22% 0.02 50);
  --color-card-muted: oklch(43% 0.022 55);
  --color-card-rule: oklch(76% 0.035 78);
  --color-back: oklch(27% 0.03 42);
  --color-back-line: oklch(39% 0.055 48);
  --color-back-edge: oklch(44% 0.035 50);
  --color-back-ink: oklch(92% 0.018 82);

  /* Overlay behind the sheet. The only token that carries alpha, and thin
     enough that the countdown above the sheet stays readable through it. */
  --color-scrim: oklch(6% 0.01 60 / 0.5);

  /* Light text on a dark ground reads heavier than it is; set it lighter. */
  --weight-body: 370;
  --weight-text: 380;

  /* Type ----------------------------------------------------------------- */
  /* Fraunces says things: titles, names, instructions, buttons.
     Geist counts and labels them: clocks, tallies, hints. */
  --font-display: "Fraunces", "Fraunces Fallback", Georgia, "Times New Roman", serif;
  --font-body: "Geist", "Geist Fallback", system-ui, -apple-system, "Helvetica Neue", sans-serif;

  /* A major third built down and up from 18px, the size an instruction
     needs to be read off a phone lying at arm's length. */
  --text-xs: 0.8rem; /* floor: the next step down, 11.5px, is too small */
  --text-sm: 0.9rem;
  --text-base: 1.125rem;
  --text-md: 1.4063rem;
  --text-lg: 1.7578rem;
  --text-xl: 2.1973rem;
  --text-2xl: 2.7466rem;
  --text-display: clamp(3rem, 15vw, 3.75rem);

  /* Space: 4pt scale, named by role ---------------------------------------- */
  --space-3xs: 0.125rem;
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;

  /* Sizes ---------------------------------------------------------------- */
  --tap: 2.75rem; /* 44px, the smallest thing a thumb is asked to hit */
  --control: 3.25rem; /* buttons and text fields share one height */
  --measure-app: 35rem;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Shape ---------------------------------------------------------------- */
  --radius-control: 0.375rem;
  --radius-card: 0.625rem;
  --radius-card-lg: 1rem;
  --radius-sheet: 1.25rem;
  --radius-round: 62.5rem;
  --rule-hair: 1px;
  --rule-bold: 2px;

  /* Motion --------------------------------------------------------------- */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-micro: 120ms;
  --dur-short: 220ms;
  --dur-long: 420ms;
  --dur-dawn: 900ms; /* the sky changing: the one slow thing in the app */

  /* Layers --------------------------------------------------------------- */
  --z-base: 1;
  --z-sticky: 200;
  --z-modal: 400;

  color-scheme: dark;
}

/* Sky: night ---------------------------------------------------------------- */

body[data-phase="night"] {
  --color-paper: oklch(9.5% 0.01 60);
  --color-paper-2: oklch(13% 0.012 60);
  --color-paper-3: oklch(17% 0.014 60);
  --color-rule: oklch(24% 0.014 60);
  --color-rule-2: oklch(19% 0.012 60);
  --color-edge: oklch(47% 0.018 62);
  --color-muted: oklch(62% 0.015 68);
  --color-ink-2: oklch(73% 0.014 76);
  --color-ink: oklch(82% 0.016 80);

  --color-accent: oklch(70% 0.13 58);
  --color-accent-ink: oklch(14% 0.03 55);
  --color-focus: oklch(76% 0.16 66);

  --color-danger: oklch(63% 0.15 27);
  --color-danger-rule: oklch(34% 0.08 27);

  --color-card: oklch(82% 0.03 84);
  --color-card-ink: oklch(18% 0.02 50);
  --color-card-muted: oklch(36% 0.022 55);
  --color-card-rule: oklch(66% 0.035 78);
  --color-back: oklch(15% 0.022 42);
  --color-back-line: oklch(26% 0.045 48);
  --color-back-edge: oklch(31% 0.03 50);
  --color-back-ink: oklch(80% 0.018 82);
}

/* Sky: day -------------------------------------------------------------------- */

body[data-phase="day"],
body[data-phase="vote"],
body[data-phase="reveal"] {
  --color-paper: oklch(93% 0.018 82);
  --color-paper-2: oklch(96.5% 0.012 85);
  --color-paper-3: oklch(97.5% 0.01 86);
  --color-rule: oklch(80% 0.022 78);
  --color-rule-2: oklch(86% 0.02 80);
  --color-edge: oklch(57% 0.025 70);
  --color-muted: oklch(45% 0.02 62);
  --color-ink-2: oklch(34% 0.018 58);
  --color-ink: oklch(21% 0.016 55);

  /* The same ember, seen by daylight: lower and a little redder. */
  --color-accent: oklch(50% 0.135 45);
  --color-accent-ink: oklch(97% 0.012 85);
  --color-focus: oklch(47% 0.13 45);

  --color-danger: oklch(46% 0.17 27);
  --color-danger-ink: oklch(97% 0.012 85);
  --color-danger-rule: oklch(72% 0.08 27);

  --color-card: oklch(97.5% 0.012 86);
  --color-card-ink: oklch(21% 0.016 55);
  --color-card-muted: oklch(43% 0.02 60);
  --color-card-rule: oklch(74% 0.028 76);
  --color-back: oklch(27% 0.03 42);
  --color-back-line: oklch(40% 0.055 48);
  --color-back-edge: oklch(21% 0.02 45);
  --color-back-ink: oklch(94% 0.016 84);

  --weight-body: 400;
  --weight-text: 400;

  color-scheme: light;
}

/* The vote is about ending someone, so the accent turns to blood. */
body[data-phase="vote"] {
  --color-accent: var(--color-danger);
  --color-accent-ink: var(--color-danger-ink);
  --color-focus: var(--color-danger);
}
