:root {
  --docs-bg: #070605;
  --docs-panel: rgba(20, 15, 12, 0.78);
  --docs-panel-strong: rgba(28, 19, 14, 0.92);
  --docs-text: #fff8f1;
  --docs-copy: #d8cec6;
  --docs-muted: #9f958d;
  --docs-line: rgba(255, 190, 136, 0.17);
  --docs-line-strong: rgba(255, 168, 100, 0.34);
  --docs-warm: #ff9955;
  --docs-cyan: #72d7f4;
  --docs-green: #72dca5;
  --docs-yellow: #f2c66d;
  --docs-red: #f28a82;
}

* { box-sizing: border-box; }

body.docs-body {
  margin: 0;
  background:
    radial-gradient(circle at 22% 8%, rgba(112, 50, 19, 0.22), transparent 31rem),
    var(--docs-bg);
  color: var(--docs-text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.64;
}

.docs-body::before { opacity: 0.42; }

.docs-frame {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5rem);
  width: min(100% - 3rem, 1420px);
  margin: 0 auto;
  padding: 2.25rem 0 7rem;
}

.docs-sidebar {
  position: sticky;
  top: calc(var(--header-offset) + 1.4rem);
  align-self: start;
  max-height: calc(100vh - var(--header-offset) - 2.8rem);
  overflow: auto;
  padding: 0 0.75rem 2rem 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 153, 85, 0.36) transparent;
}

.docs-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.docs-sidebar-head a {
  color: var(--docs-text);
  font-size: 0.94rem;
  font-weight: 760;
  text-decoration: none;
}

.docs-version {
  border: 1px solid var(--docs-line);
  border-radius: 999px;
  padding: 0.2rem 0.48rem;
  color: #e6b28c;
  font-size: 0.67rem;
  font-weight: 750;
  letter-spacing: 0.07em;
}

.docs-search {
  position: relative;
  margin-bottom: 1.2rem;
}

.docs-search input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--docs-line);
  border-radius: 11px;
  padding: 0.68rem 0.78rem 0.68rem 2.3rem;
  background: rgba(255, 255, 255, 0.035);
  color: var(--docs-text);
  font: inherit;
  font-size: 0.84rem;
}

.docs-search::before {
  content: "⌕";
  position: absolute;
  top: 0.37rem;
  left: 0.75rem;
  color: var(--docs-muted);
  font-size: 1.15rem;
  pointer-events: none;
}

.docs-search input::placeholder { color: #827870; }

.docs-nav-group { margin: 0 0 1.15rem; }

.docs-nav-group strong {
  display: block;
  margin: 0 0 0.38rem;
  color: #b6aba3;
  font-size: 0.67rem;
  font-weight: 780;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.docs-nav-group a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 34px;
  margin: 1px 0;
  border-radius: 8px;
  padding: 0.38rem 0.55rem;
  color: #a99f97;
  font-size: 0.83rem;
  font-weight: 560;
  text-decoration: none;
}

.docs-nav-group a::before {
  content: "";
  width: 4px;
  height: 4px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #675d56;
}

.docs-nav-group a:hover,
.docs-nav-group a[aria-current="page"] {
  background: rgba(255, 153, 85, 0.09);
  color: #fff2e8;
}

.docs-nav-group a[aria-current="page"]::before {
  background: var(--docs-warm);
  box-shadow: 0 0 10px rgba(255, 153, 85, 0.75);
}

.docs-no-results {
  display: none;
  color: var(--docs-muted);
  font-size: 0.8rem;
}

.docs-menu-toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--docs-line);
  border-radius: 10px;
  padding: 0.54rem 0.7rem;
  background: rgba(255, 255, 255, 0.035);
  color: var(--docs-text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
}

.doc-page {
  width: min(100%, 920px);
  min-width: 0;
}

.doc-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.2rem;
  color: var(--docs-muted);
  font-size: 0.76rem;
}

.doc-breadcrumbs a { color: #c6b7ac; text-decoration: none; }
.doc-breadcrumbs span { color: #675d56; }

.doc-hero {
  position: relative;
  padding: clamp(1rem, 3vw, 2rem) 0 clamp(2.25rem, 6vw, 4.3rem);
}

.doc-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.9rem;
  color: #ffc79d;
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.doc-eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--docs-warm);
  box-shadow: 0 0 18px rgba(255, 153, 85, 0.8);
}

.doc-page h1,
.doc-page h2,
.doc-page h3,
.doc-page h4 {
  color: var(--docs-text);
  line-height: 1.13;
  letter-spacing: -0.034em;
}

.doc-page h1 {
  max-width: 820px;
  margin: 0 0 1rem;
  font-size: clamp(2.5rem, 7vw, 5.7rem);
  letter-spacing: -0.06em;
}

.doc-page h2 {
  scroll-margin-top: calc(var(--header-offset) + 1.5rem);
  margin: 0 0 1rem;
  font-size: clamp(1.65rem, 3.6vw, 2.65rem);
}

.doc-page h3 {
  scroll-margin-top: calc(var(--header-offset) + 1.5rem);
  margin: 1.55rem 0 0.55rem;
  font-size: 1.15rem;
}

.doc-page h4 { margin: 1.2rem 0 0.4rem; font-size: 0.96rem; }

.doc-page p,
.doc-page li { color: var(--docs-copy); }

.doc-page p { margin: 0.45rem 0 1rem; }
.doc-page li + li { margin-top: 0.42rem; }

.doc-lead {
  max-width: 760px;
  color: #eee3db !important;
  font-size: clamp(1.08rem, 2.2vw, 1.34rem);
  line-height: 1.55;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.35rem;
}

.doc-section {
  padding: clamp(2.5rem, 6vw, 4.6rem) 0;
  border-top: 1px solid var(--docs-line);
}

.doc-section-intro {
  max-width: 760px;
  margin-bottom: 1.55rem !important;
  font-size: 1.04rem;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0.28rem 0.58rem;
  font-size: 0.68rem;
  font-weight: 760;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-now { color: var(--docs-green); background: rgba(114, 220, 165, 0.07); }
.status-foundation { color: var(--docs-cyan); background: rgba(114, 215, 244, 0.07); }
.status-designed { color: var(--docs-yellow); background: rgba(242, 198, 109, 0.07); }
.status-forbidden { color: var(--docs-red); background: rgba(242, 138, 130, 0.07); }
.status-draft { color: #d5a8f0; background: rgba(213, 168, 240, 0.07); }

.doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 1.25rem 0;
}

.doc-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.doc-card {
  min-width: 0;
  border: 1px solid var(--docs-line);
  border-radius: 15px;
  padding: 1.15rem;
  background:
    linear-gradient(145deg, rgba(255, 153, 85, 0.035), transparent 55%),
    var(--docs-panel);
}

.doc-card h3 { margin-top: 0; }
.doc-card p:last-child, .doc-card ul:last-child { margin-bottom: 0; }
.doc-card-wide { grid-column: 1 / -1; }
.doc-card .status { margin-bottom: 0.72rem; }

.doc-link-card {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.doc-link-card:hover {
  border-color: var(--docs-line-strong);
  background: var(--docs-panel-strong);
  transform: translateY(-2px);
}

.doc-link-card .arrow { display: block; margin-top: 1rem; color: var(--docs-warm); font-weight: 750; }

.doc-callout {
  margin: 1.4rem 0;
  border: 1px solid var(--docs-line);
  border-left: 3px solid var(--docs-warm);
  border-radius: 0 14px 14px 0;
  padding: 1.05rem 1.15rem;
  background: rgba(255, 153, 85, 0.065);
}

.doc-callout strong { color: #ffe6d4; }
.doc-callout p:last-child { margin-bottom: 0; }
.doc-callout.cyan { border-left-color: var(--docs-cyan); background: rgba(114, 215, 244, 0.055); }
.doc-callout.green { border-left-color: var(--docs-green); background: rgba(114, 220, 165, 0.055); }
.doc-callout.red { border-left-color: var(--docs-red); background: rgba(242, 138, 130, 0.055); }

.doc-flow {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  margin: 1.25rem 0 1.5rem;
  overflow-x: auto;
  padding: 0.1rem 0 0.7rem;
}

.doc-flow-step {
  min-width: 145px;
  flex: 1 0 145px;
  border: 1px solid var(--docs-line);
  border-radius: 12px;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  color: #f0e5dc;
  font-size: 0.84rem;
  font-weight: 690;
}

.doc-flow-step small { display: block; margin-top: 0.24rem; color: var(--docs-muted); font-weight: 480; line-height: 1.4; }
.doc-flow-arrow { display: grid; place-items: center; color: var(--docs-warm); }

.doc-table-wrap {
  width: 100%;
  margin: 1.3rem 0 1.6rem;
  overflow-x: auto;
  border: 1px solid var(--docs-line);
  border-radius: 14px;
}

.doc-table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
  background: rgba(11, 9, 8, 0.72);
  font-size: 0.84rem;
}

.doc-table th,
.doc-table td {
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--docs-line);
  text-align: left;
  vertical-align: top;
}

.doc-table th { color: #f4c6a5; font-size: 0.7rem; letter-spacing: 0.07em; text-transform: uppercase; }
.doc-table td { color: var(--docs-copy); }
.doc-table tr:last-child td { border-bottom: 0; }

.doc-code,
.doc-page pre {
  margin: 1.15rem 0 1.5rem;
  overflow-x: auto;
  border: 1px solid var(--docs-line);
  border-radius: 13px;
  padding: 1rem;
  background: #0d0b09;
  color: #f0d7c4;
  font: 0.82rem/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.doc-page code {
  border: 1px solid rgba(255, 190, 136, 0.13);
  border-radius: 5px;
  padding: 0.1em 0.32em;
  background: rgba(255, 255, 255, 0.04);
  color: #f2c6a8;
  font: 0.88em ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.doc-page pre code { border: 0; padding: 0; background: transparent; color: inherit; font-size: inherit; }

.doc-figure {
  margin: 1.4rem 0 1.8rem;
  border: 1px solid var(--docs-line);
  border-radius: 17px;
  padding: 1.2rem;
  background: var(--docs-panel);
}

.doc-figure figcaption { margin-top: 0.85rem; color: var(--docs-muted); font-size: 0.78rem; }

.plane-map {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 1px;
  overflow-x: auto;
  border: 1px solid var(--docs-line);
  border-radius: 14px;
  background: var(--docs-line);
}

.plane-map > div {
  min-width: 145px;
  padding: 1rem;
  background: linear-gradient(155deg, rgba(48, 29, 17, 0.96), rgba(12, 10, 8, 0.98));
}

.plane-map b { display: block; margin-bottom: 0.42rem; color: #ffe0ca; font-size: 0.75rem; }
.plane-map small { color: var(--docs-muted); line-height: 1.4; }

.doc-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 1.25rem; }

.doc-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--docs-line-strong);
  border-radius: 11px;
  padding: 0.58rem 0.82rem;
  background: rgba(255, 153, 85, 0.08);
  color: #fff3ea !important;
  font-size: 0.82rem;
  font-weight: 720;
  text-decoration: none !important;
}

.doc-button:hover { background: rgba(255, 153, 85, 0.15); }
.doc-button.secondary { border-color: var(--docs-line); background: rgba(255, 255, 255, 0.025); }

.doc-anchor {
  margin-left: 0.4rem;
  color: #8f8177 !important;
  font-size: 0.7em;
  text-decoration: none !important;
  opacity: 0;
  transition: opacity 0.16s ease;
}

h2:hover .doc-anchor,
h3:hover .doc-anchor,
.doc-anchor:focus { opacity: 1; }

.doc-footer {
  margin-top: 3rem;
  border-top: 1px solid var(--docs-line);
  padding: 1.6rem 0 0;
  color: var(--docs-muted);
  font-size: 0.78rem;
}

.doc-footer p { color: inherit; }

@media (max-width: 1020px) {
  .docs-frame { grid-template-columns: 1fr; gap: 1rem; padding-top: 1rem; }
  .docs-menu-toggle { display: inline-flex; }
  .docs-sidebar {
    position: fixed;
    z-index: 940;
    inset: var(--header-offset) auto 0 0;
    width: min(86vw, 320px);
    max-height: none;
    padding: 1.2rem;
    border-right: 1px solid var(--docs-line);
    background: rgba(7, 6, 5, 0.98);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }
  body.docs-nav-open .docs-sidebar { transform: translateX(0); }
  body.docs-nav-open::after {
    content: "";
    position: fixed;
    z-index: 930;
    inset: var(--header-offset) 0 0;
    background: rgba(0, 0, 0, 0.62);
  }
  .doc-page { margin: 0 auto; }
}

@media (max-width: 720px) {
  .docs-frame { width: min(100% - 1.25rem, 1420px); }
  .doc-grid, .doc-grid.three { grid-template-columns: 1fr; }
  .doc-card-wide { grid-column: auto; }
  .doc-page h1 { font-size: clamp(2.35rem, 13vw, 4rem); }
  .doc-section { padding: 2.7rem 0; }
  .plane-map { grid-template-columns: repeat(5, 145px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .docs-sidebar, .doc-link-card { transition: none; }
}
