/* 996maxing — Mintlify-inspired docs theme */

:root {
  /* Light theme */
  --bg: #ffffff;
  --bg-elev: #fafafa;
  --bg-code: #f6f7f9;
  --bg-inline-code: #f1f3f5;
  --text: #111418;
  --text-muted: #4a5562;
  --text-faint: #8a95a3;
  --border: #e8ebef;
  --border-strong: #d4d9e0;

  --accent: #00c48c;         /* 996maxing mint — refined, distinctive */
  --accent-strong: #00a876;
  --accent-soft: rgba(0,196,140,0.08);

  --blockquote-bg: #f8faf9;
  --blockquote-border: #00c48c;
  --erin-bg: #fff9ea;
  --erin-border: #f3c969;

  --ring: rgba(0,196,140,0.35);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --topbar-h: 60px;
  --sidebar-w: 260px;
  --toc-w: 220px;
  --content-max: 760px;

  --shadow-sm: 0 1px 2px rgba(16,24,40,0.05);
  --shadow-md: 0 4px 16px rgba(16,24,40,0.08);
}

html[data-theme='dark'] {
  --bg: #0d1117;
  --bg-elev: #111821;
  --bg-code: #0b1018;
  --bg-inline-code: #1a2230;
  --text: #e6edf3;
  --text-muted: #98a5b3;
  --text-faint: #6b7685;
  --border: #1d2631;
  --border-strong: #2a3643;

  --accent: #2dd4a4;
  --accent-strong: #37e7b3;
  --accent-soft: rgba(45,212,164,0.12);

  --blockquote-bg: #0f1a1b;
  --blockquote-border: #2dd4a4;
  --erin-bg: #1f1a0f;
  --erin-border: #a57c2e;

  --ring: rgba(45,212,164,0.45);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 16px);
}

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

::selection { background: var(--accent-soft); color: var(--text); }

/* --- Top bar --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
}
.topbar-inner {
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 240px 1fr auto;
  gap: 24px;
  align-items: center;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand-name { font-family: var(--font-display); font-size: 19px; font-weight: 700; }
.brand-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.topbar-search {
  position: relative;
  max-width: 420px;
  justify-self: center;
  width: 100%;
}
.topbar-search input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  font: inherit;
  font-size: 14px;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.topbar-search input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
  box-shadow: 0 0 0 3px var(--ring);
}
.topbar-search input::placeholder { color: var(--text-faint); }
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}
.kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  color: var(--text-faint);
  pointer-events: none;
}
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  max-height: 60vh;
  overflow-y: auto;
  padding: 6px;
}
.search-results[hidden] { display: none; }
.search-result {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
.search-result:hover, .search-result.active {
  background: var(--bg-elev);
  text-decoration: none;
}
.search-result .sr-section {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin-bottom: 2px;
}
.search-result .sr-snippet {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}
.search-empty { padding: 14px; color: var(--text-faint); font-size: 14px; text-align: center; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.topbar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.topbar-link:hover { background: var(--bg-elev); color: var(--text); text-decoration: none; }

.theme-sun { display: none; }
.theme-moon { display: inline; }
html[data-theme='dark'] .theme-sun { display: inline; }
html[data-theme='dark'] .theme-moon { display: none; }

.mobile-only { display: none; }

/* --- Layout --- */
.layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--toc-w);
  gap: 48px;
  align-items: start;
}

/* --- Sidebar --- */
.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 24px 8px 48px 0;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 22px; }
.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--text-faint);
  padding: 0 10px 6px;
}
.sidebar-nav a {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  position: relative;
}
.sidebar-nav a:hover {
  color: var(--text);
  background: var(--bg-elev);
  text-decoration: none;
}
.sidebar-nav a.active {
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-weight: 600;
}
.sidebar-nav a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
}

/* --- Main --- */
.main { padding: 40px 0 64px; min-width: 0; }
.article { max-width: var(--content-max); }

/* Typography */
.article h1 {
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--text);
}
.article h2 {
  font-size: 24px;
  line-height: 1.3;
  letter-spacing: -0.015em;
  font-weight: 700;
  margin: 48px 0 16px;
  padding-top: 8px;
  color: var(--text);
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.article h3 {
  font-size: 18px;
  line-height: 1.4;
  letter-spacing: -0.01em;
  font-weight: 600;
  margin: 32px 0 12px;
  color: var(--text);
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.article h4 {
  font-size: 15px;
  font-weight: 600;
  margin: 24px 0 8px;
  color: var(--text);
}

.article p {
  margin: 14px 0;
  color: var(--text);
}
.article strong { color: var(--text); font-weight: 600; }
.article em { color: var(--text); }

.article ul, .article ol {
  padding-left: 24px;
  margin: 14px 0;
}
.article li { margin: 6px 0; }
.article li > p { margin: 6px 0; }

.article hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

/* Inline code */
.article :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-inline-code);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 5px;
  color: var(--text);
}

/* Code blocks */
.article pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 20px 0;
  font-size: 13.5px;
  line-height: 1.6;
}
.article pre code {
  font-family: var(--font-mono);
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: var(--text);
}

/* Tables */
.article table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.article th, .article td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.article th {
  font-weight: 600;
  background: var(--bg-elev);
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.article tbody tr:last-child td { border-bottom: none; }
.article tbody tr:hover { background: var(--bg-elev); }

/* Blockquote — "Erin says" treatment for callouts */
.article blockquote {
  margin: 20px 0;
  padding: 14px 18px;
  background: var(--blockquote-bg);
  border-left: 3px solid var(--blockquote-border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text);
}
.article blockquote p { margin: 6px 0; }
.article blockquote p:first-child { margin-top: 0; }
.article blockquote p:last-child { margin-bottom: 0; }
.article blockquote.erin {
  background: var(--erin-bg);
  border-left-color: var(--erin-border);
}

/* Checkbox list items in markdown */
.article li input[type="checkbox"] {
  margin-right: 8px;
  transform: translateY(1px);
  accent-color: var(--accent);
}

/* --- TOC --- */
.toc {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 40px 0 48px;
}
.toc-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--text-faint);
  margin-bottom: 10px;
}
.toc-list { display: flex; flex-direction: column; gap: 2px; }
.toc-list a {
  display: block;
  padding: 4px 10px;
  border-left: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.4;
  transition: color .15s, border-color .15s;
}
.toc-list a.toc-level-3 { padding-left: 22px; font-size: 12.5px; }
.toc-list a:hover { color: var(--text); text-decoration: none; }
.toc-list a.active {
  color: var(--accent-strong);
  border-left-color: var(--accent);
  font-weight: 500;
}

/* --- Footer nav (prev/next) --- */
.doc-footer {
  max-width: var(--content-max);
  margin-top: 80px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.footer-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.footer-nav a {
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  transition: border-color .15s, background .15s;
}
.footer-nav a:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}
.footer-nav a.next { text-align: right; }
.footer-nav .fn-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.footer-nav .fn-title { font-weight: 600; color: var(--text); }

.footer-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  font-size: 13px;
  color: var(--text-faint);
}

/* --- Home page hero hook --- */
.article h1:first-child + p {
  font-size: 19px;
  line-height: 1.55;
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* --- Scrim for mobile sidebar --- */
.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 40;
}
.sidebar-scrim.open { display: block; }

/* --- Responsive --- */
@media (max-width: 1200px) {
  .toc { display: none; }
  .layout { grid-template-columns: var(--sidebar-w) 1fr; }
}
@media (max-width: 880px) {
  .topbar-inner {
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    padding: 0 16px;
  }
  .topbar-search { max-width: none; }
  .kbd { display: none; }
  .mobile-only { display: inline-flex; }
  .brand-badge { display: none; }

  .layout { grid-template-columns: 1fr; padding: 0 16px; gap: 0; }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    width: 280px;
    height: calc(100vh - var(--topbar-h));
    background: var(--bg);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    z-index: 45;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); }

  .main { padding: 24px 0 48px; }
  .article h1 { font-size: 32px; }
  .article h2 { font-size: 22px; margin-top: 36px; }
  .article table { font-size: 13px; }
  .article th, .article td { padding: 8px 10px; }
}

/* Loading state */
.loading {
  padding: 40px;
  text-align: center;
  color: var(--text-faint);
  font-size: 14px;
}
