/* The Five Letters: themes.
   The base rule is the Morning Edition. Every element with data-theme (the page itself, and the preview
   cards in the Press Pass) starts from it, so derived values like --correct-fill follow each theme's own colours.
   Which theme unlocks how: progress.js. */

/* Light specks for dark paper */
:root {
  --grain-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .92 0 0 0 0 .8 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Morning Edition (base) ---------- */
:root, [data-theme] {
  --paper: #f3ecdd;
  --paper-2: #ebe2cf;
  --ink: #1d1a16;
  --ink-soft: #5b544a;
  --rule: #1d1a16;
  --correct: #2f6a52;   /* press green */
  --present: #d69e1f;   /* mustard */
  --absent: #8f887b;    /* newsprint grey */
  --red: #b3361f;
  --card: #fbf7ee;      /* keys, toasts, inputs */
  --on-correct: #fbf7ee; --on-present: var(--ink); --on-absent: #fbf7ee;
  --correct-fill: var(--correct); --present-fill: var(--present); --absent-fill: var(--absent);
  --tile-edge: #c9bfa9; --tile-bg: rgba(255,255,255,.25); --tile-radius: 0px; --tile-shadow: none; --tile-glow: none;
  --key-radius: 3px; --key-absent-ink: #efe9dc; --key-absent-edge: #6f695e;
  --dotted: #b9af9a; --faint: #d6ccb6; --scrim: rgba(29,26,22,.45);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .3 0 0 0 0 .22 0 0 0 .18 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain-size: auto;
  --glow: radial-gradient(ellipse at 50% 0%, #faf6ec 0%, transparent 70%);
  --display: var(--serif);   /* masthead */
  --tile-font: var(--serif); /* tiles and keys */
  --win: hop;                /* winning row animation */
  color-scheme: light;
}

/* ---------- Evening Edition: dark paper under a warm lamp ---------- */
[data-theme="evening"] {
  --paper: #1d1a16; --paper-2: #262219;
  --ink: #ede4d0; --ink-soft: #a59c8a; --rule: #ede4d0;
  --correct: #367c5d; --present: #dba53a; --absent: #4d4840; --red: #e2694c;
  --card: #2a2620;
  --on-correct: #fbf7ee; --on-present: #1d1a16; --on-absent: #ede4d0;
  --tile-edge: #4d473e; --tile-bg: rgba(255,255,255,.03);
  --key-absent-ink: #a59c8a; --key-absent-edge: #34302a;
  --dotted: #4d473e; --faint: #3a352d; --scrim: rgba(0,0,0,.6);
  --grain: var(--grain-light);
  --glow: radial-gradient(ellipse at 50% -10%, rgba(255,184,99,.17) 0%, transparent 62%);
  color-scheme: dark;
}

/* ---------- Telegram: typewriter on a paper strip ---------- */
[data-theme="telegram"] {
  --paper: #efe4c4; --paper-2: #e6d9b3;
  --ink: #26221c; --ink-soft: #5e5444; --rule: #26221c;
  --correct: #2f5878; --present: #c77d32; --absent: #736a58; --red: #a3321d;
  --card: #f8f1dc;
  --on-correct: #f8f1dc; --on-present: #1f1a12; --on-absent: #f8f1dc;
  --tile-edge: #b9ab86; --tile-bg: #f8f1dc; --tile-shadow: 0 2px 0 rgba(38,34,28,.18);
  --key-radius: 0px; --key-absent-ink: #e6dcc2; --key-absent-edge: #4a4336;
  --dotted: #b9ab86; --faint: #d8cba6;
  --glow: linear-gradient(transparent 0 0);
  --display: "Courier Prime", "Courier New", monospace;
  --tile-font: "Courier Prime", "Courier New", monospace;
  --win: stamp;
}
[data-theme="telegram"] .masthead h1 { font-style: normal; letter-spacing: .06em; text-transform: uppercase; font-size: clamp(26px, 8.4vw, 40px); }
[data-theme="telegram"] .tile { font-weight: 700; }

/* ---------- Letterpress: heavy type pressed into cotton paper ---------- */
[data-theme="letterpress"] {
  --paper: #ebe5d8; --paper-2: #e2dbcb;
  --ink: #24211f; --ink-soft: #615a52; --rule: #24211f;
  --correct: #2c5a4c; --present: #c38b2b; --absent: #77716a; --red: #9c2f22;
  --card: #f5f1e8;
  --on-correct: #f4efe4; --on-present: #24211f; --on-absent: #f4efe4;
  --tile-edge: #cfc6b4; --tile-bg: rgba(0,0,0,.025); --tile-radius: 4px;
  --tile-shadow: inset 0 3px 5px rgba(0,0,0,.38), inset 0 -1px 0 rgba(255,255,255,.25);
  --tile-glow: 0 1px 0 rgba(255,255,255,.22);
  --key-radius: 5px; --key-absent-ink: #e8e2d6; --key-absent-edge: #4f4a43;
  --dotted: #c3baa8; --faint: #d8d0c0;
  --display: "Abril Fatface", var(--serif);
  --tile-font: "Abril Fatface", var(--serif);
  --win: press;
}
[data-theme="letterpress"] .masthead h1 { font-style: normal; font-weight: 400; text-shadow: 0 1px 0 rgba(255,255,255,.7), 0 -1px 0 rgba(0,0,0,.18); }
[data-theme="letterpress"] .tile { font-weight: 400; }
[data-theme="letterpress"] .tile.filled:not(.revealed) { box-shadow: inset 0 1px 2px rgba(0,0,0,.12); }

/* ---------- Blueprint: white ink on the drafting table ---------- */
[data-theme="blueprint"] {
  --paper: #1f4f82; --paper-2: #245a92;
  --ink: #eef5ff; --ink-soft: #b5cbe6; --rule: #eef5ff;
  --correct: #f2f6fb; --present: #ffd166; --absent: #3a679a; --red: #ff9a7d;
  --card: #255a92;
  --on-correct: #1f4f82; --on-present: #1f3550; --on-absent: #dfeaf7;
  --tile-edge: #6f95c2; --tile-bg: transparent; --tile-radius: 2px;
  --key-radius: 2px; --key-absent-ink: #b5cbe6; --key-absent-edge: #163c66;
  --dotted: rgba(238,245,255,.35); --faint: rgba(238,245,255,.18); --scrim: rgba(8,22,40,.62);
  --grain: linear-gradient(rgba(238,245,255,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(238,245,255,.07) 1px, transparent 1px);
  --grain-size: 22px 22px, 22px 22px;
  --glow: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,.09) 0%, transparent 70%);
  --display: "IBM Plex Mono", ui-monospace, monospace;
  --tile-font: "IBM Plex Mono", ui-monospace, monospace;
  color-scheme: dark;
}
[data-theme="blueprint"] .masthead h1 { font-style: normal; font-weight: 700; letter-spacing: -.03em; font-size: clamp(28px, 9vw, 42px); }
[data-theme="blueprint"] .tile { font-weight: 700; border-style: dashed; }
[data-theme="blueprint"] .tile.filled, [data-theme="blueprint"] .tile.revealed { border-style: solid; }

/* ---------- Neon Classifieds: the small ads at midnight ---------- */
[data-theme="neon"] {
  --paper: #110f1c; --paper-2: #181528;
  --ink: #f2eeff; --ink-soft: #a49cc4; --rule: #ff5fae;
  --correct: #18d4a0; --present: #ff5fae; --absent: #2f2a45; --red: #ff5fae;
  --card: #1b1830;
  --on-correct: #0b0a14; --on-present: #0b0a14; --on-absent: #b9b1d8;
  --tile-edge: #3a3456; --tile-bg: rgba(255,255,255,.02); --tile-radius: 6px;
  --key-radius: 6px; --key-absent-ink: #7d75a0; --key-absent-edge: #0b0a14;
  --dotted: #3a3456; --faint: #2a2540; --scrim: rgba(5,4,12,.7);
  --grain: var(--grain-light);
  --glow: radial-gradient(ellipse at 50% -5%, rgba(255,95,174,.16) 0%, transparent 60%);
  --display: "Monoton", var(--serif);
  --win: neon;
  color-scheme: dark;
}
[data-theme="neon"] .masthead h1 { font-style: normal; font-weight: 400; color: #ffd1e8; font-size: clamp(26px, 8.6vw, 40px); letter-spacing: .02em;
  text-shadow: 0 0 6px #ff5fae, 0 0 18px rgba(255,95,174,.7); }
[data-theme="neon"] .tile.correct { box-shadow: 0 0 18px -3px #18d4a0; }
[data-theme="neon"] .tile.present { box-shadow: 0 0 18px -3px #ff5fae; }
[data-theme="neon"] .key { box-shadow: 0 0 0 transparent; border-color: #3a3456; }
[data-theme="neon"] .key.correct { box-shadow: 0 0 12px -3px #18d4a0; border-color: transparent; }
[data-theme="neon"] .key.present { box-shadow: 0 0 12px -3px #ff5fae; border-color: transparent; }

/* ---------- Gold Leaf: gilded edges for the very best ---------- */
[data-theme="gold"] {
  --paper: #17130d; --paper-2: #1f1a12;
  --ink: #f1e4c0; --ink-soft: #b0a27c; --rule: #c9a54a;
  --correct: #c9a227; --present: #b9c0c6; --absent: #3a3226; --red: #e07a5f;
  --correct-fill: linear-gradient(135deg, #f6e39a 0%, #d4ae35 42%, #9a7414 100%);
  --present-fill: linear-gradient(135deg, #f1f4f6 0%, #b9c0c6 50%, #7c838a 100%);
  --card: #221c13;
  --on-correct: #1b1408; --on-present: #15171a; --on-absent: #b0a27c;
  --tile-edge: #4a3f2c; --tile-bg: rgba(201,165,74,.03);
  --tile-shadow: inset 0 1px 0 rgba(255,255,255,.35);
  --key-absent-ink: #8d8064; --key-absent-edge: #0e0b07;
  --dotted: #4a3f2c; --faint: #2e271b; --scrim: rgba(0,0,0,.65);
  --grain: var(--grain-light);
  --glow: radial-gradient(ellipse at 50% -10%, rgba(201,162,39,.16) 0%, transparent 62%);
  --display: "Cinzel", var(--serif);
  --tile-font: "Cinzel", var(--serif);
  --win: gild;
  color-scheme: dark;
}
[data-theme="gold"] .masthead h1 { font-style: normal; font-size: clamp(26px, 8.4vw, 40px); letter-spacing: .04em;
  color: #dcb84e; text-shadow: 0 1px 0 #6e520e, 0 0 14px rgba(201,162,39,.25); }
[data-theme="gold"] .masthead { border-color: #c9a54a; }
[data-theme="gold"] .key { box-shadow: 2px 2px 0 #c9a54a; border-color: #c9a54a; }

/* ---------- Holiday Issue: pine, berries and fresh snow (December only) ---------- */
[data-theme="holiday"] {
  --paper: #f5efe3; --paper-2: #ece4d3;
  --correct: #1f6b45; --present: #d4a62a; --red: #a8281e;
  --rule: #a8281e;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cg fill='%23a8281e' fill-opacity='.10'%3E%3Ccircle cx='14' cy='20' r='2'/%3E%3Ccircle cx='70' cy='9' r='1.5'/%3E%3Ccircle cx='104' cy='44' r='2.2'/%3E%3Ccircle cx='42' cy='62' r='1.4'/%3E%3Ccircle cx='86' cy='92' r='1.8'/%3E%3Ccircle cx='20' cy='104' r='1.5'/%3E%3C/g%3E%3C/svg%3E");
}
[data-theme="holiday"] .masthead h1 { color: #a8281e; }
[data-theme="holiday"] .masthead h1::before, [data-theme="holiday"] .masthead h1::after { content: "❄"; font: 400 .5em var(--sans); vertical-align: middle; margin: 0 .35em; color: #1f6b45; }

/* ---------- Accessibility: always free, works with every theme ---------- */
/* Colour-blind tiles: orange and blue instead of green and yellow */
[data-cb], [data-cb] [data-theme] {
  --correct: #e8732c; --present: #4f9fe0;
  --correct-fill: var(--correct); --present-fill: var(--present);
  --on-correct: #1d1a16; --on-present: #1d1a16;
}
/* High contrast: no grain, full-strength ink and rules */
[data-hc], [data-hc] [data-theme] {
  --ink-soft: var(--ink); --tile-edge: var(--ink); --dotted: var(--ink); --faint: color-mix(in srgb, var(--ink) 35%, transparent);
  --grain: linear-gradient(transparent 0 0); --glow: linear-gradient(transparent 0 0); --grain-size: auto;
}
[data-hc] .tile.revealed { outline: 2px solid var(--ink); outline-offset: -2px; }
[data-hc] .tile.revealed::after { display: none; }
