/* ==========================================================================
   GIMAN® — UNIFIED STYLESHEET / REV 1.0.5
   Substrate: unbleached documentation paper. Ink: carbon. Accent: aviation red.
   Constraints: zero border-radius, zero gradients on chrome, single accent.
   ========================================================================== */

/* ==================== SHARED DESIGN SYSTEM ==================== */

:root {
  --paper:      #F4F4F0;
  --paper-2:    #EAE8E3;
  --paper-3:    #DEDBD4;
  --ink:        #050505;
  --ink-2:      #111111;
  --ink-mute:   #6E6B64;
  --ink-faint:  #9C988F;
  --red:        #E61919;

  /* inverted panels (solid ink blocks) */
  --on-ink:      #F4F4F0;
  --on-ink-mute: #8B8880;

  --rule:      1px solid var(--ink);
  --rule-2:    2px solid var(--ink);
  --rule-soft: 1px solid var(--paper-3);

  --pad:  clamp(1.25rem, 4vw, 4rem);
  --pad-y: clamp(3rem, 7vw, 6.5rem);

  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --display: 'Archivo Black', 'Inter', sans-serif;

  --sidebar-w: 16rem;
}

*, *::before, *::after { box-sizing: border-box; border-radius: 0 !important; }

html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Mechanical noise — unified physical grain across the whole substrate */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: .34;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

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

a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ==================== TYPOGRAPHY ==================== */

.macro {
  font-family: var(--display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: -0.045em;
  line-height: 0.86;
  margin: 0;
}
.macro--l  { font-size: clamp(2.1rem, 6.2vw, 4.6rem); letter-spacing: -0.04em; }
.macro--m  { font-size: clamp(1.5rem, 3.4vw, 2.5rem); letter-spacing: -0.035em; line-height: 0.92; }

.mono {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  line-height: 1.3;
}
.mono--sm { font-size: 0.625rem; letter-spacing: 0.14em; }
.mono--md { font-size: 0.75rem; letter-spacing: 0.09em; }

.c-red   { color: var(--red); }
.c-mute  { color: var(--ink-mute); }
.c-faint { color: var(--ink-faint); }

code, samp, kbd, pre { font-family: var(--mono); font-variant-ligatures: none; }

/* Inline code — a stamped chip, not a rounded pill */
.ic {
  font-size: 0.85em;
  background: var(--paper-2);
  border: var(--rule-soft);
  padding: 0.05em 0.3em;
  color: var(--ink);
  white-space: nowrap;
}

/* ==================== MASTHEAD ==================== */

.masthead {
  position: sticky; top: 0; z-index: 100;
  background: var(--paper);
  border-bottom: var(--rule);
}
.masthead-in {
  max-width: 1480px; margin: 0 auto;
  border-left: var(--rule); border-right: var(--rule);
  display: flex; align-items: stretch; justify-content: space-between;
  min-height: 3.25rem;
}
.wordmark {
  display: flex; align-items: center; gap: 0.4rem;
  font-family: var(--display); font-size: 1rem; text-transform: uppercase;
  letter-spacing: -0.03em; padding: 0 var(--pad); border-right: var(--rule);
}
.wordmark sup { font-family: var(--mono); font-size: 0.5rem; font-weight: 700; top: -0.7em; }

.mast-status {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0 var(--pad); border-right: var(--rule);
  font-family: var(--mono); font-size: 0.625rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-faint);
  white-space: nowrap; overflow: hidden;
}
.mast-status .dot { width: 6px; height: 6px; background: var(--red); flex: none; }
@media (max-width: 620px) { .mast-status { display: none; } }

.nav-idx { display: flex; align-items: stretch; margin-left: auto; }
.nav-idx a {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0 1rem; border-left: var(--rule);
  font-family: var(--mono); font-size: 0.625rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.14em;
  transition: background .12s linear, color .12s linear;
}
.nav-idx a:hover { background: var(--ink); color: var(--paper); }
.nav-idx a:hover .nav-n { color: var(--red); }
.nav-n { color: var(--ink-faint); font-weight: 700; }
.nav-idx a.is-src { background: var(--red); border-left-color: var(--red); color: var(--paper); }
.nav-idx a.is-src:hover { background: var(--ink); border-left-color: var(--ink); }
.nav-idx a.is-src:hover .nav-n { color: var(--red); }

/* ==================== FOOTER ==================== */

.foot { background: var(--ink); color: var(--on-ink); }
.foot-in { max-width: 1480px; margin: 0 auto; border-left: var(--rule); border-right: var(--rule); }
.foot-mark { padding: clamp(2rem, 5vw, 3.5rem) var(--pad) clamp(1.5rem, 3vw, 2rem); border-bottom: 1px solid #2A2A28; }
.foot-mark .macro { font-size: clamp(3.5rem, 17vw, 14rem); color: var(--on-ink); }
.foot-mark .macro sup { font-family: var(--mono); font-size: 0.14em; font-weight: 700; color: var(--red); top: -1.9em; letter-spacing: 0; }
.foot-grid { display: grid; grid-template-columns: 1fr; }
@media (min-width: 780px) { .foot-grid { grid-template-columns: 1.4fr 1fr; } }
.foot-cell { padding: clamp(1.4rem, 3vw, 2rem) var(--pad); }
.foot-cell + .foot-cell { border-top: 1px solid #2A2A28; }
@media (min-width: 780px) { .foot-cell + .foot-cell { border-top: 0; border-left: 1px solid #2A2A28; } }
.foot-links { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.foot-links a {
  font-family: var(--mono); font-size: 0.625rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  border: 1px solid #2A2A28; padding: 0.55rem 0.9rem;
  transition: background .12s linear, color .12s linear, border-color .12s linear;
}
.foot-links a:hover { background: var(--red); border-color: var(--red); color: var(--paper); }
.foot-note { font-family: var(--mono); font-size: 0.625rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--on-ink-mute); line-height: 1.8; }
.foot-note .c-red { color: var(--red); }

/* ==========================================================================
   LANDING PAGE (index.html)
   ========================================================================== */

  /* ==========================================================================
     GIMAN® — LANDING-PAGE STYLES / REV 1.0.5
     ========================================================================== */

  hr { border: 0; border-top: var(--rule); margin: 0; }

  .macro--xl { font-size: clamp(2.9rem, 13.5vw, 11.5rem); }

  .prose {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--ink-mute);
    max-width: 62ch;
    margin: 0;
  }
  .prose strong { color: var(--ink); font-weight: 600; }

  .num { font-family: var(--mono); font-variant-ligatures: none; }
  .tnum { font-variant-numeric: tabular-nums; }

  /* ==================== FRAME / GUTTERS ==================== */

  .frame {
    max-width: 1480px;
    margin: 0 auto;
    border-left: var(--rule);
    border-right: var(--rule);
    position: relative;
  }

  .sec { border-bottom: var(--rule); padding: var(--pad-y) var(--pad); position: relative; }
  .sec--flush { padding: 0; }

  .sec-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.75rem 1.25rem; margin-bottom: 1.5rem; }
  .sec-tag {
    font-family: var(--mono); font-size: 0.625rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.16em;
    border: var(--rule); padding: 0.3rem 0.6rem; white-space: nowrap;
  }
  .sec-tag--red { background: var(--red); border-color: var(--red); color: var(--paper); }
  .sec-rule { flex: 1 1 6rem; height: 1px; background: var(--ink); align-self: center; min-width: 2rem; }
  .sec-lede { margin-top: 1.25rem; margin-bottom: clamp(2rem, 4vw, 3.25rem); }

  .xh { position: relative; }
  .xh > .xh-m {
    position: absolute; width: 11px; height: 11px; pointer-events: none; color: var(--red);
  }
  .xh > .xh-m::before, .xh > .xh-m::after {
    content: ''; position: absolute; background: currentColor;
  }
  .xh > .xh-m::before { left: 0; right: 0; top: 5px; height: 1px; }
  .xh > .xh-m::after  { top: 0; bottom: 0; left: 5px; width: 1px; }
  .xh-m.tl { top: -6px; left: -6px; }
  .xh-m.tr { top: -6px; right: -6px; }
  .xh-m.bl { bottom: -6px; left: -6px; }
  .xh-m.br { bottom: -6px; right: -6px; }

  .halftone {
    background-image: radial-gradient(var(--ink) 1.05px, transparent 1.15px);
    background-size: 6px 6px;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.35) 55%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.35) 55%, transparent 100%);
  }

  .hgrid { display: grid; gap: 1px; background: var(--ink); border: var(--rule); }
  .hgrid > * { background: var(--paper); }

  @media (max-width: 900px) { .nav-hide { display: none !important; } }

  /* ==================== HERO ==================== */

  .hero { padding: clamp(2.5rem, 6vw, 5rem) var(--pad) 0; border-bottom: var(--rule); }

  .hero-meta {
    display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; align-items: center;
    margin-bottom: clamp(1.75rem, 4vw, 3rem);
    color: var(--ink-mute);
  }
  .hero-meta .slash { color: var(--red); font-weight: 700; }

  .hero-title { margin-bottom: 0; }
  .hero-title .ln { display: block; }
  .hero-title .ln--red { color: var(--red); }

  .hero-split {
    display: grid; grid-template-columns: 1fr; gap: clamp(1.75rem, 4vw, 3rem);
    margin-top: clamp(1.75rem, 4vw, 2.75rem);
    padding-top: 1.5rem; border-top: var(--rule-2); border-top-color: var(--red);
  }
  @media (min-width: 900px) { .hero-split { grid-template-columns: minmax(0,1.15fr) minmax(0,1fr); gap: clamp(2rem,5vw,5rem); } }

  .spec { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0; align-self: start; }
  .spec dt, .spec dd {
    font-family: var(--mono); font-size: 0.6875rem; text-transform: uppercase;
    letter-spacing: 0.1em; padding: 0.55rem 0; border-bottom: var(--rule-soft); margin: 0;
  }
  .spec dt { color: var(--ink-faint); font-weight: 500; padding-right: 2rem; white-space: nowrap; }
  .spec dd { color: var(--ink); font-weight: 700; text-align: right; }

  .cmdbar {
    display: flex; align-items: stretch; border: var(--rule-2);
    background: var(--paper); margin-top: 1.75rem; max-width: 34rem;
  }
  .cmdbar-sig {
    display: flex; align-items: center; padding: 0 0.85rem;
    background: var(--red); color: var(--paper);
    font-family: var(--mono); font-size: 0.8125rem; font-weight: 700;
  }
  .cmdbar code {
    flex: 1; display: flex; align-items: center; padding: 0.9rem 1rem;
    font-size: 0.875rem; font-weight: 500; letter-spacing: -0.01em; overflow-x: auto;
    white-space: nowrap;
  }
  .btn-copy {
    appearance: none; border: 0; border-left: var(--rule-2); background: var(--paper);
    color: var(--ink); cursor: pointer; padding: 0 1.1rem;
    font-family: var(--mono); font-size: 0.625rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.14em;
    transition: background .12s linear, color .12s linear;
  }
  .btn-copy:hover { background: var(--ink); color: var(--paper); }
  .btn-copy[data-done="1"] { background: var(--red); color: var(--paper); border-left-color: var(--red); }

  .hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-top: 1rem; }
  .btn {
    display: inline-flex; align-items: center; gap: 0.6rem;
    padding: 0.85rem 1.4rem; border: var(--rule-2);
    font-family: var(--mono); font-size: 0.6875rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.14em;
    transition: background .12s linear, color .12s linear, border-color .12s linear;
  }
  .btn--solid { background: var(--ink); color: var(--paper); }
  .btn--solid:hover { background: var(--red); border-color: var(--red); }
  .btn--ghost:hover { background: var(--ink); color: var(--paper); }
  .btn .arw { color: var(--red); }
  .btn--solid .arw { color: var(--red); }
  .btn--solid:hover .arw { color: var(--paper); }

  .hero-foot { margin-top: clamp(2rem, 5vw, 3.5rem); height: 74px; }

  /* ==================== HAZARD STRIPE + MARQUEE ==================== */

  .hazard { height: 22px; border-bottom: var(--rule);
    background: repeating-linear-gradient(45deg, var(--red) 0 11px, var(--paper) 11px 22px); }

  .marquee { overflow: hidden; border-bottom: var(--rule); background: var(--ink); color: var(--paper); }
  .marquee-track { display: flex; width: max-content; animation: slide 38s linear infinite; }
  .marquee-track span {
    font-family: var(--mono); font-size: 0.6875rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.22em;
    padding: 0.7rem 0; white-space: nowrap;
  }
  .marquee-track b { color: var(--red); font-weight: 700; padding: 0 1.5rem; }
  @keyframes slide { from { transform: translateX(0); } to { transform: translateX(-50%); } }
  @media (prefers-reduced-motion: reduce) { .marquee-track { animation: none; } }

  /* ==================== INK PANELS (terminal / code) ==================== */

  .panel { border: var(--rule); background: var(--ink); color: var(--on-ink); }
  .panel-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 0.6rem 1rem; border-bottom: 1px solid #2A2A28;
    font-family: var(--mono); font-size: 0.625rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.14em; color: var(--on-ink-mute);
  }
  .panel-bar .lbl { color: var(--on-ink); }
  .panel-body { padding: clamp(1rem, 2.5vw, 1.6rem); font-family: var(--mono); font-size: 0.8125rem; line-height: 1.7; overflow-x: auto; }

  .panel .btn-copy { border: 1px solid #2A2A28; background: transparent; color: var(--on-ink-mute); padding: 0.3rem 0.7rem; }
  .panel .btn-copy:hover { background: var(--red); border-color: var(--red); color: var(--paper); }
  .panel .btn-copy[data-done="1"] { background: var(--red); border-color: var(--red); color: var(--paper); }

  .ln-cmd { display: flex; gap: 0.6rem; }
  .ln-cmd .sig { color: var(--red); font-weight: 700; flex: none; }
  .ln-out { color: var(--on-ink-mute); padding-left: 1.35rem; }
  .ln-out em { font-style: normal; color: var(--on-ink); font-weight: 500; }
  .ln-group + .ln-group { margin-top: 0.9rem; }
  .ln-note { color: #5E5C57; }

  .panel-body::-webkit-scrollbar { height: 8px; }
  .panel-body::-webkit-scrollbar-track { background: #161614; }
  .panel-body::-webkit-scrollbar-thumb { background: #3A3A36; }

  /* ==================== STATS ==================== */

  .stats { grid-template-columns: 1fr; }
  @media (min-width: 720px) {
    .stats { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
    .stat--hero { grid-column: 1; grid-row: 1 / span 2; justify-content: center; }
  }
  .stat { padding: clamp(1.5rem, 3.5vw, 2.5rem) var(--pad); display: flex; flex-direction: column; }
  .stat-n {
    font-family: var(--display); font-size: clamp(2.4rem, 6.5vw, 4.25rem);
    line-height: 0.9; letter-spacing: -0.045em; margin: 0 0 0.6rem;
    font-variant-numeric: tabular-nums;
  }
  .stat-n--hero { font-size: clamp(3.5rem, 12.5vw, 9.5rem); line-height: 0.84; margin-bottom: 1rem; }
  .stat-n--hero[data-scrambling] { color: var(--red); }
  .stat-l { color: var(--ink-mute); }
  .stat-i { color: var(--red); font-weight: 700; display: block; margin-bottom: 0.9rem; }

  /* ==================== FEATURE / FILE CARDS ==================== */

  .cards { grid-template-columns: 1fr; }
  @media (min-width: 700px) { .cards { grid-template-columns: repeat(2, 1fr); } }
  @media (min-width: 1000px) { .cards { grid-template-columns: repeat(3, 1fr); } }

  .card { padding: clamp(1.5rem, 3vw, 2.25rem); display: flex; flex-direction: column; gap: 0.75rem; transition: background .12s linear; }
  .card:hover { background: var(--paper-2); }
  .card-i { display: flex; align-items: center; justify-content: space-between; color: var(--ink-faint); }
  .card-i b { color: var(--red); font-weight: 700; }
  .card h3 { margin: 0.4rem 0 0; font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.02em; text-transform: uppercase; }
  .card p { margin: 0; font-size: 0.875rem; line-height: 1.55; color: var(--ink-mute); }
  .card-cmds { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: auto; padding-top: 0.75rem; }
  .chip {
    font-family: var(--mono); font-size: 0.6875rem; font-weight: 500;
    border: var(--rule); padding: 0.28rem 0.5rem; background: var(--paper);
    white-space: nowrap;
  }
  .chip--red { border-color: var(--red); color: var(--red); }
  .card-path { font-family: var(--mono); font-size: 0.75rem; font-weight: 700; color: var(--red); letter-spacing: 0.02em; word-break: break-all; }

  /* ==================== WALKTHROUGH ==================== */

  .steps { margin-top: clamp(1.5rem, 3vw, 2.5rem); }
  .step { display: grid; grid-template-columns: 1fr; gap: 0.6rem; padding: clamp(1.1rem, 2.4vw, 1.6rem); }
  @media (min-width: 780px) { .step { grid-template-columns: 8.5rem 1fr; gap: 1.5rem; align-items: start; } }
  .step-n { font-family: var(--mono); font-size: 0.625rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-faint); }
  .step-n b { color: var(--red); display: block; font-size: 1.5rem; letter-spacing: -0.02em; line-height: 1; margin-bottom: 0.3rem; font-family: var(--display); font-weight: 400; }
  .step-cmd { font-family: var(--mono); font-size: 0.8125rem; font-weight: 500; display: block; }
  .step-cmd .sig { color: var(--red); font-weight: 700; margin-right: 0.5rem; }
  .step-r { font-family: var(--mono); font-size: 0.75rem; color: var(--ink-mute); display: block; margin-top: 0.35rem; }
  .step-r::before { content: '→ '; color: var(--red); }

  /* ==================== COMMAND TABLE ==================== */

  table.cmdtbl { width: 100%; border-collapse: collapse; min-width: 640px; }
  .cmdtbl th {
    text-align: left; font-family: var(--mono); font-size: 0.5625rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.18em; color: var(--paper);
    background: var(--ink); padding: 0.7rem 1rem; white-space: nowrap;
  }
  .cmdtbl td { border-top: var(--rule-soft); padding: 0.85rem 1rem; vertical-align: top; }
  .cmdtbl tbody tr:hover { background: var(--paper-2); }
  .cmdtbl .t-i { font-family: var(--mono); font-size: 0.6875rem; font-weight: 700; color: var(--ink-faint); width: 3.5rem; }
  .cmdtbl tbody tr:hover .t-i { color: var(--red); }
  .cmdtbl .t-c { font-family: var(--mono); font-size: 0.8125rem; font-weight: 700; white-space: nowrap; width: 1%; }
  .cmdtbl .t-d { font-size: 0.875rem; line-height: 1.5; color: var(--ink-mute); }

  /* ==================== CHANGELOG ==================== */

  .rel { border-top: var(--rule-2); }
  .rel + .rel { margin-top: clamp(2rem, 4vw, 3rem); }
  .rel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; padding: 0.9rem 0 1.1rem; }
  .rel-v { font-family: var(--display); font-size: clamp(1.5rem, 3.4vw, 2.25rem); letter-spacing: -0.04em; line-height: 1; text-transform: uppercase; }
  .rel-d { font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.12em; color: var(--ink-faint); text-transform: uppercase; }
  .rel-badge {
    font-family: var(--mono); font-size: 0.5625rem; font-weight: 700; letter-spacing: 0.18em;
    text-transform: uppercase; padding: 0.35rem 0.6rem; margin-left: auto;
    background: var(--red); color: var(--paper);
  }
  .rel-badge--out { background: var(--paper); color: var(--ink); border: var(--rule); }

  .entry { display: grid; grid-template-columns: 1fr; gap: 0.5rem; padding: clamp(1rem, 2.2vw, 1.4rem); }
  @media (min-width: 720px) { .entry { grid-template-columns: 5rem 1fr; gap: 1.25rem; align-items: start; } }
  .entry-t {
    font-family: var(--mono); font-size: 0.5625rem; font-weight: 700; letter-spacing: 0.18em;
    text-transform: uppercase; border: var(--rule); padding: 0.25rem 0; text-align: center;
    justify-self: start; min-width: 3.4rem;
  }
  .entry-t--fix { border-color: var(--red); color: var(--red); }
  .entry-t--feat { background: var(--ink); color: var(--paper); }
  .entry h4 { margin: 0 0 0.35rem; font-size: 0.9375rem; font-weight: 700; letter-spacing: -0.015em; line-height: 1.35; }
  .entry p { margin: 0; font-size: 0.8125rem; line-height: 1.55; color: var(--ink-mute); }

/* ==========================================================================
   DOCS PAGE (docs.html)
   ========================================================================== */

  /* ==========================================================================
     GIMAN® DOCS — DOCS-LAYOUT STYLES / REV 1.0.5
     ========================================================================== */

  /* ==================== DOCS LAYOUT ==================== */

  .docs-frame {
    max-width: 1480px;
    margin: 0 auto;
    border-left: var(--rule);
    border-right: var(--rule);
    display: flex;
    min-height: calc(100vh - 3.25rem);
  }

  /* --- Sidebar --- */

  .sidebar {
    width: var(--sidebar-w);
    flex: none;
    border-right: var(--rule);
    position: sticky;
    top: 3.25rem;
    height: calc(100vh - 3.25rem);
    overflow-y: auto;
    background: var(--paper);
    z-index: 50;
    padding: 1.5rem 0;
  }

  .sidebar-label {
    font-family: var(--mono); font-size: 0.5625rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.18em;
    color: var(--ink-faint); padding: 0 1rem 0.75rem;
  }

  .sidebar-nav { list-style: none; margin: 0; padding: 0; }

  .sidebar-nav li { margin: 0; }

  .sidebar-nav a {
    display: block;
    padding: 0.38rem 1rem;
    font-family: var(--mono); font-size: 0.6875rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--ink-mute);
    border-left: 3px solid transparent;
    transition: color .12s linear, background .12s linear, border-color .12s linear;
  }
  .sidebar-nav a:hover { background: var(--paper-2); color: var(--ink); }

  .sidebar-nav a.active,
  .sidebar-nav a[aria-current="true"] {
    color: var(--red);
    border-left-color: var(--red);
    background: var(--paper-2);
    font-weight: 700;
  }

  .sidebar-sub { list-style: none; margin: 0; padding: 0; }

  .sidebar-sub a {
    padding-left: 2rem;
    font-size: 0.625rem;
    letter-spacing: 0.06em;
    color: var(--ink-faint);
  }

  .sidebar-cat {
    font-family: var(--mono); font-size: 0.5rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.2em;
    color: var(--ink-faint); padding: 1rem 1rem 0.35rem;
  }
  .sidebar-cat:first-of-type { padding-top: 0.25rem; }

  .sidebar-tree-toggle {
    display: block; width: 100%;
    font-family: var(--mono); font-size: 0.625rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--ink-mute);
    background: none; border: none; cursor: pointer;
    padding: 0.45rem 1rem;
    text-align: left;
    transition: color .12s linear, background .12s linear;
  }
  .sidebar-tree-toggle:hover { background: var(--paper-2); color: var(--ink); }
  .tree-arrow {
    display: inline-block; width: 1em; margin-right: 0.15em;
    font-size: 0.85em; transition: transform .15s linear;
  }
  .sidebar-tree-toggle[aria-expanded="true"] .tree-arrow { transform: rotate(90deg); }
  .sidebar-tree-toggle + .sidebar-sub {
    overflow: hidden;
    max-height: 30rem; transition: max-height .2s ease;
  }
  .sidebar-tree-toggle[aria-expanded="false"] + .sidebar-sub { max-height: 0; }

  .sidebar-divider {
    height: 1px;
    background: var(--paper-3);
    margin: 0.75rem 0;
  }

  /* --- Main content --- */

  .content {
    flex: 1;
    min-width: 0;
    padding: var(--pad-y) var(--pad);
  }

  .content-section {
    margin-bottom: clamp(3rem, 6vw, 5rem);
  }
  .content-section:last-child { margin-bottom: 0; }

  .content-section h2 {
    font-family: var(--display);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: -0.04em;
    line-height: 0.92;
    font-size: clamp(1.5rem, 3.4vw, 2.5rem);
    margin: 0 0 0.5rem;
    scroll-margin-top: 4.5rem;
  }

  .content-section h3 {
    font-family: var(--display);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: -0.035em;
    line-height: 0.94;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    margin: 2.5rem 0 0.75rem;
    padding-top: 0.75rem;
    border-top: var(--rule-soft);
    scroll-margin-top: 4.5rem;
  }

  .heading-anchor {
    opacity: 0;
    margin-left: .5em;
    font-family: var(--mono); font-size: 0.75em; font-weight: 500;
    color: var(--ink-faint);
    transition: opacity .14s linear, color .14s linear;
    vertical-align: 0;
  }
  .content-section h3:hover .heading-anchor,
  .content-section h2:hover .heading-anchor { opacity: 1; }
  .heading-anchor:hover { color: var(--red); }

  .content-section h4 {
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    margin: 1.5rem 0 0.5rem;
    text-transform: uppercase;
  }

  .content-section p {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--ink-mute);
    max-width: 88ch;
    margin: 0 0 0.9rem;
  }
  .content-section p strong { color: var(--ink); font-weight: 600; }

  .content-section ul, .content-section ol {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--ink-mute);
    max-width: 88ch;
    margin: 0 0 0.9rem;
    padding-left: 1.4rem;
  }
  .content-section li { margin-bottom: 0.3rem; }

  .code-block {
    border: var(--rule);
    background: var(--ink);
    color: var(--on-ink);
    margin: 0.9rem 0;
    font-family: var(--mono);
    font-size: 0.8125rem;
    line-height: 1.7;
    padding: 0;
    overflow-x: auto;
    max-width: 60rem;
  }
  .code-block pre {
    margin: 0;
    padding: 1rem 1.2rem;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
  }

  .tbl-wrap { border: var(--rule); overflow-x: auto; margin: 0.9rem 0; max-width: 60rem; }
  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    line-height: 1.5;
  }
  table th {
    text-align: left;
    font-family: var(--mono); font-size: 0.5625rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.18em; color: var(--paper);
    background: var(--ink); padding: 0.7rem 1rem; white-space: nowrap;
  }
  table td {
    border-top: var(--rule-soft);
    padding: 0.7rem 1rem;
    vertical-align: top;
    color: var(--ink-mute);
  }
  table td:first-child { font-family: var(--mono); font-size: 0.8125rem; color: var(--ink); font-weight: 700; white-space: nowrap; }
  table tbody tr:hover { background: var(--paper-2); }

  .content-section blockquote {
    margin: 0.9rem 0;
    padding: 0.6rem 0 0.6rem 0.9rem;
    border-left: 3px solid var(--red);
    font-size: 0.8125rem;
    line-height: 1.55;
    color: var(--ink-mute);
    max-width: 60rem;
  }
  .content-section blockquote code { font-size: 0.9em; }

  .content-hr {
    border: 0;
    border-top: var(--rule);
    margin: 2.5rem 0;
  }

  .sidebar::-webkit-scrollbar { width: 6px; }
  .sidebar::-webkit-scrollbar-track { background: var(--paper-2); }
  .sidebar::-webkit-scrollbar-thumb { background: var(--paper-3); }

  /* ==================== RESPONSIVE ==================== */

  @media (max-width: 860px) {
    .sidebar {
      position: fixed;
      top: 3.25rem;
      left: 0;
      bottom: 0;
      z-index: 90;
      transform: translateX(-100%);
      transition: transform .18s linear;
      box-shadow: 2px 0 12px rgba(0,0,0,.12);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay {
      display: none;
      position: fixed; inset: 0; z-index: 89;
      background: rgba(5,5,5,.22);
    }
    .sidebar-overlay.open { display: block; }
    .sidebar-toggle {
      display: flex;
      align-items: center; gap: 0.35rem;
      padding: 0 1rem; border-left: var(--rule);
      font-family: var(--mono); font-size: 0.625rem; font-weight: 500;
      text-transform: uppercase; letter-spacing: 0.14em;
      background: none; color: var(--ink); cursor: pointer;
      transition: background .12s linear, color .12s linear;
    }
    .sidebar-toggle:hover { background: var(--ink); color: var(--paper); }
    .content { padding: clamp(1.5rem, 5vw, 2.5rem) clamp(1rem, 3vw, 2rem); }
  }

  @media (min-width: 861px) {
    .sidebar-toggle, .sidebar-overlay { display: none; }
  }
