/* ---------- tokens ---------- */
:root {
  --paper: #f1f2ee;
  --surface: #e3e5df;
  --ink: #000000;
  --muted: #5e615b;
  --signal: #1f2fd8;
  --signal-ink: #ffffff;
  --rule: 2px solid var(--ink);
  --measure: 62ch;
  --gutter: clamp(1rem, 4vw, 3rem);
  --font: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 140ms;
  --t-state: 220ms;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.5;
  font-variation-settings: "wdth" 100;
}
h1, h2, h3, h4, p, ul, ol { margin: 0; }
ul, ol { padding: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--ink); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--signal); }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }
[hidden] { display: none !important; }
::selection { background: var(--signal); color: var(--signal-ink); }
html { scroll-padding-top: 1rem; scroll-padding-bottom: 6rem; }

/* ---------- layout ---------- */
.wrap { padding-left: var(--gutter); padding-right: var(--gutter); max-width: 76rem; margin: 0 auto; }
.measure { max-width: var(--measure); }

/* ---------- masthead ---------- */
.masthead { border-bottom: var(--rule); padding-top: 1.25rem; padding-bottom: 1.25rem; display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.masthead .wordmark { font-weight: 800; font-size: 1.125rem; letter-spacing: -0.01em; }
.masthead nav { display: flex; gap: 1.5rem; font-weight: 600; }
.masthead nav a { text-decoration: none; }
.masthead nav a:hover { text-decoration: underline; }

.hero { padding-top: clamp(2.5rem, 8vw, 6rem); padding-bottom: clamp(2.5rem, 6vw, 4rem); border-bottom: var(--rule); }
.hero h1 {
  font-size: clamp(2.75rem, 9vw, 7.5rem);
  line-height: 0.92;
  font-weight: 800;
  letter-spacing: -0.035em;
  font-variation-settings: "wdth" 88;
  max-width: 14ch;
  text-wrap: balance;
}
.hero p { margin-top: 1.5rem; font-size: clamp(1.125rem, 2.2vw, 1.5rem); line-height: 1.35; max-width: 34ch; }
.hero .cta { margin-top: 2rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  border: var(--rule);
  background: var(--ink);
  color: var(--paper);
  padding: 0.85rem 1.4rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease, color var(--t-fast) ease, opacity var(--t-state) ease, transform 80ms ease;
}
.btn:hover { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.btn:active { transform: translate(2px, 2px); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.btn[disabled]:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- baseline band ---------- */
.baseline { background: var(--ink); color: var(--paper); padding-top: clamp(2.5rem, 6vw, 5rem); padding-bottom: clamp(2.5rem, 6vw, 5rem); }
.baseline h2 { font-size: clamp(1.75rem, 4vw, 3rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1; max-width: 22ch; }
.baseline .lede { margin-top: 1rem; max-width: var(--measure); color: #c9cbc4; }
.rules { margin-top: 2.5rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); border-top: 2px solid var(--paper); }
.rules li { list-style: none; border-bottom: 2px solid var(--paper); padding: 1.25rem 1.25rem 1.5rem 0; }
@media (min-width: 48rem) {
  .rules li { border-right: 2px solid var(--paper); padding-left: 1.25rem; }
  .rules li:first-child { padding-left: 0; }
  .rules li:last-child { border-right: 0; }
}
.rules h3 { font-size: 1.375rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; }
.rules p { margin-top: 0.6rem; color: #c9cbc4; font-size: 0.975rem; }
.baseline a { color: var(--paper); }
.baseline a:hover { color: #9aa3ff; }
.guides-cta { margin-top: 2.5rem; display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2rem; }
.guides-cta p { font-weight: 600; color: #c9cbc4; max-width: 44ch; }

.btn.invert { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.btn.invert:hover { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }

/* ---------- guides page ---------- */
.masthead .wordmark a { text-decoration: none; }
.masthead nav a[aria-current="page"] { color: var(--signal); }
.page-head h1 { font-size: clamp(2.5rem, 7vw, 5.5rem); font-variation-settings: "wdth" 88; max-width: 16ch; }
.guide-list { padding-top: clamp(2rem, 5vw, 3.5rem); padding-bottom: clamp(3rem, 8vw, 6rem); }
.guide-list > h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 800; letter-spacing: -0.02em; border-bottom: 6px solid var(--ink); padding-bottom: 0.5rem; }
.guide-list ul { display: grid; grid-template-columns: 1fr; }
@media (min-width: 56rem) {
  .guide-list ul { grid-template-columns: 1fr 1fr; }
  .guide-list li:nth-child(odd) { border-right: var(--rule); padding-right: 2rem; }
  .guide-list li:nth-child(even) { padding-left: 2rem; }
}
.guide-list li { list-style: none; border-bottom: var(--rule); padding: 1.5rem 0; display: flex; flex-direction: column; }
.guide-list .by { font-weight: 600; color: var(--muted); font-size: 0.95rem; }
.guide-list h3 { margin-top: 0.25rem; font-size: 1.5rem; font-weight: 800; letter-spacing: -0.015em; line-height: 1.15; }
.guide-list h3 a { text-decoration: none; }
.guide-list h3 a:hover { text-decoration: underline; }
.guide-list li > p:last-child { margin-top: 0.75rem; max-width: 52ch; }
.next-step { border-top: var(--rule); padding-top: 2rem; padding-bottom: 2rem; display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2rem; }
.next-step p { font-weight: 600; max-width: 44ch; }

/* ---------- assessment ---------- */
.assess { padding-top: clamp(2.5rem, 6vw, 5rem); padding-bottom: clamp(3rem, 8vw, 6rem); }
.assess-head { display: grid; gap: 1rem; grid-template-columns: 1fr; border-bottom: var(--rule); padding-bottom: 1.5rem; }
@media (min-width: 56rem) { .assess-head { grid-template-columns: 1fr 1fr; align-items: end; } }
.assess-head h2 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; letter-spacing: -0.03em; line-height: 0.95; }
.assess-head p { max-width: 44ch; }

.rail { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); margin-top: 0; border-bottom: var(--rule); }
/* progress bar along the rail's bottom border, width set by --progress */
.rail::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -3px; height: 4px;
  background: var(--signal);
  transform: scaleX(var(--progress, 0));
  transform-origin: left center;
  transition: transform 600ms var(--ease-out);
}
.rail li { list-style: none; padding: 0.9rem 0.75rem 0.9rem 0; border-right: var(--rule); font-weight: 600; color: var(--muted); display: flex; gap: 0.6rem; align-items: baseline; transition: color var(--t-state) ease; }
.rail .n { transition: color var(--t-state) ease; }
.rail li:last-child { border-right: 0; }
.rail li:not(:first-child) { padding-left: 0.75rem; }
.rail .n { font-weight: 800; font-size: 1.5rem; line-height: 1; letter-spacing: -0.03em; }
.rail li.current { color: var(--ink); }
.rail li.current .n { color: var(--signal); }
.rail li.done { color: var(--ink); }
.rail li.done .n::after { content: " ✓"; font-size: 0.9rem; }
@media (max-width: 40rem) { .rail .label { display: none; } .rail li.current .label { display: inline; } }

.panel { margin-top: 2.5rem; display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 56rem) { .panel { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
.q-count { font-weight: 600; color: var(--muted); }
.q-text:focus, #rtitle:focus { outline: none; }
.q-text { margin-top: 0.5rem; font-size: clamp(1.5rem, 3.2vw, 2.25rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; max-width: 22ch; }
.q-help { margin-top: 0.9rem; color: var(--muted); max-width: 50ch; }

/* ---------- markdown-rendered content ---------- */
.md > *:first-child { margin-top: 0; }
.md p, .md ul, .md ol { margin-top: 0.6em; }
.md ul, .md ol { padding-left: 1.25em; }
.md li + li { margin-top: 0.3em; }
.md code { background: var(--surface); padding: 0.05em 0.35em; font-size: 0.92em; }
.md strong { font-weight: 800; }
.q-hint { margin-top: 0.6rem; font-weight: 600; font-size: 0.95rem; }

.options { margin-top: 1.5rem; display: grid; gap: 0; border-top: var(--rule); }
.opt {
  display: grid; grid-template-columns: 1.6rem 1fr; gap: 0.9rem; align-items: start;
  width: 100%; text-align: left; background: transparent;
  border: 0; border-bottom: var(--rule);
  padding: 1rem 0.5rem 1rem 0.5rem;
  /* only the background is transitioned, so text color changes instantly
     and never shows a low-contrast intermediate color */
  transition: background-color var(--t-fast) ease;
}
.opt:hover { background: var(--surface); }
.opt:focus-visible { outline-offset: -3px; }
.opt .box { position: relative; width: 1.4rem; height: 1.4rem; border: var(--rule); margin-top: 0.15rem; background: var(--paper); transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease, transform var(--t-fast) var(--ease-out); }
.opt:active .box { transform: scale(0.88); }
.opt[data-multi="true"] .box { border-radius: 0; }
.opt[data-multi="false"] .box { border-radius: 50%; }
.opt[aria-checked="true"] .box::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -62%) rotate(45deg);
  width: 0.4rem; height: 0.75rem;
  border-right: 3px solid var(--signal);
  border-bottom: 3px solid var(--signal);
  animation: tick-in var(--t-state) var(--ease-out);
}
.opt[data-multi="false"][aria-checked="true"] .box::after {
  width: 0.6rem; height: 0.6rem;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 50%;
  background: var(--signal);
  animation: dot-in var(--t-state) var(--ease-out);
}
@keyframes tick-in {
  from { opacity: 0; transform: translate(-50%, -62%) rotate(45deg) scale(0.3); }
}
@keyframes dot-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
}
.opt .t { font-weight: 600; font-size: 1.125rem; line-height: 1.3; }
.opt .d { display: block; font-weight: 400; color: var(--muted); font-size: 0.95rem; margin-top: 0.2rem; }
.opt[aria-checked="true"] { background: var(--signal); color: var(--signal-ink); transition: none; }
.opt[aria-checked="true"] .box { background: var(--signal-ink); border-color: var(--signal-ink); transition: transform var(--t-fast) var(--ease-out); }
.opt[aria-checked="true"] .d { color: #d8dbff; }

.controls { margin-top: 1.5rem; display: flex; gap: 0.75rem; flex-wrap: wrap; }
.controls-sticky {
  position: sticky; bottom: 0; z-index: 2;
  margin-top: 0.5rem;
  padding: 1rem 0 max(1rem, env(safe-area-inset-bottom));
  background: var(--paper);
  border-top: 2px solid transparent;
  transition: border-color var(--t-state) ease;
}
.controls-sticky.is-stuck { border-top-color: var(--ink); }
/* clip the step's slide-in animation at the column edge; the clip margin
   keeps focus outlines visible */
.panel > div:first-child { overflow: clip; overflow-clip-margin: 6px; }
.controls-sentinel { height: 1px; }
.controls-sentinel + .sofar { margin-top: 0.5rem; }

.aside { border-top: var(--rule); border-left: 6px solid var(--signal); padding: 1.25rem 0 1.25rem 1.25rem; align-self: start; }
.aside h3 { font-weight: 800; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--signal); }
.aside .why-text { margin-top: 1rem; color: var(--ink); font-size: clamp(1.25rem, 2.4vw, 1.625rem); font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; max-width: 32ch; }
.aside .why-text > :first-child { margin-top: 0; }
.aside .why-text > * { margin-top: 0.75rem; }

.sofar { margin-top: 1.5rem; border-top: 2px solid var(--surface); padding-top: 1rem; }
.sofar summary { cursor: pointer; font-weight: 600; color: var(--muted); font-size: 0.95rem; }
.sofar summary:hover { color: var(--ink); }
.sofar dl { margin: 1rem 0 0; }
.sofar dt { font-weight: 600; margin-top: 0.75rem; font-size: 0.9rem; color: var(--muted); }
.sofar dd { margin: 0.1rem 0 0; font-weight: 600; }

/* ---------- results ---------- */
#rview { margin-top: 2.5rem; }
.results-head { border-bottom: var(--rule); padding-bottom: 1.5rem; }
.results-head h2 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; letter-spacing: -0.03em; line-height: 0.95; }
.disclaimer { margin-top: 1.25rem; border: var(--rule); padding: 1rem 1.25rem; max-width: var(--measure); font-weight: 600; }
.disclaimer span { color: var(--signal); }
.summary { margin-top: 1.5rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0 2rem; }
.summary dt { font-size: 0.9rem; color: var(--muted); font-weight: 600; margin-top: 0.75rem; }
.summary dd { margin: 0.1rem 0 0; font-weight: 600; }

.layer { margin-top: 3rem; }
.layer > h3 { font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 800; letter-spacing: -0.02em; border-bottom: 6px solid var(--ink); padding-bottom: 0.5rem; }
.layer > h3 .n { color: var(--signal); margin-right: 0.5rem; }
.cards { display: grid; grid-template-columns: 1fr; }
@media (min-width: 56rem) { .cards { grid-template-columns: 1fr 1fr; } }
.card { border-bottom: var(--rule); padding: 1.5rem 0; }
@media (min-width: 56rem) {
  .card:nth-child(odd) { border-right: var(--rule); padding-right: 2rem; }
  .card:nth-child(even) { padding-left: 2rem; }
}
.card h4 { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; }
.card .why { margin-top: 0.75rem; max-width: 60ch; }
.card .do { margin-top: 1rem; }
.card .do h5 { margin: 0; font-size: 0.95rem; font-weight: 600; color: var(--muted); }
.card .do ul { margin-top: 0.4rem; padding-left: 1.2rem; }
.card .do li { margin-top: 0.25rem; }
.empty { padding: 1.5rem 0; color: var(--muted); border-bottom: var(--rule); }

/* ---------- images ---------- */
.q-image { display: block; max-width: 100%; height: auto; margin-top: 1rem; border: var(--rule); }
.opt .q-image { margin-top: 0.6rem; max-width: 100%; }
.card .q-image { margin-top: 0.75rem; max-width: 100%; }

/* ---------- actions section ---------- */
.layer.actions > h3 { color: var(--signal); }
.layer.actions .card h4 a { text-decoration-thickness: 2px; }

/* ---------- load error ---------- */
.loaderror { margin-top: 2.5rem; border: var(--rule); padding: 1.25rem 1.5rem; max-width: var(--measure); }
.loaderror p { margin-top: 0.6rem; }
.loaderror p:first-child { margin-top: 0; }
.loaderror code { background: var(--surface); padding: 0.1rem 0.35rem; }

/* ---------- footer ---------- */
footer { border-top: var(--rule); padding-top: 2rem; padding-bottom: 3rem; color: var(--muted); font-size: 0.95rem; display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; }

/* ---------- motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn:active, .opt:active .box { transform: none; }
  .opt[aria-checked="true"] .box::after { animation: none !important; }
  .rail::after { transition: none; }
}
@media print {
  .masthead, .hero, .baseline, .controls, .controls-sentinel, footer, .rail, .aside, .sofar { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .card { break-inside: avoid; }
  .cards { grid-template-columns: 1fr; }
  .card:nth-child(odd) { border-right: 0; padding-right: 0; }
  .card:nth-child(even) { padding-left: 0; }
}
