/* Colour tokens for both themes, and the page base */

:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f0eee9;
  --text: #1d1d1f;
  --muted: #6b6b70;
  --border: #e2dfd8;
  --accent: #2f5bd3;
  --accent-soft: #e8eefc;
  --good: #1f8a4c;
  --good-soft: #e6f4ec;
  --bad: #c2362f;
  --bad-soft: #fbeceb;
  --warn: #a86a00;
  --warn-soft: #fbf1dd;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141416;
    --surface: #1c1c1f;
    --surface-2: #26262a;
    --text: #ececef;
    --muted: #9a9aa2;
    --border: #33333a;
    --accent: #7ea2ff;
    --accent-soft: #1f2a48;
    --good: #5cc98a;
    --good-soft: #17301f;
    --bad: #ff7a72;
    --bad-soft: #3a1d1b;
    --warn: #f0b545;
    --warn-soft: #3a2c12;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #141416;
  --surface: #1c1c1f;
  --surface-2: #26262a;
  --text: #ececef;
  --muted: #9a9aa2;
  --border: #33333a;
  --accent: #7ea2ff;
  --accent-soft: #1f2a48;
  --good: #5cc98a;
  --good-soft: #17301f;
  --bad: #ff7a72;
  --bad-soft: #3a1d1b;
  --warn: #f0b545;
  --warn-soft: #3a2c12;
  --shadow: none;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
}

/* Top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  flex: 1;
}

.control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.seg {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 2px;
}

.seg button {
  border: 0;
  background: transparent;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
}

.seg button.on {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* Level buttons: each code in its level's colour; levels.css tints the buttons from the lowest level
   up to the chosen one, the levels the page shows, and the chosen one stands out */
.seg button[data-set-level] {
  color: var(--lvl);
  font-weight: 600;
}
.seg button[data-set-level].on {
  background: var(--level-strong);
  color: var(--text);
}

.seg.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool,
.menu {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
}

.menu {
  display: none;
}

/* A link in the top bar (the credits page) looks like its buttons. */
.tools a.tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}
.tools a.tool[aria-current="page"] {
  color: var(--accent);
  border-color: var(--accent);
}

/* Layout */

.layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  min-height: calc(100vh - 53px);
}

.sidebar {
  position: sticky;
  top: 53px;
  height: calc(100vh - 53px);
  overflow-y: auto;
  padding: 16px 12px 40px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.sidebar h4 {
  margin: 18px 8px 6px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar h4:first-child {
  margin-top: 0;
}

.sidebar a,
.sidebar .todo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--text);
  text-decoration: none;
}

.sidebar a:hover {
  background: var(--surface-2);
}
.sidebar a.on {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 550;
}
.sidebar .todo {
  color: var(--muted);
  opacity: 0.6;
}
.sidebar .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content {
  padding: 32px 40px 80px;
  max-width: 2376px;
  width: 100%;
  container-type: inline-size;
}

/* Badges */

.badge {
  display: inline-flex;
  border-radius: 999px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.6;
  vertical-align: middle;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* A level badge is one pill, (A1), or two joined halves, (A1][B1): the rounded badge clips its
   halves, and each half writes its level's code in the level's ink (--lvl) on its tint
   (--level-tint), both set per level and theme in levels.css. --badge-pad sizes the halves. */
.lvl {
  margin-left: 8px;
}
.lvl > .half {
  padding: var(--badge-pad, 1px 7px);
  background: var(--level-tint);
  color: var(--lvl);
  /* A half above the level filter keeps its code and fades: an outline of its colour, no tint
     (levels.css picks the halves) */
  --beyond-bg: transparent;
  --beyond-edge: inset 0 0 0 1px color-mix(in oklch, var(--lvl) 40%, transparent);
  --beyond-ink: color-mix(in oklch, var(--lvl) 55%, var(--surface));
}
.lvl > .half:first-child {
  border-radius: 999px 0 0 999px;
}
.lvl > .half:last-child {
  border-radius: 0 999px 999px 0;
}
.lvl > .half:only-child {
  border-radius: 999px;
}
/* A list badge's halves share one width and a single level keeps the second column free, so the
   badges of a list line up: lowest levels in one column, highest in the next */
.lvl.pair > .half {
  box-sizing: border-box;
  width: 2.6em;
  padding-inline: 0;
  text-align: center;
}
.lvl.pair:has(> .half:only-child) {
  margin-right: 2.6em;
}
.blk-level {
  margin: 0 0 6px;
}
.blk-level .lvl {
  margin: 0;
}
td .lvl,
li > .lvl,
p > .lvl {
  margin: 0 6px 0 0;
}

/* Document */

.doc h1 {
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}

.doc-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 10px;
}

.doc-head h1 {
  margin: 0;
}
.doc-head h1 .lvl {
  margin-left: 12px;
  font-size: 12px;
  --badge-pad: 2px 9px;
  position: relative;
  top: -3px;
}
.doc-head .actions {
  display: flex;
  gap: 6px;
}
.doc-head .tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.doc-head .tool:hover {
  color: var(--text);
  background: var(--surface-2);
}
.doc-head .tool.edit {
  width: auto;
  gap: 7px;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 550;
  text-decoration: none;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.doc > blockquote:first-of-type {
  margin: 0 0 28px;
  padding: 0;
  border: 0;
  font-size: 17px;
  color: var(--muted);
}

.doc h2 {
  font-size: 20px;
  letter-spacing: -0.01em;
  margin: 40px 0 12px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.doc h3 {
  font-size: 16px;
  margin: 24px 0 8px;
}
.doc h4 {
  font-size: 14px;
  margin: 18px 0 6px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.doc h5 {
  font-size: 13px;
  margin: 14px 0 6px;
}

.doc p,
.doc ul {
  margin: 8px 0;
}
.doc ul {
  padding-left: 20px;
}
.doc li {
  margin: 3px 0;
}
/* Marks (CONVENTIONS.md §12): the form or word a rule is about shows in bold; a sound, a meaning or a
   translation is muted; every other mark reads as its text. */
.doc
  :is(
    [data-mark="target"],
    [data-mark="aux"],
    [data-mark="subj"],
    [data-mark="verb"],
    [data-mark="ending"],
    [data-mark="stress"],
    [data-mark="term"],
    [data-mark="letter"],
    [data-mark="signal"]
  ) {
  color: var(--accent);
  font-weight: 650;
}
.doc :is([data-mark="sound"], [data-mark="gloss"], [data-mark="l1"], [data-mark="translation"]) {
  color: var(--muted);
}
.doc a {
  color: var(--accent);
}
/* A link to a topic without a page yet. */
.doc .missing {
  color: var(--muted);
  text-decoration: underline dotted;
  cursor: help;
}
.doc code {
  font: 13px var(--mono);
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
}

/* Previous and next topic, above the title and below the guide */
.pagers.top {
  margin-bottom: 20px;
}
.pagers.bottom {
  margin-top: 40px;
}
.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.pager[hidden] {
  display: none;
}
.pager a,
.pager .off {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 48%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}
.pager a:hover {
  background: var(--surface-2);
}
/* Nowhere to go: the side stays in place, inactive */
.pager .off {
  border-style: dashed;
  color: var(--muted);
  opacity: 0.55;
}
.pager .pager-next {
  margin-left: auto;
  text-align: right;
}
.pager .dir {
  font-size: 12px;
  color: var(--muted);
}
.pager .title {
  font-weight: 600;
}

/* Tables and cheatsheet pages */

.table-wrap {
  overflow-x: auto;
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.doc table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}
.doc th,
.doc td {
  padding: 7px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.doc th {
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.doc tr:last-child td {
  border-bottom: 0;
}
.doc td.key {
  font-weight: 550;
}
.doc th.group,
.doc th.group-start {
  border-left: 1px solid var(--border);
}
.doc thead tr:first-child th[rowspan],
.doc th.group {
  border-bottom: 1px solid var(--border);
}
.doc thead th[rowspan] {
  vertical-align: middle;
}
/* Tables with merged cells list one word per row: tight rows keep each list together. */
.doc table.compact :is(th, td):not(.gap) {
  padding-left: 8px;
  padding-right: 8px;
}
.doc table.compact td.center {
  white-space: nowrap;
}
.doc table.compact td {
  padding-top: 2px;
  padding-bottom: 2px;
  line-height: 1.35;
}
/* Every column after the first has a line on its left; a merged cell at the bottom edge leaves it to the box. */
.doc table.compact td:not(.key),
.doc table.compact thead tr + tr th,
.doc table.compact th.group {
  border-left: 1px solid var(--border);
}
.doc table.compact td.end {
  border-bottom: 0;
}
/* Gaps: an empty column between groups, an empty row between blocks; their edges close the boxes around them. */
.doc :is(th, td).gap,
.doc tr.gap-row td {
  padding: 0;
  background: var(--bg);
}
.doc :is(th, td).gap {
  width: 12px;
  min-width: 12px;
  border-top: 0;
  border-bottom: 0;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.doc tr.gap-row td {
  height: 12px;
  border-left: 0;
  border-right: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.doc :is(th, td).center {
  text-align: center;
  vertical-align: middle;
}

.doc table.errors td:nth-child(1) {
  color: var(--bad);
  background: var(--bad-soft);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--bad) 45%, transparent);
}
.doc table.errors td:nth-child(2) {
  background: var(--good-soft);
}

.empty {
  margin-top: 40px;
  padding: 28px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

/* Sheets */

.sheet h2 {
  font-size: 22px;
}
.sheet h3 {
  font-size: 17px;
  margin-top: 28px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

/* Below 860 px */

.sidebar .nav-brand {
  display: none;
}

@media (max-width: 860px) {
  /* The menu carries the logo; a tap on the dimmed page beside it closes it (client-bar.ts) */
  .sidebar .nav-brand {
    display: block;
    padding: 2px 8px 14px;
    font-size: 18px;
    font-weight: 650;
    letter-spacing: -0.01em;
  }
  .sidebar .nav-brand:hover {
    background: none;
  }
  body.nav-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(0, 0, 0, 0.25);
  }
  .menu {
    display: inline-block;
  }
  .topbar {
    flex-wrap: wrap;
    padding: 10px 16px;
    gap: 10px;
  }
  /* The switches take the logo's place; an open switch moves them to a row of their own */
  .topbar:has(.controls .control) .brand {
    display: none;
  }
  .controls:has(.seg.open) {
    order: 3;
    flex-basis: 100%;
  }
  .tools {
    margin-left: auto;
  }
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 30;
    width: 290px;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.2);
  }
  body.nav-open .sidebar {
    transform: none;
  }
  .content {
    padding: 20px 16px 60px;
  }
  /* A switch shows its current choice alone; tapping it opens every choice (client-seg.ts) */
  .seg:not(.open) > :not(.on) {
    display: none;
  }
  .seg:not(.open) > .on::after {
    content: "▾";
    margin-left: 6px;
    font-size: 0.85em;
    opacity: 0.6;
  }
  /* The top bar slides away while the reader scrolls down and returns on a scroll up (client-bar.ts) */
  .topbar {
    transition: transform 0.25s ease;
  }
  html.bar-hidden .topbar {
    transform: translateY(-100%);
  }
  /* An open switch takes the whole row, its label beside its choices */
  .control:has(.seg.open) {
    flex-basis: 100%;
    flex-wrap: nowrap;
  }
}

@media (max-width: 860px) and (prefers-reduced-motion: reduce) {
  .topbar {
    transition: none;
  }
}

/* Print */

@media print {
  @page {
    size: A4;
    margin: 16mm;
  }
  .topbar,
  .sidebar,
  .rail,
  .doc-head .actions,
  .pagers {
    display: none;
  }
  .layout {
    display: block;
  }
  .content {
    padding: 0;
    max-width: none;
  }
  body {
    background: #fff;
    font-size: 11pt;
  }
  .table-wrap {
    box-shadow: none;
    break-inside: avoid;
  }
  .doc h2,
  .doc h3 {
    break-after: avoid;
  }
  .doc {
    max-width: none;
  }
  .lanes {
    display: block;
  }
}

/* Static pages */

.seg a {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}

.seg a.on {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.layout.no-nav {
  grid-template-columns: minmax(0, 1fr);
}
.layout.no-nav .content {
  margin: 0 auto;
}

.sidebar .nav-home {
  color: var(--muted);
  font-size: 13px;
}
.sidebar .nav-home::before {
  content: "←";
}
.sidebar .nav-track {
  font-weight: 650;
  margin-bottom: 6px;
}
.muted {
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.card {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.doc .card h2 {
  margin: 0 0 4px;
  padding-top: 0;
  border-top: 0;
  font-size: 18px;
}

.track-link {
  display: flex;
  flex-direction: column;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.track-link:hover {
  background: var(--accent-soft);
}
.track-link span {
  font-size: 13px;
  color: var(--muted);
}
.doc .track-link strong {
  color: var(--text);
}

.doc .topic-list {
  list-style: none;
  padding: 0;
}
.doc .topic-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 2px 0;
  padding: 4px 0;
}
.doc .topic-list .lvl {
  margin: 0;
}

.doc h2 a,
.doc h3 a {
  color: inherit;
  text-decoration: none;
}
.doc h2 a:hover,
.doc h3 a:hover {
  color: var(--accent);
}

/* Level filter rules come from levels.yaml (assets.ts, levels.css); the Cheatsheet view is here */

/* Cheatsheet view: section 00 alone */
html[data-page="topic"][data-view="cheatsheet"] .sections > section.part:not(.cheatsheet) {
  display: none;
}

/* The rail keeps every entry: what the view hides turns grey */
html[data-page="topic"][data-view="cheatsheet"] .toc > li.guide {
  opacity: 0.4;
  pointer-events: none;
}

/* A view whose content all sits above the level filter shows its note instead */
.filter-empty {
  display: none;
  margin: 28px 0;
  padding: 20px 24px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
}
.filter-empty p {
  margin: 0 0 12px;
}
.filter-empty button {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
html[data-view="cheatsheet"] .filter-empty.extended,
html:not([data-view="cheatsheet"]) .filter-empty.cheatsheet {
  display: none;
}

/* Order: by category or along the study path (client.ts); the lists of the other order hide */
html:not([data-order="path"]) [data-order="path"],
html[data-order="path"] [data-order="categories"] {
  display: none;
}
.nav-order {
  margin: 12px 8px 18px;
}
/* On the study path the menu highlights the step being read alone (client.ts) */
.nav-list[data-order="path"] a.on:not([aria-current="step"]) {
  background: none;
  color: var(--text);
  font-weight: inherit;
}
.nav-order .seg button {
  padding: 4px 8px;
  font-size: 12px;
}
.index-order {
  margin-top: 14px;
}

/* Sidebar level badges */

.sidebar h4 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar h4 .name {
  flex: 1;
}
.sidebar .lvl {
  margin: 0;
  font-size: 10px;
  --badge-pad: 0 6px;
}
.sidebar a,
.sidebar .todo {
  gap: 6px;
}

/* Phones: keep the page at screen width; wide tables scroll inside their box */

@media (max-width: 860px) {
  .layout,
  .layout.no-nav {
    grid-template-columns: minmax(0, 1fr);
  }
  .content {
    min-width: 0;
  }
  .controls {
    min-width: 0;
    gap: 8px 12px;
  }
  .control {
    flex-wrap: wrap;
    min-width: 0;
  }
  .seg {
    max-width: 100%;
    overflow-x: auto;
  }
  .doc h1 {
    font-size: 24px;
    overflow-wrap: anywhere;
  }
  .doc p,
  .doc li {
    overflow-wrap: anywhere;
  }
}

/* A topic at a single level shows its level once, in the header */
.doc.one-level .sections > section > h2 .lvl {
  display: none;
}

/* Lanes: a page reads in one 820px column; once the content area is 1200px wide, its lanes take
   the full width and hold as many columns of at least --lane as fit. Each block goes, in order, to
   the top of the shortest column (grid-lanes; client.ts lays out the same placement on a grid of
   4px rows where grid-lanes is missing). --lane-gap spaces blocks within a column. */
.doc {
  max-width: 820px;
}
.layout.no-nav .doc {
  margin-inline: auto;
}
.lanes {
  --lane: 560px;
  --lane-gap: 0px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--lane)), 1fr));
  gap: var(--lane-gap) var(--lane-col-gap, 48px);
  align-items: start;
}
.lanes.js-lanes {
  grid-auto-rows: 4px;
  row-gap: 0;
}
@supports (display: grid-lanes) {
  .lanes {
    display: grid-lanes;
  }
}
@container (min-width: 1200px) {
  .doc:has(.lanes) {
    max-width: none;
  }
}
.sections > .block {
  margin: 0 0 28px;
}

/* Topic rail: On this page and Up next, beside the content once the window is 1400px wide */
.rail {
  display: none;
}
@media (min-width: 1400px) {
  .layout.has-rail {
    grid-template-columns: 290px minmax(0, 1fr) 280px;
  }
  .rail {
    display: block;
    position: sticky;
    top: 53px;
    height: calc(100vh - 53px);
    overflow-y: auto;
    padding: 28px 20px 40px 0;
  }
}
.rail h4 {
  margin: 0 0 8px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
}
.toc {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
}
.toc a {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 12px;
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  text-decoration: none;
}
.toc a:hover {
  background: var(--surface-2);
}
.toc a.on {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.toc .name {
  flex: 1;
  min-width: 0;
}
.next {
  display: block;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
.next:hover {
  box-shadow: inset 0 0 0 1px var(--border);
}
.next strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
  line-height: 1.3;
}
.next .summary {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}
.sections > .part {
  scroll-margin-top: 72px;
}

.toc .lvl {
  flex: none;
  margin: 0;
  font-size: 10px;
  --badge-pad: 0 6px;
}

/* Guide sections are numbered in reading order, in the index card style; sections the level
   filter hides take no number. */
.sections {
  counter-reset: part;
}
.sections > .part {
  counter-increment: part;
}
/* The cheatsheet comes first as 00; the sections count on from 01. */
.sections > .part.cheatsheet {
  counter-increment: none;
}
.sections > .part > h2::before {
  content: counter(part, decimal-leading-zero);
  margin-right: 12px;
  font: 600 1em var(--mono);
  letter-spacing: -0.02em;
  color: var(--muted);
}
.sheet-index {
  --lane: 320px;
}

/* Track index: header, one card per section */

.index-head {
  margin-bottom: 28px;
}
.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.doc .index-head h1 {
  font-size: 34px;
  margin: 0 0 8px;
}
.index-head .lead {
  margin: 0;
  font-size: 16px;
  color: var(--muted);
}

.index-grid {
  --lane: 360px;
  --lane-gap: 16px;
  --lane-col-gap: 16px;
}

.index-card {
  padding: 14px 8px 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.index-card > header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 6px;
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--border);
}

.index-card .num {
  font: 600 17px var(--mono);
  color: var(--muted);
  letter-spacing: -0.02em;
}
.doc .index-card h2 {
  flex: 1;
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 17px;
}
.index-card .count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.doc .index-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.doc .index-list li {
  margin: 0;
}
.doc .index-list a,
.doc .index-list .row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}
.doc .index-list a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.doc .index-list .name {
  flex: 1;
  min-width: 0;
}
.doc .index-list .todo .row {
  color: var(--muted);
}
.doc .index-list .lvl {
  margin: 0;
}
.doc .index-list .todo .lvl {
  opacity: 0.5;
}

@media (max-width: 860px) {
  .doc .index-head h1 {
    font-size: 28px;
  }
}
