/* Palettes. theme.js sets data-palette on <html> before first paint.
   Every colour, edge and letter face the app uses is a token here; style.css only
   reads them. The base :root block is the "classic" recipe, driven by --main and
   --accent, so the five original palettes only set those two. The five newer
   palettes set every token themselves. Tile faces are bundled in fonts/ (OFL). */

@font-face { font-family: "Archivo"; src: url("fonts/archivo-900.woff2") format("woff2"); font-weight: 900; font-display: swap; }
@font-face { font-family: "Archivo Black"; src: url("fonts/archivo-black.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Playfair Display"; src: url("fonts/playfair-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Libre Caslon Text"; src: url("fonts/caslon-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Unbounded"; src: url("fonts/unbounded-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

/* ---------- classic recipe (default) ---------- */
:root {
  --main: #492B70;
  --accent: #F1D492;
  color-scheme: dark;

  --bg: var(--main);
  --bg-image: radial-gradient(120% 80% at 50% 0%, rgba(255, 255, 255, 0.10), transparent 60%);
  --field: rgba(0, 0, 0, 0.22);
  --surface: rgba(255, 255, 255, 0.07);
  --card-bg: rgba(0, 0, 0, 0.24);
  --panel: color-mix(in srgb, var(--main) 82%, black);
  --disc: radial-gradient(circle, rgba(255, 255, 255, 0.04) 0 55%, rgba(255, 255, 255, 0.09) 56% 100%);
  --line: rgba(255, 255, 255, 0.22);
  --card-line: color-mix(in srgb, var(--accent) 35%, transparent);
  --ink: #FFFFFF;
  --ink-soft: rgba(255, 255, 255, 0.78);
  --soft-fill: rgba(255, 255, 255, 0.08);

  --title: var(--accent);
  --title-font: 700 clamp(1.3rem, 5vw, 1.7rem) Georgia, "Times New Roman", serif;
  --title-track: 0.02em;

  --tile-bg: var(--accent);
  --tile-ink: var(--main);
  --tile-font: Georgia, "Times New Roman", serif;
  --tile-weight: 700;
  --tile-shadow: 0 2px 0 rgba(0, 0, 0, 0.25), 0 3px 8px rgba(0, 0, 0, 0.25);
  --tile-round: 0.2;
  --select: #FFFFFF;

  --cell-bg: rgba(255, 255, 255, 0.07);
  --cell-line: rgba(255, 255, 255, 0.22);
  --cell-style: dashed;

  --accent-ink: var(--main);
  --accent-text: var(--accent);
  --answer: var(--accent);
  --solve-bg: color-mix(in srgb, var(--accent) 22%, transparent);
  --solve-ink: var(--accent);
  --chip-bg: transparent;
  --chip-ink: rgba(255, 255, 255, 0.78);
  --chip-line: rgba(255, 255, 255, 0.22);
  --radius: 10px;
}

:root[data-palette="purple-champagne"] { --main: #492B70; --accent: #F1D492; }
:root[data-palette="midnight-copper"] { --main: #132B46; --accent: #F0B58E; }
:root[data-palette="petrol-apricot"] { --main: #0D4C50; --accent: #FFC39F; }
:root[data-palette="plum-rose"] { --main: #582647; --accent: #F3B5C8; }
:root[data-palette="charcoal-ice"] { --main: #29313C; --accent: #A7D8FF; }

/* ---------- Blackout Grid: a cryptic grid at night ---------- */
:root[data-palette="blackout-grid"] {
  --main: #0B0B0C; --accent: #FFD60A;
  --bg: #0B0B0C; --bg-image: none;
  --field: #141416; --surface: #161618; --card-bg: #121214; --panel: #111113; --disc: #121214;
  --line: #34343A; --card-line: #FFD60A; --ink: #F5F5F2; --ink-soft: #A3A3AA; --soft-fill: #1D1D21;
  --title: #F5F5F2; --title-font: 900 clamp(1.25rem, 5vw, 1.6rem) "Archivo", "Arial Black", sans-serif; --title-track: 0.02em;
  --tile-bg: #F5F5F2; --tile-ink: #0B0B0C; --tile-font: "Archivo", "Arial Black", sans-serif; --tile-weight: 900;
  --tile-shadow: inset 0 1px 0 #FFFFFF, 0 3px 0 #6E6E68; --tile-round: 0.08; --select: #FFD60A;
  --cell-bg: #0B0B0C; --cell-line: #3A3A40; --cell-style: solid;
  --accent-ink: #0B0B0C; --accent-text: #FFD60A; --answer: #FFD60A;
  --solve-bg: #FFD60A; --solve-ink: #0B0B0C;
  --chip-bg: #FFD60A; --chip-ink: #0B0B0C; --chip-line: #FFD60A;
  --radius: 5px;
}

/* ---------- Gilt Edge: black lacquer and gold leaf ---------- */
:root[data-palette="gilt-edge"] {
  --main: #0F0D0A; --accent: #E9BE57;
  --bg: #0F0D0A; --bg-image: none;
  --field: #17140F; --surface: #1A1612; --card-bg: #15120E; --panel: #14110D; --disc: #15120E;
  --line: #3E3426; --card-line: #6B5530; --ink: #F3EBDD; --ink-soft: #B4A68D; --soft-fill: #221D16;
  --title: #E9BE57; --title-font: 800 clamp(1.35rem, 5.4vw, 1.8rem) "Playfair Display", Georgia, serif; --title-track: 0.01em;
  --tile-bg: linear-gradient(180deg, #F8DE90 0%, #E2B24C 55%, #CB9532 100%); --tile-ink: #1C1305;
  --tile-font: "Playfair Display", Georgia, serif; --tile-weight: 800;
  --tile-shadow: inset 0 1px 0 #FFF1C2, 0 3px 0 #7A561A; --tile-round: 0.12; --select: #F3EBDD;
  --cell-bg: #120F0B; --cell-line: #4A3E2C; --cell-style: solid;
  --accent-ink: #1C1305; --accent-text: #E9BE57; --answer: #F1C863;
  --solve-bg: #E9BE57; --solve-ink: #1C1305;
  --chip-bg: #2A2217; --chip-ink: #E9BE57; --chip-line: #4A3E2C;
  --radius: 7px;
}

/* ---------- Late Edition: the printed puzzle page (light) ---------- */
:root[data-palette="late-edition"] {
  color-scheme: light;
  --main: #E7E8E3; --accent: #C8102E;
  --bg: #E7E8E3; --bg-image: none;
  --field: #F7F7F4; --surface: #F7F7F4; --card-bg: #F7F7F4; --panel: #F7F7F4; --disc: #EFF0EC;
  --line: #B9BBB2; --card-line: #121212; --ink: #121212; --ink-soft: #55574F; --soft-fill: #E4E5DF;
  --title: #121212; --title-font: 700 clamp(1.35rem, 5.4vw, 1.8rem) "Libre Caslon Text", Georgia, serif; --title-track: 0;
  --tile-bg: #121212; --tile-ink: #FFFFFF; --tile-font: "Libre Caslon Text", Georgia, serif; --tile-weight: 700;
  --tile-shadow: inset 0 1px 0 #3A3A3A, 0 3px 0 #C8102E; --tile-round: 0.04; --select: #C8102E;
  --cell-bg: #FFFFFF; --cell-line: #121212; --cell-style: solid;
  --accent-ink: #FFFFFF; --accent-text: #C8102E; --answer: #C8102E;
  --solve-bg: #C8102E; --solve-ink: #FFFFFF;
  --chip-bg: #121212; --chip-ink: #FFFFFF; --chip-line: #121212;
  --radius: 3px;
}

/* ---------- Ember: graphite and molten orange ---------- */
:root[data-palette="ember"] {
  --main: #111213; --accent: #FF6A1A;
  --bg: #111213; --bg-image: none;
  --field: #18191B; --surface: #1B1C1E; --card-bg: #161719; --panel: #161719; --disc: #161719;
  --line: #36383C; --card-line: #FF6A1A; --ink: #F2F2F0; --ink-soft: #A2A5AA; --soft-fill: #232427;
  --title: #FF6A1A; --title-font: 400 clamp(1.25rem, 5vw, 1.65rem) "Archivo Black", "Arial Black", sans-serif; --title-track: 0.01em;
  --tile-bg: #FF6A1A; --tile-ink: #160700; --tile-font: "Archivo Black", "Arial Black", sans-serif; --tile-weight: 400;
  --tile-shadow: inset 0 1px 0 #FF9A5E, 0 3px 0 #8C3300; --tile-round: 0.1; --select: #F2F2F0;
  --cell-bg: #141516; --cell-line: #3C3E42; --cell-style: solid;
  --accent-ink: #160700; --accent-text: #FF6A1A; --answer: #FF7A30;
  --solve-bg: #FF6A1A; --solve-ink: #160700;
  --chip-bg: #2B1A10; --chip-ink: #FF8A4A; --chip-line: #4A2A16;
  --radius: 6px;
}

/* ---------- Ultraviolet: deep violet and hot pink ---------- */
:root[data-palette="ultraviolet"] {
  --main: #0E0920; --accent: #FF4FB0;
  --bg: #0E0920; --bg-image: none;
  --field: #160F2E; --surface: #1A1236; --card-bg: #150E2D; --panel: #140D2B; --disc: #150E2D;
  --line: #3A2D66; --card-line: #FF4FB0; --ink: #F1ECFF; --ink-soft: #ADA0D3; --soft-fill: #221846;
  --title: #FF4FB0; --title-font: 700 clamp(1.05rem, 4.4vw, 1.4rem) "Unbounded", "Arial Black", sans-serif; --title-track: 0.01em;
  --tile-bg: #FF4FB0; --tile-ink: #22001A; --tile-font: "Unbounded", "Arial Black", sans-serif; --tile-weight: 700;
  --tile-shadow: inset 0 1px 0 #FF9AD3, 0 3px 0 #7A0F4F; --tile-round: 0.18; --select: #8FF3FF;
  --cell-bg: #120B26; --cell-line: #43357A; --cell-style: solid;
  --accent-ink: #22001A; --accent-text: #FF4FB0; --answer: #FF6CBF;
  --solve-bg: #FF4FB0; --solve-ink: #22001A;
  --chip-bg: #2A1440; --chip-ink: #FF8FCF; --chip-line: #43357A;
  --radius: 9px;
}
