/* ============================================================
   DOCS — Layout for /docs/* pages
   Sidebar nav left, scrollable; reading column right.
   Reuses shared.css tokens for theming consistency.
   ============================================================ */

.docs-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 48px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 112px 32px 80px;
}

/* ---------- SIDEBAR ---------- */
.docs-sidebar {
  position: sticky;
  top: 80px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 16px;
}

.docs-sidebar-group { margin-bottom: 28px; }

.docs-sidebar-group-title {
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: 10px;
  padding: 0 8px;
}

.docs-sidebar-link {
  display: block;
  padding: 7px 12px;
  margin: 1px 0;
  font-size: 13.5px;
  color: var(--ink-2);
  text-decoration: none;
  border-radius: 7px;
  border-left: 2px solid transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.docs-sidebar-link:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.docs-sidebar-link.is-active {
  background: var(--gs-dim-15);
  color: var(--text);
  border-left-color: hsl(var(--gs-accent-h) 100% 68%);
  font-weight: 600;
}

[data-theme="light"] .docs-sidebar-link:hover { background: rgba(0, 0, 0, 0.04); }

/* ---------- MAIN CONTENT ---------- */
.docs-content {
  min-width: 0;
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--ink-2);
}

.docs-breadcrumbs {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-3);
  margin-bottom: 18px;
}
.docs-breadcrumbs a { color: var(--ink-3); text-decoration: none; }
.docs-breadcrumbs a:hover { color: var(--text); }
.docs-breadcrumbs-sep { opacity: 0.5; }

.docs-tier-tag {
  display: inline-block;
  margin-left: 10px;
  padding: 3px 10px;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(255, 200, 90, 0.18), rgba(255, 180, 60, 0.08));
  color: rgba(255, 215, 130, 0.95);
  border: 1px solid rgba(255, 200, 90, 0.28);
  vertical-align: middle;
}

.docs-content h1 {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 16px;
}

.docs-content h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 48px 0 14px;
  padding-top: 8px;
  scroll-margin-top: 90px;
}

.docs-content h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin: 28px 0 10px;
}

.docs-content p { margin-bottom: 16px; }

.docs-lead {
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink-2);
  margin-bottom: 32px;
}

.docs-content ul, .docs-content ol {
  margin: 0 0 18px 22px;
}
.docs-content li { margin-bottom: 8px; }

.docs-content a {
  color: hsl(var(--gs-accent-h) 100% 68%);
  text-decoration: none;
  border-bottom: 1px solid rgba(94, 170, 255, 0.3);
  transition: border-color 0.12s;
}
.docs-content a:hover { border-bottom-color: hsl(var(--gs-accent-h) 100% 68%); }

.docs-content strong { color: var(--text); font-weight: 600; }

.docs-content code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13.5px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
}

[data-theme="light"] .docs-content code { background: rgba(0, 0, 0, 0.04); }

.docs-content figure {
  margin: 28px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
}

.docs-content figure img {
  display: block;
  width: 100%;
  height: auto;
}

.docs-content figcaption {
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--ink-3);
  border-top: 1px solid var(--line);
  background: var(--bg-elev-3);
}

/* Lightbox — figure images are click-to-zoom via docs.js. */
.docs-content figure img {
  cursor: zoom-in;
  transition: opacity 0.15s;
}
.docs-content figure img:hover { opacity: 0.92; }
.docs-content figure img:focus-visible {
  outline: 2px solid hsl(var(--gs-accent-h) 100% 68%);
  outline-offset: 2px;
}

.docs-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: rgba(0, 0, 0, 0.92);
  cursor: zoom-out;
  animation: docs-lightbox-fade 0.15s ease-out;
  box-sizing: border-box;
}
.docs-lightbox.hidden { display: none; }
.docs-lightbox-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: default;
  border-radius: 10px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);
}
.docs-lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  padding: 0;
}
.docs-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
}
.docs-lightbox-close:focus-visible {
  outline: 2px solid hsl(var(--gs-accent-h) 100% 68%);
  outline-offset: 2px;
}
@keyframes docs-lightbox-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Responsive YouTube / video embed — 16:9 via the padding-bottom trick
   (universally reliable). !important guards against cache/specificity quirks
   and the iframe's own intrinsic dimensions. */
.docs-video-embed {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  height: 0 !important;
  padding: 0 !important;
  padding-bottom: 56.25% !important; /* 9 / 16 */
  margin: 28px 0 !important;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  box-sizing: border-box;
}
.docs-video-embed iframe {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border: 0 !important;
  display: block !important;
}

/* Callout / note box */
.docs-callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  margin: 20px 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--line);
  border-left: 3px solid hsl(var(--gs-accent-h) 100% 68%);
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink-2);
}
.docs-callout-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.docs-callout.is-warn { border-left-color: rgba(255, 180, 80, 0.7); }
.docs-callout.is-pro  { border-left-color: rgba(255, 215, 130, 0.85); }

/* Step list (numbered, visually richer than ol) */
.docs-steps { counter-reset: docstep; list-style: none; margin: 24px 0 28px; padding: 0; }
.docs-steps li {
  counter-increment: docstep;
  position: relative;
  padding: 12px 14px 12px 50px;
  margin-bottom: 8px;
  background: var(--gs-card-bg);
  border: 1px solid var(--gs-card-border);
  border-radius: 10px;
}
.docs-steps li::before {
  content: counter(docstep);
  position: absolute;
  left: 14px;
  top: 12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gs-dim-22);
  color: hsl(var(--gs-accent-h) 100% 68%);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Page footer nav */
.docs-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.docs-pager-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink-2);
  transition: background 0.12s, border-color 0.12s;
}
.docs-pager-link:hover {
  background: rgba(255, 255, 255, 0.025);
  border-color: var(--line-strong);
  color: var(--text);
}
.docs-pager-link.is-next { text-align: right; }
.docs-pager-label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.docs-pager-title { font-size: 14.5px; font-weight: 600; color: var(--text); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 880px) {
  .docs-layout {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 96px 20px 64px;
  }
  .docs-sidebar {
    position: static;
    max-height: none;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg-elev-2);
  }
  .docs-content h1 { font-size: 30px; }
  .docs-content h2 { font-size: 19px; margin: 36px 0 12px; }
}
