@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  --ink: #171714;
  --ink-soft: #3d3d38;
  --muted: #6e6e66;
  --faint: #9a9a90;
  --line: rgba(23, 23, 20, 0.08);
  --line-strong: rgba(23, 23, 20, 0.14);
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #fffcf7;
  --panel: #f3f1eb;
  --accent: #1f6b5c;
  --accent-soft: rgba(31, 107, 92, 0.1);
  --accent-hover: #185548;
  --warn-bg: #f8f1e7;
  --warn-line: #e2c9a4;
  --info-bg: #eef4f2;
  --info-line: #b7d0c8;
  --code-bg: #161714;
  --code-fg: #e8e6df;
  --sidebar-w: 260px;
  --toc-w: 200px;
  --nav-h: 60px;
  --font: "Manrope", "Noto Sans SC", ui-sans-serif, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 10px;
  --content: 44rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink-soft);
  background:
    radial-gradient(1200px 500px at 12% -10%, rgba(31, 107, 92, 0.07), transparent 55%),
    radial-gradient(900px 420px at 100% 0%, rgba(23, 23, 20, 0.04), transparent 50%),
    linear-gradient(180deg, #f7f5f0 0%, #f4f2ec 100%);
  background-attachment: fixed;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
}

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.12em 0.38em;
  color: var(--ink);
}

pre {
  background: var(--code-bg);
  color: var(--code-fg);
  border-radius: 12px;
  padding: 16px 18px;
  overflow: auto;
  border: 1px solid #2a2b27;
  margin: 1.1rem 0 1.4rem;
}

pre code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: 12.5px;
  line-height: 1.65;
}

/* Top nav */
.topnav {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nav-h);
  border-bottom: 1px solid var(--line);
  background: rgba(247, 245, 240, 0.82);
  backdrop-filter: blur(14px) saturate(1.2);
}

.topnav-inner {
  max-width: 1320px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  line-height: 0;
}

.brand:hover {
  opacity: 0.9;
}

.brand-logo {
  height: 34px;
  width: auto;
  max-width: 168px;
  display: block;
  object-fit: contain;
}

.brand-mark {
  display: none;
}

.search {
  position: relative;
  flex: 1;
  max-width: 420px;
  margin: 0 8px 0 12px;
  display: flex;
  align-items: center;
  min-width: 0;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--faint);
  pointer-events: none;
  flex-shrink: 0;
}

.search input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.65);
  padding: 0 40px 0 36px;
  font: 500 13.5px/1 var(--font);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.search input::placeholder {
  color: var(--faint);
  font-weight: 450;
}

.search input:focus {
  border-color: rgba(31, 107, 92, 0.45);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-kbd {
  position: absolute;
  right: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  background: rgba(255, 255, 255, 0.8);
  pointer-events: none;
}

.search:focus-within .search-kbd {
  display: none;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: min(420px, 70vh);
  overflow: auto;
  background: #fffcf7;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(23, 23, 20, 0.12);
  z-index: 60;
  padding: 6px;
}

.search-results[hidden] {
  display: none;
}

.search-item {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink-soft);
}

.search-item:hover,
.search-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

.search-item-title {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: inherit;
  line-height: 1.35;
}

.search-item-group {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--faint);
  font-weight: 500;
}

.search-empty {
  padding: 16px 12px;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
}

.top-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 550;
  color: var(--ink-soft);
  background: transparent;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  text-decoration: none;
}

.btn-primary {
  background: var(--ink);
  color: #f7f5f0;
  border-color: var(--ink);
}

.btn-primary:hover {
  background: #2c2c28;
  color: #fff;
}

.menu-btn {
  display: none;
  border: 1px solid var(--line-strong);
  background: transparent;
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  color: var(--ink);
}

/* Layout */
.layout {
  max-width: 1320px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  column-gap: 8px;
  min-height: calc(100vh - var(--nav-h));
  align-items: start;
}

.sidebar {
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow: auto;
  padding: 22px 10px 48px 18px;
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
}

.nav-group {
  margin-bottom: 22px;
}

.nav-group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
  padding: 4px 10px 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: block;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.12s ease, background 0.12s ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  text-decoration: none;
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.main {
  min-width: 0;
  max-width: 100%;
  padding: 36px 36px 96px;
  overflow-x: clip;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

h1 {
  margin: 0 0 14px;
  font-size: clamp(1.75rem, 2.4vw, 2.15rem);
  line-height: 1.25;
  color: var(--ink);
  letter-spacing: -0.035em;
  font-weight: 700;
  max-width: var(--content);
}

.lead {
  font-size: 15.5px;
  color: var(--muted);
  margin: 0 0 4px;
  max-width: var(--content);
  line-height: 1.7;
}

.prose {
  max-width: var(--content);
  margin-top: 28px;
  color: var(--ink-soft);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.prose img,
.prose video,
.prose iframe,
.prose svg {
  max-width: 100%;
}

.prose img {
  height: auto;
  display: block;
  border-radius: 10px;
  border: 1px solid var(--line);
  margin: 1rem 0 1.25rem;
  background: #fff;
}

.prose h1 {
  display: none;
}

.prose h2 {
  margin: 2.6rem 0 0.9rem;
  padding-top: 0.4rem;
  font-size: 1.28rem;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.025em;
  scroll-margin-top: 88px;
  border-top: 1px solid var(--line);
}

.prose h2:first-child {
  border-top: 0;
  margin-top: 1.2rem;
}

.prose h3,
.prose h4 {
  margin: 1.7rem 0 0.55rem;
  font-size: 1.05rem;
  color: var(--ink);
  font-weight: 650;
  letter-spacing: -0.02em;
  scroll-margin-top: 88px;
}

.prose p {
  margin: 0 0 1rem;
}

.prose ul,
.prose ol {
  padding-left: 1.2rem;
  margin: 0.45rem 0 1rem;
}

.prose li {
  margin: 0.3rem 0;
}

.prose li::marker {
  color: var(--faint);
}

.prose strong {
  color: var(--ink);
  font-weight: 650;
}

.prose table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 13.5px;
  display: block;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.prose th,
.prose td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
}

.prose th {
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  font-weight: 600;
}

.prose tr:last-child td {
  border-bottom: 0;
}

.prose blockquote {
  margin: 1.1rem 0;
  padding: 0.7rem 1rem;
  border-left: 2px solid var(--accent);
  background: rgba(255, 255, 255, 0.45);
  color: var(--muted);
  border-radius: 0 8px 8px 0;
}

/* Cards — quiet, almost flush */
.card {
  display: flex;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 12px 0;
  background: rgba(255, 255, 255, 0.55);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.card:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.85);
  text-decoration: none;
}

.card.stacked {
  flex-direction: column;
}

.card h4 {
  margin: 0;
  font-size: 15px;
  color: var(--ink);
  font-weight: 650;
}

.card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.param {
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 14px 0;
  margin: 0;
  background: transparent;
}

.param + .param {
  margin-top: 0;
}

.param-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.param .type {
  font-size: 12px;
  color: var(--faint);
  font-family: var(--mono);
}

.param .req {
  font-size: 11px;
  color: #9a6b2f;
  letter-spacing: 0.02em;
}

.param-body {
  font-size: 14px;
  color: var(--muted);
}

.callout {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 14px 0;
  background: rgba(255, 255, 255, 0.5);
}

.callout.warn {
  background: var(--warn-bg);
  border-color: var(--warn-line);
}

.callout.info,
.callout.note,
.callout.tip,
.callout.check {
  background: var(--info-bg);
  border-color: var(--info-line);
}

.faq {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin: 14px 0 28px;
  background: rgba(255, 255, 255, 0.4);
}

.faq details {
  border-bottom: 1px solid var(--line);
}

.faq details:last-child {
  border-bottom: 0;
}

.faq summary {
  list-style: none;
  cursor: pointer;
  padding: 15px 16px;
  font-weight: 550;
  color: var(--ink);
  transition: background 0.12s ease;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::before {
  content: "+";
  display: inline-block;
  width: 1.1em;
  color: var(--faint);
  font-weight: 500;
  margin-right: 6px;
}

.faq details[open] summary::before {
  content: "–";
}

.faq summary:hover {
  background: rgba(255, 255, 255, 0.55);
}

.faq .ans {
  padding: 0 16px 16px 2.1em;
  color: var(--muted);
  font-size: 14.5px;
}

.pagination {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 44px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  max-width: var(--content);
}

.pagination a {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 13.5px;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.pagination a:hover {
  color: var(--accent);
}

.footer {
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 12.5px;
  max-width: var(--content);
}

.footer a {
  color: var(--muted);
}

.toc {
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow: auto;
  padding: 32px 16px 48px 12px;
  background: linear-gradient(180deg, #f7f5f0 0%, #f4f2ec 100%);
  border-left: 1px solid var(--line);
  z-index: 2;
  min-width: 0;
  box-sizing: border-box;
}

.toc-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
  margin-bottom: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toc a {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  padding: 5px 0 5px 12px;
  border-left: 1px solid var(--line);
  text-decoration: none;
  line-height: 1.4;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.toc a:hover,
.toc a.active {
  color: var(--ink);
  border-left-color: var(--accent);
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(23, 23, 20, 0.28);
  z-index: 45;
  backdrop-filter: blur(2px);
}

body.sidebar-open .overlay {
  display: block;
}

body.sidebar-open .sidebar {
  transform: translateX(0);
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }
  .toc {
    display: none;
  }
}

@media (max-width: 860px) {
  .menu-btn {
    display: inline-flex;
  }
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
    width: min(86vw, 300px);
    background: #f7f5f0;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    height: 100vh;
    border-right: 1px solid var(--line);
    padding-top: 72px;
  }
  .main {
    padding: 24px 18px 72px;
  }
  .topnav-inner {
    padding: 0 16px;
  }
  .search {
    max-width: none;
    margin: 0 4px 0 0;
  }
  .search-kbd {
    display: none;
  }
  .btn-primary {
    padding: 7px 10px;
    font-size: 12px;
  }
}
