/* One scheme for every toy: grey reading paper, 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: #dcdcd8; --ink: #000000; --soft: #4d4d4a; --line: rgba(128, 128, 124, 0.55);
  --paper: #000000; --paper-ink: #ecebe6; --paper-soft: #9b9b96; --paper-line: #2e2e2c;
  --btn: #000000; --btn-ink: #f2c230; --hit: #d0301f;
  --yellow: #f2c230; --red: #d0301f;
  --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;
}

* { 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: black with yellow words on the page, yellow with black words 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(--hit); 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;
}
.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(--paper-line); 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.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(--ink); }
input[type="number"], select {
  font: 600 1rem var(--body); padding: 0.6rem; width: 100%;
  border: 2px solid currentColor; border-radius: var(--radius); background: var(--bg); color: #000;
}
.machine :is(input[type="number"], select) { background: #000; color: var(--paper-ink); border-color: var(--paper-soft); }
output { font-weight: 800; }

/* Explainer, sources, footer */
.ask { border-top: 3px solid var(--ink); 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; }
}
