/* Persistent documentation shell; article and screenshot styles stay independent. */
@layer components {
  :root { --docs-header-height: 61px; --section-bar-height: 0px; }
  html { scroll-padding-top: calc(var(--docs-header-height) + var(--section-bar-height) + 24px); scrollbar-gutter: stable; }
  .documentation .wrap { width: min(1440px, calc(100% - 64px)); }
  .docs-header { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--line); }
  .docs-masthead { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
  .docs-masthead .brand { font-size: 1.35rem; }
  .docs-utilities { display: flex; align-items: center; gap: 20px; }
  .edition-badge { color: var(--muted); font-size: .74rem; white-space: nowrap; }
  .docs-tabs { display: flex; flex-wrap: nowrap; gap: 30px; padding-block: 0; border: 0; overflow-x: auto; scrollbar-width: thin; }
  .docs-tabs a { flex: 0 0 auto; padding-block: 10px 12px; font-size: .88rem; white-space: nowrap; }
  .docs-tabs a[aria-current] { border-bottom-width: 3px; }
  .docs-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 44px; align-items: start; min-height: calc(100dvh - var(--docs-header-height) - 82px); }
  .section-sidebar { position: sticky; top: var(--docs-header-height); padding-block: 32px; max-height: calc(100dvh - var(--docs-header-height)); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .section-sidebar .nav-label { padding-inline: 12px; margin-bottom: 12px; }
  .topic-group { position: relative; margin-block: 3px; }
  .nav-topic { margin: 0; padding: 0; border: 0; }
  .nav-topic summary { position: absolute; top: 0; right: 0; display: flex; align-items: center; list-style: none; cursor: pointer; border-radius: 6px; padding: 0; font-weight: 400; }
  .nav-topic summary::-webkit-details-marker { display: none; }
  .nav-topic summary:hover { background: var(--soft); }
  .topic-title { display: flex; min-width: 0; align-items: baseline; gap: 12px; padding: 11px 36px 11px 6px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: .88rem; line-height: 1.45; }
  .topic-title:hover { background: var(--soft); }
  .topic-number { color: var(--green); font-weight: 700; flex: 0 0 16px; }
  .topic-arrow { display: grid; place-items: center; flex: 0 0 32px; min-height: 44px; color: var(--muted); }
  .nav-topic[open] > summary .topic-arrow { transform: rotate(90deg); }
  .topic-entries { margin: 0 4px 10px 28px; }
  .topic-entries a { display: block; padding: 6px 9px; border-left: 3px solid transparent; border-radius: 5px; color: var(--muted); text-decoration: none; font-size: .8rem; line-height: 1.5; overflow-wrap: anywhere; }
  .topic-entries a:hover { color: var(--green); background: var(--soft); }
  .topic-entries a[aria-current] { color: var(--green); background: var(--soft); border-left-color: var(--green); font-weight: 650; }
  .topics-divider { border: 0; border-top: 1px solid var(--line); margin: 16px 4px; }
  .doc-content { overflow-wrap: anywhere; }
  .home .docs-layout { display: block; }
  .home { --section-bar-height: 0px; }
  .workflow-topic .chapter-article { max-width: 960px; }
  .workflow-topic h2 { border-top: 1px solid var(--line); padding-top: 30px; }
  .workflow-topic h2:focus { outline: none; }
  .section-sidebar nav > a { display: block; text-decoration: none; padding: 9px 12px; margin-block: 2px; border-radius: 6px; line-height: 1.45; color: var(--muted); font-size: .88rem; border-left: 3px solid transparent; }
  .section-sidebar nav > a:hover { color: var(--green); background: var(--soft); }
  .section-sidebar nav > a[aria-current="page"] { color: var(--green); background: var(--soft); border-left-color: var(--green); font-weight: 650; }
  .mini-draft { display: inline-block; color: #775019; font-size: .68rem; font-weight: 400; }
  .sidebar-toggle { display: none; }
  .doc-content { min-width: 0; padding-block: 36px 64px; }
  .doc-content:focus { outline: none; }
  .doc-content > .page-section-label { color: var(--green); font-size: .73rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 14px; }
  .page-heading { margin-bottom: 32px; }
  .page-heading h1, .chapter-article h1, .doc-content > .section h1 { font-size: clamp(2.15rem, 3vw, 3rem); max-width: 26ch; }
  .page-heading > p { color: var(--muted); font-size: 1.04rem; margin-top: 20px; }
  .doc-content .hero { padding-block: 0 36px; gap: 28px; grid-template-columns: minmax(0, 1fr) 220px; }
  .doc-content .hero h1 { font-size: clamp(2.2rem, 3vw, 3.2rem); max-width: 20ch; }
  .doc-content .hero-intro { font-size: 1rem; margin-top: 20px; }
  .doc-content .hierarchy { padding: 20px; }
  .doc-content .section { scroll-margin-top: 0; }
  .doc-content .chapter-article, .doc-content > .section:first-of-type { padding-top: 0; }
  .chapter-article > h1 { margin-bottom: 24px; }
  .manual-evidence { margin-top: 28px; }
  .doc-content .home-hero { padding-block: 12px 36px; gap: 32px; }
  .doc-content .home-hero h1 { font-size: clamp(2.8rem, 4.1vw, 4.3rem); }
  .doc-content .home-intro { font-size: 1rem; }
  .doc-content .example-map { padding: 22px; }
  .doc-content .home-features { gap: 12px 24px; font-size: .79rem; }
  .doc-content .home-section { padding-block: 36px; }
  .entry-paths { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
  .entry-card { padding: 22px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); background: white; }
  .entry-card .eyebrow { display: block; margin-bottom: 16px; }
  .entry-card p { font-size: .88rem; color: var(--muted); margin-block: 14px 20px; }
  .entry-card > span:last-child { color: var(--green); }
  .entry-card:hover { border-color: var(--green); }
  .home-help-link { font-size: .9rem; padding-top: 12px; }
  .topic-list { display: grid; gap: 14px; }
  .topic-link { position: relative; display: block; padding: 22px 56px 22px 24px; color: var(--ink); text-decoration: none; border: 1px solid var(--line); border-radius: 8px; background: white; }
  .topic-link h2 { font-size: 1.15rem; letter-spacing: -.015em; }
  .topic-link p { font-size: .92rem; margin-top: 9px; color: var(--muted); }
  .topic-link > span { position: absolute; right: 24px; top: 22px; color: var(--green); }
  .topic-link:hover { border-color: var(--green); }
  .page-outline { display: none; }
  .inline-outline { margin-bottom: 28px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 6px; font-size: .84rem; }
  [data-page-outline] a { display: block; text-decoration: none; padding-block: 6px; color: var(--muted); font-size: .8rem; line-height: 1.5; }
  [data-page-outline] a[aria-current] { color: var(--green); font-weight: 650; }
  .inline-outline nav { margin-top: 12px; }
  .help-questions { max-width: 76ch; }
  @media (min-width: 1280px) {
    .docs-layout.has-outline { grid-template-columns: 260px minmax(0, 1fr) 170px; gap: 32px; }
    .page-outline { display: block; position: sticky; top: var(--docs-header-height); max-height: calc(100dvh - var(--docs-header-height)); padding-block: 36px; overflow-y: auto; }
    .inline-outline { display: none; }
    .has-outline .evidence-pair { display: block; }
    .has-outline .menu-capture { display: grid; grid-template-columns: 230px minmax(0, 1fr); }
  }
  @media (max-width: 1100px) {
    .docs-layout { grid-template-columns: 240px minmax(0, 1fr); gap: 28px; }
    .doc-content .home-hero { grid-template-columns: 1fr; }
    .doc-content .example-map { max-width: 560px; }
    .entry-paths { grid-template-columns: 1fr; }
    .doc-content .hero { display: block; }
    .doc-content .hierarchy { margin-top: 24px; }
    .doc-content .hierarchy ol { display: flex; flex-wrap: wrap; gap: 18px; }
    .doc-content .hierarchy li { padding: 0 0 0 12px; }
    .doc-content .lesson-list { grid-template-columns: 1fr; }
  }
  @media (max-width: 800px) {
    :root { --docs-header-height: 53px; --section-bar-height: 46px; }
    .documentation .wrap { width: calc(100% - 32px); }
    .docs-masthead { min-height: 52px; gap: 10px; }
    .docs-masthead .brand { font-size: 1.15rem; }
    .docs-utilities { gap: 8px; }
    .edition-badge { font-size: .65rem; }
    .docs-tabs { justify-content: space-between; gap: 10px; }
    .docs-tabs a { font-size: .81rem; padding-block: 10px; }
    .docs-layout { display: block; }
    .section-sidebar { position: static; z-index: 15; background: var(--paper); padding-block: 0; border-bottom: 1px solid var(--line); overflow: visible; max-height: none; }
    .section-sidebar:has(.sidebar-toggle:not([hidden])) { position: sticky; }
    .section-sidebar nav { padding-block: 12px; max-height: calc(100dvh - var(--docs-header-height) - 60px); overflow-y: auto; overscroll-behavior: contain; }
    .section-sidebar:has(.sidebar-toggle:not([hidden])) nav { position: absolute; top: 100%; inset-inline: 0; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 12px 18px #18332c18; padding-inline: 10px; }
    .sidebar-toggle:not([hidden]) { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 46px; padding: 8px 0; border: 0; background: none; color: var(--ink); font-size: .82rem; text-align: left; cursor: pointer; }
    .sidebar-toggle[aria-expanded="true"] > span:last-child { transform: rotate(180deg); }
    .doc-content { padding-block: 26px 44px; }
    .doc-content .home-hero { padding-top: 0; }
    .doc-content .home-hero h1 { font-size: clamp(2.8rem, 9vw, 3.5rem); }
    .doc-content .home-hero { gap: 28px; }
    .entry-card { padding: 22px; }
    .doc-content .home-section h2 { font-size: 1.75rem; }
    .section-sidebar nav .nav-label { display: none; }
    .topic-link { padding: 20px 42px 20px 20px; }
    .topic-link > span { right: 18px; top: 20px; }
    .doc-content .menu-capture { display: block; }
  }
}
@layer print {
  @media print {
    .docs-header, .section-sidebar, .page-outline, .inline-outline, .legacy-entry { display: none; }
    .docs-layout, .docs-layout.has-outline { display: block; min-height: 0; }
    .documentation .wrap { width: 100%; }
    .doc-content { padding: 0; }
  }
}
