:root {
  color-scheme: dark;
  --bg: #030715;
  --bg-soft: #071023;
  --panel: #0b1328;
  --panel-strong: #111b35;
  --line: #273149;
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: #f7f9ff;
  --muted: #aab3c6;
  --muted-strong: #d9dfec;
  --brand: #ff650d;
  --brand-strong: #ff7a1a;
  --brand-soft: rgba(255, 101, 13, 0.16);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
  background:
    radial-gradient(circle at 24% 8%, rgba(96, 120, 180, 0.18), transparent 32rem),
    radial-gradient(circle at 74% 0%, rgba(255, 101, 13, 0.12), transparent 24rem),
    linear-gradient(180deg, #030715 0%, #05091a 48%, #030715 100%);
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: clamp(17rem, 22vw, 20rem) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 100vh;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: rgba(5, 9, 26, 0.86);
  backdrop-filter: blur(18px);
}

.sidebar-backdrop,
.menu-button {
  display: none;
}

.brand {
  display: block;
  padding: 1.35rem 1.25rem 1rem;
  text-decoration: none;
  border-bottom: 1px solid var(--line-soft);
}

.brand img {
  display: block;
  width: min(13rem, 100%);
  height: auto;
}

.brand span {
  display: block;
  margin-top: 0.7rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-tree {
  padding: 0.85rem 0.75rem 1.5rem;
}

.nav-tree details {
  margin: 0.2rem 0;
}

.nav-tree summary {
  cursor: pointer;
  list-style: none;
  padding: 0.45rem 0.55rem;
  border-radius: 7px;
  color: var(--muted-strong);
  font-size: 0.9rem;
  font-weight: 700;
}

.nav-tree summary::-webkit-details-marker {
  display: none;
}

.nav-tree summary::before {
  content: "+";
  display: inline-block;
  width: 1.1rem;
  color: var(--brand);
  font-weight: 800;
}

.nav-tree details[open] > summary::before {
  content: "-";
}

.nav-list {
  margin: 0.2rem 0 0.45rem 0.55rem;
  padding: 0 0 0 0.65rem;
  border-left: 1px solid var(--line-soft);
}

.nav-link {
  display: block;
  padding: 0.38rem 0.55rem;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: var(--brand-soft);
}

.content-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3.5rem);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(3, 7, 21, 0.86);
  backdrop-filter: blur(18px);
}

.topbar-title {
  min-width: 0;
}

.eyebrow {
  margin: 0;
  color: var(--brand-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0.1rem 0 0;
  font-size: clamp(1.35rem, 3vw, 2.15rem);
  line-height: 1.15;
}

.content {
  width: 100%;
  min-width: 0;
  padding: clamp(1.25rem, 4vw, 3.5rem);
}

.doc-card {
  width: 100%;
  min-width: 0;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 15, 35, 0.86);
  box-shadow: var(--shadow);
}

.doc-card h1,
.doc-card h2,
.doc-card h3,
.doc-card h4 {
  line-height: 1.2;
}

.doc-card h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 4vw, 3.3rem);
}

.doc-card h2 {
  margin-top: 2.3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line-soft);
  font-size: 1.5rem;
}

.doc-card h3 {
  margin-top: 1.8rem;
  color: var(--muted-strong);
  font-size: 1.15rem;
}

.doc-card p,
.doc-card li {
  color: var(--muted-strong);
}

.doc-card a {
  color: var(--brand-strong);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.doc-card ul,
.doc-card ol {
  padding-left: 1.4rem;
}

.doc-card hr {
  height: 1px;
  border: 0;
  margin: 2rem 0;
  background: var(--line-soft);
}

.doc-card code {
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 0.12rem 0.32rem;
  color: #fff3eb;
  background: rgba(255, 101, 13, 0.13);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.doc-card pre {
  overflow: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #020612;
}

.doc-card pre code {
  border: 0;
  padding: 0;
  color: #eef3ff;
  background: transparent;
}

.doc-card blockquote {
  margin: 1.25rem 0;
  padding: 0.1rem 1rem;
  border-left: 3px solid var(--brand);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 1.4rem 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(2, 6, 18, 0.58);
}

.doc-card table {
  width: 100%;
  min-width: 42rem;
  border-collapse: collapse;
}

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

.doc-card th {
  color: var(--text);
  background: rgba(255, 101, 13, 0.14);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.doc-card tr:last-child td {
  border-bottom: 0;
}

.doc-card td {
  color: var(--muted-strong);
}

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

.pager a,
.pager span {
  min-height: 5.4rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  background: rgba(8, 15, 35, 0.72);
}

.pager span {
  opacity: 0.45;
}

.pager small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pager strong {
  display: block;
  margin-top: 0.25rem;
  color: var(--text);
}

.pager-next {
  text-align: right;
}

.site-footer {
  margin-top: auto;
  padding: 1.4rem clamp(1rem, 4vw, 3.5rem);
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer img {
  width: 7rem;
  height: auto;
  vertical-align: middle;
  margin-right: 0.75rem;
}

.not-found {
  min-height: 24rem;
  display: grid;
  align-content: center;
}

@media (min-width: 1440px) {
  .app-shell {
    grid-template-columns: 22rem minmax(0, 1fr);
  }

  .content {
    padding: 3.5rem 4.5rem;
  }

  .doc-card {
    padding: 3rem;
  }

  .topbar,
  .site-footer {
    padding-left: 4.5rem;
    padding-right: 4.5rem;
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 16.5rem minmax(0, 1fr);
  }

  .brand {
    padding: 1.15rem 1rem 0.9rem;
  }

  .brand img {
    width: min(11.5rem, 100%);
  }

  .nav-tree {
    padding: 0.75rem 0.6rem 1.2rem;
  }

  .nav-link,
  .nav-tree summary {
    font-size: 0.86rem;
  }

  .topbar,
  .site-footer {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .content {
    padding: 1.5rem;
  }

  .doc-card {
    padding: 1.5rem;
  }
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(20rem, 86vw);
    height: 100vh;
    max-height: none;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    box-shadow: 24px 0 80px rgba(0, 0, 0, 0.42);
  }

  .menu-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: block;
    pointer-events: none;
    border: 0;
    opacity: 0;
    background: rgba(0, 0, 0, 0.58);
    transition: opacity 180ms ease;
  }

  .menu-open .sidebar-backdrop {
    pointer-events: auto;
    opacity: 1;
  }

  .brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
  }

  .brand img {
    width: 9.5rem;
  }

  .brand span {
    margin-top: 0;
  }

  .nav-tree {
    padding: 0.65rem 0.75rem 1rem;
  }

  .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.8rem;
    padding: 1rem;
  }

  .menu-button {
    display: inline-grid;
    grid-template-columns: 1.2rem auto;
    align-items: center;
    gap: 0.55rem;
    width: max-content;
    min-height: 2.45rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--text);
    background: rgba(8, 15, 35, 0.86);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
  }

  .menu-button span {
    grid-column: 1;
    display: block;
    width: 1.2rem;
    height: 2px;
    border-radius: 999px;
    background: var(--brand);
  }

  .menu-button strong {
    grid-column: 2;
    grid-row: 1 / 4;
    font-size: 0.82rem;
  }

  .topbar-title {
    min-width: 0;
  }

  .content {
    padding: 1rem;
  }

  .doc-card {
    padding: 1.1rem;
  }

  .doc-card h1 {
    font-size: 2rem;
  }

  .doc-card h2 {
    font-size: 1.35rem;
  }

  .doc-card table {
    min-width: 38rem;
  }

  .pager {
    grid-template-columns: 1fr;
  }

  .pager-next {
    text-align: left;
  }

  .site-footer {
    padding: 1rem;
  }
}

@media (max-width: 560px) {
  body {
    line-height: 1.55;
  }

  .sidebar {
    width: min(18rem, 88vw);
  }

  .brand {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
  }

  .brand img {
    width: 8rem;
  }

  .topbar h1 {
    font-size: 1.45rem;
  }

  .menu-button {
    grid-template-columns: 1rem;
    gap: 0.18rem;
    min-height: 2.25rem;
    padding: 0.42rem 0.55rem;
  }

  .menu-button span {
    width: 1rem;
  }

  .menu-button strong {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .eyebrow {
    font-size: 0.7rem;
  }

  .content {
    padding: 0.75rem;
  }

  .doc-card {
    padding: 0.9rem;
  }

  .doc-card h1 {
    font-size: 1.65rem;
  }

  .doc-card h2 {
    margin-top: 1.8rem;
    font-size: 1.2rem;
  }

  .doc-card pre {
    padding: 0.8rem;
  }

  .doc-card table {
    min-width: 34rem;
  }

  .doc-card th,
  .doc-card td {
    padding: 0.65rem 0.7rem;
  }

  .pager a,
  .pager span {
    min-height: auto;
  }

  .site-footer img {
    display: block;
    margin: 0 0 0.6rem;
  }
}
