/* ergo site — the layer above artoo-kit.

   Design DNA held across the five routes: kit type roles and spacing rhythm,
   one accent, a monospace "record voice" for anything that is literal file
   content, and the recurring block -> prose -> code triad that a data page is
   made of. Sibling to the flip site, deliberately not a copy of it: ergo's
   accent is rust rather than blue, and its signature component is the issue
   registry rather than the claim ledger. */

/* -- accent ---------------------------------------------------------------- */
/* The kit ships a blue accent. ergo takes rust: the format is about the
   caveats in a dataset, and the effect scale below reserves red and amber for
   real severity, so the brand colour has to sit beside them without competing.
   Both values clear 4.5:1 on their own background. */

:root {
  --accent: #9c4a16;
  --accent-strong: #83400f;
}

[data-theme="dark"] {
  --accent: #e09a63;
  --accent-strong: #eab182;
}

/* -- shell ---------------------------------------------------------------- */

.site-nav .brand {
  font-family: var(--font-numeric);
  letter-spacing: -0.02em;
}

.site-nav .nav-links {
  display: flex;
  gap: var(--sp-1);
  align-items: center;
}

.site-nav .spacer {
  margin-left: auto;
}

/* The kit hides .nav-toggle above the mobile breakpoint, which would hide the
   theme control with it. Dark is a real reading mode for a page this
   monospace-heavy, so the toggle stays available at every width. */
.site-nav [data-theme-toggle] { display: block; }

.site-foot {
  border-top: 1px solid var(--border);
  margin-top: var(--sp-24);
  padding: var(--sp-8) var(--sp-6) var(--sp-16);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--muted);
}

.site-foot__inner {
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-6);
  justify-content: space-between;
}

.site-foot a { color: var(--text-2); }

/* -- the record voice ------------------------------------------------------ */
/* Anything that is literal file content or literal command output wears this.
   The chip names the path so a reader always knows what they are looking at. */

.record {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  margin: var(--sp-6) 0;
}

.record__chip {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-family: var(--font-numeric);
  font-size: var(--text-xs);
  color: var(--muted);
}

.record__chip strong { color: var(--text-2); font-weight: 600; }

.record pre {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: var(--text-xs);
  max-height: 30rem;
  overflow: auto;
  /* Wrap rather than clip: a truncated error message is exactly the evidence a
     reader came to check. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.record__caption {
  padding: var(--sp-2) var(--sp-3);
  border-top: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  color: var(--muted);
}

.record--refused { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }

.record--refused .record__chip {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
}

/* A command line. Not a fake terminal — a labelled instruction you can copy. */

.cmd {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  font-family: var(--font-numeric);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3);
  margin: 0 0 var(--sp-2);
  overflow-x: auto;
}

.cmd::before {
  content: "$";
  color: var(--muted);
  flex: none;
  user-select: none;
}

.cmd code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  white-space: pre;
}

.copy {
  margin-left: auto;
  flex: none;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.45rem;
  cursor: pointer;
}

.copy:hover { color: var(--text); border-color: var(--border-strong); }
.copy[data-copied="yes"] { color: var(--success); border-color: var(--success); }

/* -- the effect scale ------------------------------------------------------ */
/* The one place colour carries meaning rather than decoration. Four values,
   fixed vocabulary, used identically on every route so a reader learns it
   once: breaks announces itself, corrupts and misleads are the dangerous
   ones, context is not a defect at all. */

.eff {
  font-family: var(--font-numeric);
  font-size: var(--text-xs);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.05rem 0.4rem;
  color: var(--text-2);
  white-space: nowrap;
}

.eff[data-effect="breaks"] { color: var(--danger); border-color: var(--danger); }
.eff[data-effect="corrupts"] { color: var(--warn); border-color: var(--warn); }
.eff[data-effect="misleads"] { color: var(--accent); border-color: var(--accent); }
.eff[data-effect="context"] { color: var(--muted); }

.eff--core {
  color: var(--bg);
  background: var(--text);
  border-color: var(--text);
  font-weight: 600;
}

.eff--status { color: var(--muted); }
.eff--status[data-status="mitigated"] { color: var(--success); border-color: var(--success); }
.eff--status[data-status="open"] { color: var(--warn); border-color: var(--warn); }

/* -- home: the hero -------------------------------------------------------- */

.hero {
  max-width: 72rem;
  margin: 0 auto;
  padding: var(--sp-16) var(--sp-6) var(--sp-12);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: var(--sp-12);
  align-items: start;
}

.hero__kicker {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}

.hero h1 {
  font-size: var(--text-4xl);
  letter-spacing: -0.025em;
  margin-bottom: var(--sp-6);
  text-wrap: balance;
}

.hero h1 em { font-style: normal; color: var(--accent); }

.hero__dek { font-size: var(--text-lg); color: var(--text-2); max-width: 34rem; }

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-8);
  font-family: var(--font-ui);
}

.btn {
  display: inline-block;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  color: var(--accent);
}

.btn:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); border-bottom-color: var(--accent); }
.btn--solid { background: var(--accent); color: var(--bg); }
.btn--solid:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn--quiet { border-color: var(--border-strong); color: var(--text-2); }
.btn--quiet:hover { border-color: var(--text-2); border-bottom-color: var(--text-2); }

/* -- home: the enforcement strip ------------------------------------------ */

.rules {
  display: grid;
  gap: var(--sp-8) var(--sp-6);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: var(--sp-8) 0;
}

.rule { border-top: 2px solid var(--accent); padding-top: var(--sp-3); }

.rule h3 {
  margin: 0 0 var(--sp-2);
  font-size: var(--text-lg);
  font-family: var(--font-display);
}

.rule p { font-size: var(--text-sm); color: var(--text-2); line-height: var(--leading-normal); }
.rule .record { margin-bottom: 0; }

/* -- comparison and tables ------------------------------------------------- */

.table-wrap { overflow-x: auto; margin: var(--sp-6) 0; }
.table-wrap table { margin: 0; }

.compare-wrap { overflow-x: auto; margin: var(--sp-6) 0; }
.compare { min-width: 48rem; font-size: var(--text-xs); }
.compare th, .compare td { vertical-align: top; }
.compare tbody th {
  font-size: var(--text-xs);
  color: var(--text-2);
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font-ui);
  white-space: nowrap;
  padding-right: var(--sp-4);
}
.compare td { font-family: var(--font-ui); line-height: var(--leading-normal); }
.compare col.is-ergo { background: color-mix(in srgb, var(--accent) 7%, transparent); }

/* -- stats ----------------------------------------------------------------- */

.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-6) var(--sp-4);
  margin: var(--sp-6) 0;
  font-family: var(--font-ui);
}

.fact { border-left: 2px solid var(--border-strong); padding-left: var(--sp-3); }
.fact dt { font-size: var(--text-xs); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.fact dd {
  margin: var(--sp-1) 0 0;
  font-family: var(--font-numeric);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-xl);
  color: var(--text);
}
.fact dd small { font-size: var(--text-xs); color: var(--muted); display: block; font-family: var(--font-ui); }

/* -- the walkthrough: one scrolling conversation --------------------------- */
/* The page models a person <> agent chat. Human turns sit right, agent turns
   left; the command the agent ran shows by default inside its bubble, and the
   full under-the-hood record lives in a closed <details> beneath it. */

.wk {
  max-width: 78rem;
  margin: 0 auto;
  padding: var(--sp-8) var(--sp-6) var(--sp-16);
}

.wk__lede { margin-bottom: var(--sp-6); }

.wk__chat { max-width: 52rem; margin: var(--sp-8) 0 var(--sp-16); }

.wk__act-kicker {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-12) 0 var(--sp-6);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

.wk__act-kicker::before,
.wk__act-kicker::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

.wk__chat .wk__act-kicker:first-child { margin-top: 0; }

.wk__exchange {
  display: flex;
  flex-direction: column;
  margin: 0 0 var(--sp-8);
  scroll-margin-top: 4.5rem;
}

/* the human's turn: right-aligned, accent-tinted */
.wk__say { align-self: flex-end; max-width: min(44rem, 92%); margin: 0 0 var(--sp-3); }

.wk__say .bubble {
  display: inline-block;
  font-size: 0.98rem;
  line-height: 1.45;
  border: 1px solid var(--border);
  border-radius: 12px 12px 3px 12px;
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  padding: 0.55rem 0.85rem;
}

.wk__say .bubble b,
.wk__agent > .bubble > b {
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.15rem;
  opacity: 0.65;
  font-family: var(--font-ui);
}

/* the agent's turn: left-aligned, surface-coloured */
.wk__agent { align-self: flex-start; width: 100%; max-width: min(46rem, 100%); }

.wk__agent > .bubble {
  display: block;
  font-size: 0.98rem;
  line-height: 1.45;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px 12px 12px 3px;
  padding: 0.55rem 0.85rem 0.65rem;
}

.wk__ran {
  margin-top: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.wk__ran-line {
  display: block;
  font-family: var(--font-numeric);
  font-size: var(--text-xs);
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0;
  white-space: nowrap;
  overflow-x: auto;
}

.wk__exit {
  font-family: var(--font-numeric);
  font-size: var(--text-xs);
  font-weight: 650;
  color: var(--danger);
}

.wk__details {
  margin-top: var(--sp-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 55%, var(--bg));
}

.wk__details > summary {
  cursor: pointer;
  padding: var(--sp-2) var(--sp-3);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--muted);
}

.wk__details > summary:hover { color: var(--text); }
.wk__details[open] > summary { border-bottom: 1px solid var(--border); color: var(--text-2); }

.wk__details-body { padding: var(--sp-3) var(--sp-4) var(--sp-4); }
.wk__details-body .wk__narrative { font-size: var(--text-sm); margin-bottom: var(--sp-4); color: var(--text-2); }
.wk__details-body .pane-label { margin-top: var(--sp-4); }
.wk__details-body .pane-label:first-of-type { margin-top: 0; }
.wk__details-body .record { margin: var(--sp-2) 0; }
.wk__details-body .tree { max-height: 22rem; }
.wk__spec-row { margin: var(--sp-3) 0 0; }

.wk__unprompted {
  align-self: center;
  text-align: center;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--muted);
  margin: 0 0 var(--sp-3);
}

/* the file tree */

.tree {
  font-family: var(--font-numeric);
  font-size: var(--text-xs);
  line-height: 1.75;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--sp-3);
  max-height: 32rem;
  overflow: auto;
  margin: 0;
}

.tree li { list-style: none; white-space: nowrap; }
.tree ul { margin: 0; padding-left: var(--sp-4); }
.tree > ul { padding-left: 0; }
.tree .dir { color: var(--muted); }
.tree .file { color: var(--text-2); }
.tree .is-added { color: var(--success); font-weight: 600; }
.tree .is-changed { color: var(--accent); font-weight: 600; }
.tree .mark { display: inline-block; width: 1.1em; color: inherit; }

.pane-label {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 var(--sp-2);
}

.demo-note {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: var(--sp-2) var(--sp-3);
  margin-bottom: var(--sp-6);
}

/* -- the format map -------------------------------------------------------- */

.map-grid {
  display: grid;
  grid-template-columns: minmax(0, 19rem) minmax(0, 1fr);
  gap: var(--sp-8);
  align-items: start;
  margin: var(--sp-8) 0;
}

.anatomy {
  font-family: var(--font-numeric);
  font-size: var(--text-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--sp-3);
  position: sticky;
  top: 4rem;
}

.anatomy ul { list-style: none; margin: 0; padding: 0; }
.anatomy li { margin: 0; }

.anatomy button {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--text-2);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0.25rem var(--sp-2);
  cursor: pointer;
}

.anatomy button:hover { background: var(--surface-2); color: var(--text); }
.anatomy button[aria-current="true"] { background: var(--accent); color: var(--bg); font-weight: 600; }
.anatomy .comment { color: var(--muted); font-size: var(--text-xs); }
.anatomy button[aria-current="true"] .comment { color: inherit; }
.anatomy .plain { padding: 0.25rem var(--sp-2); color: var(--muted); font-size: var(--text-xs); }

.block-detail__head { display: flex; align-items: baseline; gap: var(--sp-3); flex-wrap: wrap; }
.block-detail h3 { margin-top: 0; }

.keylist {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  padding: 0;
  margin: var(--sp-2) 0 var(--sp-4);
  list-style: none;
}

.keylist li {
  font-family: var(--font-numeric);
  font-size: var(--text-xs);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.4rem;
  background: var(--surface-2);
  color: var(--text-2);
}

.keylist li.is-required { border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* the vocabularies */

.vocab {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
  margin: var(--sp-4) 0;
  background: var(--surface);
}

.vocab__head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-2);
}

.vocab__field { font-family: var(--font-numeric); font-weight: 650; color: var(--text); }
.vocab__q { font-family: var(--font-ui); font-size: var(--text-sm); color: var(--text-2); }

.vocab__values { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }

.vocab__values li {
  font-family: var(--font-numeric);
  font-size: var(--text-xs);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.45rem;
  color: var(--text-2);
}

/* the lifecycle rail */

.rail {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--sp-2);
  margin: var(--sp-6) 0;
}

.rail__stage { border-top: 2px solid var(--border-strong); padding-top: var(--sp-3); }
.rail__stage[data-gate="yes"] { border-top-color: var(--accent); }

.rail__name { font-family: var(--font-numeric); font-size: var(--text-sm); color: var(--text); font-weight: 650; }

.rail__act {
  font-family: var(--font-numeric);
  font-size: var(--text-xs);
  color: var(--accent);
  display: block;
  margin: var(--sp-1) 0 var(--sp-2);
  word-break: break-word;
}

.rail__stage p {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  color: var(--text-2);
  margin: 0 0 var(--sp-2);
}

.rail__worth { color: var(--muted); }

/* the CLI surface */

.cli-table { font-size: var(--text-xs); width: 100%; }
.cli-table td { vertical-align: top; }
.cli-table td:first-child { font-family: var(--font-numeric); white-space: nowrap; color: var(--accent); font-weight: 600; }
.cli-table td:nth-child(2) { font-family: var(--font-ui); color: var(--text-2); }
.cli-table .usage { font-family: var(--font-numeric); color: var(--muted); font-size: 0.7rem; display: block; margin-top: var(--sp-1); }

/* conformance */

.conformance { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-6); margin: var(--sp-6) 0; }
.conformance h3 { font-size: var(--text-base); margin: 0 0 var(--sp-2); }
.conformance ul { margin: 0; padding-left: 1.1em; }
.conformance li { font-size: var(--text-sm); color: var(--text-2); line-height: var(--leading-normal); }
.conformance__core { border-left: 2px solid var(--accent); padding-left: var(--sp-4); }
.conformance__supp { border-left: 2px solid var(--border-strong); padding-left: var(--sp-4); }

/* -- the example page viewer ----------------------------------------------- */

.pg { max-width: 72rem; margin: 0 auto; padding: var(--sp-8) var(--sp-6) var(--sp-16); }

.pg__manifest {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: var(--sp-4);
  margin: var(--sp-6) 0;
  font-family: var(--font-ui);
}

.pg__pitfall {
  border-left: 3px solid var(--warn);
  background: color-mix(in srgb, var(--warn) 7%, transparent);
  padding: var(--sp-3) var(--sp-4);
  margin: var(--sp-6) 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.pg__pitfall p { margin: 0; font-size: var(--text-base); color: var(--text); }
.pg__pitfall .pane-label { color: var(--warn); }

.pg__filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
  margin: var(--sp-4) 0;
  font-family: var(--font-ui);
}

.pg__filter {
  font-family: var(--font-numeric);
  font-size: var(--text-xs);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  padding: 0.15rem 0.7rem;
  cursor: pointer;
}

.pg__filter:hover { border-color: var(--accent); color: var(--accent); }
.pg__filter[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
.pg__filter-count { font-variant-numeric: tabular-nums; opacity: 0.7; }

.entry {
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--sp-4);
  margin: var(--sp-4) 0;
  scroll-margin-top: 4.5rem;
}

.entry[data-effect="breaks"] { border-left-color: var(--danger); }
.entry[data-effect="corrupts"] { border-left-color: var(--warn); }
.entry[data-effect="misleads"] { border-left-color: var(--accent); }
.entry[data-effect="context"] { border-left-color: var(--muted); }
.entry[data-kind="practice"] { border-left-style: dashed; border-left-color: var(--accent); }
.entry[hidden] { display: none; }

.entry__head { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: baseline; margin-bottom: var(--sp-2); }
.entry__id { font-family: var(--font-numeric); font-size: var(--text-xs); color: var(--accent); font-weight: 650; }
.entry__title { font-size: var(--text-base); font-family: var(--font-display); margin: 0; flex: 1 1 20rem; }
.entry__chips { display: flex; flex-wrap: wrap; gap: var(--sp-1); align-items: center; }

.entry__field { margin: var(--sp-2) 0 0; font-size: var(--text-sm); line-height: var(--leading-normal); }
.entry__field > .k {
  font-family: var(--font-numeric);
  font-size: var(--text-xs);
  color: var(--muted);
  display: inline-block;
  min-width: 5.5rem;
}
.entry__field--misuse { color: var(--text); }
.entry__field--misuse > .k { color: var(--danger); }
.entry__field--instead > .k { color: var(--success); }

.entry__scope {
  font-family: var(--font-numeric);
  font-size: var(--text-xs);
  color: var(--text-2);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: var(--sp-2) var(--sp-3);
  margin-top: var(--sp-3);
}

.entry__prose { margin-top: var(--sp-3); font-size: var(--text-sm); color: var(--text-2); border-top: 1px solid var(--border); padding-top: var(--sp-3); }
.entry__prose p { margin: 0 0 var(--sp-2); line-height: var(--leading-normal); }
.entry__prose p:last-child { margin-bottom: 0; }
.entry__rule { margin: var(--sp-1) 0 0; padding-left: 1.3em; }
.entry__rule li { font-size: var(--text-sm); color: var(--text); }

.pg__empty { color: var(--muted); font-style: italic; margin: var(--sp-6) 0; }

/* -- start ----------------------------------------------------------------- */

.steps { counter-reset: step; list-style: none; padding: 0; margin: var(--sp-8) 0; }

.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: var(--sp-12);
  padding-bottom: var(--sp-8);
  border-left: 1px solid var(--border);
  margin-left: 1rem;
}

.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: -1rem;
  top: -0.15rem;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-family: var(--font-numeric);
  font-size: var(--text-xs);
  color: var(--text-2);
}

.steps h3 { margin-top: 0; font-size: var(--text-lg); }
.steps p { font-size: var(--text-sm); color: var(--text-2); }

/* -- shared bits ----------------------------------------------------------- */

.limits { border-left: 2px solid var(--warn); padding-left: var(--sp-4); }
.limits h3 { margin-top: var(--sp-6); font-size: var(--text-base); }
.limits p { font-size: var(--text-sm); color: var(--text-2); }

.section-kicker {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin-bottom: var(--sp-2);
}

/* A kicker labels the heading directly under it; the kit's default h2 top
   margin would otherwise leave them looking unrelated. */
.section-kicker + h1,
.section-kicker + h2,
.section-kicker + h3 { margin-top: 0; }

.spec-link { font-family: var(--font-ui); font-size: var(--text-xs); color: var(--muted); white-space: nowrap; }
.spec-link:hover { color: var(--accent); }

.lede { font-size: var(--text-xl); line-height: var(--leading-normal); color: var(--text-2); max-width: 44rem; }

.prose { max-width: var(--measure); }
.prose p, .prose li { font-size: var(--text-base); }

:where(a, button, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* -- responsive recomposition ---------------------------------------------- */

@media (max-width: 1000px) {
  .rules { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero { grid-template-columns: minmax(0, 1fr); gap: var(--sp-8); padding-top: var(--sp-12); }
  .hero h1 { font-size: var(--text-3xl); }
  .map-grid { grid-template-columns: minmax(0, 1fr); }
  .anatomy { position: static; }
  .rail { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .conformance { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .site-nav { padding: var(--sp-2) var(--sp-4); flex-wrap: wrap; }
  .site-nav .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-bottom: var(--sp-2);
  }
  .site-nav .nav-links.open { display: flex; }
  .site-nav .nav-toggle { display: block; }
  .site-nav .spacer { margin-left: 0; }
  .hero { padding: var(--sp-8) var(--sp-4) var(--sp-8); }
  .hero h1 { font-size: var(--text-2xl); }
  .wk, .pg, .page { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .rail { grid-template-columns: minmax(0, 1fr); }
  .steps > li { padding-left: var(--sp-8); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wk__say { max-width: 100%; }
  .entry__field > .k { display: block; }
}

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