/* ==========================================================================
   Maestro-Pi Docs — scoped documentation stylesheet.
   Self-contained: does NOT depend on the pibythree marketing CSS/Bootstrap.
   Font: Montserrat. Icons: Font Awesome. Themes: light + dark via [data-theme].
   ========================================================================== */

/* ---- Design tokens ------------------------------------------------------- */
:root {
  --brand:        #00a6ed;   /* pibythree blue */
  --brand-600:    #0089c7;
  --brand-700:    #006a9c;
  --brand-050:    #e7f6fe;

  --topbar-h: 62px;
  --sidebar-w: 300px;
  --toc-w: 240px;
  --content-max: 860px;

  --radius: 8px;
  --radius-sm: 5px;
  --mono: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;
  --sans: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Light theme (default) */
:root, :root[data-theme="light"] {
  --bg:            #ffffff;
  --bg-subtle:     #f7f9fb;
  --bg-sidebar:    #fbfcfd;
  --text:          #1b2733;
  --text-muted:    #5b6b7b;
  --text-faint:    #8494a3;
  --border:        #e5e9ee;
  --border-strong: #d3dae1;
  --link:          var(--brand-700);
  --accent:        var(--brand);
  --code-inline-bg:#eef2f5;
  --code-inline-fg:#b02a56;
  --table-head:    #f2f5f8;
  --table-stripe:  #fafbfc;
  --shadow:        0 1px 3px rgba(16,32,48,.08), 0 4px 16px rgba(16,32,48,.06);
  --callout-note:  #eef6ff;
}

/* Dark theme */
:root[data-theme="dark"] {
  --bg:            #0e1621;
  --bg-subtle:     #141f2c;
  --bg-sidebar:    #101a26;
  --text:          #d7e0e9;
  --text-muted:    #9aabbb;
  --text-faint:    #6b7d8d;
  --border:        #22303f;
  --border-strong: #2d3e50;
  --link:          #5cc6f5;
  --accent:        #33b6f0;
  --code-inline-bg:#1c2836;
  --code-inline-fg:#ff9db7;
  --table-head:    #16222f;
  --table-stripe:  #121d29;
  --shadow:        0 1px 3px rgba(0,0,0,.4), 0 6px 22px rgba(0,0,0,.35);
  --callout-note:  #12283b;
}

/* ---- Reset / base -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
/* Safety net: images never overflow their container or render at natural size. */
img { max-width: 100%; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 20px); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .layout, .sidebar, .sidebar-inner { transition: none; }
  .hero-title .fade-word { animation: none; opacity: 1; transform: none; }
}
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* ---- Top bar ------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.brand { display: inline-flex; align-items: center; }
.brand:hover { text-decoration: none; }
/* Horizontal Maestro-Pi lockup (icon + wordmark, transparent PNG). */
.brand-logo { display: block; height: 38px; width: auto; }
/* PibyThree company logo, shown at the right edge of the top bar. */
.topbar-company { display: inline-flex; align-items: center; margin-left: 4px; }
.topbar-company:hover { text-decoration: none; }
.topbar-company-logo { display: block; height: 38px; width: auto; }

.topbar-search { position: relative; flex: 1; max-width: 520px; margin: 0 auto; }
.search-box { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 12px; color: var(--text-faint); font-size: 13px; pointer-events: none; }
.search-input {
  width: 100%; height: 38px; padding: 0 40px 0 34px;
  font-family: var(--sans); font-size: 14px; color: var(--text);
  background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.search-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-050); }
:root[data-theme="dark"] .search-input:focus { box-shadow: 0 0 0 3px rgba(51,182,240,.18); }
.search-kbd {
  position: absolute; right: 10px; font-family: var(--mono); font-size: 12px;
  color: var(--text-faint); background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 7px; line-height: 1.4;
}
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  max-height: 70vh; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 6px; z-index: 120;
}
.search-group-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); padding: 8px 10px 4px;
}
.search-result {
  display: block; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text);
}
.search-result .sr-title { font-weight: 600; font-size: 14px; }
.search-result .sr-snippet { font-size: 12.5px; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-result mark { background: var(--brand-050); color: var(--brand-700); padding: 0 1px; border-radius: 2px; }
:root[data-theme="dark"] .search-result mark { background: rgba(51,182,240,.22); color: #a9e0fb; }
.search-result:hover, .search-result.is-active { background: var(--bg-subtle); text-decoration: none; }
.search-result.is-active { outline: 2px solid var(--brand); outline-offset: -2px; }
.search-empty { padding: 16px 12px; color: var(--text-muted); font-size: 14px; text-align: center; }

.topbar-right { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--radius);
  background: transparent; border: 1px solid transparent; color: var(--text-muted);
  cursor: pointer; font-size: 16px; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bg-subtle); color: var(--text); text-decoration: none; }
.hamburger { display: inline-flex; }

/* ---- Light-mode branded top bar (PiByThree blue) ------------------------- */
/* In light mode the top bar uses the PiByThree brand blue with light icons.
   Each logo sits on a white chip so its dark artwork stays crisp on the blue.
   Dark mode keeps its existing dark, translucent bar (rules below untouched). */
:root[data-theme="light"] .topbar {
  background: #1b3f86;
  border-bottom-color: #16346e;
}
:root[data-theme="light"] .topbar .icon-btn { color: #d7e3f7; }
:root[data-theme="light"] .topbar .icon-btn:hover { background: rgba(255,255,255,.15); color: #fff; }
:root[data-theme="light"] .brand,
:root[data-theme="light"] .topbar-company {
  background: #fff; border-radius: 8px; padding: 4px 10px;
}

/* ---- Layout grid --------------------------------------------------------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  grid-template-rows: 1fr auto;
  align-items: start;
  min-height: calc(100vh - var(--topbar-h));
  max-width: 1600px; margin: 0 auto;
  transition: grid-template-columns .28s ease;
}
/* Explicit placement: content + TOC sit in row 1; the footer sits in row 2 and
   spans only the content + TOC columns; the sidebar spans BOTH rows so it always
   runs the full height of the page and never overlaps the footer. */
.content { grid-column: 2; grid-row: 1; }
.toc     { grid-column: 3; grid-row: 1; }
.site-footer { grid-column: 2 / -1; grid-row: 2; }

/* Collapsed (desktop): animate the sidebar column to 0 so content + footer take
   full width. The sidebar stays in the DOM (not display:none) so width/opacity
   can transition smoothly; its own overflow clips the content as it shrinks. */
.layout.is-collapsed { grid-template-columns: 0 minmax(0, 1fr) var(--toc-w); }
.layout.is-collapsed > .sidebar { border-right-color: transparent; }
.layout.is-collapsed .sidebar-inner { opacity: 0; }
.layout--home.is-collapsed { grid-template-columns: 0 minmax(0, 1fr); }

/* ---- Sidebar ------------------------------------------------------------- */
.sidebar {
  grid-column: 1; grid-row: 1 / -1; align-self: stretch;
  min-width: 0;                 /* allow the grid track to shrink to 0 */
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  transition: border-color .28s ease;
}
.sidebar-inner {
  position: sticky; top: var(--topbar-h);
  min-width: 0;
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 10px 40px;
  transition: opacity .2s ease;
}
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 2px 4px 10px; margin-bottom: 8px; border-bottom: 1px solid var(--border);
}
.sidebar-head-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); font-weight: 700; }
.sidebar-collapse {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; flex: none;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted); cursor: pointer; font-size: 13px;
  transition: background .15s, color .15s;
}
.sidebar-collapse:hover { background: var(--bg-subtle); color: var(--text); }
.nav-parts, .nav-sections { list-style: none; margin: 0; padding: 0; }
.nav-part { margin-bottom: 2px; }
.nav-part-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border: 0; background: transparent; cursor: pointer;
  font-family: var(--sans); font-size: 13.5px; font-weight: 600; color: var(--text);
  border-radius: var(--radius-sm); text-align: left; line-height: 1.35;
}
.nav-part-toggle:hover { background: var(--bg-subtle); }
.nav-caret { font-size: 10px; color: var(--text-faint); transition: transform .18s; flex: none; margin-top: 3px; }
.nav-part.is-open > .nav-part-toggle .nav-caret { transform: rotate(90deg); }
.nav-part.is-open > .nav-part-toggle { color: var(--brand-700); }
:root[data-theme="dark"] .nav-part.is-open > .nav-part-toggle { color: var(--accent); }
.nav-part-title { flex: 1; }
.nav-sections { margin: 2px 0 8px; padding-left: 18px; border-left: 1px solid var(--border); margin-left: 14px; }
.nav-link {
  display: block; padding: 6px 10px; margin: 1px 0;
  font-size: 13px; color: var(--text-muted); border-radius: var(--radius-sm);
  line-height: 1.4; border-left: 2px solid transparent; margin-left: -1px;
}
.nav-link:hover { color: var(--text); background: var(--bg-subtle); text-decoration: none; }
.nav-link.is-active {
  color: var(--brand-700); background: var(--brand-050);
  border-left-color: var(--brand); font-weight: 600;
}
:root[data-theme="dark"] .nav-link.is-active { color: var(--accent); background: rgba(51,182,240,.10); }

/* Guide-level groups (UI Navigation Guide / DAG Authoring Guide) sit above the
   Part tree. Their label is heavier and their child list indents less, so three
   levels stay legible inside the sidebar width. */
.nav-part--guide > .nav-part-toggle { font-weight: 700; }
.nav-sections--guide { padding-left: 10px; margin-left: 11px; }
.nav-sections--guide > .nav-part > .nav-part-toggle {
  font-size: 13px; font-weight: 600; padding: 7px 8px;
}
/* Third level: the leaf sections inside each Part */
.nav-sections--guide .nav-sections { padding-left: 12px; margin-left: 9px; }
.nav-sections--guide .nav-sections .nav-link { font-size: 12.5px; }

/* ---- Content ------------------------------------------------------------- */
.content {
  min-width: 0;
  padding: 34px clamp(20px, 4vw, 56px) 80px;
  outline: none;
}
.content > * { max-width: var(--content-max); }

.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; padding: 0; font-size: 13px; color: var(--text-muted); }
.breadcrumb li + li::before { content: "/"; margin-right: 8px; color: var(--text-faint); }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb [aria-current="page"] { color: var(--text); font-weight: 600; }

.doc-header { margin-bottom: 28px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.doc-eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 700; color: var(--brand); margin: 0 0 6px; }
.doc-title { font-size: clamp(28px, 4vw, 38px); line-height: 1.15; letter-spacing: -.02em; margin: 0; font-weight: 700; }

.part-lead { color: var(--text-muted); font-size: 16.5px; margin-bottom: 20px; }
.part-lead p:first-child { margin-top: 0; }

/* Section blocks */
.doc-section { padding-top: 14px; margin-bottom: 20px; scroll-margin-top: calc(var(--topbar-h) + 16px); }
.sec-heading {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  font-size: 23px; font-weight: 700; letter-spacing: -.01em;
  margin: 28px 0 14px; padding-top: 10px; line-height: 1.25;
}
.sec-num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 28px; padding: 0 6px; border-radius: 7px;
  background: var(--brand-050); color: var(--brand-700);
  font-size: 14px; font-weight: 700; flex: none;
}
:root[data-theme="dark"] .sec-num { background: rgba(51,182,240,.14); color: var(--accent); }
.anchor-link { color: var(--text-faint); opacity: 0; font-weight: 400; margin-left: 4px; transition: opacity .12s; }
.sec-heading:hover .anchor-link { opacity: 1; }
.anchor-link:hover { color: var(--brand); text-decoration: none; }

.doc h4 { font-size: 16px; font-weight: 700; margin: 22px 0 8px; }
.doc p { margin: 0 0 14px; }
.doc ul, .doc ol { margin: 0 0 16px; padding-left: 22px; }
.doc li { margin: 5px 0; }
.doc li > strong:first-child { color: var(--text); }
.doc strong { font-weight: 700; }

/* The bolded sub-labels (What it does / Parameters / How it works / Example)
   lead their paragraphs; give them a subtle accent so scanning is easy. */
.doc p > strong:first-child:only-child,
.doc p > strong:first-child { }

/* Inline code */
.doc code {
  font-family: var(--mono); font-size: .87em;
  background: var(--code-inline-bg); color: var(--code-inline-fg);
  padding: .12em .38em; border-radius: 4px; word-break: break-word;
}

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--border); border-radius: var(--radius); }
.doc table { border-collapse: collapse; width: 100%; font-size: 14px; }
.doc thead th {
  background: var(--table-head); text-align: left; font-weight: 700; color: var(--text);
  padding: 10px 14px; border-bottom: 1px solid var(--border-strong); white-space: nowrap;
}
.doc tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc tbody tr:nth-child(even) { background: var(--table-stripe); }
.doc tbody tr:last-child td { border-bottom: 0; }
.doc td code { white-space: nowrap; }

/* Code blocks */
.code-block { margin: 0 0 20px; border-radius: var(--radius); overflow: hidden; border: 1px solid #2b2f3a; background: #1e2129; }
.code-block figcaption {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 12px; background: #171a21; border-bottom: 1px solid #2b2f3a;
}
.code-lang { font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: #8b93a7; }
.copy-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 1px solid #3a3f4d; color: #b9c0d0;
  font-family: var(--sans); font-size: 12px; padding: 3px 10px; border-radius: 6px; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.copy-btn:hover { background: #2a2e39; color: #fff; }
.copy-btn.copied { color: #56d364; border-color: #2e5b38; }
.code-block pre { margin: 0; padding: 16px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; background: #1e2129 !important; }
.code-block pre code { background: none !important; color: #e6e6e6; font-family: var(--mono); padding: 0; text-shadow: none; }
.code-block pre.line-numbers { padding-left: 3.2em; }
/* keep code blocks dark in both themes (Stripe/Airflow style) */

/* Prev / Next */
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); }
.prevnext-link {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 18px;
  border: 1px solid var(--border); border-radius: var(--radius); color: var(--text);
  transition: border-color .15s, background .15s;
}
.prevnext-link:hover { border-color: var(--brand); background: var(--bg-subtle); text-decoration: none; }
.prevnext-link.next { text-align: right; align-items: flex-end; }
.pn-dir { font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .05em; }
.pn-title { font-weight: 600; font-size: 14.5px; color: var(--brand-700); }
:root[data-theme="dark"] .pn-title { color: var(--accent); }

/* ---- Site footer (PibyThree, full-width, shared across all pages) ------- */
.site-footer { position: relative; z-index: 1; background: var(--bg-subtle); color: var(--text-muted); border-top: 1px solid var(--border); }
.site-footer a { color: var(--link); }
.site-footer a:hover { color: var(--brand-700); text-decoration: underline; }
:root[data-theme="dark"] .site-footer a:hover { color: var(--accent); }

/* Light mode: match the PiByThree-blue top bar so header + footer are consistent.
   Logo sits on a white chip (its artwork is dark) and links go light. */
:root[data-theme="light"] .site-footer { background: #1b3f86; color: #cdd9ef; border-top-color: #16346e; }
:root[data-theme="light"] .site-footer a { color: #eaf1fc; }
:root[data-theme="light"] .site-footer a:hover { color: #fff; }
:root[data-theme="light"] .site-footer-brand { background: #fff; border-radius: 8px; padding: 6px 12px; }
:root[data-theme="light"] .site-footer-bottom { border-top-color: rgba(255,255,255,.16); }
:root[data-theme="light"] .site-footer-copy { color: #aebfdd; }
.site-footer-inner {
  max-width: 1600px; margin: 0 auto;
  padding: 20px clamp(20px, 4vw, 56px) 16px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 40px;
}
.site-footer-brand { display: inline-flex; align-items: center; }
.site-footer-brand:hover { text-decoration: none; }
.site-footer-logo { display: block; height: 60px; width: auto; }
.site-footer-links { display: flex; flex-wrap: wrap; gap: 10px 28px; font-size: 14px; font-weight: 500; }
.site-footer-bottom { border-top: 1px solid var(--border); }
.site-footer-copy {
  max-width: 1600px; margin: 0 auto;
  padding: 12px clamp(20px, 4vw, 56px);
  font-size: 13px; color: var(--text-faint);
}
@media (max-width: 640px) {
  .site-footer-inner { flex-direction: column; align-items: flex-start; gap: 16px; }
}

/* ---- Right TOC ----------------------------------------------------------- */
.toc {
  position: sticky; top: var(--topbar-h);
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto; padding: 34px 20px 60px;
}
.toc-title { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); font-weight: 700; margin: 0 0 12px; }
.toc-list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc-link {
  display: block; padding: 5px 12px; margin-left: -1px; font-size: 12.5px; line-height: 1.4;
  color: var(--text-muted); border-left: 2px solid transparent;
}
.toc-link:hover { color: var(--text); text-decoration: none; }
.toc-link.is-active { color: var(--brand-700); border-left-color: var(--brand); font-weight: 600; }
:root[data-theme="dark"] .toc-link.is-active { color: var(--accent); }

/* ---- 404 / empty state --------------------------------------------------- */
.empty-state { text-align: center; padding: 80px 20px; max-width: 520px; margin: 0 auto; }
.empty-icon { font-size: 48px; color: var(--brand); margin-bottom: 16px; }
.empty-state h1 { font-size: 28px; margin: 0 0 12px; }
.empty-state p { color: var(--text-muted); }
.btn-primary {
  display: inline-block; margin-top: 12px; padding: 10px 20px; border-radius: var(--radius);
  background: var(--brand); color: #fff; font-weight: 600;
}
.btn-primary:hover { background: var(--brand-600); text-decoration: none; }
.build-warning { color: #b02a56; }

/* ---- Callout / admonition (styling ready if source adds Note/Warning) ---- */
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--callout-note); margin: 0 0 18px; }
.callout .callout-icon { color: var(--brand); font-size: 18px; margin-top: 2px; }
.callout-note { border-left: 4px solid var(--brand); }

/* ---- Home / Overview landing page --------------------------------------- */
/* Sidebar "Overview" link (sits above the Part tree). */
.nav-home {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; margin-bottom: 6px;
  font-size: 13.5px; font-weight: 600; color: var(--text);
  border-radius: var(--radius-sm); line-height: 1.35;
}
.nav-home:hover { background: var(--bg-subtle); text-decoration: none; }
.nav-home-icon { font-size: 12px; color: var(--text-faint); flex: none; }
.nav-home.is-active { color: var(--brand-700); background: var(--brand-050); }
.nav-home.is-active .nav-home-icon { color: var(--brand); }
:root[data-theme="dark"] .nav-home.is-active { color: var(--accent); background: rgba(51,182,240,.10); }
:root[data-theme="dark"] .nav-home.is-active .nav-home-icon { color: var(--accent); }

/* Drop the (empty) right TOC column on home so content isn't squeezed. */
.layout--home { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
/* Center the overview content in the available width (SaaS-style landing). */
.content--home { text-align: center; }
.content--home > * { max-width: 820px; margin-left: auto; margin-right: auto; }

/* Hero */
.hero { padding: 30px 0 10px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.hero-logo { display: block; height: 132px; width: auto; max-width: 280px; margin: 0 auto 20px; }
.hero-eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 700; color: var(--brand); margin: 0 0 8px; }
.hero-title { font-size: clamp(30px, 5vw, 44px); line-height: 1.15; letter-spacing: -.02em; font-weight: 700; margin: 0 0 14px; min-height: 1.2em; }
.hero-tagline { font-size: 17px; color: var(--text-muted); max-width: 660px; margin: 0 auto 24px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 26px; justify-content: center; }
.hero-actions .btn-primary { margin-top: 0; display: inline-flex; align-items: center; gap: 8px; }

/* Continuous, staggered fade-in/out of the hero title words. */
.hero-title .fade-word {
  display: inline-block;
  opacity: 0;
  animation: heroWordCycle 6s ease-in-out infinite both;
}
@keyframes heroWordCycle {
  0%   { opacity: 0; transform: translateY(10px); }
  14%  { opacity: 1; transform: translateY(0); }
  68%  { opacity: 1; transform: translateY(0); }
  84%  { opacity: 0; transform: translateY(-10px); }
  100% { opacity: 0; transform: translateY(-10px); }
}
.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius); font-weight: 600;
  background: var(--bg-subtle); color: var(--text); border: 1px solid var(--border-strong);
  transition: border-color .15s, background .15s, color .15s;
}
.btn-secondary:hover { border-color: var(--brand); color: var(--brand-700); text-decoration: none; }
:root[data-theme="dark"] .btn-secondary:hover { color: var(--accent); }

/* Home content sections */
.home-section { padding-top: 8px; margin-bottom: 8px; }
.home-heading { font-size: 24px; font-weight: 700; letter-spacing: -.01em; margin: 26px 0 14px; }
.home-section p { margin: 0 0 14px; }
/* Keep long body copy left-aligned for readability inside the centered column. */
.home-section > p { text-align: left; }
.home-section .callout { text-align: left; }

/* ---- UI Navigation Guide: screenshots, lightbox, legend, badges --------- */
/* Inline Font Awesome icon used inside the guide's tables/lists. */
.ui-icon { color: var(--brand); width: 1.1em; text-align: center; margin-right: 2px; }

/* Screenshot card — capped and centered, never full-bleed. */
.shot { margin: 0 auto 26px; max-width: 780px; }
.shot-btn {
  display: block; width: 100%; padding: 0; cursor: zoom-in;
  background: var(--bg-subtle); border: 1px solid var(--border-strong);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: border-color .15s;
}
.shot-btn:hover { border-color: var(--brand); }
.shot-img { display: block; width: 100%; height: auto; }
.shot-caption {
  margin-top: 9px; font-size: 12.5px; line-height: 1.5;
  color: var(--text-muted); text-align: center;
}

/* Click-to-zoom overlay */
.lightbox {
  position: fixed; inset: 0; z-index: 300;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 28px;
  background: rgba(8, 14, 22, .88);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.lightbox[hidden] { display: none; }
.lightbox-img {
  max-width: min(1500px, 96vw); max-height: 84vh; width: auto; height: auto;
  object-fit: contain; border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .5); background: #fff;
}
.lightbox-caption { color: #dbe6f7; font-size: 13px; text-align: center; max-width: 760px; }
.lightbox-close {
  position: absolute; top: 16px; right: 18px;
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .12); color: #fff;
  border: 1px solid rgba(255, 255, 255, .25); cursor: pointer; font-size: 16px;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .22); }

/* Task-state legend (Grid tab) — real colour chips, mirroring the product. */
.state-legend {
  list-style: none; display: flex; flex-wrap: wrap; gap: 8px 18px;
  margin: 0 0 20px; padding: 0; font-size: 13px; color: var(--text-muted);
}
.state-legend li { display: inline-flex; align-items: center; gap: 7px; margin: 0; }
.state-dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }

/* Sub-headings (#### in the source) + their indented TOC entries */
.sec-heading--sub { font-size: 18px; margin: 22px 0 10px; }
.toc-link--sub { padding-left: 24px; font-size: 12px; }

/* Badges (sidebar + page title) */
.nav-badge, .title-badge {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; white-space: nowrap;
  background: var(--bg-subtle); color: var(--text-faint);
  border: 1px solid var(--border-strong);
}
.title-badge { font-size: 11px; vertical-align: middle; margin-left: 8px; }

/* "Last verified" line on the UI guide landing page */
.verified-badge {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 4px 0 0; padding: 8px 14px; border-radius: var(--radius);
  background: var(--bg-subtle); border: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-muted);
}
.verified-badge i { color: var(--brand); }

.nav-parts--guide { margin-bottom: 6px; }

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 1200px) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .layout.is-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 992px) {
  /* Sidebar becomes an off-canvas drawer; grid collapses to a single column and
     the footer spans full width. Desktop "is-collapsed" is neutralised here. */
  .layout, .layout--home,
  .layout.is-collapsed, .layout--home.is-collapsed { grid-template-columns: minmax(0, 1fr); }
  .content, .site-footer { grid-column: 1 / -1; }
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; z-index: 90;
    width: min(86vw, var(--sidebar-w)); height: calc(100vh - var(--topbar-h));
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--shadow); overflow-y: auto;
  }
  .layout.is-collapsed > .sidebar { display: block; }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-inner { position: static; max-height: none; overflow: visible; padding: 14px 12px 40px; }
  .sidebar-overlay {
    position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 80;
    background: rgba(9,16,24,.5);
  }
  .brand-name { font-size: 15px; }
  .search-kbd { display: none; }
}
@media (max-width: 640px) {
  .content { padding: 22px 18px 60px; }
  .prevnext { grid-template-columns: 1fr; }
  .topbar { gap: 10px; padding: 0 12px; }
  .brand-logo { height: 30px; }
  .topbar-company { display: none; }
  .hero-logo { height: 96px; }
  .shot { max-width: 100%; }
  .lightbox { padding: 12px; gap: 10px; }
  .lightbox-img { max-height: 78vh; }
  .lightbox-close { top: 8px; right: 10px; }
  .sec-heading { font-size: 20px; }
}
