/* docs v5 — section labels promoted from weak eyebrow to real h2 + section divider */
/* ============================================================
   Pug Network — Docs site styles
   Loaded only by /docs/ pages. Reuses the design tokens defined
   in style.css (which is also loaded), but does not depend on
   any of style.css's component classes.
   Mobile-first: base styles assume <640px, then media queries
   progressively enhance for tablet (>=768px) and desktop (>=1024px).

   Spacing & type are driven by the explicit scales below. If you
   need a value that is not in the scale, the answer is almost
   always to pick the nearest scale value, not invent a new one.
   ============================================================ */

:root {
  --docs-sidebar-width: 260px;
  --docs-toc-width: 200px;
  --docs-topbar-height: 56px;
  --docs-content-max: 68ch;
  --docs-radius: 12px;
  --docs-border: rgba(124,196,255,0.14);
  --docs-border-strong: rgba(124,196,255,0.32);
  --docs-panel: rgba(22, 24, 29, 0.96);
  --docs-panel-hover: rgba(124,196,255,0.10);
  --docs-code-bg: rgba(8, 12, 20, 0.92);
  --docs-overlay: rgba(0, 0, 0, 0.55);

  /* Spacing scale — pick from these, do not invent in-between values */
  --docs-s1: 8px;
  --docs-s2: 12px;
  --docs-s3: 16px;
  --docs-s4: 24px;
  --docs-s5: 32px;
  --docs-s6: 44px;

  /* Type scale (mobile-first) */
  --docs-text-xs: 12px;
  --docs-text-sm: 14px;
  --docs-text-base: 16px;
  --docs-text-md: 17px;
  --docs-text-lg: 18px;
  --docs-line-tight: 1.35;
  --docs-line-body: 1.65;
}

/* ---------- Reset bits specific to the docs body ---------- */

body.docs-body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}

body.docs-body.is-drawer-open {
  overflow: hidden;
}

/* Skip link for keyboard users */
.docs-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #0d0e11;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
  z-index: 1000;
}
.docs-skip:focus {
  left: 12px;
  top: 12px;
}

/* ---------- Topbar ---------- */

.docs-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--docs-topbar-height);
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  height: calc(var(--docs-topbar-height) + env(safe-area-inset-top));
  background: rgba(13, 14, 17, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--docs-border);
}

.docs-topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.docs-topbar__logo {
  width: 28px;
  height: 28px;
  display: block;
}
.docs-topbar__name {
  font-size: 15px;
  white-space: nowrap;
}
.docs-topbar__sep {
  color: var(--muted);
  font-weight: 400;
  margin: 0 2px;
  white-space: nowrap;
}
.docs-topbar__crumb {
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}

.docs-topbar__spacer { flex: 1; min-width: 0; }

.docs-topbar__home {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--docs-border-strong);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Phones: drop the redundant " / Docs" crumb so the CTA has room.
   The brand mark already links to /docs/. */
@media (max-width: 480px) {
  .docs-topbar__sep,
  .docs-topbar__crumb { display: none; }
}
.docs-topbar__home:hover,
.docs-topbar__home:focus-visible {
  background: var(--docs-panel-hover);
  outline: none;
}

/* Hamburger: visible on mobile only */
.docs-topbar__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--docs-border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
}
.docs-topbar__toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.docs-topbar__toggle svg {
  width: 22px;
  height: 22px;
  display: block;
}

/* ---------- Shell layout ---------- */

.docs-shell {
  display: block;
  position: relative;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Sidebar (drawer on mobile, column on desktop) ---------- */

.docs-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  width: min(86vw, 320px);
  height: 100vh;
  height: 100dvh;
  padding: 20px 18px calc(28px + env(safe-area-inset-bottom));
  padding-top: calc(var(--docs-topbar-height) + env(safe-area-inset-top) + 16px);
  background: var(--panel);
  border-right: 1px solid var(--docs-border-strong);
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(-100%);
  transition: transform 220ms ease;
  -webkit-overflow-scrolling: touch;
}

body.is-drawer-open .docs-sidebar {
  transform: translateX(0);
}

@media (prefers-reduced-motion: reduce) {
  .docs-sidebar { transition: none; }
}

.docs-sidebar__overlay {
  position: fixed;
  inset: 0;
  background: var(--docs-overlay);
  z-index: 35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}
body.is-drawer-open .docs-sidebar__overlay {
  opacity: 1;
  pointer-events: auto;
}

.docs-sidebar__group {
  margin-bottom: 22px;
}
.docs-sidebar__group-title {
  margin: 0 0 8px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.docs-sidebar__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.docs-sidebar__list li { margin: 0; }

.docs-sidebar__link {
  position: relative;
  display: block;
  min-height: 44px;
  padding: 11px var(--docs-s2);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  line-height: var(--docs-line-tight);
}
.docs-sidebar__link:hover {
  background: var(--docs-panel-hover);
}
.docs-sidebar__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.docs-sidebar__link[aria-current="page"] {
  background: rgba(124,196,255,0.22);
  color: var(--accent);
  font-weight: 700;
  padding-left: 15px;
}
.docs-sidebar__link[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
}

/* ---------- Article ---------- */

.docs-article {
  max-width: var(--docs-content-max);
  margin: 0 auto;
  padding: var(--docs-s4) 0 64px;
}

.docs-article__eyebrow {
  margin: 0 0 var(--docs-s1);
  color: var(--accent);
  font-size: var(--docs-text-xs);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.docs-article h1 {
  margin: 0 0 var(--docs-s3);
  font-size: clamp(28px, 6vw, 38px);
  line-height: var(--docs-line-tight);
  letter-spacing: -0.01em;
}
.docs-article h2 {
  margin: var(--docs-s6) 0 var(--docs-s2);
  font-size: clamp(22px, 4.4vw, 26px);
  line-height: var(--docs-line-tight);
  scroll-margin-top: calc(var(--docs-topbar-height) + var(--docs-s4));
}
.docs-article h3 {
  margin: var(--docs-s5) 0 var(--docs-s1);
  font-size: clamp(18px, 3.6vw, 20px);
  line-height: var(--docs-line-tight);
  scroll-margin-top: calc(var(--docs-topbar-height) + var(--docs-s4));
}
.docs-article p,
.docs-article ul,
.docs-article ol {
  margin: 0 0 var(--docs-s3);
  font-size: var(--docs-text-base);
  line-height: var(--docs-line-body);
}
.docs-article p { color: var(--text); }
.docs-article ul,
.docs-article ol {
  padding-left: 22px;
}
.docs-article li {
  margin-bottom: var(--docs-s1);
  line-height: var(--docs-line-body);
}
.docs-article li > p { margin-bottom: var(--docs-s1); }
.docs-article li > strong { color: var(--text); }
.docs-article a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}
.docs-article a:hover { text-decoration-thickness: 2px; }
.docs-article a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.docs-article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
  background: var(--docs-code-bg);
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--docs-border);
}
.docs-article pre {
  background: var(--docs-code-bg);
  border: 1px solid var(--docs-border);
  border-radius: var(--docs-radius);
  padding: var(--docs-s2) var(--docs-s3);
  margin: 0 0 var(--docs-s3);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.55;
  -webkit-overflow-scrolling: touch;
}
.docs-article pre code {
  background: transparent;
  padding: 0;
  border: none;
  font-size: inherit;
}

/* Tables (responsive: horizontal scroll wrapper) */
.docs-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--docs-border);
  border-radius: var(--docs-radius);
  margin: 0 0 var(--docs-s3);
  -webkit-overflow-scrolling: touch;
}
.docs-article table {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
}
.docs-article th,
.docs-article td {
  padding: 10px var(--docs-s3);
  text-align: left;
  border-bottom: 1px solid var(--docs-border);
  vertical-align: top;
  font-size: var(--docs-text-sm);
  line-height: 1.5;
}
.docs-article th {
  background: rgba(124,196,255,0.06);
  font-weight: 700;
  color: var(--text);
}
.docs-article tbody tr:last-child td { border-bottom: none; }

/* Callouts */
.docs-callout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--docs-s2);
  padding: var(--docs-s2) var(--docs-s3);
  border-radius: var(--docs-radius);
  border: 1px solid var(--docs-border-strong);
  background: rgba(124,196,255,0.06);
  margin: 0 0 var(--docs-s3);
}
.docs-callout__icon {
  font-weight: 700;
  color: var(--accent);
  font-size: var(--docs-text-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.docs-callout p:last-child { margin-bottom: 0; }
.docs-callout--warn {
  border-color: rgba(255, 180, 80, 0.45);
  background: rgba(255, 180, 80, 0.08);
}
.docs-callout--warn .docs-callout__icon { color: #ffb450; }

/* Cards / two-column blocks for the comparison & implementations pages */
.docs-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--docs-s3);
  margin: 0 0 var(--docs-s3);
}
.docs-col {
  border: 1px solid var(--docs-border);
  border-radius: var(--docs-radius);
  background: var(--docs-panel);
  padding: var(--docs-s3) var(--docs-s4);
}
.docs-col h3 {
  margin-top: 0;
}
@media (min-width: 720px) {
  .docs-cols { grid-template-columns: 1fr 1fr; }
}

/* Prev / next pagination at the bottom of each article */
.docs-prevnext {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--docs-s2);
  margin-top: var(--docs-s6);
  padding-top: var(--docs-s4);
  border-top: 1px solid var(--docs-border);
}
.docs-prevnext__link {
  display: block;
  min-height: 64px;
  padding: var(--docs-s2) var(--docs-s3);
  border: 1px solid var(--docs-border);
  border-radius: var(--docs-radius);
  background: var(--docs-panel);
  color: var(--text);
  text-decoration: none;
}
.docs-prevnext__link:hover,
.docs-prevnext__link:focus-visible {
  border-color: var(--docs-border-strong);
  background: var(--docs-panel-hover);
  outline: none;
}
.docs-prevnext__dir {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.docs-prevnext__title {
  display: block;
  font-size: var(--docs-text-base);
  font-weight: 600;
  color: var(--text);
}
.docs-prevnext__link--next {
  text-align: right;
}
@media (min-width: 720px) {
  .docs-prevnext { grid-template-columns: 1fr 1fr; }
}

/* ---------- On-page TOC (right column on desktop, disclosure on mobile) ---------- */

.docs-toc {
  margin: var(--docs-s4) 0 0;
  padding: var(--docs-s2) var(--docs-s3);
  border: 1px solid var(--docs-border);
  border-radius: var(--docs-radius);
  background: var(--docs-panel);
}
.docs-toc[hidden] { display: none; }
.docs-toc__title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.docs-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.docs-toc__list li { margin: 0; }
.docs-toc__link {
  display: block;
  padding: 8px 4px;
  min-height: 36px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.4;
}
.docs-toc__link:hover { color: var(--text); }
.docs-toc__link[data-level="3"] {
  padding-left: 18px;
  font-size: 12px;
}

/* Mobile: collapsible TOC inside <details> */
.docs-toc-disclosure {
  margin: 24px 0 0;
}
.docs-toc-disclosure summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 14px;
  min-height: 44px;
  border: 1px solid var(--docs-border);
  border-radius: var(--docs-radius);
  background: var(--docs-panel);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.docs-toc-disclosure summary::-webkit-details-marker { display: none; }
.docs-toc-disclosure summary::after {
  content: "▾";
  color: var(--muted);
  font-size: 12px;
}
.docs-toc-disclosure[open] summary::after { content: "▴"; }
.docs-toc-disclosure .docs-toc {
  margin-top: 8px;
}
.docs-toc-disclosure .docs-toc__link {
  min-height: 44px;
  font-size: 14px;
  padding: 12px 6px;
}
.docs-toc-disclosure .docs-toc__link[data-level="3"] {
  font-size: 13px;
}

/* ---------- Index page (the /docs/ landing) ---------- */

.docs-index__hero {
  padding: var(--docs-s4) 0 var(--docs-s2);
}
.docs-index__hero h1 {
  margin: 0 0 var(--docs-s2);
  font-size: clamp(28px, 7vw, 40px);
  line-height: var(--docs-line-tight);
}
.docs-index__hero p {
  color: var(--muted);
  margin: 0;
  max-width: 60ch;
  font-size: 15px;
  line-height: var(--docs-line-body);
}

/* Section = one labeled group of cards. The previous design used a tiny
   uppercase eyebrow above a bare grid; that was visually too weak — the
   "label" looked like a caption belonging to the first card no matter
   how much margin we added beneath it.

   The fix is structural, not numeric:
     1) Wrap each label + grid in a <section> container.
     2) Promote the label to a real <h2> with body-weight font-size and
        full text colour (no uppercase, no letter-spacing tricks).
     3) Separate adjacent sections with a top divider so the visual
        grouping is unambiguous, instead of relying on margin alone. */
.docs-index__section {
  padding-top: var(--docs-s5);   /* 32px breathing room above the heading */
  margin-top: var(--docs-s4);    /* 24px additional gap between sections */
}
.docs-index__section + .docs-index__section {
  border-top: 1px solid var(--docs-border);
  margin-top: var(--docs-s5);    /* 32px so the rule doesn't crowd the heading above it */
}
.docs-index__hero + .docs-index__section {
  /* First section sits closer to the hero — no divider, no double gap. */
  padding-top: var(--docs-s3);
  margin-top: 0;
  border-top: none;
}

.docs-index__section-title {
  margin: 0 0 var(--docs-s3);    /* 16px — plenty when heading is bold and full size */
  font-size: clamp(18px, 4.4vw, 22px);
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--text);
  line-height: var(--docs-line-tight);
}

.docs-index__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--docs-s3);
  margin: 0;
}
@media (min-width: 720px) {
  .docs-index__grid { grid-template-columns: 1fr 1fr; }
}

.docs-index__card {
  display: block;
  padding: 20px 22px;
  border: 1px solid var(--docs-border);
  border-radius: var(--docs-radius);
  background: var(--docs-panel);
  color: var(--text);
  text-decoration: none !important;
  -webkit-text-decoration: none !important;
  min-height: 104px;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}
/* Defense in depth: kill underlines on every state and every descendant. */
.docs-index__card:link,
.docs-index__card:visited,
.docs-index__card:hover,
.docs-index__card:active,
.docs-index__card:focus,
.docs-index__card *,
.docs-index__card-title,
.docs-index__card-desc {
  text-decoration: none !important;
  -webkit-text-decoration: none !important;
}
.docs-index__card:hover,
.docs-index__card:focus-visible {
  border-color: var(--docs-border-strong);
  background: var(--docs-panel-hover);
  outline: none;
}
.docs-index__card-title {
  display: block;
  font-size: var(--docs-text-lg);
  font-weight: 700;
  margin-bottom: var(--docs-s1);
  color: var(--text);
  line-height: var(--docs-line-tight);
}
.docs-index__card-desc {
  display: block;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.55;
}

/* ---------- Tablet: sidebar becomes static, full layout ---------- */

@media (min-width: 768px) {
  .docs-topbar { padding: 0 24px; }

  .docs-shell {
    display: grid;
    grid-template-columns: var(--docs-sidebar-width) minmax(0, 1fr);
    gap: 28px;
    padding: 0 24px;
    align-items: start;
  }

  .docs-sidebar {
    position: sticky;
    top: calc(var(--docs-topbar-height) + env(safe-area-inset-top));
    left: auto;
    width: auto;
    height: calc(100vh - var(--docs-topbar-height) - env(safe-area-inset-top));
    height: calc(100dvh - var(--docs-topbar-height) - env(safe-area-inset-top));
    transform: none;
    background: transparent;
    border-right: none;
    padding: 24px 8px 32px;
  }
  .docs-sidebar__overlay { display: none; }

  .docs-topbar__toggle { display: none; }

  .docs-article {
    margin: 0;
    padding: 24px 4px 64px;
  }

  .docs-toc-disclosure { display: none; }
}

/* ---------- Desktop: add right-side TOC ---------- */

@media (min-width: 1080px) {
  .docs-shell {
    grid-template-columns: var(--docs-sidebar-width) minmax(0, 1fr) var(--docs-toc-width);
  }

  .docs-toc-aside {
    position: sticky;
    top: calc(var(--docs-topbar-height) + env(safe-area-inset-top) + 24px);
    align-self: start;
    max-height: calc(100vh - var(--docs-topbar-height) - 48px);
    overflow-y: auto;
  }
  .docs-toc-aside .docs-toc { margin-top: 0; }
}

@media (max-width: 1079px) {
  .docs-toc-aside { display: none; }
}

/* ---------- Print: drop chrome, keep article ---------- */

@media print {
  .docs-topbar,
  .docs-sidebar,
  .docs-sidebar__overlay,
  .docs-toc-aside,
  .docs-toc-disclosure,
  .docs-prevnext,
  .docs-skip {
    display: none !important;
  }
  body.docs-body {
    background: #fff;
    color: #000;
  }
  .docs-article {
    max-width: none;
    padding: 0;
  }
  .docs-article a { color: #000; text-decoration: underline; }
  .docs-article pre,
  .docs-article code {
    background: #f4f4f4;
    color: #000;
    border-color: #ccc;
  }
}
