/* Tickerflip. Boardread's system: paper and ink, Newsreader for words, Libre Franklin for the interface and figures.
   Flat and square. A letter's state is drawn in ink, not colour: filled is the right place, a heavy foot is in the
   word, greyed out is not in it. Motion is transform and opacity only, 120 to 220 ms, one curve. */
@font-face { font-family: "Libre Franklin"; font-weight: 400; font-display: swap; src: url("/fonts/LibreFranklin-400.woff2") format("woff2"); }
@font-face { font-family: "Libre Franklin"; font-weight: 600; font-display: swap; src: url("/fonts/LibreFranklin-600.woff2") format("woff2"); }
@font-face { font-family: "Libre Franklin"; font-weight: 800; font-display: swap; src: url("/fonts/LibreFranklin-800.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-weight: 400 600; font-display: swap; src: url("/fonts/Newsreader-var.woff2?v=4cd42e5a") format("woff2"); }
@font-face { font-family: "Franklin Fallback"; src: local("Arial"); size-adjust: 103%; ascent-override: 92%; descent-override: 22%; line-gap-override: 0%; }

:root {
  --paper: #fff; --ink: #121212; --soft: #5a5a5a; --faint: #a3a3a3; --rule: #e2e2e2; --wash: #f1f1f1;
  --f: "Libre Franklin", "Franklin Fallback", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --pad: 20px; --gap: 6px; --kh: 54px; --L: 6;
  --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) { :root { --paper: #121212; --ink: #ededed; --soft: #a0a0a0; --faint: #6b6b6b; --rule: #2b2b2b; --wash: #1e1e1e; } }
@media (max-height: 700px) { :root { --kh: 46px; } }
/* the result colours, one set for the three games. A fill carries white letters at 4.5:1 or better; the -fg tones are
   for coloured words on the page and are lighter on a dark page. High contrast swaps in orange, blue and violet and
   shows a miss in ink, for eyes that confuse red and green. */
:root { --ok: #2f7d4c; --near: #9a6700; --out: #6b7075; --bad: #b3372c; --top: #1f5fa8; --on-bad: #fff;
  --ok-fg: var(--ok); --near-fg: var(--near); --out-fg: var(--out); --bad-fg: var(--bad); --top-fg: var(--top); }
@media (prefers-color-scheme: dark) { :root { --out: #4a4e52; --ok-fg: #6cc592; --near-fg: #d9a441; --out-fg: #a0a0a0; --bad-fg: #f0857a; --top-fg: #7fb2ea; } }
.app[data-hc="1"] { --ok: #b84e08; --near: #1f6fb5; --top: #6b3fa0; --bad: var(--ink); --on-bad: var(--paper); --ok-fg: #b84e08; --near-fg: #1f6fb5; --top-fg: #6b3fa0; --bad-fg: var(--ink); }
@media (prefers-color-scheme: dark) { .app[data-hc="1"] { --ok-fg: #f08a4b; --near-fg: #6fb1ee; --top-fg: #b99ae6; } }
.hc { justify-self: start; padding: 4px 0; }

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body { background: var(--paper); color: var(--ink); font: 400 16px/1.4 var(--f); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button { font: inherit; color: inherit; border-radius: 0; cursor: pointer; }
button, a, input { touch-action: manipulation; }      /* no double-tap zoom, so no wait before a tap counts */
a { color: inherit; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.cap { font: 600 11px/1.2 var(--f); letter-spacing: 0.12em; text-transform: uppercase; color: var(--soft); }
.cap b { font-weight: 600; color: var(--ink); }
.num { font-variant-numeric: tabular-nums lining-nums; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.app { position: fixed; inset: 0 0 auto 0; height: var(--vh, 100dvh); display: flex; flex-direction: column; max-width: 520px; margin: 0 auto; --W: min(100vw, 520px); }
.top { flex: none; height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 var(--pad); border-bottom: 1px solid var(--ink); }
.brand { font: 600 23px/1 var(--serif); letter-spacing: -0.01em; text-decoration: none; padding: 11px 0; margin: -11px 0; } /* 44 px to hit, the bar does not grow */
.tools { display: flex; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; transition: transform 120ms var(--ease); }
.icon-btn:active { transform: scale(0.92); }
#sound[aria-pressed="false"] .wave, #sound[aria-pressed="true"] .mute { display: none; }

.stage { position: relative; flex: 1 1 0; min-height: 0; }
.center { height: 100%; display: flex; flex-direction: column; }
.plate { flex: none; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; padding: 14px var(--pad) 0; min-height: 44px; }
.clue { font: 400 13px/1.3 var(--f); color: var(--soft); }
.clue.on { color: var(--ink); font-weight: 600; }

/* the board: six rows of square cards, as large as the screen between the plate and the keys allows */
.frame { flex: 1 1 0; min-height: 0; display: grid; align-content: center; justify-items: center; gap: 14px; padding: 8px 0; }
.board { --t: min(62px, calc((var(--W) - 2 * var(--pad) - (var(--L) - 1) * var(--gap)) / var(--L)), calc((var(--vh, 100dvh) - 52px - 44px - 30px - 3 * var(--kh) - 44px - var(--sab) - 5 * var(--gap) - 16px) / 6)); display: grid; gap: var(--gap); }
.row { display: grid; grid-template-columns: repeat(var(--L), var(--t)); gap: var(--gap); }
.tile { position: relative; width: var(--t); height: var(--t); display: grid; place-items: center; border: 1.5px solid var(--rule); font: 800 calc(var(--t) * 0.5) / 1 var(--f); text-transform: uppercase; user-select: none; will-change: transform; backface-visibility: hidden; }
.tile[data-has="1"] { border-color: var(--ink); }
/* a scored letter is a colour, as in every word game: right place, in the word, not in it. White letters on all three. */
.tile[data-s="correct"], .tile[data-s="revealed"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.tile[data-s="present"] { background: var(--near); border-color: var(--near); color: #fff; }
.tile[data-s="absent"] { background: var(--out); border-color: var(--out); color: #fff; }
.row.shake { animation: shake 240ms linear; }
/* not a word: the row and the message say so in red for a moment */
.row.bad .tile[data-has="1"] { border-color: var(--bad); }
.msg.bad { color: var(--bad-fg); }
@keyframes shake { 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
.row.ripple .tile { animation: hop 240ms var(--ease) calc(var(--i) * 70ms); }
@keyframes hop { 35% { transform: translateY(-9px); } 70% { transform: translateY(1px); } }
.ansrow { grid-template-columns: repeat(var(--L), var(--t)); position: relative; }
.ansrow .ans-k { position: absolute; left: 0; top: -16px; }

.msg { flex: none; height: 30px; display: grid; place-items: center; font: 600 13px/1 var(--f); opacity: 0; transform: translateY(2px); transition: opacity 150ms var(--ease), transform 150ms var(--ease); }
.msg.show { opacity: 1; transform: none; }

.kb { flex: none; display: grid; gap: var(--gap); padding: 0 6px calc(10px + var(--sab)); }
.krow { display: flex; gap: 5px; justify-content: center; }
.krow:nth-child(2) { padding: 0 5%; }
.key { position: relative; flex: 1 1 0; min-width: 0; height: var(--kh); display: grid; place-items: center; border: 0; background: var(--wash); font: 600 15px/1 var(--f); padding: 0; touch-action: manipulation; transition: transform 100ms var(--ease); }
.key.wide { flex: 1.55 1 0; font-size: 12px; letter-spacing: 0.04em; }
.key:active { transform: scale(0.94); }
.key .kmark { display: none; }
.key[data-k="correct"] { background: var(--ok); color: #fff; }
.key[data-k="present"] { background: var(--near); color: #fff; }
.key[data-k="absent"] { background: var(--out); color: #fff; }
@media (hover: hover) and (pointer: fine) { .key:hover:not([data-k]) { background: var(--rule); } .icon-btn:hover { background: var(--wash); } }

.btn { display: flex; align-items: center; justify-content: center; width: 100%; height: 52px; border: 2px solid var(--ink); background: var(--ink); color: var(--paper); font: 600 15px/1 var(--f); letter-spacing: 0.02em; transition: transform 120ms var(--ease); }
.btn:active { transform: scale(0.98); }
.btn.ghost { background: none; color: var(--ink); }
.textbtn { border: 0; background: none; padding: 12px 0; font: 600 14px/1 var(--f); text-decoration: underline; text-underline-offset: 3px; }
.home { font: 400 13px/1 var(--f); color: var(--soft); }
.home a { text-underline-offset: 3px; }
.fine { font: 400 13px/1.4 var(--f); color: var(--soft); }
.fail { padding: 40px var(--pad); font: 400 20px/1.3 var(--serif); }

/* the start card: a page of its own, read top to bottom */
.scrim { display: none; }
.intro { position: fixed; inset: 0; z-index: 10; background: var(--paper); display: grid; align-content: center; justify-items: start; gap: 16px; padding: 32px max(var(--pad), calc((100vw - 440px) / 2)); overflow: auto; }
.intro .title { font: 600 56px/0.95 var(--serif); letter-spacing: -0.02em; margin-top: -4px; }
.intro .lede { font: 400 22px/1.25 var(--serif); max-width: 18em; }
.intro .how { font: 400 15px/1.4 var(--f); color: var(--soft); }
.intro .how b { color: var(--ink); font-weight: 600; }
.intro .btn { margin-top: 8px; justify-self: stretch; }
.legend { list-style: none; padding: 16px 0; display: grid; gap: 10px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); justify-self: stretch; }
.legend li { display: flex; align-items: center; gap: 12px; font: 400 15px/1 var(--f); }
.legend .tile { --t: 32px; }

/* the result: a sheet over the board */
.end { position: absolute; inset: 0; background: var(--paper); overflow: hidden auto; overscroll-behavior: contain; padding: 28px var(--pad) calc(32px + var(--sab)); display: grid; align-content: start; gap: 24px; animation: sheet 220ms var(--ease); }
@keyframes sheet { from { opacity: 0; transform: translateY(12px); } }
.e-head { display: grid; gap: 10px; }
.e-title { font: 500 46px/1 var(--serif); letter-spacing: -0.02em; outline: none; }
.e-sub { font: 400 17px/1.35 var(--serif); }
.card { border: 1px solid var(--ink); padding: 16px; display: grid; gap: 16px; }
.card-top { display: flex; align-items: baseline; justify-content: space-between; }
.e-score { font: 800 30px/1 var(--f); letter-spacing: -0.02em; }
.mini { display: grid; grid-template-columns: repeat(var(--L), 30px); gap: 5px; }
.mini i { width: 30px; height: 30px; border: 1.5px solid var(--rule); }
.mini i[data-s="correct"] { background: var(--ok); border-color: var(--ok); }
.mini i[data-s="present"] { background: var(--near); border-color: var(--near); }
.mini i[data-s="absent"] { background: var(--out); border-color: var(--out); }
.share-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); font: 400 13px/1.3 ui-monospace, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.share-text.open { position: static; width: auto; height: auto; clip-path: none; }
.next-in { display: flex; align-items: baseline; justify-content: space-between; padding-top: 16px; border-top: 1px solid var(--rule); }
.next-in b { font: 800 20px/1 var(--f); }
.reveal, .statsbox { display: grid; gap: 12px; padding-top: 20px; border-top: 1px solid var(--ink); }
.arts { list-style: none; padding: 0; }
.arts li + li { border-top: 1px solid var(--rule); }
.arts a { display: grid; gap: 6px; padding: 14px 0; text-decoration: none; }
.arts .a-h { font: 500 20px/1.2 var(--serif); }
.arts mark { background: none; color: inherit; font-weight: 600; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.arts .a-m { font: 400 12px/1.3 var(--f); color: var(--soft); overflow-wrap: anywhere; }
.arts .a-go { font: 600 13px/1 var(--f); text-decoration: underline; text-underline-offset: 3px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stats div { display: grid; gap: 6px; }
.stats dt { font: 600 10.5px/1.2 var(--f); letter-spacing: 0.1em; text-transform: uppercase; color: var(--soft); order: 2; }
.stats dd { font: 800 30px/1 var(--f); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dist { display: grid; gap: 4px; }
.d-row { display: grid; grid-template-columns: 14px 1fr; gap: 8px; align-items: center; font: 600 12px/1 var(--f); }
.d-bar { display: flex; justify-content: flex-end; align-items: center; height: 20px; width: var(--w); min-width: 22px; background: var(--wash); padding: 0 6px; font-variant-numeric: tabular-nums; }
.d-row.me .d-bar { background: var(--ink); color: var(--paper); }
.credit { font: 400 12px/1.4 var(--f); color: var(--soft); }

/* a reason to come back: the streak, the last seven days, the day's leading article */
.again { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-top: 16px; border-top: 1px solid var(--rule); }
.streak { display: flex; align-items: baseline; gap: 10px; }
.streak b { font: 800 44px/0.8 var(--f); letter-spacing: -0.04em; }
.week { list-style: none; padding: 0; display: flex; gap: 6px; }
.week li { display: grid; justify-items: center; gap: 6px; font: 600 10px/1 var(--f); color: var(--soft); }
.week li::after { content: ""; width: 18px; height: 18px; border: 1.5px solid var(--faint); }
.week li.on::after { background: var(--ink); border-color: var(--ink); }
.week li.today { color: var(--ink); }
.week li.today::after { border: 2px solid var(--ink); }
.today-link { font: 400 17px/1.35 var(--serif); }
.today-link a { text-underline-offset: 3px; }
/* the result is set down a block at a time */
.end > * { animation: rise 220ms var(--ease) backwards; }
.end > :nth-child(2) { animation-delay: 40ms; } .end > :nth-child(3) { animation-delay: 80ms; } .end > :nth-child(4) { animation-delay: 120ms; }
.end > :nth-child(n + 5) { animation-delay: 160ms; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--sab)); z-index: 20; padding: 12px 16px; background: var(--ink); color: var(--paper); font: 600 13px/1 var(--f); opacity: 0; transform: translate(-50%, 8px); transition: opacity 150ms var(--ease), transform 150ms var(--ease); pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
