/* ============================================================
   AHA Documentation Site — static stylesheet
   Brand: navy #1A2A5E + AHA red #C8202E
   ============================================================ */

:root {
  --navy: #1A2A5E;
  --accent: #C8202E;
  --ink: #161C28;
  --text: #2C3340;
  --muted: #6b7385;
  --faint: #9aa2b4;
  --line: #E6E8EF;
  --line-soft: #EEF0F4;
  --bg: #E3EDF8;
  --panel: #FAFBFC;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  font-family: var(--sans);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
::selection { background: rgba(26,42,94,.16); }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: #d5d9e2; border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #c2c8d4; }

.layout { display: flex; flex-direction: column; height: 100vh; }

/* ---------- Header ---------- */
.header {
  flex-shrink: 0; height: 61px; border-bottom: 1px solid var(--line);
  background: #fff; display: flex; align-items: center; gap: 18px;
  padding: 0 22px; z-index: 30;
}
.menu-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 4px;
  width: 38px; height: 38px; padding: 0 9px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; cursor: pointer; flex-shrink: 0;
}
.menu-toggle span { display: block; height: 2px; border-radius: 2px; background: var(--navy); transition: transform .2s, opacity .2s; }
body.nav-open .menu-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.nav-open .menu-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .menu-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.brand { display: flex; align-items: center; gap: 11px; width: 248px; flex-shrink: 0; text-decoration: none; }
.brand__mark {
  width: 32px; height: 32px; border-radius: 8px; background: var(--navy);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.brand__mark span { color: #fff; font-weight: 700; font-size: 16px; letter-spacing: .02em; }
.brand__mark img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.brand__mark:has(img) { background: none; }
.brand__mark:has(img)::after { content: none; }
.brand__mark::after {
  content: ''; position: absolute; right: 5px; bottom: 5px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
}
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__name { font-weight: 600; font-size: 15px; color: var(--ink); letter-spacing: -.01em; }
.brand__sub { font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em; color: var(--faint); text-transform: uppercase; }

.search {
  flex: 1; max-width: 440px; display: flex; align-items: center; gap: 9px;
  height: 38px; padding: 0 13px; border: 1px solid #E1E4EC; border-radius: 9px;
  background: #F8F9FB; cursor: text; transition: border-color .15s, background .15s;
}
.search:hover, .search:focus-within { border-color: #cfd4e0; background: #fff; }
.search input {
  flex: 1; border: none; background: none; outline: none;
  font-family: var(--sans); font-size: 14px; color: var(--text);
}
.search input::placeholder { color: var(--faint); }
.search kbd {
  font-family: var(--mono); font-size: 11px; color: #8a92a6; background: #fff;
  border: 1px solid #E1E4EC; border-radius: 5px; padding: 2px 6px; line-height: 1;
}
.spacer { flex: 1; }
.version {
  display: flex; align-items: center; gap: 7px; font-family: var(--mono);
  font-size: 12px; color: var(--muted); padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.version:hover { border-color: #cfd4e0; color: var(--navy); }
.btn-pdf {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 15px;
  border: none; border-radius: 9px; background: var(--accent); color: #fff;
  font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
  text-decoration: none; letter-spacing: .005em;
}
.btn-pdf:hover { filter: brightness(.93); }

/* ---------- Body row ---------- */
.body { flex: 1; display: flex; overflow: hidden; position: relative; }
.sidebar-overlay {
  position: absolute; inset: 0; z-index: 18; background: rgba(22,28,40,.42);
  opacity: 0; transition: opacity .22s ease;
}
body.nav-open .sidebar-overlay { opacity: 1; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 270px; flex-shrink: 0; border-right: 1px solid var(--line);
  background: #fff; overflow-y: auto; padding: 22px 16px 60px;
}
.nav-group { font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase; color: var(--faint);
  padding: 0 10px; margin: 22px 0 8px; }
.nav-group:first-child { margin-top: 0; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 7px 11px;
  border-radius: 8px; font-size: 14px; color: #515A6B; text-decoration: none;
  margin-bottom: 1px; transition: background .12s, color .12s;
}
.nav-link:hover { background: #F4F5F8; color: var(--navy); }
.nav-link.is-active {
  font-weight: 600; color: var(--navy); background: rgba(26,42,94,.08);
  box-shadow: inset 2px 0 0 var(--navy);
}
.nav-num { font-family: var(--mono); font-size: 11px; color: var(--faint); font-weight: 600; }
.nav-link.is-active .nav-num { color: var(--accent); }
.nav-link__label { flex: 1; }
.nav-chevron { font-size: 11px; color: var(--faint); transition: transform .18s; }
details[open] .nav-chevron { transform: rotate(90deg); }
.nav-sub { margin: 1px 0 2px; padding-left: 22px; }
.nav-sub a {
  display: block; padding: 6px 11px; border-radius: 7px; font-size: 13px;
  color: var(--muted); text-decoration: none; border-left: 1px solid var(--line);
}
.nav-sub a:hover { color: var(--navy); }
.nav-sub a.is-active { color: var(--navy); font-weight: 600; border-left-color: var(--navy); }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.side-card {
  margin: 26px 10px 0; padding: 14px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--panel);
}
.side-card__t { font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 4px; }
.side-card__d { font-size: 12px; color: #858DA0; line-height: 1.5; margin-bottom: 10px; }
.side-card a { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--accent); text-decoration: none; }

/* ---------- Main ---------- */
.main { flex: 1; overflow-y: auto; }
.page { display: flex; gap: 54px; max-width: 1140px; margin: 0 auto; padding: 38px 52px 90px; align-items: flex-start; }
.article { flex: 1; min-width: 0; max-width: 730px; }

.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--faint); margin-bottom: 18px; font-family: var(--mono); }
.breadcrumb .here { color: var(--muted); }

.stepper { display: flex; align-items: center; gap: 6px; margin-bottom: 26px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 8px; background: #F1F2F6; color: #7c8496; }
.step.is-active { background: var(--navy); color: #fff; }
.step__n { font-family: var(--mono); font-size: 11px; opacity: .7; }
.step__l { font-size: 12.5px; font-weight: 500; }
.step.is-active .step__l { font-weight: 600; }
.stepper .arrow { color: #c5cad6; }

h1.title { font-size: 33px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); margin: 0 0 14px; line-height: 1.15; }
.lede { font-size: 17px; line-height: 1.65; color: #4a5263; margin: 0 0 30px; }
h2 { font-size: 21px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); margin: 38px 0 12px; scroll-margin-top: 24px; }
.article p { font-size: 16px; line-height: 1.75; color: var(--text); margin: 0 0 14px; }
.article a.inline { color: var(--accent); text-decoration: none; font-weight: 500; border-bottom: 1px solid rgba(200,32,46,.3); }

ul.dash { margin: 0 0 14px; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; }
ul.dash li { display: flex; gap: 11px; font-size: 16px; line-height: 1.6; color: var(--text); }
ul.dash li::before { content: '—'; color: var(--accent); font-weight: 700; flex-shrink: 0; }

.callout { margin: 22px 0; padding: 16px 18px; border-radius: 11px; background: rgba(26,42,94,.05); border: 1px solid rgba(26,42,94,.10); }
.callout__k { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--navy); margin-bottom: 6px; }
.callout__b { font-size: 15px; line-height: 1.6; color: #3a4356; }

figure { margin: 0 0 8px; }
.shot {
  border-radius: 10px; border: 1px solid var(--line);
  background: repeating-linear-gradient(135deg, #F3F4F8 0 11px, #EDEFF4 11px 22px);
  height: 308px; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 12px; color: var(--faint); letter-spacing: .04em;
}
figcaption { font-size: 12.5px; color: var(--faint); margin-top: 8px; font-style: italic; }

.dtable { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; margin-bottom: 8px; width: 100%; border-collapse: collapse; background: #fff; }
.dtable thead th {
  background: var(--panel); border-bottom: 1px solid var(--line); text-align: left;
  font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--faint); padding: 11px 16px;
}
.dtable td { padding: 13px 16px; font-size: 14.5px; color: var(--text); border-bottom: 1px solid var(--line); }
.dtable tr:last-child td { border-bottom: none; }
.dtable td.when { color: #5a6273; }
.dtable td .name { font-weight: 500; }
.pill { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 5px; }
.pill.ok { color: #1A6E4A; background: #E7F4ED; }
.pill.review { color: #8a5a00; background: #FBF1DF; }

.tiers { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.tier { flex: 1; min-width: 170px; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.tier__h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot.green { background: #1A6E4A; } .dot.amber { background: #C99A2E; } .dot.red { background: var(--accent); }
.tier__r { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--ink); }
.tier__d { font-size: 13.5px; color: #5a6273; line-height: 1.5; }

.feedback { margin: 46px 0 0; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--panel); }
.feedback span { font-size: 14.5px; font-weight: 600; color: #3a4356; }
.feedback .btns { display: flex; gap: 8px; }
.feedback button { padding: 7px 16px; border: 1px solid #DcdfE8; border-radius: 8px; background: #fff; font-family: inherit; font-size: 13.5px; font-weight: 500; color: #4a5263; cursor: pointer; }
.feedback button:hover { border-color: var(--navy); color: var(--navy); }

.pager { margin-top: 22px; display: flex; gap: 14px; flex-wrap: wrap; }
.pager a { flex: 1; min-width: 220px; border: 1px solid var(--line); border-radius: 12px; padding: 15px 18px; text-decoration: none; display: block; }
.pager a:hover { border-color: #cfd4e0; background: var(--panel); }
.pager a.next { text-align: right; }
.pager__k { font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-bottom: 5px; }
.pager__t { font-size: 15px; font-weight: 600; color: var(--navy); }

/* ---------- Landing page ---------- */
.landing { max-width: 1140px; margin: 0 auto; padding: 48px 52px 90px; }
.hero { margin-bottom: 50px; }
.eyebrow { font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 16px; }
.hero__title { font-size: 42px; font-weight: 700; letter-spacing: -.025em; color: var(--ink); margin: 0 0 18px; line-height: 1.1; max-width: 18ch; }
.hero__lede { font-size: 18px; line-height: 1.6; color: #4a5263; margin: 0 0 28px; max-width: 60ch; }
.hero__cta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 26px; }
.cta { display: inline-flex; align-items: center; gap: 8px; padding: 0 20px; height: 46px; border-radius: 10px; font-size: 15px; font-weight: 600; text-decoration: none; }
.cta--primary { background: var(--navy); color: #fff; }
.cta--primary:hover { filter: brightness(1.12); }
.cta--ghost { background: #fff; border: 1px solid #DcdfE8; color: var(--navy); }
.cta--ghost:hover { border-color: var(--navy); }
.hero__logos { display: flex; gap: 12px; flex-wrap: wrap; }
.logo-chip { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; color: var(--faint); text-transform: uppercase; padding: 8px 14px; border: 1px dashed #cfd4e0; border-radius: 8px; background: var(--panel); }
.logo-img { height: 102px; width: auto; object-fit: contain; display: block; }

.lblock { margin-bottom: 48px; }
.lblock__k { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-bottom: 14px; }

.video { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #1A2A5E; display: flex; align-items: center; justify-content: center; }
.video video { display: block; width: 100%; height: auto; }
.video__play { width: 66px; height: 66px; border-radius: 50%; background: rgba(255,255,255,.92); display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 26px rgba(0,0,0,.25); }
.video__play span { width: 0; height: 0; border-style: solid; border-width: 11px 0 11px 18px; border-color: transparent transparent transparent var(--navy); margin-left: 4px; }
.video__cap { position: absolute; bottom: 16px; left: 18px; font-family: var(--mono); font-size: 12px; color: rgba(255,255,255,.8); }

.start-cards { display: flex; gap: 14px; flex-wrap: wrap; }
.start-card { flex: 1; min-width: 200px; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; text-decoration: none; display: block; transition: border-color .14s, background .14s; }
.start-card:hover { border-color: var(--navy); background: var(--panel); }
.start-card__t { font-size: 15.5px; font-weight: 600; color: var(--navy); margin-bottom: 5px; }
.start-card__d { font-size: 13.5px; color: var(--muted); line-height: 1.5; }

/* ---------- Inline code ---------- */
code { font-family: var(--mono); font-size: .88em; background: #F1F2F6; padding: 1px 6px; border-radius: 5px; color: #3a4356; white-space: nowrap; }
.dtable td code { font-size: 12.5px; }

/* ---------- Numbered steps ---------- */
ol.steps { list-style: none; counter-reset: step; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 14px; }
ol.steps li { position: relative; padding-left: 48px; font-size: 16px; line-height: 1.6; color: var(--text); min-height: 30px; }
ol.steps li::before {
  counter-increment: step; content: counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: -2px; width: 32px; height: 32px; border-radius: 9px;
  background: var(--navy); color: #fff; font-family: var(--mono); font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
ol.steps li > strong:first-child { display: block; margin-bottom: 2px; }
ol.steps li strong { font-weight: 600; color: var(--ink); }

/* ---------- Glossary ---------- */
dl.gloss { margin: 0; border-top: 1px solid var(--line); }
dl.gloss > div { padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
dl.gloss dt { font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
dl.gloss dt .tag { font-family: var(--mono); font-size: 10.5px; font-weight: 500; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; margin-left: 8px; }
dl.gloss dd { margin: 0; font-size: 15px; line-height: 1.6; color: #4a5263; }

/* ---------- FAQ accordion ---------- */
.faq { display: flex; flex-direction: column; gap: 10px; }
.faq details { border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.faq summary { list-style: none; cursor: pointer; padding: 15px 18px; font-size: 15.5px; font-weight: 600; color: var(--ink); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-family: var(--mono); font-size: 19px; color: var(--accent); flex-shrink: 0; line-height: 1; }
.faq details[open] summary::after { content: '\2212'; }
.faq details > p { margin: 0; padding: 0 18px 16px; font-size: 15px; line-height: 1.65; color: #4a5263; }

/* ---------- Mini pipeline cards (intro) ---------- */
.stage-cards { display: flex; gap: 0; align-items: stretch; flex-wrap: wrap; margin-bottom: 8px; }
.stage-card { flex: 1; min-width: 150px; border: 1px solid var(--line); border-radius: 12px; padding: 18px; background: #fff; text-decoration: none; transition: border-color .14s, background .14s; }
.stage-card:hover { border-color: var(--navy); background: var(--panel); }
.stage-card__n { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 10px; }
.stage-card__t { font-size: 15.5px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.stage-card__d { font-size: 13px; line-height: 1.55; color: var(--muted); }
.stage-cards .arrow { display: flex; align-items: center; color: #c5cad6; font-size: 18px; padding: 0 6px; }

/* ---------- Right rail TOC ---------- */
.toc { width: 194px; flex-shrink: 0; position: sticky; top: 0; align-self: flex-start; padding-top: 2px; }
.toc__h { font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-bottom: 12px; }
.toc a { display: block; font-size: 13px; color: #7c8496; text-decoration: none; padding: 5px 0 5px 12px; border-left: 2px solid #EAECF1; }
.toc a:hover { color: var(--navy); }
.toc a.is-active { color: var(--navy); font-weight: 600; border-left-color: var(--navy); }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .toc { display: none; }
}
@media (max-width: 860px) {
  .menu-toggle { display: flex; }
  .brand { width: auto; }
  .brand__text { display: none; }
  .search { max-width: none; }
  .version { display: none; }
  .btn-pdf span { display: none; }

  /* sidebar becomes a slide-in drawer */
  .sidebar {
    position: absolute; top: 0; left: 0; bottom: 0; z-index: 20;
    width: 280px; max-width: 84vw; transform: translateX(-100%);
    transition: transform .24s ease; box-shadow: 0 18px 50px rgba(22,28,40,.18);
  }
  body.nav-open .sidebar { transform: translateX(0); }

  .page { padding: 26px 22px 70px; }
  .landing { padding: 28px 22px 70px; }
  .hero__title { font-size: 32px; }
}
@media (max-width: 560px) {
  .header { gap: 12px; padding: 0 14px; }
  .search kbd { display: none; }
  h1.title { font-size: 27px; }
  .lede { font-size: 16px; }
  .stepper { gap: 4px; }
  .step__l { display: none; }
  .step { padding: 6px 10px; }
  .dtable thead { display: none; }
  .dtable, .dtable tbody, .dtable tr, .dtable td { display: block; width: 100%; }
  .dtable tr { border-bottom: 1px solid var(--line); padding: 6px 0; }
  .dtable tr:last-child { border-bottom: none; }
  .dtable td { border: none; padding: 5px 16px; }
  .dtable td::before { content: attr(data-label) ': '; color: var(--faint); font-family: var(--mono); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; display: block; margin-bottom: 2px; }
  .dtable td:empty { display: none; }
  .stage-cards .arrow { display: none; }
  .stage-card { min-width: 100%; }
}
