/* Hallmark · route: custom (tuned) · macrostructure: Stat-Led · vibe:
 * "cryptographic instrument, late-night, magenta signal"
 * display: Instrument Serif · mono: JetBrains Mono · accent: magenta ~340°
 * nav: N9 edge-aligned · footer: Ft4 dense colophon · enrichment: Tier B SVG
 *
 * Every colour and every face comes through a token in tokens.css. There are no
 * inline values here on purpose: once a page starts improvising one hex at a
 * time, the restraint that made the system work is gone by the third edit — and
 * with two colour registers, an improvised value is a value that is wrong in
 * one of them.
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink-2);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 400;
  color: var(--color-ink);
  letter-spacing: -0.012em;
  line-height: 1.06;
  margin: 0;
  overflow-wrap: anywhere;
  min-width: 0;
}

p,
dd,
figure {
  margin: 0;
}

a {
  color: var(--color-ink);
  text-decoration-color: var(--color-rule-2);
  text-underline-offset: 0.25em;
  transition: text-decoration-color var(--dur-fast) var(--ease-out);
}

a:hover {
  text-decoration-color: var(--color-accent);
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.tnum {
  font-variant-numeric: tabular-nums;
}

/* The machine-readout voice: mono, small caps-height, wide. Used for labels
 * that name a quantity, never as a decorative section marker. */
.lead-stat dt,
.panel-title,
.panel-state,
.colophon-key,
.readout dt,
.triple dt,
.live {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.section-head {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-lg);
}

.hint {
  font-size: var(--text-sm);
  color: var(--color-muted);
}

/* ── Nav · N9 edge-aligned, carrying the pool's live state ───────────
 *
 * The middle slot is a readout, not a link list. A nav that tells you the
 * search is running is doing a job; one that lists Features · Pricing · Docs is
 * wearing a costume.
 */

.masthead {
  display: flex;
  align-items: baseline;
  gap: var(--space-md) var(--space-xl);
  flex-wrap: wrap;
  padding: var(--space-lg) clamp(1rem, 5vw, 4rem) var(--space-md);
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-xl);
  letter-spacing: -0.01em;
  color: var(--color-ink);
  text-decoration: none;
}

.live {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-right: auto;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-rule-2);
  flex: none;
}

.live[data-state="live"] .live-dot {
  background: var(--color-accent);
}

.masthead-links {
  display: flex;
  gap: var(--space-lg);
  font-size: var(--text-sm);
}

.masthead-links a {
  text-decoration: none;
  color: var(--color-ink-2);
  padding-block: var(--space-2xs);
  border-bottom: var(--rule-hair) solid transparent;
  transition: border-color var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}

.masthead-links a:hover {
  border-bottom-color: var(--color-accent);
}

main {
  padding-inline: clamp(1rem, 5vw, 4rem);
}

/* ── Hero · H4 Stat-Led, figure left, the real instrument right ───── */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
  padding-block: var(--space-2xl) var(--space-3xl);
  border-top: var(--rule-hair) solid var(--color-rule);
}

.lead-stat {
  margin: 0;
}

.figure {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-figure);
  line-height: 0.86;
  letter-spacing: -0.02em;
  color: var(--color-ink);
  margin: var(--space-xs) 0 var(--space-md);
}

.hero h1 {
  font-size: clamp(1.75rem, 2.7vw + 1rem, 2.875rem);
  max-width: 20ch;
}

.qualifier {
  margin-top: var(--space-md);
  max-width: 46ch;
  color: var(--color-ink-2);
}

/* The page's one dark beat is the working instrument, not a drawing of one. */
.panel {
  background: var(--color-panel);
  border: var(--rule-hair) solid var(--color-panel-rule);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: 0 1px 2px var(--color-shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  border-bottom: var(--rule-hair) solid var(--color-panel-rule);
}

.panel-title {
  color: var(--color-on-panel-2);
}

.panel-state {
  color: var(--color-signal);
  text-align: right;
  overflow-wrap: anywhere;
}

.panel-body {
  padding: var(--space-lg);
}

.panel label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-on-panel);
  margin-bottom: var(--space-xs);
}

.panel label:not(:first-child) {
  margin-top: var(--space-lg);
}

.panel input[type="text"] {
  width: 100%;
  padding: 0.65rem 0.8rem;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-on-panel);
  background: var(--color-panel-sunk);
  border: var(--rule-hair) solid var(--color-panel-rule);
  border-radius: var(--radius-control);
  transition: border-color var(--dur-fast) var(--ease-out);
}

.panel input[type="text"]::placeholder {
  color: var(--color-on-panel-3);
}

.panel input[type="text"]:hover {
  border-color: var(--color-panel-rule-lit);
}

.panel input[type="text"]:disabled {
  color: var(--color-on-panel-2);
  cursor: not-allowed;
}

.panel .hint {
  color: var(--color-on-panel-2);
  margin-top: var(--space-xs);
}

#run {
  width: 100%;
  min-height: 2.75rem;
  margin-top: var(--space-xl);
  padding: 0.7rem 1.5rem;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-accent-ink);
  background: var(--color-signal);
  border: var(--rule-hair) solid var(--color-signal);
  border-radius: var(--radius-control);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out);
}

#run:hover:not(:disabled) {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

#run:active:not(:disabled) {
  background: var(--color-accent-press);
  border-color: var(--color-accent-press);
}

#run:disabled {
  color: var(--color-on-panel-2);
  background: transparent;
  border-color: var(--color-panel-rule);
  cursor: not-allowed;
}

#run[data-state="running"] {
  color: var(--color-on-panel);
  background: transparent;
  border-color: var(--color-panel-rule-lit);
}

.readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--space-md);
  margin: var(--space-lg) 0 0;
  padding-top: var(--space-lg);
  border-top: var(--rule-hair) solid var(--color-panel-rule);
}

/* The shared label colour is tuned for paper. Inside the instrument — which is
 * dark in both registers — it has to come from the panel's own scale, or the
 * light register drops a mid-grey onto near-black. */
.readout dt {
  color: var(--color-on-panel-2);
}

.readout dd {
  margin-top: var(--space-2xs);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-on-panel);
}

/* ── The live triple ─────────────────────────────────────────────── */

.standing {
  padding-block: var(--space-2xl) var(--space-3xl);
  border-top: var(--rule-hair) solid var(--color-rule);
}

.triple {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
  gap: var(--space-xl);
  margin: 0;
}

.triple dd {
  margin: var(--space-xs) 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 3.6vw + 0.5rem, 3.25rem);
  letter-spacing: -0.012em;
  color: var(--color-ink);
  line-height: 1;
}

.triple p {
  font-size: var(--text-sm);
  color: var(--color-muted);
  max-width: 34ch;
}

/* ── The method, and the drawing of it ───────────────────────────── */

/* The drawing gets the full width. Squeezed into a column its labels fall
 * below reading size, and an unreadable diagram is decoration. */
.method {
  padding-block: var(--space-3xl) var(--space-4xl);
  border-top: var(--rule-hair) solid var(--color-rule);
}

.method-text {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: var(--space-md) clamp(2rem, 5vw, 4rem);
  align-items: start;
  margin-bottom: var(--space-3xl);
}

.method h2 {
  font-size: clamp(1.875rem, 3vw + 0.9rem, 2.875rem);
  max-width: 16ch;
  grid-row: span 2;
}

.method p {
  max-width: 54ch;
}

.method p + p {
  margin-top: var(--space-md);
}

.method em {
  font-style: italic;
  color: var(--color-ink);
}

.walk svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

/* A drawing squeezed below its labels' reading size is decoration. Under a
 * phone's width it keeps its proportions and scrolls inside its own box —
 * the page itself never scrolls sideways. */
@media (width < 46rem) {
  .walk {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding-block: var(--space-xs);
  }

  .walk svg {
    min-width: 34rem;
  }

  .walk figcaption {
    position: sticky;
    left: 0;
  }
}

.walk .axis,
.walk .tick {
  stroke: var(--color-rule-2);
  stroke-width: 1;
}

.walk .trail {
  fill: none;
  stroke-width: 1.25;
  stroke-linecap: round;
}

.walk .trail--tame {
  stroke: var(--color-ink-2);
}

/* The wild herd is the one carrying the unknown, so it gets the signal. */
.walk .trail--wild {
  stroke: var(--color-accent);
}

.walk .landing circle {
  fill: var(--color-paper);
  stroke: var(--color-rule-2);
  stroke-width: 1;
}

.walk .meet {
  fill: var(--color-accent);
}

.walk .meet-stem {
  stroke: var(--color-rule-2);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

.walk .bound,
.walk .herd,
.walk .meet-label {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  fill: var(--color-muted);
}

.walk .meet-label {
  fill: var(--color-ink);
  text-anchor: middle;
}

.walk .bound--end,
.walk .herd--end {
  text-anchor: end;
}

.walk figcaption {
  margin-top: var(--space-lg);
  margin-inline: auto;
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-muted);
  max-width: 52ch;
}

/* ── Terms · a definition list, not a grid of cards ──────────────── */

.terms {
  padding-block: var(--space-2xl);
  border-top: var(--rule-hair) solid var(--color-rule);
}

.terms-list {
  margin: 0;
  border-top: var(--rule-hair) solid var(--color-rule);
}

.terms-list > div {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: var(--space-md) clamp(1.5rem, 4vw, 3.5rem);
  padding-block: var(--space-lg);
  border-bottom: var(--rule-hair) solid var(--color-rule);
}

.terms-list dt {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-xl);
  letter-spacing: -0.008em;
  color: var(--color-ink);
  line-height: 1.25;
}

.terms-list dd {
  font-size: var(--text-sm);
  max-width: 60ch;
}

/* ── Leaderboard ─────────────────────────────────────────────────── */

.board {
  padding-block: var(--space-3xl) var(--space-2xl);
  border-top: var(--rule-hair) solid var(--color-rule);
}

.board-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.board-head .section-head {
  margin-bottom: 0;
}

.board table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.board th {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
  text-align: left;
  padding: 0 var(--space-md) var(--space-xs) 0;
  border-bottom: var(--rule-hair) solid var(--color-rule-2);
}

.board td {
  padding: var(--space-sm) var(--space-md) var(--space-sm) 0;
  border-bottom: var(--rule-hair) solid var(--color-rule);
  vertical-align: top;
}

.board th:last-child,
.board td:last-child,
.board th:nth-child(3),
.board td:nth-child(3) {
  text-align: right;
}

.board th:last-child,
.board td:last-child {
  padding-right: 0;
}

.board .rank,
.board .points,
.board .share {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--color-ink);
}

.board .who {
  overflow-wrap: anywhere;
}

.board .alias {
  display: block;
  color: var(--color-ink);
}

.board .address {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-muted);
}

/* The empty row spans every column, so it is both the first and the last —
 * it must not inherit the last column's right alignment. */
.board tbody .board-empty td {
  color: var(--color-muted);
  padding-block: var(--space-lg);
  text-align: left;
}

/* ── Verify · the one full-bleed dark band ───────────────────────── */

.verify {
  margin-inline: calc(clamp(1rem, 5vw, 4rem) * -1);
  padding: var(--space-4xl) clamp(1rem, 5vw, 4rem);
  background: var(--color-band);
  color: var(--color-on-band-2);
  border-block: var(--rule-hair) solid var(--color-band-rule);
}

.verify-inner {
  max-width: 62rem;
}

.verify h2 {
  max-width: 18ch;
  font-size: clamp(2rem, 4.2vw + 0.7rem, 3.5rem);
  color: var(--color-on-band);
}

.verify-lede {
  max-width: 52ch;
  margin-top: var(--space-md);
}

.commands {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr));
  gap: var(--space-lg) var(--space-xl);
  margin: var(--space-2xl) 0 0;
  padding-top: var(--space-xl);
  border-top: var(--rule-hair) solid var(--color-band-rule);
}

.commands dt code {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-signal);
  overflow-wrap: anywhere;
}

.commands dd {
  margin-top: var(--space-xs);
  font-size: var(--text-sm);
  max-width: 38ch;
}

.verify-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
  margin-top: var(--space-2xl);
  font-size: var(--text-sm);
}

.verify-links a {
  color: var(--color-on-band-2);
  text-decoration-color: var(--color-band-rule);
  white-space: nowrap;
}

.verify-links a:hover {
  color: var(--color-on-band);
  text-decoration-color: var(--color-signal);
}

.link-strong {
  color: var(--color-on-band);
  font-weight: 500;
}

/* ── Footer · Ft4 dense colophon ─────────────────────────────────── */

.colophon {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md) var(--space-2xl);
  padding: var(--space-lg) clamp(1rem, 5vw, 4rem) var(--space-2xl);
  border-top: var(--rule-hair) solid var(--color-rule);
  font-size: var(--text-xs);
}

.colophon div {
  display: flex;
  gap: var(--space-xs);
  align-items: baseline;
}

.colophon-value {
  font-family: var(--font-mono);
  color: var(--color-ink-2);
  overflow-wrap: anywhere;
}

.colophon-value a {
  color: var(--color-ink-2);
  white-space: nowrap;
}

/* ── Motion ──────────────────────────────────────────────────────────
 *
 * Hover and focus only. This genre composes rather than reveals, and a section
 * that must be scrolled into view to become visible is a section that is
 * missing when the page is printed, captured whole, or read by anything that
 * does not scroll.
 */

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

/* ── Narrow ──────────────────────────────────────────────────────── */

@media (width < 60rem) {
  .hero,
  .method-text {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero {
    padding-block: var(--space-xl) var(--space-2xl);
  }

  .panel {
    order: -1;
  }

  .method {
    padding-block: var(--space-2xl) var(--space-3xl);
  }

  .terms-list > div {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-xs);
  }
}

/* Every affordance clears 44px wherever a thumb is plausible, which takes in
 * the tablet width and not only the phone breakpoint below it. */
@media (width <= 48rem) {
  .masthead-links a,
  .verify-links a,
  .colophon-value a,
  .wordmark {
    display: inline-flex;
    align-items: center;
    min-block-size: 44px;
    min-inline-size: 44px;
    justify-content: center;
  }

  /* The padding that buys the width comes out of the gap, so the row reads the
   * same as it does on a desktop. */
  .masthead-links {
    gap: var(--space-xs);
  }

  .masthead-links a {
    padding-inline: var(--space-xs);
  }

  .panel input[type="text"] {
    padding-block: 0.8rem;
  }
}

@media (width < 40rem) {
  .masthead {
    padding-block: var(--space-xs) var(--space-sm);
    row-gap: var(--space-xs);
  }

  .live {
    order: 3;
    width: 100%;
    margin-right: 0;
  }

  .board th:first-child,
  .board td:first-child {
    display: none;
  }

  .colophon {
    gap: var(--space-xs) var(--space-lg);
  }
}

.faq {
  padding-block: var(--space-2xl) var(--space-3xl);
  border-top: var(--rule-hair) solid var(--color-rule);
}

.faq details {
  border-bottom: var(--rule-hair) solid var(--color-rule);
}

.faq summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  padding-block: var(--space-md);
  cursor: pointer;
  font-size: 1.0625rem;
  color: var(--color-ink);
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  font-family: var(--font-mono);
  font-size: 1.125rem;
  line-height: 1;
  color: var(--color-ink-2);
  transition: transform 120ms ease;
}

.faq details[open] summary::after {
  content: "\2212";
}

.faq summary:hover {
  color: var(--color-accent);
}

.faq summary:focus-visible {
  outline: var(--rule-hair) solid var(--color-accent);
  outline-offset: 4px;
}

.faq details p {
  max-width: 66ch;
  margin: 0 0 var(--space-md);
  color: var(--color-ink-2);
}

.faq details p:first-of-type {
  margin-top: calc(-1 * var(--space-2xs));
}

@media (prefers-reduced-motion: reduce) {
  .faq summary::after {
    transition: none;
  }
}
