/* RESOLVE — Pretext Rendering */
/* Two-column canvas. Monospace throughout. Dark. Dense. */

:root {
  --bg: #0a0a0f;
  --bg-nav: #0d0d14;
  --bg-card: #12121a;
  --fg: #c8c8d4;
  --fg-dim: #6a6a7a;
  --fg-bright: #e8e8f0;
  --accent: #7c8aff;
  --accent-dim: #4a5299;
  --border: #1a1a28;
  --mono: 'Berkeley Mono', 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Consolas', monospace;
  --reading: min(70ch, 100%);
}

/* Light theme palette — activated by html.theme-light. */
html.theme-light {
  --bg: #f8f7f2;
  --bg-nav: #efeee7;
  --bg-card: #ffffff;
  --fg: #2a2a33;
  --fg-dim: #7a7a86;
  --fg-bright: #0a0a12;
  --accent: #4a5299;
  --accent-dim: #7c8aff;
  --border: #d8d6ce;
  color-scheme: light;
}
html:not(.theme-light) { color-scheme: dark; }

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 15px; }

body {
  font-family: var(--mono);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* === Canvas: Two Columns === */

.canvas {
  display: flex;
  min-height: 100vh;
}

.nav-col {
  width: 280px;
  min-width: 280px;
  background: var(--bg-nav);
  border-right: 1px solid var(--border);
  padding: 2rem 1.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.content-col {
  flex: 1;
  padding: 3rem 4rem;
  max-width: 900px;
  overflow-y: auto;
}

/* === Nav === */

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.15em;
  display: block;
  margin-bottom: 0.25rem;
}

.tagline {
  font-size: 0.7rem;
  color: var(--fg-dim);
  margin-bottom: 2rem;
  font-style: italic;
}

nav h3 {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-dim);
  margin-top: 1.5rem;
  margin-bottom: 0.4rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

nav h3:first-child {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

nav a {
  display: block;
  font-size: 0.75rem;
  color: var(--fg);
  text-decoration: none;
  padding: 0.2rem 0;
  transition: color 0.15s;
}

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

footer {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.footer-text {
  font-size: 0.65rem;
  color: var(--fg-dim);
  margin-bottom: 0.25rem;
}

.footer-text a {
  color: var(--accent-dim);
  text-decoration: none;
}

/* === Hero === */

.hero {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.2em;
  margin-bottom: 0.5rem;
}

.hero-sub {
  font-size: 1rem;
  color: var(--fg-bright);
  font-style: italic;
  margin-bottom: 1rem;
}

.hero-desc {
  font-size: 0.85rem;
  color: var(--fg-dim);
  max-width: 60ch;
  margin-bottom: 1.5rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  text-decoration: none;
  border-radius: 3px;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--fg-bright);
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
}

.btn-secondary:hover {
  border-color: var(--accent);
}

/* === Sections === */

.section {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.section h2 {
  font-size: 1.1rem;
  color: var(--fg-bright);
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
}

.section p {
  font-size: 0.85rem;
  color: var(--fg);
  max-width: 65ch;
  margin-bottom: 0.75rem;
}

.section-desc {
  color: var(--fg-dim) !important;
  font-style: italic;
}

/* === Evidence Grid === */

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.evidence-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1.25rem;
  border-radius: 4px;
}

.evidence-card h3 {
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.evidence-card p {
  font-size: 0.75rem;
  color: var(--fg-dim);
  margin: 0;
}

/* === Corpus List === */

.corpus-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.corpus-item {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.4rem 0.5rem;
  text-decoration: none;
  border-radius: 2px;
  transition: background 0.1s;
}

.corpus-item:hover {
  background: var(--bg-card);
}

.doc-num {
  font-size: 0.7rem;
  color: var(--accent-dim);
  min-width: 2.5rem;
  text-align: right;
}

.doc-title {
  font-size: 0.8rem;
  color: var(--fg);
  flex: 1;
}

.doc-section {
  font-size: 0.6rem;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* === Document View === */

.document { max-width: var(--reading); }

.doc-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.doc-badge {
  display: inline-block;
  font-size: 0.65rem;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  padding: 0.15rem 0.5rem;
  border-radius: 2px;
  margin-bottom: 0.75rem;
  letter-spacing: 0.08em;
}

.doc-header h1 {
  font-size: 1.5rem;
  color: var(--fg-bright);
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.doc-subtitle {
  font-size: 0.85rem;
  color: var(--fg-dim);
  font-style: italic;
}

.doc-section-tag {
  font-size: 0.6rem;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* === Pretext: Document Body === */

.pretext {
  font-size: 0.85rem;
  line-height: 1.8;
}

.pretext h1 { font-size: 1.3rem; color: var(--fg-bright); margin: 2rem 0 1rem; }
.pretext h2 { font-size: 1.1rem; color: var(--fg-bright); margin: 2rem 0 0.75rem; border-bottom: 1px solid var(--border); padding-bottom: 0.4rem; }
.pretext h3 { font-size: 0.95rem; color: var(--fg-bright); margin: 1.5rem 0 0.5rem; }

.pretext p { margin-bottom: 1rem; max-width: 65ch; }

.pretext strong { color: var(--fg-bright); }
.pretext em { color: var(--fg); font-style: italic; }

.pretext a { color: var(--accent); text-decoration: none; }
.pretext a:hover { text-decoration: underline; }

.pretext blockquote {
  border-left: 3px solid var(--accent-dim);
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  background: var(--bg-card);
  border-radius: 0 3px 3px 0;
}

.pretext blockquote p { color: var(--fg-dim); margin: 0; }

.pretext code {
  font-family: var(--mono);
  font-size: 0.8rem;
  background: var(--bg-card);
  padding: 0.15rem 0.35rem;
  border-radius: 2px;
  color: var(--accent);
}

.pretext pre {
  position: relative; /* anchor the .copy-btn inside */
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1rem 0;
}

.pretext pre code {
  background: none;
  padding: 0;
  font-size: 0.78rem;
  color: var(--fg);
}

.pretext ul, .pretext ol {
  margin: 0.75rem 0 0.75rem 1.5rem;
}

.pretext li {
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
}

.pretext table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.78rem;
}

.pretext th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--border);
  color: var(--fg-bright);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pretext td {
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
}

.pretext tr:hover td { background: var(--bg-card); }

.pretext hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* === Document References === */

.doc-ref {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent-dim);
}

.doc-ref:hover {
  border-bottom-style: solid;
}

.ref-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0 1.5rem;
}

.referenced-docs,
.section-docs {
  margin-bottom: 2rem;
}

.referenced-docs h3,
.section-docs h3 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-dim);
  margin-bottom: 0.75rem;
}

.referenced-docs ul,
.section-docs ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.referenced-docs li,
.section-docs li {
  margin-bottom: 0.35rem;
}

.referenced-docs a,
.section-docs a {
  font-size: 0.78rem;
  color: var(--fg);
  text-decoration: none;
  transition: color 0.15s;
}

.referenced-docs a:hover,
.section-docs a:hover {
  color: var(--accent);
}

/* === Closing === */

.closing {
  text-align: center;
  border-bottom: none;
}

.closing p { max-width: none; }

.closing-attr {
  font-size: 0.75rem;
  color: var(--fg-dim);
}

.closing-attr a { color: var(--accent-dim); text-decoration: none; }

/* === Seed Garden === */

.garden { max-width: var(--reading); }

.garden-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.garden-header h1 {
  font-size: 1.75rem;
  color: var(--fg-bright);
  margin-bottom: 0.5rem;
}

.garden-intro {
  font-size: 0.85rem;
  color: var(--fg);
  max-width: 60ch;
  margin-bottom: 0.5rem;
}

.garden-intro.dim, .dim { color: var(--fg-dim); }

.plots { display: flex; flex-direction: column; gap: 2.5rem; }

.plot {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.plot-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.plot-icon { font-size: 1.25rem; }

.plot-header h2 {
  font-size: 1rem;
  color: var(--fg-bright);
  flex: 1;
}

.plot-status {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  padding: 0.15rem 0.5rem;
  border-radius: 2px;
}

.plot-body {
  display: flex;
  gap: 0;
  padding: 1.25rem;
}

.plot-col {
  flex: 1;
  padding: 0 0.75rem;
}

.seed-col { border-right: 1px dashed var(--border); }

.plot-col h3 {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-dim);
  margin-bottom: 0.75rem;
}

.plot-metric {
  font-size: 0.85rem;
  color: var(--fg-bright);
  margin-bottom: 0.5rem;
}

.plot-metric strong {
  font-size: 1.1rem;
  color: var(--accent);
}

.plot-desc {
  font-size: 0.78rem;
  color: var(--fg);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.plot-desc.dim { color: var(--fg-dim); }

.plot-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--accent-dim);
  padding: 0 0.5rem;
  min-width: 2rem;
}

.plot-stats {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}

.plot-stats li {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
}

.stat-label { color: var(--fg-dim); }
.stat-value { color: var(--fg-bright); font-weight: 600; }

.plot-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.72rem;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent-dim);
}

.plot-link:hover { border-bottom-style: solid; }

.plot-soil {
  padding: 0.75rem 1.25rem;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.plot-soil p {
  font-size: 0.75rem;
  color: var(--fg-dim);
  font-style: italic;
  line-height: 1.6;
  margin: 0;
}

.garden-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.garden-footer p {
  font-size: 0.8rem;
  color: var(--fg);
  margin-bottom: 0.75rem;
  max-width: 55ch;
  margin-left: auto;
  margin-right: auto;
}

.garden-footer a {
  color: var(--accent);
  text-decoration: none;
}

@media (max-width: 768px) {
  .plot-body { flex-direction: column; }
  .seed-col { border-right: none; border-bottom: 1px dashed var(--border); padding-bottom: 1rem; margin-bottom: 1rem; }
  .plot-arrow { transform: rotate(90deg); padding: 0.5rem 0; }
}

/* === Mobile: M1-M7 Constraint-Derived Interface === */

/* M1: The thumb governs — interactive elements in the lower comfort arc */
.mobile-menu-btn {
  display: none;
  position: fixed;
  bottom: 1.25rem;           /* M1: Bottom of screen = thumb zone */
  right: 1.25rem;
  z-index: 1001;
  background: var(--accent);
  border: none;
  color: var(--bg);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.75rem 1.25rem;  /* M5: Min 44px touch target */
  min-height: 44px;
  min-width: 44px;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0.1em;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

.mobile-menu-btn:active {
  transform: scale(0.95);
}

/* M4: Viewport orientation — back to top / position awareness */
.mobile-top-btn {
  display: none;
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 1001;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--fg-dim);
  font-family: var(--mono);
  font-size: 0.65rem;
  padding: 0.6rem 0.75rem;
  min-height: 44px;           /* M5: Touch target */
  min-width: 44px;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0.08em;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.mobile-top-btn.hidden { opacity: 0; pointer-events: none; }

/* M2: Content is primary namespace — breadcrumb for orientation */
.mobile-breadcrumb {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1rem;
  font-size: 0.7rem;
  color: var(--fg-dim);
}

.mobile-breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

/* === Responsive === */

@media (max-width: 768px) {
  /* M1: Show thumb-zone controls */
  .mobile-menu-btn { display: block; }
  .mobile-top-btn { display: block; }
  .mobile-breadcrumb { display: block; }

  .canvas { flex-direction: column; }

  /* M2: Nav is overlay, content is primary */
  .nav-col {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    min-width: 100%;
    z-index: 1000;
    background: var(--bg-nav);
    padding: 1.5rem;
    padding-bottom: 5rem;     /* Space for the CLOSE button */
    border-right: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* M3: State transition — menu open */
  .nav-col.open {
    display: flex;
  }

  /* M5: Touch targets for nav links */
  nav a {
    padding: 0.6rem 0.25rem;  /* Taller tap targets */
    font-size: 0.85rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  nav h3 {
    font-size: 0.7rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
  }

  /* M2: Content fills viewport */
  .content-col {
    padding: 1.25rem;
    padding-top: 3rem;        /* Space for breadcrumb */
    padding-bottom: 5rem;     /* Space for bottom buttons */
  }

  /* M6: Progressive disclosure — compact cards */
  .evidence-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.75rem; }
  .hero-actions { flex-direction: column; gap: 0.5rem; }
  .btn { text-align: center; padding: 0.75rem 1rem; min-height: 44px; }

  /* M6: Corpus list — larger touch targets */
  .corpus-item {
    padding: 0.6rem 0.5rem;
    min-height: 44px;
    align-items: center;
  }

  /* Pretext: readable on mobile */
  .pretext p { max-width: 100%; }
  .pretext table { font-size: 0.7rem; }
  .pretext th, .pretext td { padding: 0.3rem 0.4rem; }
  .pretext pre { padding: 0.75rem; font-size: 0.7rem; }

  .doc-header h1 { font-size: 1.25rem; }
  .document { max-width: 100%; }

  /* Hard-disable any multi-column state on mobile, even if inline styles leaked in
     from a prior desktop layout pass (e.g. user rotated / resized from desktop).
     The !important overrides inline styles the layoutColumns() JS may have set. */
  .content-col,
  .content-col .pretext {
    column-count: 1 !important;
    column-width: auto !important;
    column-gap: normal !important;
    column-rule: none !important;
    column-fill: balance !important;
    width: auto !important;
    height: auto !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
  }
  .content-col .pretext { orphans: 2; widows: 2; }
}

/* === Desktop (769+): Custom scrollbars + horizontally-scrolling multi-column pretext === */

@media (min-width: 769px) {
  /* Custom nav-col scrollbar */
  .nav-col {
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--bg-nav);
  }
  .nav-col::-webkit-scrollbar {
    width: 6px;
  }
  .nav-col::-webkit-scrollbar-track {
    background: var(--bg-nav);
  }
  .nav-col::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
    transition: background 0.2s;
  }
  .nav-col::-webkit-scrollbar-thumb:hover {
    background: var(--accent-dim);
  }

  /* Document pages: content-col becomes a horizontally-scrolling multi-column canvas.
     Applies only when .pretext is present (document pages), not to home/garden/about
     which use sections and grids that don't cohere under column flow. */
  .content-col:has(.pretext) {
    overflow-y: hidden;
    overflow-x: auto;
    overflow-wrap: break-word;
    /* 100dvh uses the *dynamic* viewport — excludes mobile browser chrome (URL bar etc.)
       so the column height matches what's actually visible. Older browsers without dvh
       support fall back to vh. */
    height: 100vh;
    height: 100dvh;
    max-width: none;
    /* The horizontal scrollbar is hidden (see below) — the progress bar at the top of
       the viewport serves as the position indicator. Bottom padding still gives the
       last line clearance from the viewport edge. */
    padding: 0.3rem 3rem 1.25rem;
    /* Hide the native horizontal scrollbar so it doesn't overlap or interfere with
       column text. Wheel/trackpad and touch gestures continue to scroll normally;
       the progress bar at the top of the viewport indicates position. */
    scrollbar-width: none;          /* Firefox */
  }
  .content-col:has(.pretext)::-webkit-scrollbar {
    display: none;                  /* WebKit / Blink */
    width: 0;
    height: 0;
  }

  /* Pretext flows into fixed-width columns; total width grows horizontally.
     Crude but reliable: 80vh leaves 20vh of bottom clearance, which absorbs the
     scrollbar, padding, line-height alignment slop, and any browser/zoom variance.
     !important is required to win over the JS inline-style override (the layout
     routine sets height inline for legacy line-alignment math; that's harmless when
     this rule wins). */
  .content-col .pretext {
    column-width: 72ch;
    column-gap: 3rem;
    column-rule: 1px solid var(--border);
    column-fill: auto;
    height: 80vh !important;
    max-width: none;
    orphans: 2;
    widows: 2;
  }

  /* Opt-out: user prefers vertical scroll on document pages. Undo the horizontal layout
     and restore the default single-column scroll. */
  html.layout-vertical .content-col:has(.pretext) {
    overflow-y: auto;
    overflow-x: visible;
    height: auto;
    max-width: 900px;
    padding: 3rem 4rem;
  }
  html.layout-vertical .content-col .pretext {
    column-width: auto;
    column-count: 1;
    column-gap: normal;
    column-rule: none;
    column-fill: balance;
    height: auto;
  }
  html.layout-vertical .content-col .pretext p { max-width: 65ch; }

  /* Columns can fit paragraphs at 65ch originally — relax to the column width. */
  .content-col .pretext p { max-width: none; }

  /* Elements that must not split across column boundaries. Note: blockquote,
     headings, and the doc-header are intentionally NOT in this list — when they're
     forced to stay intact, they shove following content out of bounds and create
     clipping. Letting them break gives the browser room to align content cleanly
     with the line-height-snapped column height the JS sets. */
  .content-col .pretext pre,
  .content-col .pretext table,
  .content-col .pretext .table-scroll,
  .content-col .pretext img {
    break-inside: avoid;
  }

  /* Headings should still try to stay with the following paragraph; soft hint only,
     not a hard avoid. The browser is free to break if avoid would cause clipping. */
  .content-col .pretext h1,
  .content-col .pretext h2,
  .content-col .pretext h3 {
    break-after: avoid;
  }

  /* Doc header sits as the first-column banner. */
  .content-col .doc-header { break-after: avoid; }

  /* Pre should not overrun the column width; scroll internally if needed. */
  .content-col .pretext pre {
    max-width: 100%;
    overflow-x: auto;
  }

  /* Tables are wrapped at runtime by the layout JS in .table-scroll. The wrapper is the
     element that respects column width + break-inside; the table inside renders at natural
     width and the wrapper scrolls on both axes. */
  .content-col .pretext .table-scroll {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 10rem);
    overflow: auto;
    margin: 1rem 0;
    break-inside: avoid;
    border: 1px solid var(--border);
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--bg);
  }
  .content-col .pretext .table-scroll::-webkit-scrollbar {
    height: 6px;
    width: 6px;
  }
  .content-col .pretext .table-scroll::-webkit-scrollbar-track {
    background: var(--bg);
  }
  .content-col .pretext .table-scroll::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
  }
  .content-col .pretext .table-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--accent-dim);
  }
  .content-col .pretext .table-scroll > table {
    margin: 0;
    border: none;
  }
}

/* === Scroll progress indicator === */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: 1000;
  pointer-events: none;
  transition: opacity 0.3s;
  opacity: 0.85;
  will-change: width;
}
.scroll-progress.idle { opacity: 0.4; }
/* Push the mobile breadcrumb down by the progress-bar height so it doesn't overlap. */
@media (max-width: 768px) {
  .mobile-breadcrumb { top: 2px; }
}

/* === Toggle row in nav footer === */
.toggle-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.9rem;
}
.toggle-btn {
  flex: 1;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-dim);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  padding: 0.4rem 0.4rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.toggle-btn:hover {
  color: var(--accent);
  border-color: var(--accent-dim);
}
.toggle-btn:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}
/* Layout toggle is only meaningful on desktop where the multi-column layout exists. */
@media (max-width: 768px) {
  .toggle-btn.layout-only { display: none; }
  .knob-row.layout-only { display: none; }
}

/* Scroll-speed knob */
.knob-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.9rem;
}
.knob-label {
  font-size: 0.55rem;
  color: var(--fg-dim);
  letter-spacing: 0.18em;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.knob-label span {
  color: var(--accent);
  font-size: 0.62rem;
  letter-spacing: 0.05em;
}
.knob {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  cursor: pointer;
  outline: none;
}
.knob:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }
.knob::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}
.knob::-webkit-slider-thumb:hover { background: var(--fg-bright); }
.knob::-moz-range-thumb {
  width: 10px;
  height: 14px;
  background: var(--accent);
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.15s;
}
.knob::-moz-range-thumb:hover { background: var(--fg-bright); }
.knob::-moz-range-track {
  background: var(--border);
  height: 3px;
  border-radius: 2px;
}


/* Browsers without :has() fall back gracefully to default vertical scroll — no multi-column
   layout is applied, but documents remain readable. Modern Chromium/WebKit/Firefox all ship
   :has() as of 2024. */

