/* =========================================================================
   Ringleader docs: layout layered on top of the shared theme stylesheet.
   Sidebar + content + on-page TOC, plus docs prose (tables, callouts, etc.).
   All colors come from the theme's CSS variables.
   ========================================================================= */

/* ----------------------------------------------------------- Docs shell */
.main-docs { min-height: 70vh; }

.docs-shell {
  max-width: 1320px;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr) 216px;
  gap: 44px;
  align-items: start;
  padding-top: 28px;
  padding-bottom: clamp(56px, 8vw, 96px);
}
/* The landing reuses the shell but has no right-hand TOC, so it is two columns.
   Defined after the base rule so it wins at desktop; the 1080px/860px media
   queries target .docs-shell and still collapse it. */
.docs-shell-home { grid-template-columns: 244px minmax(0, 1fr); }

/* ----------------------------------------------------------- Sidebar nav */
.docs-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 14px);
  max-height: calc(100svh - var(--header-h) - 28px);
  overflow-y: auto;
  padding-right: 6px;
  font-size: 0.9rem;
}
.docs-nav-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--color-text-light);
  padding: 6px 0;
  margin-bottom: 10px;
  transition: color var(--transition-base);
}
.docs-nav-home:hover, .docs-nav-home.active { color: var(--color-text); }

.docs-nav-group { margin: 0 0 18px; }
.docs-nav-section {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-light);
  padding: 6px 0;
  transition: color var(--transition-base);
}
.docs-nav-section:hover, .docs-nav-section.active { color: var(--color-text); }

/* Collapsible section headers: native <details>/<summary>, no JS. The current
   section renders with the `open` attribute (server-side), so navigating to a
   page auto-expands its section and collapses the rest. */
summary.docs-nav-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}
summary.docs-nav-section::-webkit-details-marker { display: none; }
summary.docs-nav-section:hover { color: var(--color-text); }
/* Drop the browser's persistent focus box on mouse click; keep a tasteful
   outline for keyboard users only. */
summary.docs-nav-section:focus { outline: none; }
summary.docs-nav-section:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 4px;
}
.docs-nav-caret {
  flex: none;
  color: var(--color-text-light);
  transition: transform var(--transition-base);
}
details.docs-nav-group[open] > summary .docs-nav-caret { transform: rotate(90deg); }

.docs-nav-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0 0 0 2px;
  display: grid;
  gap: 1px;
  border-left: 1px solid var(--color-border);
}
.docs-nav-link {
  display: block;
  padding: 6px 12px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--color-text-light);
  transition: color var(--transition-base), border-color var(--transition-base), background var(--transition-base);
}
.docs-nav-link:hover { color: var(--color-text); background: var(--color-bg-alt); }
.docs-nav-link.active {
  color: var(--color-text);
  font-weight: 600;
  border-left-color: var(--color-accent);
}

/* ----------------------------------------------------------- Main column */
.docs-main { min-width: 0; }

.docs-breadcrumb { margin: 2px 0 18px; }
.docs-breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  font-size: 0.82rem;
  color: var(--color-text-light);
}
.docs-breadcrumb li { display: inline-flex; align-items: center; gap: 6px; }
.docs-breadcrumb li:not(:last-child)::after { content: "/"; color: var(--color-border); }
.docs-breadcrumb a { color: var(--color-text-light); transition: color var(--transition-base); }
.docs-breadcrumb a:hover { color: var(--color-text); }
.docs-breadcrumb li[aria-current] { color: var(--color-text); font-weight: 600; }

.docs-head { margin: 0 0 18px; padding-bottom: 18px; border-bottom: 1px solid var(--color-border); }
.docs-title { font-size: clamp(1.8rem, 4vw, 2.5rem); margin: 0; }
.docs-lead { font-size: 1.12rem; color: var(--color-text-light); margin: 12px 0 0; }

/* docs prose: let tables and code blocks use the full column width
   (the theme caps prose children at a narrow measure for the marketing site). */
.docs-body.prose > *,
.docs-home-body .prose > * { max-width: 760px; }
.docs-body.prose > pre,
.docs-body.prose > .table-wrap,
.docs-body.prose > table,
.docs-body.prose > .callout,
.docs-body.prose > .screenshot,
.docs-body.prose > .docs-cards { max-width: none; }
.docs-body.prose > h2 { padding-top: 0.2em; }
.docs-body.prose h2 { scroll-margin-top: calc(var(--header-h) + 16px); }
.docs-body.prose h3, .docs-body.prose h4 { scroll-margin-top: calc(var(--header-h) + 16px); }
.docs-body.prose h4 { font-size: 1.02rem; margin: 1.6em 0 0.4em; }

/* anchored headings get a subtle hover affordance */
.docs-body.prose h2, .docs-body.prose h3 { position: relative; }

/* ----------------------------------------------------------- Prose tables */
.docs-body.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.9rem;
  display: block;
  overflow-x: auto;
}
.docs-body.prose thead th {
  text-align: left;
  font-weight: 700;
  background: var(--color-bg-alt);
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}
.docs-body.prose th, .docs-body.prose td {
  padding: 9px 14px;
  border: 1px solid var(--color-border);
  vertical-align: top;
}
.docs-body.prose tbody tr:nth-child(even) { background: color-mix(in srgb, var(--color-bg-alt) 45%, transparent); }
.docs-body.prose td code { white-space: nowrap; }

/* ----------------------------------------------------------- Callouts */
.callout {
  margin: 1.6em 0;
  padding: 14px 18px;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-text-light);
  border-radius: var(--radius-sm);
  background: var(--color-bg-alt);
}
.callout-title { margin: 0 0 4px; font-weight: 700; font-size: 0.9rem; }
.callout-body > :first-child { margin-top: 0; }
.callout-body > :last-child { margin-bottom: 0; }
.callout-body p { margin: 0.5em 0; }
.callout-tip { border-left-color: #3f7d58; }
.callout-warning { border-left-color: #b4843a; }
.callout-note { border-left-color: var(--color-accent); }

/* ----------------------------------------------------------- Screenshots */
.screenshot { margin: 1.8em 0; }
.screenshot img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.screenshot-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 220px;
  padding: 32px;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 12px,
      color-mix(in srgb, var(--color-bg-alt) 60%, transparent) 12px,
      color-mix(in srgb, var(--color-bg-alt) 60%, transparent) 24px);
  color: var(--color-text-light);
  text-align: center;
}
.screenshot-tag {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.screenshot figcaption {
  margin-top: 10px;
  font-size: 0.88rem;
  color: var(--color-text-light);
  text-align: center;
}

/* ----------------------------------------------------------- Pager */
.docs-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}
.docs-pager-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: border-color var(--transition-base), transform var(--transition-base);
}
.docs-pager-link.next { text-align: right; }
.docs-pager-link:hover { border-color: var(--color-accent); }
.docs-pager-link.prev:hover { transform: translateX(-3px); }
.docs-pager-link.next:hover { transform: translateX(3px); }
.docs-pager-dir { font-size: 0.8rem; color: var(--color-text-light); }
.docs-pager-title { font-weight: 600; }

/* ----------------------------------------------------------- On-page TOC */
.docs-toc {
  position: sticky;
  top: calc(var(--header-h) + 14px);
  max-height: calc(100svh - var(--header-h) - 28px);
  overflow-y: auto;
  font-size: 0.84rem;
}
.docs-toc-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-light);
  margin: 0 0 8px;
}
.docs-toc nav#TableOfContents ul { list-style: none; margin: 0; padding: 0; }
.docs-toc nav#TableOfContents ul ul { padding-left: 12px; }
.docs-toc nav#TableOfContents li { margin: 2px 0; }
.docs-toc nav#TableOfContents a {
  display: block;
  padding: 3px 0;
  color: var(--color-text-light);
  border-left: 2px solid transparent;
  padding-left: 10px;
  margin-left: -2px;
  transition: color var(--transition-base), border-color var(--transition-base);
}
.docs-toc nav#TableOfContents a:hover { color: var(--color-text); border-left-color: var(--color-border); }

/* ----------------------------------------------------------- Section cards */
.docs-cards {
  list-style: none;
  padding: 0;
  margin: 1.8em 0 0;
  display: grid;
  gap: 12px;
}
.docs-card a {
  display: block;
  padding: 18px 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: border-color var(--transition-base), transform var(--transition-base);
}
.docs-card a:hover { border-color: var(--color-accent); transform: translateX(3px); }
.docs-card-title { display: block; font-weight: 600; font-size: 1.05rem; }
.docs-card-desc { display: block; color: var(--color-text-light); font-size: 0.92rem; margin-top: 4px; }

/* ----------------------------------------------------------- Sidebar toggle (mobile) */
.docs-sidebar-open {
  display: none;
  align-items: center;
  gap: 8px;
  width: max-content;
  margin-bottom: 18px;
  padding: 8px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-elev);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
/* The mobile click-catcher is inert until the responsive rules enable it. */
.docs-sidebar-backdrop { display: none; }

/* =============================================================== Home */
/* The landing hero now lives in the main column (sidebar runs down the left
   from the top, like every doc page), so it is left-aligned in-column rather
   than a centered full-width band. */
.docs-home-hero { padding: 2px 0 clamp(18px, 3vw, 28px); }
.docs-home-hero .hero-eyebrow { margin-bottom: 14px; }
.docs-hero-title { font-size: clamp(2rem, 4vw, 3rem); margin: 0 0 14px; }
.docs-hero-lead {
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  color: var(--color-text-light);
  max-width: 62ch;
  margin: 0 0 22px;
}
.docs-home-body { padding-bottom: 0; }
.docs-home-body .prose > * { max-width: 760px; }
.docs-home-grid { margin-top: 36px; }
.docs-home-grid .feature-card { display: block; }
.docs-home-grid .feature-title { margin-top: 0; }

/* =============================================================== Responsive */
/* Drop the on-page TOC first (narrower viewports). */
@media (max-width: 1080px) {
  .docs-shell { grid-template-columns: 232px minmax(0, 1fr); gap: 36px; }
  .docs-toc { display: none; }
}

/* Then collapse the sidebar into a toggle-revealed panel. */
@media (max-width: 860px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); }
  .docs-sidebar-open { display: inline-flex; }
  .docs-sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    z-index: 90;
    width: min(300px, 84vw);
    max-height: none;
    padding: 22px 20px;
    background: var(--color-bg-elev);
    border-right: 1px solid var(--color-border);
    box-shadow: 0 14px 40px var(--color-shadow-strong);
    transform: translateX(-105%);
    transition: transform var(--transition-base);
  }
  .docs-sidebar-checkbox:checked ~ .docs-sidebar { transform: translateX(0); }
  /* A click-catcher backdrop (a <label> for the same checkbox) appears with the
     open sidebar, so tapping outside closes it — no JavaScript required. */
  .docs-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: var(--header-h) 0 0 0;
    z-index: 80;
    background: var(--color-overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), visibility var(--transition-base);
  }
  .docs-sidebar-checkbox:checked ~ .docs-sidebar-backdrop { opacity: 1; visibility: visible; }
}

@media (prefers-reduced-motion: reduce) {
  .docs-sidebar { transition: none; }
  .docs-pager-link:hover { transform: none; }
  .docs-card a:hover { transform: none; }
}

/* 404 / not-found page */
.notfound { padding: clamp(56px, 12vw, 130px) 0; }
.notfound-inner { max-width: 640px; margin: 0 auto; text-align: center; }
.notfound-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-light);
  padding: 5px 12px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  margin: 0 0 22px;
}
.notfound-title { font-size: clamp(2rem, 5.5vw, 3.1rem); margin: 0 0 16px; }
.notfound-lead {
  font-size: 1.12rem;
  color: var(--color-text-light);
  max-width: 46ch;
  margin: 0 auto 32px;
}
.notfound-term {
  text-align: left;
  margin: 0 auto 32px;
  max-width: 520px;
  font-size: 0.86rem;
}
.notfound-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.notfound-links {
  display: flex;
  gap: 8px 22px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--color-border);
}
.notfound-links a {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-text-light);
  transition: color var(--transition-base);
}
.notfound-links a:hover { color: var(--color-text); }
