:root {
  --panel: rgba(12, 13, 11, 0.46);
  --panel-strong: rgba(12, 13, 11, 0.94);
  --line: rgba(255, 255, 255, 0.16);
  --line-hot: rgba(238, 151, 56, 0.76);
  --text: #f5efe4;
  --muted: #cfc1ad;
  --clay: #ee9738;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #14110e; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font: 1rem/1.67 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(90deg, rgba(7, 8, 8, 0.58), rgba(10, 10, 9, 0.2) 48%, rgba(7, 8, 8, 0.58)),
    linear-gradient(180deg, rgba(8, 8, 7, 0.18), rgba(8, 8, 7, 0.46)),
    url("../../../../assets/images/rutted-mx-background.png") center / cover fixed no-repeat;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.58);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 30% 0%, rgba(238, 151, 56, 0.12), transparent 34%);
}
a { color: var(--clay); }
a:hover { color: #ffc47f; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 10; padding: .7rem 1rem; background: #111; }
.docs-shell { position: relative; width: min(1440px, calc(100% - 40px)); margin: auto; padding: 20px 0; }
.mobile-menu-toggle {
  display: none; width: 100%; margin: 0 0 14px; padding: 13px 16px;
  border: 1px solid var(--line-hot); color: var(--text); background: var(--panel-strong);
  font: inherit; font-weight: 850; text-transform: uppercase; cursor: pointer;
}
.docs-grid { display: grid; grid-template-columns: minmax(240px, 290px) minmax(0, 1fr); gap: 28px; align-items: start; }
.docs-nav, .docs-content { border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); }
.docs-nav { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; }
.nav-brand {
  min-height: 150px; display: grid; place-content: center; padding: 24px 16px;
  border-bottom: 1px solid var(--line); text-align: center;
  background: linear-gradient(145deg, rgba(238,151,56,.22), rgba(0,0,0,.42));
}
.nav-brand strong { display: block; color: #fff8e8; font-size: 1.55rem; font-style: italic; letter-spacing: .04em; text-transform: uppercase; }
.nav-brand span { display: block; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.home-link { display: block; margin: 14px; padding: 11px 14px; border: 1px solid var(--line-hot); color: #fff8e8; font-size: .78rem; font-weight: 850; letter-spacing: .06em; text-align: center; text-decoration: none; text-transform: uppercase; }
.docs-nav h2 { margin: 0; padding: 13px 16px; border-block: 1px solid var(--line); color: var(--muted); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; }
.docs-nav ul { margin: 0; padding: 8px 0 14px; list-style: none; }
.docs-nav a:not(.home-link) { display: block; padding: 8px 16px; color: var(--muted); font-size: .79rem; font-weight: 700; line-height: 1.25; text-decoration: none; }
.docs-nav a:not(.home-link):hover, .docs-nav a[aria-current="page"] { color: #fff; background: rgba(238,151,56,.13); }
.docs-nav a[aria-current="page"] { border-left: 3px solid var(--clay); padding-left: 13px; }
.docs-nav .nav-secondary { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.docs-content { min-width: 0; padding: clamp(24px, 4vw, 52px); }
.docs-content > :first-child { margin-top: 0; }
h1, h2, h3, h4 { color: #fff8e8; line-height: 1.2; text-wrap: balance; scroll-margin-top: 24px; }
h1 { margin: 0 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line-hot); font-size: clamp(1.8rem, 4vw, 3rem); font-weight: 950; text-transform: uppercase; }
h2 { margin-top: 2.5rem; padding-bottom: .45rem; border-bottom: 1px solid var(--line); font-size: 1.55rem; }
h3 { margin-top: 1.8rem; font-size: 1.18rem; }
.heading-icon { width: 37px; height: 37px; margin-right: .55rem; vertical-align: middle; box-shadow: none !important; }
.lede { max-width: 75ch; color: #fff8e8; font-size: 1.12rem; }
.source-note, .callout { margin: 1.5rem 0; padding: 14px 18px; border-left: 3px solid var(--clay); background: rgba(238,151,56,.1); }
.source-links { display: flex; flex-wrap: wrap; gap: .65rem; margin: 1.5rem 0 2rem; }
.button-link { padding: .55rem .8rem; border: 1px solid var(--line-hot); text-decoration: none; font-weight: 800; }
.toc { columns: 2 18rem; gap: 2rem; padding-left: 1.3rem; }
.toc li { break-inside: avoid; margin-bottom: .3rem; }
.doc-section { padding-top: .2rem; }
.doc-section p { max-width: 88ch; }
.doc-section ul, .doc-section ol { max-width: 84ch; }
.manual-figure { margin: 1.5rem 0; }
.manual-figure img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); box-shadow: 0 10px 32px rgba(0,0,0,.34); }
.manual-figure figcaption { margin-top: .55rem; color: var(--muted); font-size: .86rem; }
.image-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.image-gallery .manual-figure { margin: 0; }
.control-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin: 1.4rem 0; }
.control-card { display: flex; align-items: center; gap: .7rem; min-height: 64px; padding: .65rem; border: 1px solid var(--line); background: rgba(0,0,0,.2); }
.control-card img { width: auto; max-width: 76px; height: auto; image-rendering: auto; }
.control-card span { font-size: .83rem; font-weight: 800; line-height: 1.25; }
.panel-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin: 1.5rem 0 2rem; }
.panel-gallery figure { margin: 0; text-align: center; }
.panel-gallery img { display: block; width: auto; max-width: 100%; height: 300px; margin: 0 auto; object-fit: contain; border: 1px solid var(--line); }
.panel-gallery figcaption { margin-top: .5rem; color: var(--muted); font-size: .85rem; font-weight: 800; }
.track-diagram { margin: 1.5rem 0 2rem; }
.tile-grid { display: grid; width: min(100%, 440px); aspect-ratio: 1; gap: 3px; padding: 3px; border: 1px solid var(--line); background: rgba(0,0,0,.38); }
.tile-grid.grid-3 { grid-template-columns: repeat(3, 1fr); }
.tile-grid.grid-5 { grid-template-columns: repeat(5, 1fr); }
.tile-grid.grid-6 { grid-template-columns: repeat(6, 1fr); }
.tile { display: grid; place-content: center; min-width: 0; border: 1px solid rgba(255,255,255,.14); background: #7b6650; color: #fff; font-size: clamp(.48rem, 1.2vw, .7rem); font-weight: 900; line-height: 1.1; text-align: center; text-shadow: 0 1px 4px #000; }
.tile.perimeter { background: #5e704a; }
.tile.edge { background: #414b50; }
.tile.track { background: #b56731; }
.track-diagram figcaption { margin-top: .65rem; color: var(--muted); font-size: .86rem; }
.three-views { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.command-grid { width: 100%; margin: 1rem 0; border-collapse: collapse; table-layout: fixed; }
.command-grid td:first-child, .command-grid th:first-child { width: 50%; }
.command-grid td:last-child, .command-grid th:last-child { width: 50%; }
.command-grid th, .command-grid td { padding: .65rem .8rem; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.command-grid th { color: #fff8e8; background: rgba(238,151,56,.12); }
code { padding: .12em .34em; border: 1px solid rgba(255,255,255,.12); background: rgba(0,0,0,.32); color: #ffe0b8; text-shadow: none; }
.plain-document { white-space: pre-wrap; overflow-wrap: anywhere; font: .94rem/1.62 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-shadow: none; }
.back-top { display: inline-block; margin-top: 1rem; font-size: .8rem; font-weight: 800; text-transform: uppercase; }
@media (max-width: 800px) {
  .docs-shell { width: min(100% - 24px, 760px); padding: 12px 0; }
  .mobile-menu-toggle { display: block; }
  .docs-grid { display: block; }
  .docs-nav { display: none; position: static; max-height: none; margin-bottom: 14px; }
  .docs-nav.is-open { display: block; }
  .docs-content { padding: 22px 18px; }
  .toc { columns: 1; }
  .image-gallery { grid-template-columns: 1fr; }
  .three-views { grid-template-columns: 1fr; }
  .command-grid { display: block; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
