/* Ballpark. A tape measure: yellow blade, graphite markings, one red tick.
   The game happens on the blade; the debrief happens on paper, where the data needs room. */

:root {
  --tape: #F2C230;
  --ink: #1D1C1A;
  --ink-2: #46433C;
  --muted: #625E55;
  --paper: #FBFAF7;
  --rule: #E3E0D7;
  --red: #C8372D;
  --low: #2B55C8;     /* saw the low number: validated pair, light surface */
  --high: #C8372D;    /* saw the high number */
  --ref: #8C877C;     /* Many Labs 1 reference marks */
  --stage: var(--tape);
  --stage-ink: var(--ink);
  --btn-bg: var(--ink);
  --btn-ink: var(--tape);
  --focus: var(--ink);
  --display: "Big Shoulders Display", "Arial Narrow", "Helvetica Neue", sans-serif;
  --sans: "Instrument Sans", system-ui, -apple-system, sans-serif;
  --mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #F3F0E8;
    --ink-2: #CBC6BA;
    --muted: #A29D92;
    --paper: #161513;
    --rule: #2E2C28;
    --red: #E2604F;
    --low: #6B8CE6;   /* validated pair, dark surface */
    --high: #E2604F;
    --ref: #7F7A70;
    --stage: #161513;
    --stage-ink: #F3F0E8;
    --btn-bg: var(--tape);
    --btn-ink: #161513;
    --focus: var(--tape);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
body:has(.stage:not([hidden])) { background: var(--stage); }
[hidden] { display: none !important; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }

.skip { position: absolute; left: -10000px; top: 0; }
.skip:focus { left: 16px; top: 12px; background: var(--paper); color: var(--ink); padding: 8px 12px; z-index: 10; }

/* ---------- the blade ---------- */
.stage {
  min-height: 100svh;
  background: var(--stage);
  color: var(--stage-ink);
  display: flex;
  align-items: center;
}
.stage__in {
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: 48px 20px calc(48px + env(safe-area-inset-bottom));
}

.wordmark {
  margin: 0;
  font: 900 clamp(4.75rem, 25vw, 10.5rem)/0.82 var(--display);
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--stage-ink);
}
@media (prefers-color-scheme: dark) { .stage .wordmark { color: var(--tape); } }
.wordmark--sm {
  display: inline-block;
  font-size: 1.75rem;
  line-height: 1;
  text-decoration: none;
  color: var(--ink);
}

/* Markings hang from the blade's edge: every 8px, longer every 40px, longest every 80px.
   No numerals: before the questions, a number on screen could act as one more anchor. */
.tape {
  --tick: currentColor;
  height: 40px;
  margin: 14px 0 34px;
  border-top: 3px solid var(--tick);
  background-image:
    repeating-linear-gradient(90deg, var(--tick) 0 2px, transparent 2px 80px),
    repeating-linear-gradient(90deg, var(--tick) 0 1.5px, transparent 1.5px 40px),
    repeating-linear-gradient(90deg, var(--tick) 0 1px, transparent 1px 8px);
  background-size: 100% 80%, 100% 52%, 100% 28%;
  background-repeat: no-repeat;
}
@media (prefers-color-scheme: dark) { .stage .tape { color: var(--tape); } }
.tape--thin { height: 18px; margin: 8px 0 0; border-top-width: 2px; color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .stage:not([hidden]) .tape { animation: pull 900ms cubic-bezier(.2, .8, .2, 1) both; }
  @keyframes pull { from { background-position-x: -160px; clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
}

.lede { margin: 0 0 8px; font: 700 clamp(1.5rem, 6vw, 2rem)/1.15 var(--sans); }
.sub { margin: 0 0 28px; max-width: 32rem; font-size: 1.125rem; }
.fine { margin: 28px 0 0; max-width: 32rem; font-size: 0.875rem; color: var(--stage-ink); opacity: 0.82; }
.eyebrow {
  margin: 0 0 14px;
  font: 700 0.8125rem/1.2 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.eyebrow:focus { outline: none; }
.brief { margin: 0 0 32px; font-size: 1.375rem; line-height: 1.45; max-width: 34rem; }

.btn {
  appearance: none;
  border: 0;
  min-height: 52px;
  padding: 0 28px;
  border-radius: 3px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  font: 700 1.0625rem/1 var(--sans);
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--line { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.debrief .btn { --btn-bg: var(--ink); --btn-ink: var(--paper); }

.error { margin: 16px 0 0; font-weight: 700; }

/* ---------- a question ---------- */
.progress { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 28px; }
.progress i { height: 10px; border-top: 3px solid currentColor; opacity: 0.25; }
.progress i.is-done { opacity: 1; }
.progress i.is-now { opacity: 1; border-top-color: var(--red); }
@media (prefers-color-scheme: dark) { .progress i.is-now { border-top-color: var(--tape); } }

.q__statement { margin: 0 0 6px; font-size: clamp(1.3rem, 5vw, 1.625rem); line-height: 1.3; font-weight: 500; }
.q__question { display: block; margin: 0 0 26px; font-size: clamp(1.3rem, 5vw, 1.625rem); line-height: 1.3; font-weight: 700; }
.q__field {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 6px;
  border-bottom: 3px solid currentColor;
}
.q__field::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 100%;
  height: 12px;
  background-image:
    repeating-linear-gradient(90deg, currentColor 0 1.5px, transparent 1.5px 40px),
    repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 8px);
  background-size: 100% 100%, 100% 50%;
  background-repeat: no-repeat;
  opacity: 0.55;
}
.q__input {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: 800 clamp(2.75rem, 13vw, 4rem)/1 var(--display);
  letter-spacing: 0.01em;
}
.q__input:focus { outline: none; }
.q__field:focus-within { border-bottom-color: var(--red); }
@media (prefers-color-scheme: dark) { .q__field:focus-within { border-bottom-color: var(--tape); } }
.q__unit { font-weight: 700; font-size: 1.125rem; }
.q__echo { min-height: 1.6em; margin: 22px 0 26px; font: 400 0.8125rem/1.5 var(--mono); }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- the debrief ---------- */
.debrief { background: var(--paper); color: var(--ink); padding-bottom: 72px; }
.debrief__head { padding: 18px 20px 0; max-width: 48rem; margin: 0 auto; }
.col { max-width: 44rem; margin: 0 auto; padding: 40px 20px 0; }
.display {
  margin: 0 0 22px;
  font: 900 clamp(2.6rem, 11vw, 4.5rem)/0.92 var(--display);
  letter-spacing: -0.005em;
}
.display:focus { outline: none; }
.h3 {
  margin: 56px 0 14px;
  padding-top: 14px;
  border-top: 2px solid var(--ink);
  font: 800 1.75rem/1.05 var(--display);
  letter-spacing: 0.01em;
}
.body { margin: 0 0 14px; max-width: 38rem; color: var(--ink-2); }
.body strong { color: var(--ink); }
.link { text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.mono { font-family: var(--mono); font-size: 0.875em; }

.mine { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.mine li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}
.mine__label { font-weight: 700; }
.mine__saw { grid-column: 1; color: var(--muted); font-size: 0.9375rem; }
.mine__you, .mine__truth { grid-column: 2; text-align: right; font-variant-numeric: tabular-nums; }
.mine__you { grid-row: 1; font-weight: 700; }
.mine__truth { grid-row: 2; color: var(--muted); font-size: 0.9375rem; }
.mine__note { grid-column: 1 / -1; color: var(--muted); font-size: 0.8125rem; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot--low { background: var(--low); }
.dot--high { background: var(--high); }

.status { margin: 0 0 14px; color: var(--ink-2); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 8px; font-size: 0.875rem; color: var(--ink-2); }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: 0; }
.key--low { background: var(--low); }
.key--high { background: var(--high); }
.key--truth { width: 2px; height: 14px; border-radius: 0; background: var(--ink); vertical-align: -2px; }

.pull { margin: 22px 0 8px; }
.pull__title { margin: 0 0 2px; font: 700 1.0625rem/1.3 var(--sans); }
.pull__cap { margin: 4px 0 0; font-size: 0.875rem; color: var(--muted); }
.pull svg, .effects svg { display: block; width: 100%; height: auto; overflow: visible; }
.axis-text { font: 400 10px var(--mono); fill: var(--muted); }
.axis-text--ink { fill: var(--ink); }
.chart-label { font: 700 12px var(--sans); fill: var(--ink-2); }

details.numbers { margin: 8px 0 0; font-size: 0.875rem; color: var(--ink-2); }
details.numbers summary { cursor: pointer; color: var(--muted); }
.numbers table { width: 100%; border-collapse: collapse; margin-top: 8px; font-variant-numeric: tabular-nums; }
.numbers th, .numbers td { text-align: right; padding: 5px 6px; border-bottom: 1px solid var(--rule); }
.numbers th:first-child, .numbers td:first-child { text-align: left; }

.share { margin-top: 48px; padding: 20px; border: 2px solid var(--ink); border-radius: 3px; }
.copied { margin-left: 12px; font-size: 0.875rem; color: var(--muted); }
.credit { margin: 40px 0 0; font-size: 0.875rem; color: var(--muted); }

.tip {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  max-width: 240px;
  padding: 7px 10px;
  border-radius: 3px;
  background: var(--ink);
  color: var(--paper);
  font: 500 0.8125rem/1.35 var(--sans);
}

/* ---------- method page ---------- */
.doc { background: var(--paper); }
.doc__head { padding: 18px 20px 0; max-width: 48rem; margin: 0 auto; }
.doc__body { max-width: 44rem; margin: 0 auto; padding: 32px 20px 72px; color: var(--ink-2); }
.doc__body h1 { margin: 0 0 18px; font: 900 clamp(2.4rem, 9vw, 3.5rem)/0.95 var(--display); color: var(--ink); }
.doc__body h2 { margin: 40px 0 10px; padding-top: 12px; border-top: 2px solid var(--ink); font: 800 1.5rem/1.1 var(--display); color: var(--ink); }
.doc__body strong { color: var(--ink); }
.doc__body li { margin: 4px 0; }
.doc__sha { margin-top: 40px; font-size: 0.8125rem; color: var(--muted); word-break: break-all; }
.doc__sha code { font-family: var(--mono); }

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