/* Guide styling. The chapter rules are lifted from the original
   single-page guide; tools/build-guide.py writes this file and the
   hub-only and chapter-only rules at the bottom. Do not hand-edit. */

/* ── Guide-only additions. axion.css owns everything else; these classes are
      namespaced .gd- so nothing here can collide with the theme. ─────────── */

body { -webkit-font-smoothing: antialiased; }

/* Header ---------------------------------------------------------------- */
.gd-head {
  position: sticky; top: 0; z-index: 40;
  background: rgba(9, 12, 20, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--ax-border);
}
.gd-head-in {
  max-width: 1240px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.gd-brand { display: flex; align-items: center; gap: 11px; }
.gd-brand img { width: 30px; height: 30px; border-radius: 7px; display: block; }
.gd-brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.gd-brand-name {
  font-family: var(--ax-font-head); font-size: 15px; font-weight: 600;
  letter-spacing: 0.02em; color: var(--ax-text);
}
.gd-brand-sub {
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ax-dim);
}
.gd-head-links { display: flex; align-items: center; gap: 6px; }
.gd-head-links a { font-size: 13px; padding: 6px 10px; border-radius: 6px; color: var(--ax-muted); }
.gd-head-links a:hover { color: var(--ax-text); background: var(--ax-surface3); }

/* Intro ----------------------------------------------------------------- */
.gd-intro { max-width: 1240px; margin: 0 auto; padding: 46px 24px 30px; }
.gd-intro h1 {
  font-size: clamp(30px, 4.6vw, 44px); line-height: 1.1; text-wrap: balance;
  margin: 10px 0 0; max-width: 16ch;
}
.gd-intro p {
  margin-top: 16px; max-width: 62ch; font-size: 16px; line-height: 1.65;
  color: var(--ax-muted);
}
.gd-intro .gd-meta {
  margin-top: 22px; display: flex; flex-wrap: wrap; gap: 8px 18px;
  font-size: 12px; color: var(--ax-dim);
}

/* Two-column shell ------------------------------------------------------ */
.gd-shell {
  max-width: 1240px; margin: 0 auto; padding: 0 24px 90px;
  display: grid; grid-template-columns: 234px minmax(0, 1fr); gap: 44px;
  align-items: start;
}

/* Chapter rail ---------------------------------------------------------- */
.gd-rail { position: sticky; top: 68px; max-height: calc(100vh - 88px); overflow-y: auto; padding-bottom: 20px; }
.gd-rail-label {
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ax-dim); margin: 20px 0 8px; font-weight: 600;
}
.gd-rail-label:first-child { margin-top: 0; }
.gd-rail a {
  display: block; padding: 5px 10px; border-radius: 6px;
  font-size: 13px; color: var(--ax-muted); border-left: 2px solid transparent;
}
.gd-rail a:hover { color: var(--ax-text); background: var(--ax-surface3); }
.gd-rail a.is-current {
  color: var(--ax-text); border-left-color: var(--ax-accent);
  background: rgba(var(--ax-accent-rgb), 0.06);
}
.gd-filter { margin-bottom: 18px; }
.gd-filter .form-control { font-size: 13px; padding: 8px 11px; }

/* Chapters -------------------------------------------------------------- */
.gd-body { min-width: 0; max-width: 72ch; }
.gd-ch { padding-top: 30px; margin-bottom: 14px; scroll-margin-top: 76px; }
.gd-ch + .gd-ch { border-top: 1px solid var(--ax-border); }
.gd-ch h2 { font-size: 25px; margin: 6px 0 0; text-wrap: balance; }
.gd-ch > p { margin-top: 13px; line-height: 1.7; color: var(--ax-muted); font-size: 14.5px; max-width: 66ch; }
.gd-ch h3 { margin: 26px 0 8px; font-size: 15px; color: var(--ax-text); }
.gd-ch ul, .gd-ch ol { margin: 12px 0 0 20px; }
.gd-ch li { margin-bottom: 8px; line-height: 1.65; color: var(--ax-muted); font-size: 14.5px; }
.gd-ch strong { color: var(--ax-text); font-weight: 600; }

/* "Where to find it" locator -- real navigation, not decoration ---------- */
.gd-where {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 7px;
  margin-top: 14px; padding: 7px 12px;
  background: var(--ax-surface3); border: 1px solid var(--ax-border);
  border-radius: var(--ax-radius); font-size: 12px; color: var(--ax-muted);
}
.gd-where b { color: var(--ax-dim); font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; font-size: 10px; }
.gd-where span { color: var(--ax-text); font-weight: 500; }
.gd-where i { color: var(--ax-dim); font-style: normal; }

/* A named thing you will literally see on screen ------------------------- */
.gd-ui {
  font-family: var(--ax-font-mono); font-size: 0.86em;
  background: var(--ax-surface4); color: var(--ax-text);
  border: 1px solid var(--ax-border); border-radius: 4px;
  padding: 1px 6px; white-space: nowrap;
}

/* Numbered walkthrough -- used ONLY where order actually matters --------- */
.gd-steps { counter-reset: gdstep; list-style: none; margin: 16px 0 0; padding: 0; }
.gd-steps li {
  counter-increment: gdstep; position: relative;
  padding: 0 0 0 40px; margin-bottom: 14px; min-height: 26px;
}
.gd-steps li::before {
  content: counter(gdstep);
  position: absolute; left: 0; top: -1px;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--ax-font-mono); font-size: 12px; font-weight: 600;
  color: var(--ax-accent);
  background: rgba(var(--ax-accent-rgb), 0.10);
  border: 1px solid rgba(var(--ax-accent-rgb), 0.30);
}

/* Figures ---------------------------------------------------------------
   Every diagram is hand-authored inline SVG using the theme's own tokens, so
   there are no image files to keep in sync with the product. Shapes inherit
   currentColor; --ax-accent marks the one thing each figure is about. ----- */
.gd-fig { margin: 22px 0 0; overflow-x: auto; }
.gd-fig svg {
  display: block; width: 100%; min-width: 440px; max-width: 100%; height: auto;
  color: var(--ax-muted);
}
.gd-fig figcaption {
  margin-top: 10px; font-size: 12px; line-height: 1.55; color: var(--ax-dim);
  border-left: 2px solid var(--ax-border); padding-left: 10px;
}
.gd-fig .f-box { fill: var(--ax-surface2); stroke: var(--ax-border2); }
.gd-fig .f-box-key { fill: rgba(var(--ax-accent-rgb), 0.10); stroke: var(--ax-accent); }
.gd-fig .f-box-warn { fill: rgba(245, 158, 11, 0.10); stroke: rgba(245, 158, 11, 0.55); }
.gd-fig .f-panel { fill: var(--ax-surface); stroke: var(--ax-border); }
.gd-fig .f-t { fill: var(--ax-text); font-size: 12px; font-weight: 500; }
.gd-fig .f-t-sm { fill: var(--ax-muted); font-size: 10.5px; }
.gd-fig .f-t-key { fill: var(--ax-accent-bright); font-size: 12px; font-weight: 600; }
.gd-fig .f-t-warn { fill: #fcd34d; font-size: 11px; font-weight: 500; }
.gd-fig .f-hd {
  fill: var(--ax-dim); font-size: 9.5px; font-weight: 600; letter-spacing: 0.12em;
}
.gd-fig .f-line { stroke: var(--ax-border2); fill: none; }
.gd-fig .f-flow { stroke: currentColor; fill: none; stroke-width: 1.5; }
.gd-fig .f-flow-key { stroke: var(--ax-accent); fill: none; stroke-width: 1.75; }
.gd-fig .f-flow-warn { stroke: rgba(245, 158, 11, 0.75); fill: none; stroke-width: 1.5; }
.gd-fig .f-dash { stroke-dasharray: 4 3; }

/* Callouts -------------------------------------------------------------- */
.gd-note {
  margin-top: 18px; padding: 13px 16px; border-radius: var(--ax-radius-lg);
  border: 1px solid var(--ax-border); border-left: 3px solid var(--ax-accent);
  background: var(--ax-surface2); font-size: 13.5px; line-height: 1.65;
  color: var(--ax-muted);
}
.gd-note b { color: var(--ax-text); }
.gd-note.is-branch { border-left-color: #fcd34d; }
.gd-note.is-branch b { color: #fcd34d; }

/* Report / feature grid ------------------------------------------------- */
.gd-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.gd-cards .card { padding: 15px 16px; }
.gd-cards h4 { font-family: var(--ax-font-head); font-size: 14px; font-weight: 600; margin-bottom: 5px; color: var(--ax-text); }
.gd-cards p { font-size: 12.5px; line-height: 1.6; color: var(--ax-muted); }

/* Footer ---------------------------------------------------------------- */
.gd-foot { border-top: 1px solid var(--ax-border); background: var(--ax-surface); }
.gd-foot-in {
  max-width: 1240px; margin: 0 auto; padding: 30px 24px;
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between;
  font-size: 12.5px; color: var(--ax-dim);
}
.gd-foot a { color: var(--ax-muted); }
.gd-foot a:hover { color: var(--ax-accent); }

/* Responsive ------------------------------------------------------------ */
@media (max-width: 900px) {
  .gd-shell { grid-template-columns: 1fr; gap: 0; }
  .gd-rail {
    position: static; max-height: none; overflow: visible;
    border-bottom: 1px solid var(--ax-border); padding-bottom: 24px; margin-bottom: 8px;
  }
  .gd-cards { grid-template-columns: 1fr; }
  .gd-head-links a.gd-hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}
html { scroll-behavior: smooth; }


/* ── Added by the split: hub cards, chapter crumbs, prev/next ──────────── */

.gd-hub { max-width: 1080px; margin: 0 auto; padding: 0 20px 72px; }
.gd-group { margin-top: 44px; }
.gd-group h2 {
  font-size: 1.05rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ax-dim); margin: 0 0 16px; padding-bottom: 10px;
  border-bottom: 1px solid var(--ax-border);
}
.gd-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.gd-card {
  display: flex; flex-direction: column; gap: 6px; padding: 16px 18px;
  border: 1px solid var(--ax-border); border-radius: 10px;
  background: var(--ax-surface); text-decoration: none;
  transition: border-color .15s ease, transform .15s ease;
}
.gd-card:hover { border-color: var(--ax-accent); transform: translateY(-2px); }
.gd-card-t { font-weight: 600; color: var(--ax-text); }
.gd-card-d { font-size: .88rem; line-height: 1.5; color: var(--ax-dim); }

.gd-shell-ch .gd-body { padding-top: 8px; }
.gd-crumbs {
  font-size: .82rem; color: var(--ax-dim); margin-bottom: 18px;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.gd-crumbs a { color: var(--ax-dim); text-decoration: none; }
.gd-crumbs a:hover { color: var(--ax-accent); text-decoration: underline; }

.gd-rail-home {
  display: block; font-size: .85rem; color: var(--ax-dim);
  text-decoration: none; margin-bottom: 14px;
}
.gd-rail-home:hover { color: var(--ax-accent); }

.gd-related {
  display: block; margin-top: 40px; padding: 14px 18px;
  border: 1px solid var(--ax-border); border-left: 3px solid var(--ax-accent);
  border-radius: 0 8px 8px 0; background: var(--ax-surface); font-size: .92rem;
}
.gd-related-k { font-weight: 600; color: var(--ax-text); margin-right: 4px; }

.gd-prevnext {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--ax-border);
}
.gd-pn {
  display: flex; flex-direction: column; gap: 4px; max-width: 46%;
  padding: 14px 18px; border: 1px solid var(--ax-border); border-radius: 10px;
  text-decoration: none; transition: border-color .15s ease;
}
.gd-pn:hover { border-color: var(--ax-accent); }
.gd-pn.next { text-align: right; margin-left: auto; }
.gd-pn-k {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ax-dim);
}
.gd-pn-t { font-weight: 600; color: var(--ax-text); }

@media (max-width: 640px) {
  .gd-prevnext { flex-direction: column; }
  .gd-pn, .gd-pn.next { max-width: none; text-align: left; margin-left: 0; }
}
