/*
 * SameSame — "Vintage Day + Night" (chosen by the owner, built 2026-11-17).
 *
 * One palette, two looks. Three anchors, each a short tonal ramp, plus three
 * status ramps (block "palette" below):
 *   Old Cream     the paper and the Day table      cream-50 … cream-700
 *   Midnight Navy the ink, the card backs, Night   navy-500 … navy-950
 *   Vintage Red   the one primary action, the seal red-300 … red-800
 *   sage (matched / ready), gold (reconnecting); errors use the red ramp; the hint ring is cream on navy keylines.
 * Both looks draw every colour from these ramps: they are the same deck seen by
 * day and by night.
 *
 *   Day   (the main look): cream page, paper panels lifted by soft warm
 *         shadows, navy text, navy card backs. 60 cream / 30 navy / 10 red.
 *   Night (dark mode): navy page, lifted navy panels, cream text, the same
 *         navy backs on a wide cream margin so each reads as a card on the table.
 *
 * How a look is chosen. A tiny script at the top of index.html's <head> runs
 * before first paint and ALWAYS sets <html data-theme="day|night">: the
 * player's stored choice (localStorage "samesame:theme" = day / night) if there
 * is one, otherwise the device's prefers-color-scheme, and it follows the
 * device live while there is no stored choice. The look switch (public/theme.js)
 * only changes that stored choice. So the Night values below are written once,
 * under [data-theme="night"]: no media query can disagree with the switch. With
 * scripting off the page is Day (and the game needs scripting anyway).
 *
 * Semantic tokens point at the ramps with var(); tools/check-contrast.mjs
 * resolves them and checks every pair in both looks. Each look's block sits
 * between "tokens:start <look>" and "tokens:end"; the "shared" block holds the
 * non-colour tokens both looks use. ui-kit.css (shared with Prism and
 * Pentaline) is unchanged; SameSame's few overrides are in styles.css.
 *
 * Fonts (Google Fonts):
 * <link rel="preconnect" href="https://fonts.googleapis.com">
 * <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
 * <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;700;800&family=Nunito:wght@400;600;700;800&display=swap">
 */
:root {
  /* palette:start */
  --cream-50:   #faf5e8;  /* paper: Day panels, dialog, toasts; ink on red */
  --cream-100:  #f4ecda;  /* Day hover on paper; Night primary text */
  --cream-200:  #ece1c7;  /* the Day table (page) */
  --cream-300:  #e0d2b2;  /* Day wells: tab track, secondary fill; Night card-back margin */
  --cream-400:  #cbbb98;  /* Day decorative dividers; Night secondary text */
  --cream-500:  #afa292;  /* Night muted text, placeholders */
  --cream-700:  #786d57;  /* Day control outlines (>= 3:1 on every Day surface) */

  --navy-500:   #7a8aa3;  /* Night control outlines (>= 3:1 on every Night surface) */
  --navy-600:   #4b5570;  /* Day muted text, placeholders */
  --navy-700:   #34405e;  /* Day secondary text */
  --navy-800:   #273653;  /* Night raised step: hover, secondary fill; card-back lattice */
  --navy-850:   #1d2b45;  /* Night raised: chips, rows, tiles */
  --navy-900:   #142139;  /* Day primary text and selected fill; card-back ground; Night panels */
  --navy-950:   #0c1a33;  /* the Night table (page): a visible midnight navy, 0.056 OKLab from Pentaline's #030e21 */

  --red-300:    #ea7267;  /* Night error border and disc */
  --red-200:    #f08378;  /* Night error hover */
  --red-400:    #c0463a;  /* Night primary hover: lighter, so the edge holds on navy */
  --red-500:    #bb4439;  /* Night primary action (a step lighter than Day's so it lifts off navy) */
  --red-600:    #a3302a;  /* Vintage Red: Day primary action; the card-back seal */
  --red-700:    #8a2621;  /* Day primary hover, red as text */
  --red-800:    #7a1d1a;  /* Day error border and disc (darker than the accent, so an error never reads as "press here") */
  --red-900:    #66161a;  /* Day error hover */

  --sage-400:   #85b996;  /* Night matched / ready */
  --sage-700:   #355f4b;  /* Day matched / ready */
  --gold-300:   #f6b84d;  /* Night reconnecting */
  --gold-800:   #7a4f0f;  /* Day reconnecting */
  /* palette:end */
}

:root {
  /* tokens:start day */
  --bg:           var(--cream-200);   /* the page; theme-color */
  --bg-deep:      var(--cream-300);   /* wells: tab track, score pill */
  --surface:      var(--cream-50);    /* panels, dialog, pills */
  --surface-2:    var(--cream-50);    /* raised: toast, chips, deck tiles */
  --surface-3:    var(--cream-300);   /* secondary fills, winner row */
  --line:         var(--cream-400);   /* decorative dividers (no contrast floor) */
  --line-strong:  var(--cream-700);   /* input and unselected-choice outlines */
  --fg:           var(--navy-900);    /* primary text */
  --fg-muted:     var(--navy-700);    /* secondary text */
  --fg-subtle:    var(--navy-600);    /* muted text, placeholders, disabled labels */
  --accent:       var(--red-600);     /* the one primary action */
  --accent-hover: var(--red-700);
  --accent-fg:    var(--cream-50);    /* text on red */
  --accent-soft:  var(--cream-300);   /* selection wash, ::selection */
  --accent-text:  var(--red-700);     /* red as text (rare) */
  --success:      var(--sage-700);    /* matched, ready */
  --warning:      var(--gold-800);    /* reconnecting */
  --danger:       var(--red-800);     /* error border, disc, destructive fill */
  --danger-hover: var(--red-900);
  --danger-fg:    var(--cream-50);
  --focus:        var(--navy-900);    /* 2px ring, offset 2px */
  --scrim:        #142139d1;          /* navy-900 at 82%: the paper dialog sits on navy, not on a greyed cream */
  /* tokens:end */
  --shadow-1: 0 1px 2px rgb(90 66 30 / .12), 0 6px 14px -6px rgb(90 66 30 / .24);
  --shadow-2: 0 2px 6px rgb(11 23 44 / .16), 0 22px 44px -14px rgb(11 23 44 / .40);
}

:root[data-theme="night"] {
  /* tokens:start night */
  --bg:           var(--navy-950);    /* the page; theme-color */
  --bg-deep:      var(--navy-950);    /* wells: tab track */
  --surface:      var(--navy-900);    /* panels */
  --surface-2:    var(--navy-850);    /* raised: chips, rows, tiles, toggle */
  --surface-3:    var(--navy-800);    /* hover, secondary fill, winner row */
  --line:         var(--navy-800);    /* decorative dividers */
  --line-strong:  var(--navy-500);    /* input and unselected-choice outlines */
  --fg:           var(--cream-100);   /* primary text */
  --fg-muted:     var(--cream-400);   /* secondary text */
  --fg-subtle:    var(--cream-500);   /* muted text, placeholders, disabled labels */
  --accent:       var(--red-500);     /* the one primary action */
  --accent-hover: var(--red-400);
  --accent-fg:    var(--cream-50);
  --accent-soft:  var(--navy-800);    /* selection wash: tonal, never red */
  --accent-text:  var(--cream-100);
  --success:      var(--sage-400);
  --warning:      var(--gold-300);
  --danger:       var(--red-300);
  --danger-hover: var(--red-200);
  --danger-fg:    var(--navy-950);
  --focus:        var(--cream-100);
  --scrim:        #050d1fc2;          /* a deeper navy than the page, at 76% */
  /* tokens:end */
  --shadow-1: 0 1px 2px rgb(5 12 26 / .45), 0 6px 14px -6px rgb(5 12 26 / .6);
  --shadow-2: 0 2px 6px rgb(5 12 26 / .45), 0 24px 48px -16px rgb(5 12 26 / .7);
}

:root {
  /* tokens:start shared */
  /* Radii (identical in all three games) */
  --radius-chip: 8px;
  --radius-control: 12px;
  --radius-card: 16px;
  --radius-dialog: 24px;
  --radius-pill: 999px;

  /* Motion (identical; the portal's curve) */
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --dur-press: 120ms;
  --dur-fast: 160ms;
  --dur-base: 240ms;

  /* Stacking */
  --z-raised: 10;
  --z-sticky: 30;
  --z-overlay: 50;
  --z-toast: 60;

  /* Type (identical in all three games: rounded, never sharp) */
  --font-body: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Baloo 2", ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  /* tokens:end */
}

/*
 * ---- Game content: NOT chrome. ----
 * --board is what a card lies on (the page). tools/color.mjs CARD_SURROUNDS
 * holds both looks' tables and panels with the edge drawn round a face there
 * (--card-edge, --card-edge-w); the deck-ink gate checks every deck's ink and
 * paper against them, and tools/check-contrast.mjs fails if the two disagree.
 * --paper is the card face.
 * The card-back pictures themselves are in styles.css (they need literal hexes).
 */
:root {
  /* content:start day */
  --board:        var(--cream-200);
  --card-back:    var(--navy-900);    /* the back's ground */
  --card-edge:    var(--cream-400);   /* the fine printed edge round a face on the cream table */
  --card-edge-w:  1px;
  --hint:         var(--cream-50);    /* the hint ring and the "mirror" label: cream, hue-free */
  --hint-key:     var(--navy-900);    /* the two navy keylines round the ring, the label's edge */
  --hint-ink:     var(--navy-900);    /* the "mirror" label's text */
  --success-ink:  var(--cream-50);    /* the tick on the matched badge (drawn in styles.css) */
  --paper:        #fffaf0;
  /* content:end */
}
:root[data-theme="night"] {
  /* content:start night */
  --board:        var(--navy-950);
  --card-back:    var(--navy-900);
  --card-edge:    #fffaf0;            /* a paper frame round every face, so deck ink never touches the navy table */
  --card-edge-w:  2.5px;
  --success-ink:  var(--navy-950);
  /* content:end */
}
