/* apps/docs/docs.css — docs-specific overlay on /shared/theme.css.
   Adds the persistent left sidebar layout and the docs hero gradient. */

/* ── Doc shell layout ──────────────────────────────────────────── */
.doc-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: calc(var(--nav-height) + 0.75rem) 1.75rem 2rem;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}

aside.sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 0.75rem);
  align-self: start;
  max-height: calc(100vh - var(--nav-height) - 1rem);
  overflow-y: auto;
  padding: 1rem 0.5rem 2rem;
  font-size: 0.86rem;
}
aside.sidebar::-webkit-scrollbar { width: 6px; }
aside.sidebar::-webkit-scrollbar-track { background: transparent; }
aside.sidebar::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }

.sidebar-section { margin-bottom: 1.75rem; }
.sidebar-section h4 {
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0 0.75rem;
  margin-bottom: 0.6rem;
}
.sidebar-section ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin: 0;
  padding: 0;
}
.sidebar-section li { margin: 0; }
.sidebar-section a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--r-md);
  font-size: 0.86rem;
  color: var(--text-muted);
  font-weight: 500;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}
.sidebar-section a:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}
.sidebar-section a.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  border-left-color: var(--accent);
  font-weight: 600;
}
.sidebar-section a .glyph {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  width: 1.4em;
}
.sidebar-section a.active .glyph { color: var(--accent); }
.sidebar-tag {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-left: auto;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  color: var(--gold);
  background: color-mix(in srgb, var(--gold) 12%, transparent);
}
.sidebar-tag.live { color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); }

/* ── Main content ──────────────────────────────────────────────── */
main.doc-content {
  min-width: 0;
  max-width: var(--doc-max);
  padding-bottom: 4rem;
}

/* ── Docs h2 with thin top rule (visual section breaks) ────────── */
main.doc-content h2 {
  margin: 4rem 0 1rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
main.doc-content h2:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 2rem;
}

/* ── Hero glow on docs index ───────────────────────────────────── */
.docs-hero {
  position: relative;
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
  /* The ::before gradient overflows the hero by 3rem on each side; clip
     it so the bleed doesn't push horizontal page scroll on narrow
     viewports. The visual loss at desktop is negligible. */
  overflow: hidden;
}
.docs-hero::before {
  /* the sunwash — same dawn light the landing hero wears */
  content: '';
  position: absolute;
  top: -3rem; left: -3rem; right: -3rem;
  height: 320px;
  background: radial-gradient(ellipse 70% 50% at 50% 0%, color-mix(in srgb, var(--accent) 10%, transparent) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}
.docs-hero h1 {
  font-size: clamp(2.5rem, 5vw, 3.8rem);
  margin-bottom: 1.5rem;
}

/* ── Plain endpoint tables (e.g. collect.html) ─────────────────── */
.endpoint-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.88rem;
}
.endpoint-table th,
.endpoint-table td {
  text-align: left;
  padding: 0.55rem 1.5rem 0.55rem 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.endpoint-table th {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.endpoint-table th:last-child,
.endpoint-table td:last-child {
  padding-right: 0;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .endpoint-table { font-size: 0.8rem; }
  .endpoint-table th,
  .endpoint-table td { padding-right: 0.75rem; }
  .endpoint-table th:first-child,
  .endpoint-table td:first-child { width: 1%; white-space: nowrap; }
}

/* ── Docs footer (matches site-footer baseline) ────────────────── */
footer.doc-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 1.75rem 3rem;
  max-width: 1280px;
  margin: 4rem auto 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex; justify-content: space-between; flex-wrap: wrap;
  gap: 1rem;
}
footer.doc-footer .right {
  font-family: var(--serif);
  font-style: italic;
  color: var(--text-dim);
}

/* ── Mobile ────────────────────────────────────────────────────── */
@media (max-width: 920px) {
  .doc-shell {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: calc(var(--nav-height) + 0.5rem) 1.25rem 2rem;
  }
  /* Content first, nav second — a phone visitor should meet the hero
     before scrolling a 24-link sidebar. */
  main.doc-content { order: 1; }
  aside.sidebar { order: 2; }
  aside.sidebar {
    position: static;
    max-height: none;
    overflow-y: visible;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--surface);
  }
  main.doc-content h2 { margin-top: 3rem; padding-top: 1.5rem; }
  pre { font-size: 0.76rem; padding: 0.85rem 1rem; }
}
