/* ─── Base resets (needed when landing page isn't mounted) ── */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
html { scroll-behavior: smooth; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible {
  outline: 3px solid #cfff58;
  outline-offset: 4px;
  border-radius: 10px;
}

/* ─── Layout ──────────────────────────────────────────────── */
.docs-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  background: var(--bg, #0d1716);
}

.docs-header {
  grid-column: 1 / -1;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(18px);
  background: rgba(13, 23, 22, 0.88);
  border-bottom: 1px solid rgba(242, 235, 216, 0.2);
}

.docs-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.docs-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.docs-header-left .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: inherit;
  text-decoration: none;
}

.docs-header-left .brand-mark {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(207, 255, 88, 0.75);
  border-radius: 10px;
  position: relative;
  background: #0a1211;
  overflow: hidden;
  flex-shrink: 0;
}

.docs-header-left .mark-track {
  position: absolute;
  inset: 6px 8px;
  border-left: 2px solid #cfff58;
  border-right: 2px solid #7be7d8;
  transform: skewX(-12deg);
}

.docs-header-left .mark-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #ff7a45;
}

.docs-header-left .dot-a { top: 6px; left: 6px; }
.docs-header-left .dot-b { bottom: 6px; right: 7px; background: #cfff58; }

.docs-header-left .brand-word {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  color: #f2ebd8;
}

.docs-breadcrumb-sep {
  color: rgba(242, 235, 216, 0.3);
  font-size: 1.2rem;
  user-select: none;
}

.docs-label {
  font-family: "Courier New", "Lucida Console", monospace;
  font-size: 0.82rem;
  color: rgba(242, 235, 216, 0.6);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.docs-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.docs-header-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: "Courier New", "Lucida Console", monospace;
  font-size: 0.82rem;
  color: rgba(242, 235, 216, 0.6);
  text-decoration: none;
  transition: color 0.2s ease;
}

.docs-header-link:hover {
  color: #cfff58;
}

/* ─── Sidebar ─────────────────────────────────────────────── */
.docs-sidebar {
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 20px 0 40px;
  background: rgba(13, 23, 22, 0.6);
  border-right: 1px solid rgba(242, 235, 216, 0.12);
  scrollbar-width: thin;
  scrollbar-color: rgba(242, 235, 216, 0.15) transparent;
}

.sidebar-category {
  margin-bottom: 8px;
}

.sidebar-category-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #ff7a45;
  padding: 18px 24px 6px;
  margin: 0;
}

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

.sidebar-link {
  display: block;
  padding: 7px 24px 7px 28px;
  font-family: "Courier New", "Lucida Console", monospace;
  font-size: 0.84rem;
  color: rgba(242, 235, 216, 0.58);
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  border-left: 2px solid transparent;
  line-height: 1.45;
}

.sidebar-link:hover {
  color: #f2ebd8;
  background: rgba(242, 235, 216, 0.04);
}

.sidebar-link-active {
  color: #cfff58;
  border-left-color: #cfff58;
  background: rgba(207, 255, 88, 0.06);
  font-weight: 600;
}

/* ─── Main content ────────────────────────────────────────── */
.docs-main {
  padding: 48px 48px 80px;
  overflow-x: hidden;
  background: #f2ebd8;
  min-height: calc(100vh - 56px);
}

.docs-content-wrapper {
  display: grid;
  grid-template-columns: minmax(0, 720px) 200px;
  gap: 32px;
  max-width: 1000px;
}

.docs-content-col {
  min-width: 0;
}

/* ─── Table of contents ───────────────────────────────────── */
.docs-toc {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-top: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(24, 33, 31, 0.12) transparent;
}

.toc-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #ff7a45;
  margin: 0 0 10px;
}

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

.toc-item {
  margin: 0;
}

.toc-level-3 {
  padding-left: 12px;
}

.toc-link {
  display: block;
  padding: 3px 0;
  font-family: "Courier New", "Lucida Console", monospace;
  font-size: 0.72rem;
  line-height: 1.4;
  color: rgba(24, 33, 31, 0.45);
  text-decoration: none;
  transition: color 0.15s ease;
}

.toc-link:hover {
  color: #18211f;
}

/* ─── Markdown article ────────────────────────────────────── */
.docs-article {
  color: #18211f;
}

.docs-article h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.08;
  color: #18211f;
  margin: 0 0 16px;
}

.docs-article h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.18;
  color: #18211f;
  margin: 48px 0 14px;
  padding-top: 24px;
  border-top: 1px solid rgba(24, 33, 31, 0.13);
}

.docs-article h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.25;
  color: #18211f;
  margin: 32px 0 10px;
}

.docs-article h4 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-weight: 700;
  color: #18211f;
  margin: 24px 0 8px;
}

.docs-article h1:first-child {
  margin-top: 0;
}

.docs-article h2:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.docs-article p,
.docs-article li {
  font-family: "Courier New", "Lucida Console", monospace;
  font-size: 0.92rem;
  line-height: 1.72;
  color: #51615d;
}

.docs-article li {
  margin-bottom: 4px;
}

.docs-article ul,
.docs-article ol {
  padding-left: 24px;
  margin: 12px 0;
}

.docs-article strong {
  color: #18211f;
  font-weight: 700;
}

.docs-article a {
  color: #9a3418;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(154, 52, 24, 0.35);
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.docs-article a:hover {
  color: #18211f;
  text-decoration-color: #18211f;
}

.docs-article hr {
  border: none;
  border-top: 1px solid rgba(24, 33, 31, 0.13);
  margin: 32px 0;
}

.docs-article blockquote {
  margin: 20px 0;
  padding: 12px 20px;
  border-left: 3px solid #ff7a45;
  background: rgba(24, 33, 31, 0.04);
  border-radius: 0 8px 8px 0;
}

.docs-article blockquote p {
  margin: 0;
}

/* ─── Code blocks ─────────────────────────────────────────── */
.code-block-wrapper {
  position: relative;
  margin: 18px 0;
}

.docs-article pre {
  background: #070d0c;
  color: #dff5e8;
  border: 1px solid rgba(242, 235, 216, 0.12);
  border-radius: 12px;
  padding: 18px 20px;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.65;
  margin: 0;
}

.docs-article pre code {
  font-family: "Courier New", "Lucida Console", monospace;
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  color: inherit;
}

.docs-article p code,
.docs-article li code,
.docs-article td code,
.docs-article th code {
  background: rgba(24, 33, 31, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Courier New", "Lucida Console", monospace;
  font-size: 0.86em;
  color: #18211f;
}

.code-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  font-family: "Courier New", "Lucida Console", monospace;
  font-size: 0.7rem;
  color: rgba(223, 245, 232, 0.5);
  background: rgba(242, 235, 216, 0.08);
  border: 1px solid rgba(242, 235, 216, 0.15);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.code-copy-btn:hover {
  color: #dff5e8;
  background: rgba(242, 235, 216, 0.15);
}

.code-copy-btn.copied {
  color: #cfff58;
  border-color: rgba(207, 255, 88, 0.3);
}

/* ─── Tables ──────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  margin: 18px 0;
  border-radius: 10px;
  border: 1px solid rgba(24, 33, 31, 0.13);
}

.docs-article table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 253, 245, 0.6);
  font-size: 0.85rem;
}

.docs-article th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 700;
  color: #18211f;
  background: rgba(24, 33, 31, 0.05);
  border-bottom: 2px solid rgba(24, 33, 31, 0.13);
  font-family: "Courier New", "Lucida Console", monospace;
  font-size: 0.82rem;
  white-space: nowrap;
}

.docs-article td {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(24, 33, 31, 0.08);
  color: #51615d;
  font-family: "Courier New", "Lucida Console", monospace;
  line-height: 1.55;
}

.docs-article tr:last-child td {
  border-bottom: none;
}

/* ─── Prev / Next nav ─────────────────────────────────────── */
.docs-footer-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid rgba(24, 33, 31, 0.13);
}

.footer-nav-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid rgba(24, 33, 31, 0.13);
  background: rgba(255, 253, 245, 0.5);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.footer-nav-link:hover {
  border-color: rgba(24, 33, 31, 0.3);
  background: rgba(255, 253, 245, 0.8);
}

.footer-nav-link.next {
  text-align: right;
}

.footer-nav-label {
  font-family: "Courier New", "Lucida Console", monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #ff7a45;
}

.footer-nav-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #18211f;
  letter-spacing: -0.02em;
}

/* ─── Mobile menu button ──────────────────────────────────── */
.docs-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(242, 235, 216, 0.2);
  border-radius: 8px;
  background: rgba(242, 235, 216, 0.06);
  color: #f2ebd8;
  cursor: pointer;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.docs-sidebar-overlay {
  display: none;
}

/* ─── highlight.js token overrides ────────────────────────── */
.hljs { background: transparent; color: #dff5e8; }
.hljs-keyword { color: #7be7d8; }
.hljs-string { color: #cfff58; }
.hljs-number { color: #ff7a45; }
.hljs-comment { color: rgba(174, 187, 181, 0.55); font-style: italic; }
.hljs-title { color: #f2ebd8; }
.hljs-built_in { color: #7be7d8; }
.hljs-attr { color: #aebbb5; }
.hljs-literal { color: #ff7a45; }
.hljs-type { color: #cfff58; }
.hljs-params { color: #aebbb5; }
.hljs-meta { color: rgba(174, 187, 181, 0.7); }
.hljs-variable { color: #f2ebd8; }
.hljs-selector-class { color: #cfff58; }
.hljs-selector-tag { color: #7be7d8; }
.hljs-attribute { color: #cfff58; }
.hljs-section { color: #f2ebd8; font-weight: 700; }
.hljs-bullet { color: #ff7a45; }
.hljs-symbol { color: #ff7a45; }
.hljs-addition { color: #cfff58; }
.hljs-deletion { color: #ff7a45; }

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 1100px) {
  .docs-toc {
    display: none;
  }

  .docs-content-wrapper {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }

  .docs-menu-btn {
    display: flex;
  }

  .docs-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    z-index: 30;
    background: rgba(13, 23, 22, 0.97);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    padding-top: 20px;
  }

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

  .docs-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 16, 15, 0.6);
    z-index: 29;
    backdrop-filter: blur(2px);
  }

  .docs-sidebar-overlay.open {
    display: block;
  }

  .docs-main {
    padding: 28px 20px 60px;
  }

  .docs-article h1 {
    font-size: 1.9rem;
  }

  .docs-article h2 {
    font-size: 1.3rem;
  }

  .docs-footer-nav {
    grid-template-columns: 1fr;
  }

  .footer-nav-link.next {
    text-align: left;
  }
}

@media (max-width: 480px) {
  .docs-main {
    padding: 20px 16px 48px;
  }

  .docs-article pre {
    font-size: 0.75rem;
    padding: 14px 14px;
    border-radius: 8px;
  }

  .docs-header-inner {
    padding: 0 16px;
  }
}
