:root {
  --paper: #faf9f7;
  --ink: #191712;
  --muted: #5c564e;
  --line: #e4e0d6;
  --navy: #00247d;
  --red: #a51931;
  --pad: 22px;
  --sans: "Helvetica Neue", Helvetica, Arial, "IBM Plex Sans Thai", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --paper: #111110;
  --ink: #f3f0e8;
  --muted: #a39c92;
  --line: #2c2a26;
  --navy: #9ebcf0;
  --red: #ef7d88;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
}

button, input { font: inherit; color: inherit; }

button {
  background: none;
  border: 0;
  padding: 0;
  border-radius: 0;
  cursor: pointer;
}

::selection { background: var(--ink); color: var(--paper); }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.shell {
  height: 100dvh;
  display: grid;
  grid-template-columns: clamp(300px, 32vw, 420px) minmax(0, 1fr);
}

.index, .plate {
  min-width: 0;
  min-height: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.index { border-right: 1px solid var(--line); }

.bar {
  height: 44px;
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 var(--pad);
  border-bottom: 1px solid var(--line);
}

.mark {
  color: inherit;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.bar-kicker {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-btn {
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.text-btn:hover { color: var(--navy); }

.back, .theme-mobile { display: none; }

.bar-open[hidden] { display: none; }

.find {
  height: 44px;
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 var(--pad);
  border-bottom: 1px solid var(--line);
}

.find input {
  flex: 1;
  min-width: 0;
  height: 44px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  outline: none;
  font-size: 16px;
}

.find input::placeholder { color: var(--muted); }

.find-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.locator {
  height: 40px;
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 22px;
  padding: 0 var(--pad);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.index-scroll, .plate-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.index-scroll { padding: 8px 0 44px; }

.group { margin-top: 18px; }
.group:first-child { margin-top: 8px; }

.group h2 {
  margin: 0;
  padding: 0 var(--pad) 4px calc(var(--pad) + 52px);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.group h2 span {
  letter-spacing: 0;
  text-transform: none;
  font-family: var(--mono);
  font-weight: 400;
  margin-left: 8px;
}

.item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: 8px;
  align-items: baseline;
  align-content: center;
  width: 100%;
  /* 111 rows at 27px was under a comfortable touch target. The row grows;
     the type does not. */
  min-height: 44px;
  text-align: left;
  padding: 6px var(--pad);
  font-size: 14px;
  line-height: 1.35;
  letter-spacing: -0.011em;
  color: var(--ink);
}

.item .num {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.item:hover { color: var(--navy); }

.item[aria-current="true"] {
  font-weight: 500;
  box-shadow: inset 2px 0 0 var(--ink);
}

.item[aria-current="true"] .num { color: var(--ink); }

.item:focus-visible,
.text-btn:focus-visible,
.find input:focus-visible,
.plate-scroll:focus-visible {
  outline: 1px solid var(--navy);
  outline-offset: -1px;
}

.empty {
  margin: 0;
  padding: 14px var(--pad);
  color: var(--muted);
  font-size: 14px;
}

.plate-scroll { padding-bottom: 48px; }

.poster {
  width: min(18em, calc(100% - (var(--pad) * 2)));
  margin: 28px var(--pad) 0;
  font-size: clamp(40px, 4.8vw, 68px);
  font-weight: 500;
  line-height: 0.96;
  letter-spacing: -0.038em;
}

.poster em {
  display: block;
  margin-top: 0.12em;
  font-style: normal;
  color: var(--navy);
}

.block { margin: 22px var(--pad) 0; }
.measure > .block:first-child,
.plate-scroll > .measure { margin-top: 28px; }

.kicker {
  margin: 28px var(--pad) 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

h1.name {
  width: min(16em, calc(100% - (var(--pad) * 2)));
  margin: 28px var(--pad) 0;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.lede, .prose, .note {
  max-width: 66ch;
  margin: 12px 0 0;
  font-size: 17px;
  line-height: 1.45;
}

.prose + .prose { margin-top: 10px; }

.prose--ai { font-size: 14px; line-height: 1.5; }

.note {
  font-size: 14px;
  color: var(--muted);
  max-width: 68ch;
}

/* The document column. Declared AFTER the type rules on purpose: those use a
   `margin` shorthand that would otherwise reset the inset back to zero. */
.inset {
  margin-left: var(--pad);
  margin-right: var(--pad);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 16px var(--pad) 0;
}

.actions a, .inline-link {
  color: var(--navy);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  font-size: 15px;
}

/* Primary calls to action are standalone, not inline in a sentence, so they
   carry the full target rather than the inline exemption. */
.actions a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.shot-link {
  display: block;
  margin-top: 22px;
  color: inherit;
  text-decoration: none;
}

.shot-link img, .shot {
  display: block;
  width: min(960px, calc(100% - (var(--pad) * 2)));
  height: auto;
  margin: 22px var(--pad) 0;
}
.plate-scroll > .shot:first-child { margin-top: 0; }

.caption {
  margin: 8px var(--pad) 0;
  max-width: 68ch;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.arch {
  display: grid;
  width: max-content;
  max-width: calc(100% - (var(--pad) * 2));
  margin: 22px var(--pad) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.arch[data-cols="1"] { grid-template-columns: max-content; }
.arch[data-cols="2"] { grid-template-columns: max-content max-content; }
.arch[data-cols="3"] { grid-template-columns: max-content max-content max-content; }

.arch section { padding: 11px 28px 13px 0; }
.arch section + section {
  padding-left: 28px;
  border-left: 1px solid var(--line);
}

.arch h2 {
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.arch ul { margin: 0; padding: 0; list-style: none; }
.arch li { font-size: 13px; line-height: 1.45; }

.rule-list { width: min(920px, calc(100% - (var(--pad) * 2))); margin: 18px var(--pad) 0; }

/* Numbered prose rows are paragraphs, not spec-sheet columns. Their rules
   must stop at the measure the text actually fills. */
.rule-list--prose { width: min(66ch, calc(100% - (var(--pad) * 2))); }

.fig, .def, .row, .layer {
  display: grid;
  align-items: baseline;
  border-top: 1px solid var(--line);
  padding: 9px 0;
}

.fig:last-child, .def:last-child, .row:last-child, .layer:last-child {
  border-bottom: 1px solid var(--line);
}

.fig { grid-template-columns: 6.5rem minmax(8rem, 12rem) minmax(0, 1fr); gap: 12px; }
.fig--pair { grid-template-columns: 6.5rem minmax(0, 1fr); }
.fig b {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.fig i { font-style: normal; font-size: 14px; }
.fig span { font-size: 15px; line-height: 1.4; }

.def { grid-template-columns: 11.5rem minmax(0, 1fr); gap: 16px; font-size: 15px; }
.def > :first-child { color: var(--muted); }

.row {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  text-decoration: none;
  color: inherit;
}
.row b { font-weight: 500; font-size: 15px; display: block; }
.row i { font-style: normal; color: var(--muted); font-size: 13px; }
.row:hover b { color: var(--navy); }

.numbered { margin: 0; padding: 12px 0; border-top: 1px solid var(--line); }
.numbered:last-child { border-bottom: 1px solid var(--line); }
.numbered .n {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.numbered h2 { margin: 2px 0 0; font-size: 17px; font-weight: 500; letter-spacing: -0.015em; }
.numbered p { margin: 4px 0 0; font-size: 15px; line-height: 1.45; }

.stack-line, .roles {
  margin: 12px var(--pad) 0;
  max-width: 72ch;
  font-size: 14px;
  line-height: 1.5;
}

.layer { grid-template-columns: minmax(8.5rem, 13rem) minmax(0, 1fr); gap: 12px; }
.layer h2 { margin: 0; font-size: 14px; font-weight: 500; }
.layer p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.tools { font-size: 13px; line-height: 1.7; }
.tool { white-space: nowrap; margin-right: 12px; }
.tool.is-fav { font-weight: 500; }
.tool i {
  font-style: normal;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-left: 4px;
}

.group-block { margin-top: 22px; }
.group-block h2 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.group-block ul { margin: 0; padding: 0; list-style: none; }
.group-block li { font-size: 15px; line-height: 1.45; padding: 3px 0; }
.group-block a { color: var(--navy); text-underline-offset: 3px; }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  margin: 28px var(--pad) 0;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.pager a {
  max-width: 46%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
  text-decoration: none;
}
.pager a:last-child { margin-left: auto; text-align: right; }
.pager a:hover { color: var(--navy); }
.is-live { color: var(--red); }
.pager span { color: var(--muted); }

.th { font-family: var(--sans); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .index { border-right: 0; }
  .plate { display: none; }
  .shell.is-open .index { display: none; }
  .shell.is-open .plate { display: flex; }
  .back, .theme-mobile { display: inline-flex; }
  .poster { font-size: 36px; margin-top: 22px; }
  .fig, .fig--pair, .def, .layer, .arch[data-cols] {
    width: auto;
    max-width: none;
    grid-template-columns: 1fr;
  }
  .arch section + section { padding-left: 0; border-left: 0; padding-top: 11px; border-top: 1px solid var(--line); }
  .fig b { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
