/* ============ Docs layout — loaded only on /docs/ pages ============
   Reuses site.css tokens (--bg-2/--line/--accent*/--fg*/--font-*). Mirrors the BlacklistGuard
   docs system (sidebar IA + on-this-page TOC + ⌘K search), remapped to Hania's design tokens.
   Wrap markup is `<div class="container"><div class="docs-layout">…`. */

:root { --docs-header-h: 64px; }

.docs-layout {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr) 196px;
  gap: 40px; align-items: start;
  padding: 28px 0 96px;
}

/* ---- Left sidebar ---- */
.docs-sidebar {
  position: sticky; top: calc(var(--docs-header-h) + 18px); align-self: start;
  max-height: calc(100vh - var(--docs-header-h) - 36px); overflow-y: auto;
  padding-right: 6px;
}
.docs-sidebar .ds-section { margin-bottom: 20px; }
.docs-sidebar .ds-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 600; color: var(--fg-3); margin: 0 0 6px; padding: 0 10px;
}
.docs-sidebar a, .docs-sidebar .ds-soon {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; border-radius: 6px; line-height: 1.35;
  font-size: 13.5px; color: var(--fg-2); text-decoration: none;
}
.docs-sidebar a:hover { background: var(--bg-hover); color: var(--fg); }
.docs-sidebar a.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.docs-sidebar .ds-soon { color: var(--fg-3); opacity: 0.55; cursor: default; }
.docs-sidebar .ds-soon span {
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--bg-3); color: var(--fg-3); padding: 1px 5px; border-radius: 999px;
}

/* ---- Content ---- */
.docs-content { min-width: 0; }
.docs-content .docs-eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  font-weight: 600; color: var(--accent); margin-bottom: 10px;
}
.docs-content h1 { font-size: 32px; font-weight: 600; letter-spacing: -0.025em; margin: 0 0 10px; line-height: 1.15; color: var(--fg); }
.docs-content .docs-lead { font-size: 16px; line-height: 1.6; color: var(--fg-2); margin: 0 0 30px; }
.docs-content h2 { font-size: 21px; font-weight: 600; letter-spacing: -0.01em; margin: 42px 0 14px; color: var(--fg); scroll-margin-top: calc(var(--docs-header-h) + 18px); }
.docs-content h3 { font-size: 15.5px; font-weight: 600; margin: 26px 0 8px; color: var(--fg); scroll-margin-top: calc(var(--docs-header-h) + 18px); }
.docs-content p, .docs-content li { font-size: 14.5px; line-height: 1.72; color: var(--fg-2); }
.docs-content strong { color: var(--fg); font-weight: 600; }
.docs-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.docs-content ul, .docs-content ol { padding-left: 22px; margin: 0 0 18px; }
.docs-content li { margin-bottom: 6px; }
.docs-content :not(pre) > code {
  font-family: var(--font-mono); font-size: 0.86em;
  background: var(--bg-3); padding: 2px 6px; border-radius: 4px; color: var(--fg);
}
.docs-content hr { border: 0; border-top: 1px solid var(--line); margin: 36px 0; }

/* Code blocks (hand-authored <pre><code>) */
.docs-content pre {
  position: relative; margin: 0 0 20px; padding: 14px 16px;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius-sm);
  overflow-x: auto; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; color: var(--fg);
}
.docs-content pre code { font: inherit; background: none; padding: 0; color: inherit; }

/* Numbered step heads */
.docs-step { display: flex; align-items: center; gap: 10px; margin: 40px 0 14px; scroll-margin-top: calc(var(--docs-header-h) + 18px); }
.docs-step .ds-num {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
}
.docs-step h2 { margin: 0; }

/* Callouts */
.docs-note, .docs-warn {
  border-radius: var(--radius-sm); padding: 13px 16px; margin: 0 0 20px;
  font-size: 13.5px; line-height: 1.6; display: flex; gap: 10px; color: var(--fg);
  border: 1px solid transparent;
}
.docs-note { background: oklch(from var(--info) l c h / 0.10); border-color: oklch(from var(--info) l c h / 0.30); }
.docs-warn { background: oklch(from var(--warn) l c h / 0.10); border-color: oklch(from var(--warn) l c h / 0.30); }
.docs-note strong, .docs-warn strong { color: var(--fg); }

/* Param / response tables */
.docs-content table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 13.5px; }
.docs-content th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--fg-3); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.docs-content td { padding: 9px 12px; border-bottom: 1px solid var(--line); color: var(--fg-2); vertical-align: top; }
.docs-content td code { white-space: nowrap; }
.table-scroll { overflow-x: auto; }

/* Prev/next footer */
.docs-pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }
.docs-pager a { flex: 1; text-decoration: none; color: inherit; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-2); }
.docs-pager a:hover { border-color: var(--line-2); }
.docs-pager .dp-label { font-size: 11px; color: var(--fg-3); margin-bottom: 3px; }
.docs-pager .dp-title { font-size: 14px; font-weight: 600; color: var(--fg); }
.docs-pager .dp-next { text-align: right; }

/* ---- Right "on this page" TOC ---- */
.docs-toc { position: sticky; top: calc(var(--docs-header-h) + 18px); align-self: start; font-size: 12.5px; }
.docs-toc .dt-title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-3); font-weight: 600; margin-bottom: 10px; }
.docs-toc a { display: block; padding: 4px 0 4px 10px; border-left: 2px solid var(--line); color: var(--fg-3); text-decoration: none; line-height: 1.4; }
.docs-toc a.lvl-3 { padding-left: 22px; }
.docs-toc a:hover { color: var(--fg); border-left-color: var(--line-2); }
.docs-toc a.is-active { color: var(--accent); border-left-color: var(--accent); }

/* Copy button injected onto code blocks */
.docs-copy {
  position: absolute; top: 8px; right: 8px;
  font-family: var(--font-sans); font-size: 11px; font-weight: 500;
  padding: 3px 9px; border-radius: 5px; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--fg-2);
  opacity: 0; transition: opacity 120ms ease;
}
.docs-content pre:hover .docs-copy { opacity: 1; }
.docs-copy:hover { color: var(--fg); border-color: var(--line-2); }

/* ---- Landing: section cards + hero search ---- */
.docs-hero { padding: 32px 0 8px; }
.docs-hero h1 { font-size: 34px; font-weight: 600; letter-spacing: -0.025em; margin: 0 0 8px; color: var(--fg); }
.docs-hero p { font-size: 16px; color: var(--fg-2); margin: 0 0 20px; max-width: 640px; line-height: 1.6; }
.docs-searchbox {
  display: flex; align-items: center; gap: 10px; max-width: 520px;
  padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-2); color: var(--fg-3); cursor: text; font-size: 14px;
}
.docs-searchbox input { flex: 1; border: 0; background: transparent; outline: none; color: var(--fg); font: inherit; }
.docs-searchbox .kbd { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }
.docs-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin: 32px 0 64px; }
.docs-card {
  display: block; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-2); text-decoration: none; transition: border-color 140ms, transform 140ms;
}
.docs-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.docs-card h3 { font-size: 15px; font-weight: 600; margin: 0 0 4px; color: var(--fg); }
.docs-card p { font-size: 13px; color: var(--fg-3); margin: 0; line-height: 1.55; }
.docs-card.is-soon { opacity: 0.6; pointer-events: none; }
.docs-card .soon-tag { font-size: 9px; text-transform: uppercase; letter-spacing: 0.05em; background: var(--bg-3); color: var(--fg-3); padding: 1px 6px; border-radius: 999px; margin-left: 6px; vertical-align: middle; }

/* ---- Search command palette (⌘K) ---- */
.docs-search-modal { position: fixed; inset: 0; z-index: 1000; display: none; }
.docs-search-modal.is-open { display: block; }
.dsm-overlay { position: absolute; inset: 0; background: oklch(0 0 0 / 0.45); }
.dsm-box {
  position: relative; max-width: 560px; margin: 12vh auto 0;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 24px 64px -16px oklch(0 0 0 / 0.5); overflow: hidden;
}
.dsm-input {
  width: 100%; height: 52px; padding: 0 18px; box-sizing: border-box;
  border: 0; border-bottom: 1px solid var(--line); background: transparent;
  color: var(--fg); font-size: 15px; font-family: var(--font-sans); outline: none;
}
.dsm-results { max-height: 52vh; overflow-y: auto; padding: 6px; }
.dsr-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-radius: 8px; text-decoration: none; color: var(--fg);
}
.dsr-item.is-sel { background: var(--accent-soft); }
.dsr-title { font-size: 14px; font-weight: 500; }
.dsr-item.is-sel .dsr-title { color: var(--accent); }
.dsr-sec { font-size: 11px; color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.dsr-empty { padding: 22px 16px; color: var(--fg-3); font-size: 13px; line-height: 1.6; text-align: center; }
.dsr-empty a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.dsm-hint { display: flex; gap: 16px; padding: 8px 16px; border-top: 1px solid var(--line); font-size: 11px; color: var(--fg-3); }

/* Sidebar collapses to a tap-to-open menu (+ a search button) below the 3-col layout. */
.docs-nav-bar { display: none; }

@media (max-width: 1080px) {
  .docs-layout { grid-template-columns: 1fr; gap: 0; }
  .docs-toc { display: none; }
  .docs-sidebar {
    position: static; max-height: none; overflow: visible;
    margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--line);
  }
  .docs-nav-bar { display: flex; gap: 8px; }
  .docs-nav-toggle {
    flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 11px 14px; border: 1px solid var(--line-2); border-radius: 8px;
    background: var(--bg-2); color: var(--fg); font-family: var(--font-sans);
    font-weight: 500; font-size: 14px; cursor: pointer;
  }
  .docs-nav-toggle svg { flex-shrink: 0; transition: transform 180ms ease; }
  .docs-sidebar.is-open .docs-nav-toggle svg { transform: rotate(180deg); }
  .docs-nav-search {
    flex-shrink: 0; width: 44px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line-2); border-radius: 8px;
    background: var(--bg-2); color: var(--fg-2); cursor: pointer;
  }
  .docs-nav-search:hover { color: var(--fg); }
  .docs-nav-groups { display: none; padding-top: 16px; }
  .docs-sidebar.is-open .docs-nav-groups { display: block; }
}

@media (max-width: 480px) {
  .docs-pager { flex-direction: column; }
  .docs-pager .dp-next { text-align: left; }
}
