/* ═══════════════════════════════════════════════════════════════
   OpsPing — Docs layout (user guide pages under www/docs/)
   Extends styles.css: sidebar nav + prose column + screenshot
   figures + callouts + step numbering. Load AFTER styles.css.
   ═══════════════════════════════════════════════════════════════ */

/* ── Layout: sticky sidebar + prose column ─────────────────── */
.docs-layout {
  max-width: 1160px;
  margin: 0 auto;
  padding: 96px 32px 80px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 56px;
  position: relative;
  z-index: 1;
}

.docs-sidebar {
  position: sticky;
  top: 96px;
  align-self: start;
  max-height: calc(100vh - 128px);
  overflow-y: auto;
}
.docs-sidebar-section { margin-bottom: 28px; }
.docs-sidebar h4 {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  padding-left: 12px;
}
.docs-sidebar a {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius);
  border-left: 2px solid transparent;
  transition: color .15s, background .15s;
}
.docs-sidebar a:hover { color: var(--text-primary); background: rgba(255,255,255,0.03); }
.docs-sidebar a.active {
  color: var(--accent);
  background: rgba(108,99,255,0.08);
  border-left-color: var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-weight: 500;
}

/* ── Prose column ──────────────────────────────────────────── */
.docs-content { max-width: 720px; min-width: 0; }
.docs-breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.docs-breadcrumb a { color: var(--text-secondary); text-decoration: none; }
.docs-breadcrumb a:hover { color: var(--accent); }
.docs-content h1 {
  font-size: 34px; font-weight: 800; letter-spacing: -0.03em;
  color: var(--text-primary); margin-bottom: 12px;
}
.docs-lede { font-size: 16px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 32px; }
.docs-content h2 { font-size: 22px; font-weight: 700; color: var(--text-primary); margin: 40px 0 12px; }
.docs-content h3 { font-size: 17px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.docs-content p { font-size: 15px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 16px; }
.docs-content ul, .docs-content ol:not(.docs-steps) {
  color: var(--text-secondary); font-size: 15px; line-height: 1.7; margin: 0 0 16px 24px;
}
.docs-content li { margin-bottom: 6px; }
.docs-content strong { color: var(--text-primary); font-weight: 600; }
.docs-content code {
  font-family: var(--font-mono); font-size: 13px;
  background: var(--surface); padding: 2px 6px; border-radius: var(--radius-sm);
  color: var(--accent);
}
.docs-content pre {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.7;
  overflow-x: auto; margin: 16px 0;
  color: var(--text-secondary);
}
.docs-content a { color: var(--accent); text-decoration: none; }
.docs-content a:hover { text-decoration: underline; }

/* ── Numbered steps ────────────────────────────────────────── */
.docs-steps { counter-reset: step; list-style: none; margin: 32px 0 0; }
.docs-steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 56px;
  margin-bottom: 48px;
}
.docs-steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: -4px;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-size: 14px; font-weight: 700;
  background: rgba(108,99,255,0.06);
}

/* ── Prerequisites box ─────────────────────────────────────── */
.docs-prereq {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin: 0 0 40px;
}
.docs-prereq-title {
  font-size: 12px; font-weight: 700; color: var(--text-primary);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.docs-prereq ul { margin: 0 0 0 20px; color: var(--text-secondary); font-size: 14px; line-height: 1.7; }
.docs-prereq li { margin-bottom: 4px; }
.docs-prereq code {
  font-family: var(--font-mono); font-size: 12px;
  background: var(--surface-raised); padding: 1px 5px; border-radius: var(--radius-sm);
  color: var(--accent);
}

/* ── Screenshot figures ────────────────────────────────────── */
.docs-shot { margin: 24px 0; }
.docs-shot img {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  background: var(--surface);
}
.docs-shot figcaption {
  font-size: 13px; color: var(--text-muted); line-height: 1.5;
  margin-top: 10px;
}
/* Single mobile screenshot (390×844 source): constrain width */
.docs-shot-mobile img { max-width: 300px; margin: 0 auto; }
.docs-shot-mobile figcaption { text-align: center; }
/* Two mobile screenshots side by side */
.docs-shot-pair { display: flex; gap: 24px; margin: 24px 0; align-items: flex-start; }
.docs-shot-pair .docs-shot { flex: 1; margin: 0; min-width: 0; }
.docs-shot-pair .docs-shot img { max-width: 100%; }
.docs-shot { cursor: zoom-in; }

/* ── Screenshot lightbox (click to enlarge) ────────────────── */
/* Triggered by docs.js on any .docs-shot image. Lets readers on
   large/wide monitors view a screenshot near full-viewport size. */
.docs-lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(12, 11, 24, 0.97);
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
}
/* purple radial wash behind the enlarged image — same accent glow
   (rgba(108,99,255,…)) used by the redesigned landing hero/bento. */
.docs-lightbox::before {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 1200px; height: 800px; transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(108,99,255,0.30), transparent);
  pointer-events: none;
}
.docs-lightbox[hidden] { display: none; }
.docs-lightbox-figure {
  position: relative; margin: 0; max-width: 100%; max-height: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.docs-lightbox-figure img {
  max-width: 96vw; max-height: 86vh;
  border-radius: var(--radius-lg); border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 0 70px rgba(108,99,255,0.28), 0 24px 70px rgba(0,0,0,0.6);
  object-fit: contain; background: var(--surface);
}
.docs-lightbox-figure figcaption {
  color: var(--text-secondary); font-size: 14px; line-height: 1.5;
  max-width: 760px; text-align: center;
}
.docs-lightbox-close {
  position: absolute; top: 18px; right: 22px; z-index: 1;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.16);
  color: var(--text-primary); font-size: 26px; line-height: 1; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.docs-lightbox-close:hover {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent);
}
@media (prefers-color-scheme: light) {
  .docs-lightbox { background: rgba(240, 242, 245, 0.97); }
  .docs-lightbox::before { background: radial-gradient(closest-side, rgba(87,79,214,0.20), transparent); }
  .docs-lightbox-figure img {
    border-color: var(--border);
    box-shadow: 0 0 60px rgba(87,79,214,0.20), 0 12px 40px rgba(0,0,0,0.12);
  }
  .docs-lightbox-close { background: var(--surface); }
}

/* ── Callouts ──────────────────────────────────────────────── */
.docs-callout {
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
  margin: 20px 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.docs-callout p { font-size: 14px; margin-bottom: 8px; }
.docs-callout p:last-child { margin-bottom: 0; }
.docs-callout-title {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.docs-callout.note { border-left-color: var(--accent); }
.docs-callout.note .docs-callout-title { color: var(--accent); }
.docs-callout.tip { border-left-color: var(--success); }
.docs-callout.tip .docs-callout-title { color: var(--success); }
.docs-callout.warning { border-left-color: var(--warning); }
.docs-callout.warning .docs-callout-title { color: var(--warning); }
.docs-callout code {
  font-family: var(--font-mono); font-size: 12px;
  background: var(--surface-raised); padding: 1px 5px; border-radius: var(--radius-sm);
  color: var(--accent);
}

/* ── Next-page footer link ─────────────────────────────────── */
.docs-next {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.docs-next-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.docs-next a {
  font-size: 15px; font-weight: 600;
  color: var(--accent); text-decoration: none;
}
.docs-next a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ── Responsive: sidebar collapses above content ───────────── */
@media (max-width: 900px) {
  .docs-layout { grid-template-columns: 1fr; gap: 32px; padding-top: 88px; }
  .docs-sidebar {
    position: static;
    max-height: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 12px;
  }
  .docs-sidebar-section { margin-bottom: 16px; }
  .docs-sidebar-section:last-child { margin-bottom: 0; }
  .docs-content h1 { font-size: 28px; }
}
@media (max-width: 600px) {
  .docs-shot-pair { flex-direction: column; gap: 0; }
  .docs-shot-pair .docs-shot { margin: 0 0 24px; }
  .docs-steps > li { padding-left: 48px; }
}

/* ── Light mode ────────────────────────────────────────────── */
@media (prefers-color-scheme: light) {
  .docs-shot img { box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
  .docs-sidebar a:hover { background: rgba(0,0,0,0.04); }
  .docs-sidebar a.active { background: rgba(21,87,176,0.08); }
  .docs-steps > li::before { background: rgba(21,87,176,0.06); }
}
