/* Exam paper: graph-paper page, navy ink, red pen reserved for grading. */
@font-face { font-family: "Public Sans"; font-weight: 400; font-display: swap; src: url("/fonts/public-sans-400.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 600; font-display: swap; src: url("/fonts/public-sans-600.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 800; font-display: swap; src: url("/fonts/public-sans-800.woff2") format("woff2"); }

:root {
  --paper: #f7f9fc;
  --grid: #e3ebf3;
  --ink: #1b2a4a;
  --ink-2: #55657f;
  --rule: #c9d5e3;
  --red: #d7263d;
  --green: #15803d;
  --tile: #e9eff6;
  --white: #ffffff;
  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* the whole type scale: every font-size below uses one of these */
  --fs-sm: 0.9375rem;
  --fs-body: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-h2: 1.5rem;
  --fs-h1: 2.25rem;
  --fs-display: clamp(2.75rem, 11vw, 4.5rem);
  --lift: 0 1px 2px rgba(27, 42, 74, 0.08), 0 8px 24px -10px rgba(27, 42, 74, 0.22);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --gutter-l: max(16px, env(safe-area-inset-left));
  --gutter-r: max(16px, env(safe-area-inset-right));
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
/* Controls behave like app controls: no double-tap-zoom delay, no text selection on long-press. */
button, .btn, .opt, .textbtn, .menu-btn, .site-menu a, .article-list a {
  touch-action: manipulation; -webkit-user-select: none; user-select: none;
}
body {
  margin: 0;
  font: 400 var(--fs-body)/1.5 var(--sans);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
a { color: var(--ink); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
main { flex: 1; width: 100%; max-width: 600px; margin: 0 auto; padding: 8px var(--gutter-r) 32px var(--gutter-l); }
main.wide { max-width: 1100px; }

h1, h2, h3 { font-weight: 800; line-height: 1.15; margin: 0 0 12px; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-h1); }
h1.display { font-size: var(--fs-display); line-height: 1.02; letter-spacing: -0.035em; margin: 20px 0 14px; max-width: 11em; text-wrap: balance; }
h2 { font-size: var(--fs-h2); margin-top: 40px; }
h3 { font-size: var(--fs-lg); }
p { margin: 0 0 12px; max-width: 34em; }
.muted { color: var(--ink-2); }
.small { font-size: var(--fs-sm); }
.center { text-align: center; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px max(6px, env(safe-area-inset-right)) 4px var(--gutter-l); max-width: 600px; margin: 0 auto; width: 100%; }
.menu-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: var(--ink); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.menu-btn:active { background: var(--tile); }
.menu-btn { transition: background-color 150ms ease; }
.menu-btn path { transition: transform 200ms var(--ease-in-out), opacity 150ms ease; transform-origin: 12px 12px; }
.menu-open .menu-btn .l1 { transform: translateY(5px) rotate(45deg); }
.menu-open .menu-btn .l2 { opacity: 0; }
.menu-open .menu-btn .l3 { transform: translateY(-5px) rotate(-45deg); }
.site-menu { max-width: 600px; margin: 0 auto; width: 100%; padding: 0 var(--gutter-r) 0 var(--gutter-l); opacity: 0; transform: scale(0.97); transform-origin: top right; transition: opacity 120ms ease-out, transform 120ms ease-out; }
.site-menu.open { opacity: 1; transform: none; transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out); }
.site-menu ul { list-style: none; margin: 4px 0 8px; padding: 6px; background: var(--white); border-radius: 12px; box-shadow: var(--lift); } /* taste-skill-ignore: the menu floats over the page */
.site-menu a { display: block; padding: 12px 12px; border-radius: 8px; font-weight: 700; text-decoration: none; }
.site-menu a:active { background: var(--tile); }
.site-menu .menu-cta { margin: 4px 4px 8px; }
.site-menu .menu-cta a.btn { display: flex; padding: 14px 20px; color: var(--white); border-radius: 10px; font-size: var(--fs-lg); }
.logo { font-weight: 800; font-size: var(--fs-lg); text-decoration: none; letter-spacing: -0.02em; }

/* buttons */
.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 56px; padding: 14px 20px;
  font: 800 var(--fs-body)/1.2 var(--sans); text-decoration: none; text-align: center;
  color: var(--white); background: var(--ink); border: 2px solid var(--ink); border-radius: 6px;
  cursor: pointer;
}
.btn { transition: transform 160ms var(--ease-out); }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.6; cursor: wait; }
.btn.ghost { color: var(--ink); background: var(--white); }
.btn.inline { display: inline-flex; width: auto; min-height: 44px; padding: 8px 16px; font-size: var(--fs-body); }
.price-line { font-size: var(--fs-sm); color: var(--ink-2); margin-top: 10px; }
.price-line strong { color: var(--ink); }

/* a sheet of paper sitting on the grid */
.sheet { background: var(--white); border-radius: 3px; padding: 18px; margin: 0 0 18px; }

/* landing */
.lede { font-size: var(--fs-lg); color: var(--ink-2); }
.instructions { padding-left: 1.2em; margin: 0 0 12px; }
.instructions li { margin-bottom: 6px; }
.practice-q { font-weight: 800; font-size: var(--fs-lg); margin-bottom: 4px; }
.practice-seq { font-size: var(--fs-h2); font-weight: 800; letter-spacing: 0.02em; margin-bottom: 14px; font-variant-numeric: tabular-nums; }
.pen { font-weight: 800; font-size: var(--fs-body); line-height: 1.4; min-height: 1.4em; margin: 12px 0 0; }
.pen.good { color: var(--green); }
.pen.bad { color: var(--red); }

/* answer bubbles */
.options { display: grid; gap: 10px; grid-template-columns: 1fr; }
.options.two { grid-template-columns: 1fr 1fr; }
.options.pics { grid-template-columns: repeat(3, 1fr); }
.options.pics.four { grid-template-columns: repeat(2, 1fr); }
.opt {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px;
  font: 600 var(--fs-lg)/1.25 var(--sans); color: var(--ink); text-align: left;
  background: var(--white); border: 1.5px solid var(--rule); border-radius: 6px;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 150ms ease, border-color 150ms ease;
}
.opt:active { transform: scale(0.97); }
.options.pics .opt { flex-direction: column; gap: 6px; padding: 6px 6px 10px; }
.options.pics .opt svg { width: 100%; height: auto; display: block; }
.bubble {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid var(--ink); font-size: var(--fs-sm); font-weight: 800; color: var(--ink); background: var(--white);
  transition: background 0.12s ease, color 0.12s ease;
}
.opt.selected { border-color: var(--ink); }
.opt.selected .bubble { background: var(--ink); color: var(--white); }
.opt.right { border-color: var(--green); background: #f0fdf4; }
.opt.right .bubble { background: var(--green); border-color: var(--green); color: var(--white); }
.opt.wrong { border-color: var(--red); background: #fef2f2; }
.opt.wrong .bubble { background: var(--red); border-color: var(--red); color: var(--white); }

/* test runner */
body.focus { background-image: none; }
body.focus .topbar, body.focus footer { display: none; }
.test-head { position: sticky; top: 0; z-index: 2; padding: 14px 0 6px; background: var(--paper); }
.test-meta { display: flex; justify-content: space-between; align-items: baseline; font-weight: 800; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.test-meta span:last-child { color: var(--ink-2); font-weight: 600; }
.timer.low { color: var(--red); }
.answer-sheet { display: grid; grid-template-columns: repeat(25, 1fr); gap: 3px; }
.answer-sheet button { position: relative; height: 18px; padding: 0; border: 0; background: none; cursor: pointer; }
.answer-sheet button::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 5px; border-radius: 3px; background: var(--rule); }
.answer-sheet button.done::before { background: var(--ink); }
.answer-sheet button.here::before { background: var(--red); }
.q-figure { display: flex; justify-content: center; padding: 18px 0 4px; }
.q-figure svg { width: 100%; max-width: 360px; height: auto; display: block; }
.q-figure.small svg { max-width: 170px; }
.q-stage { text-align: center; font-size: var(--fs-h1); font-weight: 800; letter-spacing: 0.02em; padding: 44px 8px 6px; font-variant-numeric: tabular-nums; }
.q-stage.words { font-size: var(--fs-h2); line-height: 1.3; letter-spacing: 0; padding: 44px 8px 22px; }
.q-prompt { text-align: center; font-size: var(--fs-body); font-weight: 600; color: var(--ink-2); margin: 10px auto 18px; }
.options.tiles .opt { justify-content: center; text-align: center; background: var(--tile); border: 2px solid transparent; border-radius: 12px; min-height: 64px; font-size: var(--fs-lg); font-weight: 700; }
.options.tiles .opt.selected { background: var(--white); border-color: var(--ink); }
.options.tiles.pics .opt { padding: 8px; }
.options.tiles .opt.right { background: #f0fdf4; border-color: var(--green); color: var(--green); }
.options.tiles .opt.wrong { background: #fef2f2; border-color: var(--red); color: var(--red); }
.next-btn { margin-top: 20px; }
.next-btn[disabled] { opacity: 0.3; cursor: default; transform: none; }
.test-nav { display: flex; justify-content: space-between; margin-top: 6px; }
.textbtn { font: 600 var(--fs-body) var(--sans); color: var(--ink-2); background: none; border: 0; padding: 12px 4px; cursor: pointer; }
.textbtn[disabled] { visibility: hidden; }
.jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }

/* page heroes, stats, feature tiles */
.hero { text-align: center; padding: 28px 0 8px; }
.hero h1 { font-size: var(--fs-h1); }
.hero .lede { margin: 0 auto 16px; }
.hero .grade { margin-left: auto; margin-right: auto; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 20px; text-align: center; }
.stats div { background: var(--tile); border-radius: 12px; padding: 14px 6px; }
.stats b { display: block; font-size: var(--fs-h2); font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats span { font-size: var(--fs-sm); color: var(--ink-2); }
.features { list-style: none; padding: 0; margin: 10px 0 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.features li { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; background: var(--tile); border-radius: 12px; padding: 18px 10px; font-weight: 700; line-height: 1.25; }
.features svg { color: var(--ink); }
.curve { margin-left: auto; margin-right: auto; }

/* info pages */
.article-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 10px; }
.article-list a { display: block; padding: 14px 16px; background: var(--tile); border-radius: 12px; text-decoration: none; transition: transform 160ms var(--ease-out); }
.article-list a:active { transform: scale(0.98); }
.article-list strong { display: block; font-size: var(--fs-body); }
.article-list span { display: block; color: var(--ink-2); font-size: var(--fs-sm); margin-top: 2px; }
table.data { margin: 4px 0 16px; font-size: var(--fs-body); border-radius: 12px; overflow: hidden; }
table.data th { background: var(--tile); }
table.data th, table.data td { border-bottom: 0; padding: 10px 12px; }
table.data tbody tr:nth-child(even) td { background: var(--paper); }
table.data td:not(:first-child), table.data th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.flag { font-size: var(--fs-lg); line-height: 1; }
.sources { font-size: var(--fs-sm); color: var(--ink-2); padding-left: 1.1em; }
.sources li { margin-bottom: 6px; }
.cta { text-align: center; margin: 32px 0 8px; }
.cta h2 { margin-top: 0; border: 0; padding: 0; }

/* home: podium and famous minds */
.big-flag { font-size: var(--fs-h1); line-height: 1; }
.podium { list-style: none; padding: 0; margin: 8px 0 12px; display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 8px; text-align: center; }
.podium li { display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--tile); border-radius: 12px; padding: 14px 6px 12px; }
.podium .place-1 { order: 2; padding-top: 22px; padding-bottom: 20px; background: var(--ink); color: var(--white); }
.podium .place-1 .medal { color: var(--white); opacity: 0.75; }
.podium .place-2 { order: 1; }
.podium .place-3 { order: 3; }
.podium .place-1 .big-flag { transform: scale(1.3); margin: 6px 0; }
.podium .medal { font-size: var(--fs-sm); font-weight: 800; color: var(--ink-2); }
.podium strong { font-size: var(--fs-sm); line-height: 1.2; }
.board { margin: 40px calc(-1 * var(--gutter-r)) 0 calc(-1 * var(--gutter-l)); padding: 28px 8px 20px; background: var(--ink); color: var(--white); }
.board h2 { margin: 0 8px 16px; color: var(--white); }
.board .rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.board .row { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 8px; border: 0; border-radius: 0; background: #24365c; color: var(--white); font: 800 var(--fs-lg)/1.15 var(--sans); text-align: left; cursor: pointer; transition: background-color 200ms ease; }
.board .row img { display: block; width: 48px; height: 48px; object-fit: cover; object-position: top; transition: width 200ms var(--ease-out), height 200ms var(--ease-out); }
.board .row .flag { font-size: var(--fs-body); }
.board .row .more { display: none; margin-top: 8px; font: 400 var(--fs-body)/1.4 var(--sans); }
.board .row .iq { align-self: center; padding: 4px 10px; min-width: 72px; text-align: center; background: var(--paper); color: var(--ink); font-variant-numeric: tabular-nums; }
.board .row.open { align-items: start; background: var(--red); }
.board .row.open img { width: 96px; height: 120px; }
.board .row.open { grid-template-columns: 96px 1fr auto; }
.board .row.open .more { display: block; }
.board .row.open .iq { align-self: start; }
.board .fine { margin: 16px 8px 0; font-size: var(--fs-sm); color: var(--rule); }
@media (min-width: 640px) { .board { margin-left: 0; margin-right: 0; border-radius: 12px; padding: 28px 12px 20px; } }

/* motion: question changes, practice feedback, score reveal */
@keyframes q-from-right { from { opacity: 0; transform: translateX(14px); } }
@keyframes q-from-left { from { opacity: 0; transform: translateX(-14px); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(4px); } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.94); } }
@keyframes draw-loop { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.question.enter-next { animation: q-from-right 180ms var(--ease-out); }
.question.enter-back { animation: q-from-left 180ms var(--ease-out); }
.pen.show { animation: fade-up 200ms var(--ease-out); }
.grade.reveal .num { animation: pop-in 320ms var(--ease-out) both; }
.grade.reveal polyline { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw-loop 520ms var(--ease-in-out) 160ms forwards; }

/* grading */
.grade { position: relative; display: inline-block; margin: 4px 0 8px; font-size: clamp(5rem, 26vw, 7.5rem); line-height: 1; }
.grade svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.grade .num { display: block; font-family: var(--sans); font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--red); padding: 0.28em 0.45em 0.2em; }
.curve { display: block; width: 100%; max-width: 420px; height: auto; margin: 4px 0 12px; }
.report { margin: 0; padding: 0; list-style: none; }
.report li { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; font-weight: 600; }
.report .dots { flex: 1; border-bottom: 2px dotted var(--rule); transform: translateY(-4px); }
.report .val { font-variant-numeric: tabular-nums; }
.share-img { display: block; width: 100%; max-width: 240px; height: auto; margin: 0 0 14px; border-radius: 3px; }
.stack { display: grid; gap: 10px; }
.note { font-size: var(--fs-sm); color: var(--ink-2); background: var(--tile); border-radius: 12px; padding: 12px 14px; margin: 28px 0 12px; }
input[type="text"], input[type="search"] {
  width: 100%; font: 400 var(--fs-body) var(--sans); color: var(--ink);
  padding: 14px; border: 1.5px solid var(--ink); border-radius: 6px; background: var(--white);
}
.spinner { width: 32px; height: 32px; border: 3px solid var(--rule); border-top-color: var(--ink); border-radius: 50%; animation: spin 0.9s linear infinite; margin: 6px 0 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* legal + admin */
.prose { padding-top: 12px; }
.prose h1 { font-size: var(--fs-h1); margin-bottom: 4px; }
.prose h2 { font-size: var(--fs-lg); margin-top: 40px; }
.prose li { margin-bottom: 6px; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); background: var(--white); }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 800; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--fs-sm); word-break: break-all; }
.table-wrap { overflow-x: auto; }
.pill { display: inline-block; padding: 1px 8px; border: 1.5px solid var(--ink-2); border-radius: 99px; font-size: var(--fs-sm); font-weight: 600; }
.pill.paid { border-color: var(--ink); background: var(--ink); color: var(--white); }
.pill.test { border-style: dashed; }
.pill.refunded { border-color: var(--red); color: var(--red); }
@media (max-width: 700px) {
  table.events thead { display: none; }
  table.events tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--rule); }
  table.events td { display: block; border: 0; padding: 2px 4px; }
  table.events td[data-label]::before { content: attr(data-label) ": "; font-weight: 800; color: var(--ink-2); font-family: var(--sans); }
}

/* full-width tinted band instead of a rule line */
footer { width: 100%; margin-top: 24px; padding: 24px var(--gutter-r) max(32px, env(safe-area-inset-bottom)) var(--gutter-l); background: var(--tile); font-size: var(--fs-sm); color: var(--ink-2); }
footer > * { max-width: 568px; margin-left: auto; margin-right: auto; }
footer p { margin: 0 auto 6px; }
footer nav { display: flex; gap: 16px; flex-wrap: wrap; margin: 10px auto; }
footer a { color: var(--ink-2); }

@keyframes fade-only { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .question.enter-next, .question.enter-back, .pen.show, .grade.reveal .num { animation: fade-only 150ms ease; }
  .grade.reveal polyline { animation: none; stroke-dashoffset: 0; }
  .btn:active, .opt:active, .article-list a:active { transform: none; }
  .board .row img { transition: none; }
  .site-menu, .site-menu.open { transform: none; }
  .menu-btn path { transition: opacity 150ms ease; }
}
