/* ==========================================================================
   Optipic — API documentation page (/docs)
   Sidebar-navigation layout, code blocks with language tabs, endpoint
   cards. Shares design tokens (colors/radius/shadow/container) with
   style.css — this file only adds what docs needs on top of it.
   ========================================================================== */

:root{
  --mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --code-bg:#0d1220;
  --code-ink:#e6ecfb;
  --code-border:#1c2540;
}

.docs-shell{
  display:grid;
  grid-template-columns:264px minmax(0,1fr);
  gap:56px;
  align-items:start;
  padding:40px 0 120px;
}

/* ---------- Sidebar ---------- */

.docs-sidebar{
  position:sticky;
  top:96px;
  max-height:calc(100vh - 120px);
  overflow-y:auto;
  padding-inline-end:8px;
}

.docs-search{
  display:flex;
  align-items:center;
  gap:8px;
  background:var(--surface-alt);
  border:1.5px solid var(--border);
  border-radius:var(--radius-sm);
  padding:9px 12px;
  margin-bottom:24px;
  color:var(--ink-400);
  font-size:13.5px;
}
.docs-search svg{ width:16px; height:16px; flex:none; }
.docs-search kbd{
  margin-inline-start:auto;
  font-family:var(--mono);
  font-size:11px;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:5px;
  padding:1px 6px;
  color:var(--ink-500);
}

.docs-nav-group{ margin-bottom:22px; }
.docs-nav-group h6{
  font-size:11.5px;
  font-weight:800;
  letter-spacing:.06em;
  text-transform:uppercase;
  color:var(--ink-400);
  margin:0 0 8px;
}
.docs-nav-group ul{ display:flex; flex-direction:column; gap:2px; }
.docs-nav-group a{
  display:flex;
  align-items:center;
  gap:9px;
  padding:7px 10px;
  border-radius:8px;
  font-size:14px;
  font-weight:600;
  color:var(--ink-700);
  transition:background .15s ease, color .15s ease;
}
.docs-nav-group a:hover{ background:var(--surface-alt); color:var(--brand-blue-600); }
.docs-nav-group a.is-active{ background:var(--brand-gradient-soft); color:var(--brand-blue-700); }
.docs-nav-group a .method-chip{ flex:none; }

/* ---------- Main content ---------- */

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

.docs-hero{
  padding-bottom:36px;
  margin-bottom:44px;
  border-bottom:1px solid var(--border);
}
.docs-eyebrow{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-size:13px;
  font-weight:700;
  color:var(--brand-blue-600);
  background:var(--brand-gradient-soft);
  padding:5px 12px;
  border-radius:999px;
  margin-bottom:16px;
}
.docs-hero h1{
  font-size:clamp(30px,4vw,44px);
  line-height:1.1;
  letter-spacing:-.01em;
  font-weight:800;
  margin-bottom:14px;
}
.docs-hero p{
  font-size:17px;
  line-height:1.7;
  color:var(--ink-500);
  max-width:680px;
}
.docs-hero-actions{ display:flex; gap:12px; margin-top:24px; flex-wrap:wrap; }

.docs-section{
  padding-top:8px;
  margin-top:8px;
  scroll-margin-top:96px;
}
.docs-section + .docs-section{
  margin-top:64px;
  padding-top:48px;
  border-top:1px solid var(--border);
}
.docs-section h2{
  font-size:26px;
  font-weight:800;
  letter-spacing:-.005em;
  margin-bottom:14px;
}
.docs-section h3{
  font-size:19px;
  font-weight:750;
  margin:28px 0 10px;
}
.docs-section > p{
  font-size:15.5px;
  line-height:1.75;
  color:var(--ink-700);
  max-width:720px;
}
.docs-section > p + p{ margin-top:12px; }
.docs-lede{
  font-size:16.5px;
  line-height:1.75;
  color:var(--ink-500);
  max-width:720px;
  margin-bottom:22px;
}

.docs-section a.docs-link{
  color:var(--brand-blue-600);
  font-weight:600;
  text-decoration:underline;
  text-decoration-color:rgba(30,111,239,.35);
  text-underline-offset:3px;
}

/* ---------- Callouts ---------- */

.docs-callout{
  display:flex;
  gap:12px;
  padding:16px 18px;
  border-radius:var(--radius-md);
  margin:20px 0;
  font-size:14.5px;
  line-height:1.65;
}
.docs-callout svg{ width:20px; height:20px; flex:none; margin-top:1px; }
.docs-callout.is-info{ background:rgba(24,87,209,.07); color:var(--brand-blue-700); }
.docs-callout.is-warn{ background:rgba(217,119,6,.08); color:#92450a; }
.docs-callout.is-danger{ background:rgba(220,38,38,.07); color:#a32424; }
.docs-callout strong{ font-weight:750; }

/* ---------- Endpoint header (method + path) ---------- */

.docs-endpoint{
  margin:22px 0 18px;
}
.docs-endpoint-line{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  background:var(--ink-900);
  border-radius:var(--radius-sm);
  padding:13px 16px;
}
.method-chip{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-family:var(--mono);
  font-size:11.5px;
  font-weight:700;
  letter-spacing:.02em;
  padding:3px 9px;
  border-radius:6px;
  flex:none;
}
.method-chip.m-get{ background:rgba(34,197,138,.16); color:#4ade9b; }
.method-chip.m-post{ background:rgba(30,111,239,.18); color:#5b9dff; }

.docs-endpoint-path{
  font-family:var(--mono);
  font-size:14.5px;
  color:var(--code-ink);
  word-break:break-all;
}
.docs-endpoint-desc{
  margin-top:10px;
  font-size:14.5px;
  color:var(--ink-500);
}

/* ---------- Params table ---------- */

.docs-table-wrap{
  overflow-x:auto;
  margin:18px 0;
  border:1px solid var(--border);
  border-radius:var(--radius-md);
}
table.docs-table{
  width:100%;
  border-collapse:collapse;
  font-size:14px;
  min-width:520px;
}
table.docs-table th{
  text-align:start;
  font-size:11.5px;
  font-weight:800;
  letter-spacing:.05em;
  text-transform:uppercase;
  color:var(--ink-400);
  padding:11px 16px;
  background:var(--surface-alt);
  border-bottom:1px solid var(--border);
}
table.docs-table td{
  padding:12px 16px;
  border-bottom:1px solid var(--border);
  color:var(--ink-700);
  vertical-align:top;
}
table.docs-table tr:last-child td{ border-bottom:none; }
table.docs-table code{
  font-family:var(--mono);
  font-size:12.5px;
  background:var(--surface-alt);
  border:1px solid var(--border);
  border-radius:5px;
  padding:1px 6px;
  color:var(--brand-blue-700);
}
table.docs-table .req-badge{
  display:inline-block;
  font-size:10.5px;
  font-weight:800;
  letter-spacing:.03em;
  padding:2px 7px;
  border-radius:999px;
}
table.docs-table .req-badge.is-required{ background:rgba(220,38,38,.09); color:#c22; }
table.docs-table .req-badge.is-optional{ background:var(--ink-100); color:var(--ink-500); }

/* ---------- Code blocks + language tabs ---------- */

.docs-code{
  background:var(--code-bg);
  border:1px solid var(--code-border);
  border-radius:var(--radius-md);
  margin:18px 0;
  overflow:hidden;
}
.docs-code-tabs{
  display:flex;
  gap:2px;
  padding:8px 8px 0;
  border-bottom:1px solid var(--code-border);
}
.docs-code-tab{
  font-family:var(--mono);
  font-size:12.5px;
  font-weight:600;
  color:var(--ink-400);
  background:transparent;
  border:none;
  padding:9px 14px;
  border-radius:8px 8px 0 0;
  cursor:pointer;
}
.docs-code-tab:hover{ color:var(--code-ink); }
.docs-code-tab.is-active{ color:var(--code-ink); background:rgba(255,255,255,.06); }

.docs-code-panels{ position:relative; }
.docs-code-panel{ display:none; }
.docs-code-panel.is-active{ display:block; }

.docs-code pre{
  margin:0;
  padding:18px 20px;
  overflow-x:auto;
  font-family:var(--mono);
  font-size:13px;
  line-height:1.7;
  color:var(--code-ink);
}
.docs-code code{ font-family:inherit; }

/* Minimal syntax highlight — hand-tagged spans, not a JS highlighter */
.tok-key{ color:#7dd3fc; }
.tok-str{ color:#a7e8a0; }
.tok-num{ color:#f0b86e; }
.tok-com{ color:#6b7594; font-style:italic; }
.tok-fn{ color:#c9a2ff; }
.tok-kw{ color:#ff8fab; }

.docs-code-copy{
  position:absolute;
  top:8px;
  inset-inline-end:8px;
  display:flex;
  align-items:center;
  gap:6px;
  font-family:var(--font-en);
  font-size:12px;
  font-weight:600;
  color:var(--ink-400);
  background:rgba(255,255,255,.06);
  border:1px solid var(--code-border);
  border-radius:7px;
  padding:5px 10px;
  cursor:pointer;
  transition:color .15s ease, background .15s ease;
}
.docs-code-copy:hover{ color:var(--code-ink); background:rgba(255,255,255,.1); }
.docs-code-copy svg{ width:13px; height:13px; }
.docs-code-copy.is-copied{ color:#4ade9b; }

/* ---------- Response example block ---------- */

.docs-response-label{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:12.5px;
  font-weight:700;
  color:var(--ink-500);
  margin:22px 0 -4px;
}
.status-chip{
  font-family:var(--mono);
  font-size:11px;
  font-weight:700;
  padding:2px 8px;
  border-radius:6px;
}
.status-chip.s-2xx{ background:rgba(34,197,138,.14); color:#1a9d6c; }
.status-chip.s-4xx{ background:rgba(220,38,38,.1); color:#c22; }

/* ---------- Error key reference grid ---------- */

.docs-error-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(260px,1fr));
  gap:10px;
  margin:18px 0;
}
.docs-error-item{
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  padding:12px 14px;
  background:var(--surface);
}
.docs-error-item code{
  font-family:var(--mono);
  font-size:12.5px;
  color:var(--brand-blue-700);
  font-weight:700;
}
.docs-error-item p{
  margin-top:5px;
  font-size:13px;
  color:var(--ink-500);
  line-height:1.5;
}

/* ---------- Quick nav cards (getting-started grid) ---------- */

.docs-quick-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:14px;
  margin:24px 0;
}
.docs-quick-card{
  display:block;
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  padding:18px 20px;
  transition:border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.docs-quick-card:hover{ border-color:var(--brand-blue-500); transform:translateY(-2px); box-shadow:var(--shadow-md); }
.docs-quick-card .icon{
  width:38px; height:38px;
  border-radius:10px;
  display:flex; align-items:center; justify-content:center;
  background:var(--brand-gradient-soft);
  color:var(--brand-blue-600);
  margin-bottom:12px;
}
.docs-quick-card .icon svg{ width:19px; height:19px; }
.docs-quick-card h4{ font-size:15px; font-weight:750; margin-bottom:4px; }
.docs-quick-card p{ font-size:13px; color:var(--ink-500); line-height:1.55; }

/* ---------- Field/definition list (auth, notes) ---------- */

.docs-deflist{ display:flex; flex-direction:column; gap:14px; margin:18px 0; }
.docs-deflist-item{ display:flex; gap:14px; }
.docs-deflist-item .dot{
  flex:none;
  width:8px; height:8px;
  border-radius:50%;
  background:var(--brand-gradient);
  margin-top:8px;
}
.docs-deflist-item div{ font-size:14.5px; line-height:1.7; color:var(--ink-700); }
.docs-deflist-item strong{ color:var(--ink-900); font-family:var(--mono); font-size:13.5px; font-weight:700; }

/* ---------- Mobile ---------- */

.docs-mobile-nav-toggle{ display:none; }

@media (max-width: 980px){
  .docs-shell{ grid-template-columns:1fr; gap:0; padding-top:20px; }

  .docs-mobile-nav-toggle{
    display:flex;
    align-items:center;
    justify-content:space-between;
    width:100%;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius-sm);
    padding:12px 16px;
    font-weight:700;
    font-size:14.5px;
    margin-bottom:16px;
  }
  .docs-mobile-nav-toggle svg{ width:18px; height:18px; transition:transform .2s ease; }
  .docs-mobile-nav-toggle[aria-expanded="true"] svg{ transform:rotate(180deg); }

  .docs-sidebar{
    position:static;
    max-height:none;
    display:none;
    margin-bottom:24px;
    padding:16px;
    border:1px solid var(--border);
    border-radius:var(--radius-md);
    background:var(--surface-alt);
  }
  .docs-sidebar.is-open{ display:block; }

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

@media (max-width: 560px){
  .docs-quick-grid{ grid-template-columns:1fr; }
  table.docs-table{ min-width:460px; }
}
