/* ============================================
   DODO AEGIES — Docs layout
   ============================================ */

.docs-page {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 220px;
  gap: 0;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: calc(100vh - var(--nav-h));
}

/* Sidebar */
.docs-side {
  border-right: 1px solid var(--line);
  padding: 32px 24px 64px 0;
  position: sticky;
  top: var(--nav-h);
  align-self: start;
  max-height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}
.docs-search {
  position: relative;
  margin-bottom: 24px;
}
.docs-search input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font: 13px var(--font-sans);
  background: var(--surface);
  outline: 0;
}
.docs-search input:focus { border-color: var(--brand-500); background: var(--card); box-shadow: 0 0 0 3px rgba(47,99,245,.15); }
.docs-search::before {
  content: '';
  position: absolute;
  top: 50%; left: 12px;
  width: 14px; height: 14px;
  transform: translateY(-50%);
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e7488' stroke-width='2'><circle cx='11' cy='11' r='7'/><path d='M21 21l-4.3-4.3'/></svg>");
  background-size: contain;
  pointer-events: none;
}
.docs-search .kbd {
  position: absolute;
  top: 50%; right: 8px;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 5px;
  color: var(--slate-3);
  pointer-events: none;
}
.docs-nav-section {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--slate-3);
  padding: 14px 0 8px;
}
.docs-nav-section:first-child { padding-top: 0; }
.docs-nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--slate-2);
  text-decoration: none;
}
.docs-nav-link:hover { background: var(--surface); color: var(--ink); }
.docs-nav-link.active { background: var(--brand-50); color: var(--brand-700); font-weight: 500; }
.docs-nav-link .meta { margin-left: auto; font-size: 10px; font-family: var(--font-mono); color: var(--slate-4); }
.docs-nav-link .tag { padding: 1px 5px; font-size: 9px; }

/* Main content */
.docs-main {
  padding: 40px 48px 96px;
  min-width: 0;
}
.docs-breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  color: var(--slate-3);
  margin-bottom: 24px;
  font-family: var(--font-mono);
}
.docs-breadcrumb a { color: var(--slate-3); }
.docs-breadcrumb a:hover { color: var(--brand-600); }
.docs-breadcrumb .sep { color: var(--slate-4); }
.docs-main h1 { font-size: 40px; margin-bottom: 12px; letter-spacing: -.025em; }
.docs-main .lead {
  font-size: 18px;
  color: var(--slate-2);
  margin-bottom: 40px;
  max-width: 65ch;
  line-height: 1.55;
}
.docs-main h2 {
  font-size: 26px;
  margin-top: 56px;
  margin-bottom: 12px;
  letter-spacing: -.02em;
  padding-top: 8px;
  scroll-margin-top: 88px;
}
.docs-main h3 {
  font-size: 18px;
  margin-top: 32px;
  margin-bottom: 8px;
  scroll-margin-top: 88px;
}
.docs-main p, .docs-main li { font-size: 15px; line-height: 1.65; color: var(--slate-1); }
.docs-main p { margin-bottom: 16px; max-width: 65ch; }
.docs-main ul, .docs-main ol { padding-left: 24px; max-width: 65ch; }
.docs-main li { margin-bottom: 6px; }
.docs-main code:not(pre code) {
  font-family: var(--font-mono);
  font-size: .9em;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--brand-700);
}
.docs-main a { color: var(--brand-600); text-decoration: underline; text-decoration-color: var(--brand-200); text-underline-offset: 2px; }

.docs-main pre {
  margin: 16px 0 24px;
  background: #0d1126;
  color: #d8def0;
  border-radius: var(--r-md);
  padding: 18px 20px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
  overflow-x: auto;
  position: relative;
}
.docs-main pre .k  { color: #8aa6ff; }
.docs-main pre .s  { color: #9be59b; }
.docs-main pre .c  { color: #6e7488; }
.docs-main pre .n  { color: #ffb37a; }
.docs-main pre .f  { color: #6dd1ff; }

/* code block header (lang + copy) */
.codeblock { position: relative; margin: 16px 0 24px; }
.codeblock .copy {
  position: absolute; top: 10px; right: 10px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  color: #d8def0;
  padding: 4px 10px;
  border-radius: 4px;
  font: 11px var(--font-mono);
  cursor: pointer;
}
.codeblock .copy:hover { background: rgba(255,255,255,.12); }
.codeblock .lang {
  position: absolute; top: 10px; left: 16px;
  font: 11px var(--font-mono);
  color: var(--brand-300);
  text-transform: uppercase;
  letter-spacing: .08em;
  pointer-events: none;
}
.codeblock pre { padding-top: 36px !important; margin: 0 !important; }

/* Callout */
.callout {
  display: flex; gap: 12px;
  border-left: 3px solid var(--brand-400);
  background: var(--brand-50);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: 14px 16px;
  margin: 24px 0;
  font-size: 14px;
  color: var(--ink-2);
}
.callout.warn { border-color: var(--warn); background: #fff8eb; }
.callout.note { border-color: var(--slate-3); background: var(--surface); }
.callout strong { display: block; font-size: 12px; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--brand-700); margin-bottom: 4px; }
.callout.warn strong { color: #a16207; }
.callout.note strong { color: var(--slate-2); }

/* Table */
.docs-main table {
  width: 100%;
  margin: 16px 0 24px;
  border-collapse: collapse;
  font-size: 14px;
}
/* Wide tables (4+ columns) scroll inside themselves on phones instead of
   pushing the whole page sideways. */
@media (max-width: 620px) {
  .docs-main table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .docs-main th, .docs-main td { padding: 8px 10px; }
}
.docs-main th, .docs-main td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.docs-main th {
  background: var(--surface);
  font-weight: 600;
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--slate-2);
}
.docs-main td code:not(pre code) { color: var(--ink); }

/* Right TOC */
.docs-toc {
  padding: 40px 0 64px 24px;
  position: sticky;
  top: var(--nav-h);
  align-self: start;
  max-height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  font-size: 13px;
}
.docs-toc .head {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--slate-3);
  margin-bottom: 12px;
}
.docs-toc a {
  display: block;
  padding: 4px 0;
  color: var(--slate-2);
}
.docs-toc a.h3 { padding-left: 12px; font-size: 12.5px; }
.docs-toc a:hover { color: var(--ink); }
.docs-toc a.active { color: var(--brand-600); font-weight: 500; }

/* prev/next pager */
.docs-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 64px;
}
.docs-pager a {
  display: block;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--ink);
  background: var(--card);
  transition: border-color .15s;
}
.docs-pager a:hover { border-color: var(--brand-300); }
.docs-pager .lbl { font-family: var(--font-mono); font-size: 11px; color: var(--slate-3); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .08em; }
.docs-pager .ttl { font-weight: 500; font-size: 15px; }
.docs-pager .next { text-align: right; }

/* API method badges */
.method {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .06em;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}
.method.get  { background: #e0f2fe; color: #0369a1; }
.method.post { background: #dcfce7; color: #16a34a; }
.method.put  { background: #fef3c7; color: #b45309; }
.method.del  { background: #fee2e2; color: #b91c1c; }

/* Endpoint card */
.endpoint {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px 20px;
  margin: 16px 0 24px;
  background: var(--card);
}
.endpoint .url {
  font-family: var(--font-mono);
  font-size: 13px;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
}
.endpoint .url code { background: var(--surface); padding: 3px 8px; border-radius: 4px; }
.endpoint p { font-size: 14px; margin: 0; }

/* Docs homepage hero */
.docs-home-hero {
  text-align: center;
  padding: 48px 0 56px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 48px;
}
.docs-home-hero h1 { font-size: 44px; }
.docs-home-hero .lead { margin: 16px auto 0; max-width: 60ch; }
.docs-home-hero .search-big {
  max-width: 560px;
  margin: 32px auto 0;
  position: relative;
}
.docs-home-hero .search-big input {
  width: 100%;
  padding: 14px 16px 14px 48px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: 15px;
  outline: 0;
  box-shadow: var(--shadow-sm);
}
.docs-home-hero .search-big input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 4px rgba(47,99,245,.15); }
.docs-home-hero .search-big::before {
  content: '';
  position: absolute; top: 50%; left: 18px;
  width: 18px; height: 18px;
  transform: translateY(-50%);
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e7488' stroke-width='2'><circle cx='11' cy='11' r='7'/><path d='M21 21l-4.3-4.3'/></svg>");
  background-size: contain;
}

.docs-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 64px;
}
.docs-card {
  display: block;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  text-decoration: none;
  color: inherit;
  background: var(--card);
  transition: border-color .15s, transform .15s;
}
.docs-card:hover { border-color: var(--brand-300); transform: translateY(-2px); }
.docs-card .ic {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--brand-50);
  color: var(--brand-600);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.docs-card h3 { font-size: 17px; }
.docs-card p { font-size: 13.5px; color: var(--slate-2); margin-top: 4px; line-height: 1.5; }
@media (max-width: 900px) { .docs-cards-grid { grid-template-columns: 1fr; } }

@media (max-width: 1080px) {
  .docs-page { grid-template-columns: 240px minmax(0, 1fr); }
  .docs-toc { display: none; }
}
@media (max-width: 900px) {
  .docs-page { grid-template-columns: 1fr; padding: 0 16px; }
  .docs-main { padding: 32px 0 64px; }
}

/* ============================================
   Sidebar trigger + collapsible groups
   ============================================ */
.docs-search-trigger {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  margin-bottom: 20px;
  padding: 9px 10px 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--slate-3);
  font: 13px var(--font-sans);
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, background .15s;
}
.docs-search-trigger:hover { border-color: var(--brand-300); background: var(--card); }
.docs-search-trigger svg { width: 15px; height: 15px; flex: 0 0 15px; }
.docs-search-trigger span:not(.kbd) { flex: 1; }
.docs-search-trigger .kbd {
  font-family: var(--font-mono); font-size: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 4px; padding: 2px 5px; color: var(--slate-3);
}

.docs-nav-group { margin-bottom: 4px; }
.docs-nav-group .docs-nav-section {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  background: transparent; border: 0; cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--slate-3);
  padding: 14px 0 8px;
}
.docs-nav-group:first-child .docs-nav-section { padding-top: 0; }
.docs-nav-group .docs-nav-section:hover { color: var(--ink); }
.docs-nav-group .chev { width: 13px; height: 13px; transition: transform .18s; color: var(--slate-4); }
.docs-nav-group.collapsed .chev { transform: rotate(-90deg); }
.docs-nav-items { display: grid; gap: 1px; overflow: hidden; }
.docs-nav-group.collapsed .docs-nav-items { display: none; }

/* ============================================
   ⌘K search modal
   ============================================ */
body.dsm-lock { overflow: hidden; }
.docs-search-modal { position: fixed; inset: 0; z-index: 200; display: none; }
.docs-search-modal.open { display: block; }
.dsm-backdrop {
  position: absolute; inset: 0;
  background: rgba(8, 12, 28, .55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: dsmFade .12s ease;
}
.dsm-box {
  position: relative;
  max-width: 640px;
  margin: 11vh auto 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  max-height: 72vh;
  overflow: hidden;
  animation: dsmPop .14s cubic-bezier(.2,.8,.2,1);
}
@keyframes dsmFade { from { opacity: 0; } }
@keyframes dsmPop { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
.dsm-input { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.dsm-input svg { width: 18px; height: 18px; color: var(--slate-3); flex: 0 0 18px; }
.dsm-input input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font: 16px var(--font-sans); color: var(--ink);
}
.dsm-input input::placeholder { color: var(--slate-4); }
.dsm-esc { font-family: var(--font-mono); font-size: 10px; color: var(--slate-4); border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; }
.dsm-results { overflow-y: auto; padding: 8px; }
.dsm-empty { padding: 32px; text-align: center; color: var(--slate-3); font-size: 14px; }
.dsm-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-sm);
  text-decoration: none; color: var(--ink);
}
.dsm-row.sel { background: var(--brand-50); }
.dsm-ic {
  flex: 0 0 30px; width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 7px; background: var(--surface); color: var(--slate-3);
}
.dsm-row.sel .dsm-ic { background: var(--brand-100); color: var(--brand-700); }
.dsm-ic svg { width: 15px; height: 15px; }
.dsm-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dsm-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dsm-crumb { color: var(--slate-3); font-weight: 400; }
.dsm-crumb::after { content: '/'; margin: 0 6px; color: var(--slate-4); }
.dsm-snip { font-size: 12.5px; color: var(--slate-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dsm-row mark { background: transparent; color: var(--brand-600); font-weight: 600; }
.dsm-go { font-family: var(--font-mono); font-size: 12px; color: var(--slate-4); opacity: 0; }
.dsm-row.sel .dsm-go { opacity: 1; }
.dsm-foot {
  display: flex; gap: 18px; padding: 10px 16px;
  border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--slate-3);
}
.dsm-foot kbd {
  font-family: var(--font-mono); font-size: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 4px; padding: 1px 5px; margin-right: 2px; color: var(--slate-2);
}

/* ============================================
   Heading anchors
   ============================================ */
.docs-main h2, .docs-main h3 { position: relative; }
.heading-anchor {
  position: absolute; left: -22px; top: 50%; transform: translateY(-50%);
  color: var(--brand-400); text-decoration: none; font-weight: 600;
  opacity: 0; transition: opacity .12s; padding: 0 6px;
}
.docs-main h2:hover .heading-anchor,
.docs-main h3:hover .heading-anchor { opacity: 1; }
.heading-anchor.copied { color: var(--ok); }
.heading-anchor.copied::after {
  content: 'Copied!'; position: absolute; left: 100%; top: 50%; transform: translateY(-50%);
  white-space: nowrap; font: 500 11px var(--font-sans); color: var(--ok); margin-left: 6px;
}
@media (max-width: 1080px) { .heading-anchor { display: none; } }

/* ============================================
   Article footer (last updated + feedback)
   ============================================ */
.docs-article-foot {
  margin-top: 56px; padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}
.daf-updated { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--slate-3); }
.daf-updated svg { width: 15px; height: 15px; }
.daf-updated strong { color: var(--slate-2); font-weight: 500; }
.daf-feedback { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--slate-2); }
.daf-btns { display: flex; gap: 6px; }
.daf-feedback button {
  width: 32px; height: 32px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--card); color: var(--slate-3); cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.daf-feedback button:hover { color: var(--ink); border-color: var(--brand-300); }
.daf-feedback button svg { width: 16px; height: 16px; }
.daf-feedback button.on { color: var(--brand-600); border-color: var(--brand-400); background: var(--brand-50); }
.daf-thanks { display: none; color: var(--ok); font-weight: 500; }
.daf-feedback[data-done="1"] .daf-q,
.daf-feedback[data-done="1"] .daf-btns { display: none; }
.daf-feedback[data-done="1"] .daf-thanks { display: inline; }

/* ============================================
   Mobile drawer
   ============================================ */
.docs-menu-btn { display: none; }
.docs-drawer-backdrop { display: none; }
@media (max-width: 900px) {
  .docs-menu-btn {
    display: inline-flex; align-items: center; gap: 8px;
    position: fixed; left: 16px; bottom: 16px; z-index: 120;
    height: 44px; padding: 0 18px;
    border: 1px solid var(--line); border-radius: 999px;
    background: var(--card); color: var(--ink);
    font: 500 14px var(--font-sans); cursor: pointer;
    box-shadow: var(--shadow-lg);
  }
  .docs-menu-btn svg { width: 18px; height: 18px; }
  .docs-side {
    display: block !important;
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 290px; max-width: 86vw; z-index: 130;
    background: var(--bg); border-right: 1px solid var(--line);
    padding: 24px 20px 64px; margin: 0;
    max-height: none; overflow-y: auto;
    transform: translateX(-102%); transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  body.docs-drawer-open .docs-side { transform: translateX(0); }
  .docs-drawer-backdrop {
    position: fixed; inset: 0; z-index: 125;
    background: rgba(8,12,28,.5);
    opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  body.docs-drawer-open .docs-drawer-backdrop { display: block; opacity: 1; pointer-events: auto; }
  .dsm-box { margin: 6vh 12px 0; }
}
