/* The Chain. ONE typeface, DejaVu Sans (the book interior's), in two weights.
 *
 * Three layers, like Rabbithole: a white page; a light grey panel (full width
 * on a phone, 1280px on a wide screen); and a navy oval that runs out past a
 * ring of dark chain. The ring's top five links are today's and fill in as
 * you play. Everything on a screen sits inside the ring: app.js sizes the
 * ring to the screen and shrinks the text block until its corners clear it. */
@font-face { font-family: "DejaVu Sans Web"; src: url(fonts/dejavu-sans.woff) format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "DejaVu Sans Web"; src: url(fonts/dejavu-sans-bold.woff) format("woff"); font-weight: 700; font-display: swap; }

:root {
  --font: "DejaVu Sans Web", "DejaVu Sans", Arial, Helvetica, sans-serif;
  --page: #ffffff;        /* beyond the panel (wide screens only) */
  --panel: #d6dadf;       /* outside the ring */
  --panel-ink: #1d2a37;
  --navy: #3a4c60;        /* the ring's ground, running out past the chain */
  --link: #131c25;        /* the chain */
  --ink: #f3ede1; --muted: #b3bfcc; --line: #52657a;
  --brass: #d4a94f; --brass-dim: #8e7640; --on-brass: #1b1407;
  --second: #d98f3a; --miss: #e07a62;
  --field: #2a394a; --field-line: #5a6d82;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); font: 400 16px/1.5 var(--font); color: var(--ink); }
button, input { font: inherit; }
a { color: var(--brass); }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }

.panel { position: relative; max-width: 1280px; min-height: 100vh; margin: 0 auto; background: var(--panel); overflow: hidden; }

/* the ring */
#ring { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
#ring .fill { fill: var(--navy); }
#ring .f { fill: none; stroke: var(--link); }  #ring .e { fill: var(--link); }
#ring .f.s1, #ring .f.cur { stroke: var(--brass); }  #ring .e.s1, #ring .e.cur { fill: var(--brass); }
#ring .f.s2 { stroke: var(--second); }               #ring .e.s2 { fill: var(--second); }
#ring .f.s0 { stroke: var(--miss); stroke-dasharray: 10 8; } #ring .e.s0 { fill: var(--miss); }
/* The current link and the Submit button pulse together, on one clock
 * (app.js pins both to the page timeline): answer this, and that link holds.
 * A fade, not movement, so it stays on with reduced motion too. */
#ring .cur { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.answer .btn { animation: btnpulse 1.8s ease-in-out infinite; }
@keyframes btnpulse { 50% { background-color: var(--brass-dim); } }

/* masthead, on the grey */
.bar { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; max-width: 640px; margin: 0 auto; padding: 12px 12px 12px 16px; }
.brand { font-weight: 700; font-size: 14px; letter-spacing: .18em; color: var(--panel-ink); text-decoration: none; }
.icons { display: flex; gap: 4px; }
.icons a, .icons button { display: grid; place-items: center; width: 40px; height: 40px; border: 0; padding: 0; background: none; color: var(--panel-ink); cursor: pointer; }
.icons a:hover, .icons button:hover, .icons a[aria-current] { color: #000; }
.icons svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.icons .dot { fill: currentColor; }

/* running total, under today's links */
.tally { position: absolute; z-index: 2; left: 0; right: 0; margin: 0; text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--brass); }
.tally b { font-size: 15px; letter-spacing: .05em; }
.tally:empty { display: none; }

/* everything sits inside the ring; sizes are in em so app.js can scale the
 * whole block with --fs when a screen is short on room */
.stage { position: absolute; z-index: 1; left: 0; right: 0; display: flex; align-items: center; justify-content: center; text-align: center; }
.card { width: 100%; max-width: min(var(--inner, 420px), 460px); font-size: calc(16px * var(--fs, 1)); }
.kicker { margin: 0; font-size: .75em; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
h1 { margin: .25em 0 .2em; font-size: 2.4em; line-height: 1.05; font-weight: 700; letter-spacing: .08em; }
.lede { margin: 0 0 1.6em; color: var(--brass); }
.theme { margin: -.8em 0 1.4em; font-size: .88em; }
.q { margin: .9em 0 1.1em; font-size: 1.06em; line-height: 1.45; }
.q mark { background: none; color: var(--brass); font-weight: 700; }
.btn { display: inline-block; min-width: 10em; padding: .85em 1.4em; border: 0; border-radius: 8px; cursor: pointer; background: var(--brass); color: var(--on-brass); font: 700 .94em/1 var(--font); letter-spacing: .04em; text-decoration: none; }
.btn:hover { filter: brightness(1.07); }
.answer { text-align: center; }
.answer input { display: block; width: 100%; margin-bottom: .6em; padding: .75em; border-radius: 8px; font: 1.06em var(--font); text-align: center; background: var(--field); color: var(--ink); border: 2px solid var(--field-line); }
.answer input::placeholder { color: #8d9aa8; }
.answer input:focus { outline: none; border-color: var(--brass); }
.answer .btn { min-width: 0; padding: .7em 1.3em; }
.fb { min-height: 1.4em; margin: .6em 0 0; font-size: .88em; color: var(--muted); }
.fb.bad { color: var(--miss); }
.fb.good { color: var(--brass); font-weight: 700; font-size: 1.06em; }
.reveal { margin: 0 0 1.1em; font-size: .88em; color: var(--muted); }
.reveal b { display: block; margin-top: .1em; font-size: 1.5em; color: var(--ink); }
.pass { margin-top: .2em; border: 0; background: none; color: var(--muted); font-size: .8em; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.small { margin: 1em 0 0; font-size: .8em; }
.small a, .small button { color: var(--muted); background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.score { margin: .2em 0 0; font-size: 4.5em; font-weight: 700; line-height: 1; color: var(--brass); }
.score span { font-size: .45em; color: var(--muted); }
.sub { margin: .5em 0 1.1em; color: var(--muted); font-size: .88em; }
.answers { margin: 0 0 1.2em; font-size: .8em; color: var(--muted); }
.answers .s1 { color: var(--ink); } .answers .s2 { color: var(--second); } .answers .s0 { color: var(--miss); text-decoration: line-through; }
.themereveal { margin: 0 0 1.2em; font-size: .88em; }
.themereveal b { display: block; color: var(--brass); font-size: 1.14em; }
.book { margin: 1.4em auto 0; padding-top: 1em; border-top: 1px solid var(--line); font-size: .8em; max-width: 20em; color: var(--muted); }
.book strong { color: var(--ink); }
.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* the finishing animation (a perfect 5/5), from the A/B playtest */
.banner { margin: .5em 0 .9em; font-weight: 700; font-size: 1.15em; color: var(--brass); }
.fchain { display: flex; flex-direction: column; align-items: center; }
.fnode { padding: .35em .9em; border-radius: 6px; background: var(--field); border: 1px solid var(--field-line); font-weight: 700; font-size: .94em;
  opacity: .08; transform: scale(.45); transition: opacity .4s ease, transform .4s ease, border-color .4s ease, box-shadow .4s ease; }
.fnode.on { opacity: 1; transform: none; }
.fchain.complete .fnode { border-color: var(--brass); box-shadow: 0 0 10px rgba(212, 169, 79, .45); }
.flink { position: relative; width: 3px; height: .35em; margin: 0 auto; background: var(--field-line); transition: height .3s ease, background .3s ease; }
.flink.on { height: 1.1em; background: var(--brass); }
/* sits just under its link, over what's below, then shrinks and drifts down
   into the next answer as that answer appears */
.ffact { position: absolute; z-index: 3; left: 50%; top: 0; width: max-content; max-width: min(var(--inner, 20em), 19em);
  padding: .5em .75em; border-radius: 6px; background: #22303e; border: 1px solid var(--line); color: var(--ink);
  font-size: .8em; line-height: 1.4; text-align: center; pointer-events: none;
  opacity: 0; transform: translate(-50%, 6px) scale(.9); transform-origin: top center; transition: opacity .25s ease, transform .6s ease; }
.ffact.show { opacity: 1; transform: translate(-50%, 6px) scale(1); }
.ffact.leaving { opacity: 0; transform: translate(-50%, 26px) scale(.08); }
#ring.glow [data-t] { filter: drop-shadow(0 0 6px rgba(212, 169, 79, .85)); }

/* archive: a short scrolling list inside the ring */
.archive { list-style: none; margin: .8em 0 0; padding: 0; text-align: left; max-height: 38vh; overflow-y: auto; }
.archive a { display: flex; justify-content: space-between; gap: .8em; padding: .65em .2em; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: .88em; }
.archive a:hover .l { color: var(--brass); }
.archive .d { color: var(--muted); }
.archive .s { white-space: nowrap; letter-spacing: 1px; }
.archive .play { color: var(--brass); font-weight: 700; }

/* how to play */
dialog { max-width: 340px; width: calc(100% - 32px); padding: 24px 22px 16px; color: var(--ink); background: var(--navy); border: 0; border-radius: 14px; text-align: center; }
dialog::backdrop { background: rgba(20, 28, 37, .6); }
dialog h2 { margin: 0 0 14px; font-size: 14px; letter-spacing: .16em; text-transform: uppercase; color: var(--brass); }
dialog ol { margin: 0 0 20px; padding-left: 20px; text-align: left; font-size: 15px; }
dialog li { margin-bottom: 8px; }
dialog li::marker { color: var(--brass); font-weight: 700; }
dialog .btn { font-size: 15px; }
.contact { margin: 14px 0 0; font-size: 12px; }
.contact a { color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 9; background: var(--panel-ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; font-weight: 700; }

/* preview bar (only at /preview/) */
.pbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; display: flex; gap: 8px; align-items: center; justify-content: center; padding: 6px 8px; background: #3b2a0c; color: #f0cf85; font-size: 12px; }
.pbar[hidden] { display: none; }
.pbar button, .pbar select { font-size: 12px; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--brass); background: none; color: #f0cf85; }
.pbar select option { color: #000; }

@media (prefers-reduced-motion: reduce) { .shake { animation: none; } }
