/* Monsoon: the design-state reference.
   World: the ledger page. Paper, ink, one annotation blue. Spectral
   carries the voice; system mono carries citation data. Designed at
   420 px, the design target; wider layouts adapt to it. One linear
   vertical scroll: no spread, no table. Structure in index.html, the
   station model in copy.js, rendering in page.js. No network requests;
   opens from file://. */

@font-face {
  font-family: "Spectral";
  src: url("fonts/spectral-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Spectral";
  src: url("fonts/spectral-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Spectral";
  src: url("fonts/spectral-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #faf9f6;
  --card: #ffffff;
  --ink: #201e1b;
  --ink-2: #5a554c;
  --rule: #d9d4c9;
  --blue: #274690;
  --serif: "Spectral", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --measure: 30rem;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(39, 70, 144, 0.16); }

a {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { text-decoration-thickness: 2px; }
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: rgba(32, 30, 27, 0.06);
  padding: 0.1em 0.35em;
}

/* Shown only when scripting is off: the words stay reachable via copy.js. */
.noscript {
  max-width: 68ch;
  margin: 1.5rem auto 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--ink);
  background: var(--card);
  font-family: var(--mono);
  font-size: 0.875rem;
}

/* ---------- masthead ---------- */

.masthead {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.75rem 1.25rem 1.9rem;
}

.masthead h1 {
  margin: 0;
  font-size: clamp(2.75rem, 9vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.02;
}

.masthead-sub {
  margin: 0.4rem 0 0;
  font-size: clamp(1.2rem, 3.5vw, 1.45rem);
  font-style: italic;
  color: var(--ink-2);
}

.masthead-lede {
  margin: 1.25rem 0 0;
}

/* ---------- front matter: the cut line, then the checkpoint log ---------- */

.frontmatter {
  margin-top: 2rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
}

.cutline {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
}
.cutline .k { color: var(--ink-2); }

.clog { margin-top: 0.4rem; }

.crow { padding: 0.7rem 0; border-top: 1px solid var(--rule); }
.crowhead {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
}
.cno { color: var(--blue); }
.cdate { color: var(--ink-2); }

/* ---------- the sticky station index ---------- */

/* The page's one heavy rule (2px ink) sits above the index. The anchors
   wrap, so the sticky bar can never force the page sideways. */
.stationindex {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--paper);
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--rule);
}
.stationindex .in {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0.5rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.9rem;
}
.stationindex a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  /* Thumb-sized hit area (counter plus padding reaches ~40px at 420);
     the negative margin pays the padding back, so the line never grows. */
  padding: 0.55rem 0.4rem;
  margin: -0.55rem -0.4rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--ink);
  text-decoration: none;
}
.stationindex a .no {
  width: 1.35rem;
  height: 1.35rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--blue);
  border-radius: 50%; /* drawn counter: the one radius the law allows */
  font-size: 0.75rem;
  color: var(--blue);
}
.stationindex a .nm { display: none; }
.stationindex a:hover { color: var(--blue); }
.stationindex a:hover .no {
  background: var(--blue);
  color: var(--card);
}

/* ---------- stations and sections ---------- */

.station, .sec {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.4rem 1.25rem 2.6rem;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 3rem;
}

.station h2, .sec h2 {
  margin: 0.3rem 0 0;
  font-size: clamp(1.55rem, 4.5vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.15;
  text-wrap: balance;
}

.sec h2 { margin-bottom: 0.4rem; }

.station p, .sec p { max-width: 68ch; }

.stno {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
}

.stverb {
  margin: 0.45rem 0 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--ink-2);
}
.stverb .k { color: var(--ink-2); }

/* Layer heads file the station into its three layers. */
.layer {
  margin: 2rem 0 0.75rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* Apparatus key-value line: faded mono key, then the value. */
.kv {
  margin: 0.3rem 0 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.55;
}
.kv .k { color: var(--ink-2); }

/* Note links (fact markers, queue and register "the margin note" links)
   carry a wider hit area; the negative margin pays it back so the line's
   layout holds. */
.kv a {
  display: inline-block;
  padding: 0.35rem 0.2rem;
  margin: -0.35rem -0.2rem;
}

/* ---------- standing facts: stacked label-value rows, never a table ---------- */

.facts {
  margin: 0.75rem 0 0;
  border: 1px solid var(--ink);
  background: var(--card);
}
.fact { padding: 0.8rem 1rem; }
.fact + .fact { border-top: 1px solid var(--rule); }
.fact dt {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.fact dd {
  margin: 0.25rem 0 0;
  font-size: 1rem;
  line-height: 1.55;
}

/* ---------- margin notes: open on tap ---------- */

.notes {
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}
.note {
  border: 1px solid var(--ink);
  background: var(--card);
}
.note summary {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.8rem 1rem;
  cursor: pointer;
  list-style: none;
}
.note summary::-webkit-details-marker { display: none; }
.note summary::marker { content: ""; }
.note summary::before {
  content: "";
  flex: none;
  width: 0.62em;
  height: 0.62em;
  margin-top: 0.4em;
}
.note.ruling summary::before {
  background: var(--blue);
  border: 1px solid var(--blue);
}
.note.receipt summary::before {
  border: 1.5px solid var(--ink);
}
.clsw {
  flex: none;
  margin-top: 0.3em;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.note .gap { min-width: 0; }
.note .panel {
  padding: 0.2rem 1rem 1rem;
  border-top: 1px solid var(--rule);
}
.note .panel p { margin: 0.55rem 0 0; }

/* ---------- figures: drawn, not captured ---------- */

.figwrap {
  margin-top: 2rem;
  border: 1px solid var(--ink);
  background: var(--card);
}
.figwrap summary {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 0.9rem;
  cursor: pointer;
  list-style: none;
}
.figwrap summary::-webkit-details-marker { display: none; }
.figwrap summary::marker { content: ""; }
/* No class marker on a figure summary: the square markers classify
   margin notes only. The mono uppercase title carries the summary. */
.figtitle {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
}
.fig {
  margin: 0;
  padding: 0 0.9rem 0.9rem;
}
.fig svg {
  display: block;
  width: 100%;
  height: auto;
}
.fig svg path,
.fig svg line,
.fig svg circle,
.fig svg rect {
  stroke: var(--ink);
  stroke-width: 1.25;
}
.fig figcaption {
  padding: 0.7rem 0 0.15rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.55;
}
.prov {
  display: block;
  margin-top: 0.15rem;
  color: var(--ink-2);
  font-size: 0.75rem;
}

/* ---------- the deferred register and the closing queue ---------- */

.filer {
  margin-top: 1rem;
  border: 1px solid var(--ink);
  background: var(--card);
}
.filer .row { padding: 0.85rem 1rem; }
.filer .row + .row { border-top: 1px solid var(--rule); }
.rowtitle {
  margin: 0;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.5;
}

/* ---------- colophon ---------- */

.colophon {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2rem 1.25rem 3.5rem;
  border-top: 1px solid var(--rule);
}
.colophon p {
  margin: 0;
  font-size: 0.875rem;
  font-style: italic;
  color: var(--ink-2);
}

/* ---------- wider than the phone: adapt, never spread ---------- */

@media (min-width: 900px) {
  :root { --measure: 42rem; }
  .stationindex a .nm { display: inline; }
  .station, .sec { scroll-margin-top: 4.75rem; }
}

@media (min-width: 1280px) {
  :root { --measure: 46rem; }
  .station, .sec { scroll-margin-top: 3.5rem; }
}
