/* One scheme for every toy: a dark graphite reading page, a black machine window where the simulation runs,
   yellow for what the machine shows you, red for what luck did. theme.css files only hold layout. */
@import url("https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,200..700;1,6..72,300..500&family=Hanken+Grotesk:wght@400..800&display=swap");

:root {
  --bg: #1c1c1a; --ink: #ecebe6; --soft: #a5a49e; --line: #3a3a37;
  --paper: #000000; --paper-ink: #ecebe6; --paper-soft: #9b9b96; --paper-line: #262624;
  --btn: #f2c230; --btn-ink: #000000; --hit: #e2432f;
  --edge: #34342f;
  --yellow: #f2c230; --red: #e2432f;
  --display: "Newsreader", Georgia, serif; --body: "Hanken Grotesk", system-ui, sans-serif; --dw: 400;
  --h1: 300 clamp(2.5rem, 11.5vw, 4rem)/0.98 var(--display);
  --h2: 400 1.75rem/1.12 var(--display);
  --radius: 3px;
  --col: 36rem;
  --s1: 0.5rem; --s2: 1rem; --s3: 1.5rem; --s4: 2.5rem; --s5: 4rem;
  /* chart colours, all drawn on the black machine */
  --c1: #f2c230; --c2: #ecebe6; --c3: #8a8a86; --c4: #3a3a38; --c5: #a07f1c;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 400 1.0625rem/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
main, footer.site { max-width: var(--col); margin: 0 auto; padding: 0 1.25rem; }

.mast { margin: var(--s4) 0 var(--s3); }
.toy-name { font: 700 1rem/1.2 var(--body); margin: 0 0 var(--s2); }
h1 { font: var(--h1); margin: 0 0 var(--s2); text-wrap: balance; letter-spacing: -0.025em; font-optical-sizing: auto; }
.lede { font-size: 1.12rem; color: var(--soft); margin: 0 0 var(--s3); max-width: 32rem; text-wrap: pretty; }
h2 { font: var(--h2); margin: var(--s5) 0 var(--s2); text-wrap: balance; letter-spacing: -0.01em; }
h3 { font: 700 1.12rem/1.3 var(--body); margin: var(--s3) 0 var(--s1); }
p { margin: 0 0 var(--s2); }
a { color: inherit; text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
small, .small { font-size: 0.88rem; color: var(--soft); }

/* Buttons: yellow with black words, on the page and inside the machine */
button, .btn {
  font: 700 1.05rem/1.1 var(--body);
  border: 2px solid var(--btn); border-radius: var(--radius);
  background: var(--btn); color: var(--btn-ink);
  padding: 0.95rem 1.3rem; cursor: pointer; text-decoration: none; display: inline-block;
  touch-action: manipulation;
}
button.big { width: 100%; font-size: 1.2rem; padding: 1.15rem 1.3rem; }
button.quiet, .btn.quiet { background: transparent; color: var(--ink); border-color: currentColor; }
button:disabled { opacity: 0.45; cursor: default; }
button:not(:disabled):active { transform: translateY(1px); }
:is(button, a, input, select):focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: var(--s2) 0; }
.row > * { flex: 1 1 auto; }

/* The machine: the black window where the simulation runs, step by step */
.machine {
  --ink: var(--paper-ink); --soft: var(--paper-soft);
  background: var(--paper); color: var(--paper-ink);
  border-radius: var(--radius); padding: 1rem 1rem 1.1rem; margin: var(--s3) 0;
  border: 1px solid var(--edge);
}
.machine button { background: var(--yellow); color: #000; border-color: var(--yellow); }
.machine button.quiet { background: transparent; color: var(--paper-ink); border-color: var(--paper-soft); }
.machine :is(button, a, input, select):focus-visible { outline-color: var(--yellow); }
.machine input[type="range"] { accent-color: var(--yellow); }
.steps { list-style: none; margin: 0 0 0.9rem; padding: 0; display: flex; gap: 0.25rem; counter-reset: step; }
.steps li {
  flex: 1 1 0; min-width: 0; counter-increment: step;
  font: 600 0.78rem/1.25 var(--body); color: var(--paper-soft);
  border-top: 3px solid var(--paper-line); padding-top: 0.45rem;
  transition: color 0.3s, border-color 0.3s;
}
.steps li::before { content: counter(step); display: block; font: 300 1.35rem/1 var(--display); margin-bottom: 0.2rem; }
.steps li.done { color: var(--paper-ink); border-color: var(--paper-soft); }
.steps li.now { color: var(--yellow); border-color: var(--yellow); }
.now-line { font: 400 1rem/1.5 var(--body); color: var(--paper-ink); margin: 0.8rem 0 0; min-height: 3em; }
.now-line b { color: var(--yellow); font-weight: 700; }
.big-num { font: 300 3.2rem/1 var(--display); color: var(--yellow); letter-spacing: -0.02em; }

/* The toy area */
.stage { position: relative; margin: 0; }
canvas.chart { display: block; width: 100%; height: 13rem; }

/* The printed object a toy hands you: fact sheet, profile, model card */
.gloss {
  background: var(--paper); color: var(--paper-ink);
  padding: 1.15rem 1.15rem 1.25rem; border-radius: var(--radius);
  border: 1px solid var(--edge); border-top: 3px solid var(--yellow);
}
.gloss .kicker { font: 600 0.85rem/1.3 var(--body); color: var(--paper-soft); margin: 0 0 0.3rem; }
.gloss h3 { font: 400 1.7rem/1.1 var(--display); margin: 0 0 0.6rem; color: var(--yellow); }
.gloss .figs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin: 0.9rem 0; border-top: 1px solid var(--paper-line); border-bottom: 1px solid var(--paper-line); padding: 0.75rem 0; }
.gloss .figs b { display: block; font: 300 1.7rem/1 var(--display); }
.gloss .figs span { display: block; font-size: 0.8rem; line-height: 1.3; color: var(--paper-soft); margin-top: 0.25rem; }
.gloss blockquote { margin: 0.6rem 0 0; font: italic 300 1.05rem/1.5 var(--display); color: var(--paper-soft); }

/* Colour key under a picture. Swatches take the chart colours. */
.key { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; font: 600 0.82rem var(--body); color: var(--soft); margin: 0.6rem 0 0; padding: 0; list-style: none; }
.key i { display: inline-block; width: 0.75rem; height: 0.75rem; margin-right: 0.35rem; vertical-align: -0.1rem; background: var(--c1); }
.key i.c2 { background: var(--c2); } .key i.c3 { background: var(--c3); } .key i.c4 { background: var(--c4); box-shadow: 0 0 0 1px var(--c3); } .key i.c5 { background: var(--c5); } .key i.hit { background: var(--hit); }

/* Plain-words verdict under the toy: red bar, because the verdict is always about luck */
.verdict { border-left: 3px solid var(--hit); padding: 0.2rem 0 0.2rem 1rem; margin: var(--s3) 0; font-size: 1.15rem; line-height: 1.5; }
.verdict b { font-weight: 800; }

/* Sliders and fields */
label { font-weight: 600; display: block; margin: var(--s2) 0 0.3rem; }
input[type="range"] { width: 100%; accent-color: var(--yellow); }
input[type="number"], select {
  font: 600 1rem var(--body); padding: 0.6rem; width: 100%;
  border: 2px solid var(--soft); border-radius: var(--radius); background: #000; color: var(--ink);
}
.machine :is(input[type="number"], select) { background: #000; color: var(--paper-ink); border-color: var(--paper-soft); }
output { font-weight: 800; }

/* Your decisions: a grid of choices, the round ledger, the truth labels, the lesson and the book */
.picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 0.5rem; margin: 0.8rem 0 0; }
.machine button.pick, button.pick {
  background: #0d0d0c; color: var(--paper-ink); border: 1px solid var(--edge);
  font: 400 0.92rem/1.35 var(--body); text-align: left; padding: 0.75rem 0.8rem; width: 100%;
}
.machine button.pick:not(:disabled):hover { border-color: var(--paper-soft); }
.machine button.pick.chosen { border-color: var(--yellow); box-shadow: inset 0 0 0 1px var(--yellow); opacity: 1; }
.machine button.pick:disabled:not(.chosen) { opacity: 0.7; }
.pick b { display: block; font: 300 1.6rem/1.05 var(--display); color: var(--yellow); margin: 0.1rem 0 0.25rem; }
.pick .t { display: block; font-weight: 700; color: var(--paper-ink); }
.pick small { display: block; color: var(--paper-soft); font-size: 0.8rem; line-height: 1.35; margin-top: 0.2rem; }
.pick.none b { color: var(--paper-ink); }
.pick i.sw { display: inline-block; width: 0.7rem; height: 0.7rem; margin-right: 0.4rem; vertical-align: -0.05rem; background: var(--c1); }
.pick i.c2 { background: var(--c2); } .pick i.c3 { background: var(--c3); } .pick i.c4 { background: var(--c4); box-shadow: 0 0 0 1px var(--c3); } .pick i.c5 { background: var(--c5); }
.pick small.tell { color: var(--paper-ink); font-weight: 600; }
.pick small.after { border-top: 1px solid var(--paper-line); padding-top: 0.35rem; margin-top: 0.4rem; color: var(--paper-ink); }
.turn-head { margin: 0 0 0.6rem; color: var(--paper-ink); }
.turn-head b { color: var(--yellow); }
canvas.chart.tall { height: 16rem; }
.reveal h3 { margin: var(--s3) 0 0.4rem; }
.reveal td small { color: var(--soft); }
.reveal td.chosen { font-weight: 700; box-shadow: inset 3px 0 0 var(--yellow); padding-left: 0.5rem; }
.ledger { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin: 0.8rem 0 0; }
.ledger th { text-align: left; font-weight: 600; color: var(--soft); padding: 0.35rem 0.4rem 0.35rem 0; border-bottom: 1px solid var(--edge); }
.ledger td { padding: 0.45rem 0.4rem 0.45rem 0; border-bottom: 1px solid var(--paper-line); vertical-align: top; }
.ledger .up { color: var(--yellow); } .ledger .down { color: var(--hit); }
.truth { display: inline-block; font: 700 0.78rem/1 var(--body); padding: 0.28rem 0.45rem; border-radius: 2px; white-space: nowrap; }
.truth.real { background: var(--yellow); color: #000; }
.truth.luck { background: var(--hit); color: #000; }
.score { display: flex; gap: 1.2rem; flex-wrap: wrap; margin: 0.6rem 0 0; }
.score div { min-width: 5.5rem; }
.score b { display: block; font: 300 2rem/1 var(--display); color: var(--yellow); }
.score b.down { color: var(--hit); }
.score span { font-size: 0.8rem; color: var(--paper-soft); }
.aha { border: 1px solid var(--edge); border-left: 3px solid var(--yellow); background: var(--paper); padding: 1.1rem 1.15rem; margin: var(--s3) 0; border-radius: var(--radius); }
.aha h3 { font: 400 1.55rem/1.15 var(--display); margin: 0 0 0.6rem; color: var(--yellow); }
.aha p:last-child { margin-bottom: 0; }
.book { border-top: 1px solid var(--edge); margin: var(--s5) 0 0; padding: var(--s3) 0 0; display: grid; grid-template-columns: 4.6rem 1fr; gap: 0 1.1rem; align-items: start; }
.book .cover { grid-row: span 3; aspect-ratio: 2 / 3; background: #000; border: 1px solid var(--edge); border-top: 3px solid var(--yellow); display: flex; align-items: flex-end; padding: 0.35rem; font: 400 0.68rem/1.05 var(--display); color: var(--paper-ink); }
.book .from { font-size: 0.85rem; color: var(--soft); margin: 0; }
.book .title { font: 300 1.75rem/1.08 var(--display); margin: 0.1rem 0 0.4rem; letter-spacing: -0.01em; }
.book p.hook { margin: 0; color: var(--soft); }

/* Explainer, sources, footer */
.ask { border-top: 3px solid var(--yellow); padding: 1rem 0 0.2rem; margin: var(--s4) 0; font-size: 1.1rem; }
.ask b { font-weight: 800; }
.sources { font-size: 0.88rem; color: var(--soft); padding-left: 1.2rem; }
.sources li { margin-bottom: 0.45rem; }
footer.site { padding-top: var(--s3); padding-bottom: var(--s5); border-top: 1px solid var(--line); margin-top: var(--s5); }

.hidden { display: none !important; }

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

/* Phones: the body is the scroll box (fixes the bouncing bar), text boxes 16px (no focus zoom) */
@media (max-width: 900px) {
  html, body { overscroll-behavior-y: none; }
  html { height: 100%; overflow: hidden; }
  body { position: relative; height: 100%; min-height: 0; overflow-x: hidden; overflow-y: auto; }
  table { display: block; overflow-x: auto; }
  :is(input, textarea, select) { font-size: 16px; }
  .machine { margin-left: -1.25rem; margin-right: -1.25rem; border-radius: 0; padding-left: 1.25rem; padding-right: 1.25rem; }
}
