/* Cipi — documentation layout and content components */

:root { --side-w: 272px; --toc-w: 220px; --border: var(--rule); --text-muted: var(--muted); }
.docs body, body.docs { font-size: 16.5px; }

.docs-shell {
    display: grid;
    grid-template-columns: var(--side-w) minmax(0, 1fr);
    max-width: 1480px; margin: 0 auto;
}

/* ---------- Sidebar ---------- */
.docs-side {
    position: sticky; top: var(--nav-h); align-self: start;
    height: calc(100vh - var(--nav-h)); overflow-y: auto;
    padding: 24px 16px 48px 24px;
    border-right: 1px solid var(--rule);
    scrollbar-width: thin; scrollbar-color: var(--rule-2) transparent;
}
.side-search {
    display: flex; align-items: center; gap: 10px; width: 100%; height: 40px; margin-bottom: 18px; padding: 0 10px 0 12px;
    border: 1px solid var(--rule-2); border-radius: var(--r); background: var(--card); color: var(--muted);
    font-size: 14px; cursor: pointer; text-align: left;
}
.side-search:hover { border-color: var(--ink-2); }
.side-search svg { width: 15px; height: 15px; }
.side-search span { flex: 1; }
.side-start { display: block; margin: 0 0 14px; padding: 6px 10px; border-radius: 6px; font-weight: 600; font-size: 14.5px; text-decoration: none; }
.side-start[aria-current="page"], .side-start:hover { background: var(--paper-2); }
.side-group { margin: 0 0 2px; }
.side-group summary {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 7px 10px; border-radius: 6px; cursor: pointer; list-style: none;
    font-size: 14.5px; font-weight: 700; color: var(--ink);
}
.side-group summary::-webkit-details-marker { display: none; }
.side-group summary::after {
    content: ""; width: 7px; height: 7px; flex: none; margin-right: 2px;
    border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted);
    transform: rotate(-45deg); transition: transform .15s;
}
.side-group[open] summary::after { transform: rotate(45deg); }
.side-group summary:hover { background: var(--paper-2); }
.side-group ul { list-style: none; margin: 2px 0 12px; padding: 0 0 0 10px; border-left: 1px solid var(--rule); margin-left: 12px; }
.side-group li a {
    display: block; padding: 5px 10px; margin-left: -1px; border-left: 2px solid transparent;
    font-size: 14.5px; line-height: 1.35; color: var(--ink-2); text-decoration: none;
}
.side-group li a:hover { color: var(--ink); }
.side-group li a[aria-current="page"] { border-left-color: var(--lime); color: var(--ink); font-weight: 600; background: linear-gradient(90deg, var(--lime-soft), transparent 80%); }
.side-group .side-overview { color: var(--muted); }

/* ---------- Main column ---------- */
.docs-main { display: grid; grid-template-columns: minmax(0, 1fr) var(--toc-w); gap: 48px; padding: 40px 40px 96px 56px; }
.docs-article { min-width: 0; max-width: 780px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; font-size: 14px; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--rule-2); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.docs-article > header h1 {
    margin: 0 0 12px; font-size: clamp(2.1rem, 3.4vw, 2.75rem); line-height: 1.08; font-weight: 800; letter-spacing: -.035em;
}
.docs-lead { margin: 0 0 8px; font-size: 19px; color: var(--ink-2); line-height: 1.55; }
.docs-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 18px 0 0; padding-bottom: 26px; border-bottom: 1px solid var(--rule); font-size: 14px; color: var(--muted); }
.docs-meta a { text-decoration: none; }
.docs-meta a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- TOC ---------- */
.docs-toc { position: sticky; top: calc(var(--nav-h) + 40px); align-self: start; max-height: calc(100vh - var(--nav-h) - 60px); overflow-y: auto; font-size: 13.5px; }
.docs-toc h2 { margin: 0 0 10px; font-size: 13.5px; font-weight: 700; }
.docs-toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule); }
.docs-toc a { display: block; padding: 4px 0 4px 12px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; line-height: 1.35; }
.docs-toc a.l3 { padding-left: 24px; font-size: 13px; }
.docs-toc a:hover { color: var(--ink); }
.docs-toc a.active { color: var(--ink); border-left-color: var(--lime); }
.toc-tools { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--rule); display: grid; gap: 8px; }
.toc-tools a { color: var(--muted); text-decoration: none; }
.toc-tools a:hover { color: var(--ink); }

/* ---------- Prose ---------- */
.prose { padding-top: 8px; }
.prose > .doc-section + .doc-section { margin-top: 8px; }
.prose h2 {
    margin: 52px 0 14px; padding-top: 4px;
    font-size: 1.62rem; line-height: 1.2; font-weight: 800; letter-spacing: -.02em;
}
.prose h3 { margin: 36px 0 10px; font-size: 1.2rem; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; }
.prose h4 { margin: 26px 0 8px; font-size: 1.02rem; font-weight: 700; }
.prose h2 code, .prose h3 code, .prose h1 code { font-size: .88em; background: none; border: 0; padding: 0; color: inherit; }
.prose .anchor { margin-left: 8px; color: var(--rule-2); text-decoration: none; font-weight: 500; opacity: 0; }
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose .anchor:focus { opacity: 1; }
.prose p, .prose li { color: var(--ink-2); }
.prose p { margin: 0 0 16px; }
.prose strong { color: var(--ink); font-weight: 650; }
.prose a { color: var(--lime-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--lime-ink) 45%, transparent); }
.prose a:hover { text-decoration-color: currentColor; }
.prose ul, .prose ol { margin: 0 0 18px; padding-left: 22px; }
.prose li { margin: 5px 0; }
.prose li::marker { color: var(--muted); }
.prose hr, .prose .doc-divider { border: 0; border-top: 1px solid var(--rule); margin: 36px 0; }
.prose :not(pre) > code {
    font-size: .86em; padding: .12em .38em; border-radius: 4px;
    background: var(--paper-2); border: 1px solid var(--rule); color: var(--ink); word-break: break-word;
}
.prose kbd { font-size: .85em; padding: 1px 6px; border: 1px solid var(--rule-2); border-bottom-width: 2px; border-radius: 4px; }
.prose img { max-width: 100%; height: auto; }

/* Code blocks */
.code-block { margin: 0 0 20px; border-radius: var(--r); background: var(--term); border: 1px solid #1F2A23; overflow: hidden; }
.code-block-header { display: flex; align-items: center; justify-content: space-between; height: 36px; padding: 0 8px 0 14px; background: var(--term-2); border-bottom: 1px solid var(--term-rule); }
.code-block-lang { font: 500 11.5px/1 var(--f-mono); color: var(--term-dim); }
.code-copy-btn { height: 24px; padding: 0 9px; border: 1px solid var(--term-rule); border-radius: 5px; background: transparent; color: var(--term-dim); font: 500 11.5px/1 var(--f-sans); cursor: pointer; }
.code-copy-btn:hover { color: var(--term-text); border-color: #3A4A40; }
.code-block pre, .prose > pre, .doc-section > pre {
    margin: 0; padding: 14px 16px; overflow-x: auto;
    font: 400 13.5px/1.65 var(--f-mono); color: var(--term-text); background: var(--term);
    scrollbar-width: thin; scrollbar-color: #2C3830 transparent;
}
.doc-section > pre { border-radius: var(--r); margin-bottom: 20px; }
.code-block pre .p::before { content: "$ "; color: var(--term-lime); user-select: none; -webkit-user-select: none; }
.code-block pre .c { color: var(--term-dim); }
.code-block pre .s { color: #B9E58A; }
.code-block pre .k { color: #F0B35A; }
.code-block pre .nv, .code-block pre .v { color: var(--term-cyan); }
.code-block pre .mi, .code-block pre .n { color: #E9A6F5; }
.code-block pre .o { color: var(--term-text); }
.code-block pre .nf { color: #9CC4FF; }

/* Callouts */
.callout { display: flex; gap: 12px; margin: 0 0 20px; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--rule-2); background: var(--card); font-size: 15.5px; color: var(--ink-2); }
.callout-icon { flex: none; width: 18px; height: 18px; margin-top: 3px; }
.callout > div > :last-child { margin-bottom: 0; }
.callout.info { border-color: color-mix(in srgb, var(--blue) 30%, var(--rule)); background: color-mix(in srgb, var(--blue) 5%, var(--card)); }
.callout.info .callout-icon { color: var(--blue); }
.callout.warning { border-color: color-mix(in srgb, var(--amber) 40%, var(--rule)); background: color-mix(in srgb, var(--amber) 6%, var(--card)); }
.callout.warning .callout-icon { color: var(--amber); }
.callout.success { border-color: color-mix(in srgb, var(--lime) 50%, var(--rule)); background: var(--lime-soft); }
.callout.success .callout-icon { color: var(--lime-ink); }

/* Tables */
.table-scroll { margin: 0 0 22px; overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--r); }
.cmd-table, .env-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.prose > .cmd-table, .doc-section > .cmd-table, .doc-section > .env-table { margin-bottom: 22px; border: 1px solid var(--rule); }
.cmd-table th, .env-table th { text-align: left; padding: 10px 14px; font-weight: 700; font-size: 13.5px; background: var(--paper-2); border-bottom: 1px solid var(--rule); color: var(--ink); }
.cmd-table td, .env-table td { padding: 10px 14px; border-bottom: 1px solid var(--rule); vertical-align: top; color: var(--ink-2); }
.cmd-table tr:last-child td, .env-table tr:last-child td { border-bottom: 0; }
.cmd-table td:first-child code, .env-table td:first-child code { white-space: nowrap; }

/* Option lists */
.options-list { margin: 0 0 22px; border: 1px solid var(--rule); border-radius: var(--r); }
.option-item { display: grid; grid-template-columns: minmax(150px, max-content) 1fr; gap: 16px; padding: 11px 14px; border-bottom: 1px solid var(--rule); font-size: 15px; }
.option-item:last-child { border-bottom: 0; }
.option-item > code { align-self: start; justify-self: start; }
.option-item > span { color: var(--ink-2); }

/* Directory tree */
.tree-block { margin: 0 0 22px; border-radius: var(--r); background: var(--term); border: 1px solid #1F2A23; }
.tree-block pre { margin: 0; padding: 16px; overflow-x: auto; font: 400 13px/1.7 var(--f-mono); color: var(--term-text); }
.tree-accent { color: var(--term-lime); }
.tree-comment { color: var(--term-dim); }

/* Timeline (history) */
.timeline { position: relative; margin: 8px 0 28px; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--rule); }
.timeline-item { position: relative; padding-bottom: 26px; }
.timeline-marker { position: absolute; left: -28px; top: 5px; width: 16px; height: 16px; border-radius: 50%; background: var(--paper); border: 2px solid var(--rule-2); }
.timeline-item--current .timeline-marker { border-color: var(--lime); background: var(--lime); }
.timeline-version { font: 700 13px/1 var(--f-mono); color: var(--lime-ink); margin-right: 10px; }
.timeline-date { font-size: 13.5px; color: var(--muted); }
.timeline-title { margin: 6px 0 6px !important; }

/* GUI screenshots */
.gui-shot { margin: 0 0 26px; }
.gui-shot-frame { border: 1px solid var(--rule-2); border-radius: 10px; overflow: hidden; background: #0B0D10; cursor: zoom-in; }
.gui-shot-bar { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; background: #15181D; border-bottom: 1px solid #23272E; }
.gui-shot-bar i { width: 8px; height: 8px; border-radius: 50%; background: #2B3038; }
.gui-shot-url { margin-left: 10px; font: 500 11px/1 var(--f-mono); color: #8A919C; }
.gui-shot img { width: 100%; height: auto; display: block; }
.gui-shot .shot-dark { display: none; }
[data-theme="dark"] .gui-shot .shot-dark { display: block; }
[data-theme="dark"] .gui-shot .shot-light { display: none; }
[data-theme="light"] .gui-shot-frame:has(.shot-light) { background: #F3F4F6; }
.gui-shot figcaption { margin-top: 8px; font-size: 14px; color: var(--muted); }
.gui-shot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.gui-shot-phones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 0 0 26px; }
.gui-shot-phones img { width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--rule-2); }
.lightbox { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 24px; background: rgba(8, 12, 10, .86); cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* Misc legacy blocks */
.why-cipi-intro { display: grid; grid-template-columns: 88px 1fr; gap: 20px; align-items: start; margin-bottom: 18px; }
.why-cipi-mascot svg { width: 88px; height: 88px; color: var(--lime-ink); }
.cmp-overview-wrap { overflow-x: auto; margin: 0 0 24px; border: 1px solid var(--rule); border-radius: var(--r); }
.cmp-overview-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.cmp-overview-table td { border-bottom: 1px solid var(--rule); }
.cmp-overview-table svg { width: 18px; height: 18px; display: inline-block; }
.cmp-overview-cipi { background: var(--lime-soft); }
.cmp-overview-cipi-name { font-weight: 800; }

/* Animated terminal inside docs */
.prose .term { margin: 4px 0 24px; --term-min: 0px; --term-max: 420px; }
.prose .term .term-body { color: var(--term-text); }
.term-caption { margin: -14px 0 24px; font-size: 14px; color: var(--muted); }
.prose .pd { margin: 4px 0 28px; }

/* Group landing cards */
.landing-list { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid var(--ink); }
.landing-list li { border-bottom: 1px solid var(--rule); }
.landing-list a { display: grid; grid-template-columns: 1fr auto; gap: 4px 20px; padding: 16px 4px; text-decoration: none; }
.landing-list a b { font-size: 17px; color: var(--ink); }
.landing-list a span { grid-column: 1; color: var(--muted); font-size: 15px; }
.landing-list a::after { content: ""; grid-row: 1 / span 2; grid-column: 2; align-self: center; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-top: 2px solid var(--muted); transform: rotate(45deg); }
.landing-list a:hover b { text-decoration: underline; text-underline-offset: 3px; }
.landing-list a:hover::after { border-color: var(--lime-ink); }

/* Docs home */
.docs-home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px; margin-top: 12px; }
.dh-group { padding: 22px 0; border-top: 1px solid var(--rule); }
.dh-group h2 { margin: 0 0 4px !important; padding: 0 !important; font-size: 1.15rem !important; }
.dh-group h2 a { color: var(--ink) !important; text-decoration: none !important; }
.dh-group h2 a:hover { text-decoration: underline !important; }
.dh-group > p { margin: 0 0 10px !important; font-size: 15px; color: var(--muted) !important; }
.dh-group ul { list-style: none; margin: 0 !important; padding: 0 !important; display: flex; flex-wrap: wrap; gap: 6px; }
.dh-group li { margin: 0 !important; }
.dh-group li a { display: inline-block; padding: 3px 9px; border: 1px solid var(--rule-2); border-radius: 6px; font-size: 14px; color: var(--ink-2) !important; text-decoration: none !important; }
.dh-group li a:hover { border-color: var(--ink); color: var(--ink) !important; }
.dh-start { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 10px 0 36px; }
.dh-start a { display: block; padding: 18px; border: 1px solid var(--rule-2); border-radius: var(--r); background: var(--card); text-decoration: none !important; }
.dh-start a:hover { border-color: var(--ink); }
.dh-start b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.dh-start span { color: var(--muted); font-size: 14.5px; line-height: 1.45; display: block; }
.dh-start .is-first { background: var(--ink); border-color: var(--ink); }
.dh-start .is-first b { color: var(--lime); }
.dh-start .is-first span { color: color-mix(in srgb, var(--paper) 72%, transparent); }

/* Prev / next */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 64px; }
.pager a { display: block; padding: 16px 18px; border: 1px solid var(--rule-2); border-radius: var(--r); text-decoration: none; }
.pager a:hover { border-color: var(--ink); }
.pager small { display: block; font-size: 13px; color: var(--muted); }
.pager b { font-size: 16px; }
.pager .next { text-align: right; grid-column: 2; }
.feedback { margin-top: 28px; font-size: 14px; color: var(--muted); }
.feedback a { color: var(--ink-2); }

/* Mobile docs nav */
.docs-menu-btn { display: none; }
@media (max-width: 1240px) {
    .docs-main { grid-template-columns: minmax(0, 1fr); padding: 32px 32px 80px 40px; }
    .docs-toc { display: none; }
}
@media (max-width: 900px) {
    .docs-shell { grid-template-columns: 1fr; }
    .docs-side {
        position: fixed; z-index: 45; top: var(--nav-h); left: 0; width: min(320px, 86vw);
        background: var(--paper); transform: translateX(-100%); transition: transform .25s ease;
        box-shadow: 20px 0 40px -20px rgba(0,0,0,.3);
    }
    .docs-side.open { transform: none; }
    .docs-menu-btn {
        display: flex; align-items: center; gap: 8px; position: sticky; top: var(--nav-h); z-index: 30;
        width: 100%; height: 46px; padding: 0 20px; border: 0; border-bottom: 1px solid var(--rule);
        background: var(--paper); font-size: 14.5px; font-weight: 600; cursor: pointer; text-align: left;
    }
    .docs-menu-btn svg { width: 16px; height: 16px; }
    .docs-main { padding: 24px 20px 72px; }
    .dh-start, .docs-home-grid { grid-template-columns: 1fr; }
    .option-item { grid-template-columns: 1fr; gap: 4px; }
    .pager { grid-template-columns: 1fr; }
    .pager .next { grid-column: 1; }
    .gui-shot-grid { grid-template-columns: 1fr; }
}

/* Overflow guards */
.callout > div { min-width: 0; }
.prose pre { max-width: 100%; overflow-x: auto; }
.prose li > pre, .prose p + pre:not(.code-block pre) { margin: 8px 0 14px; padding: 12px 14px; border-radius: var(--r); background: var(--term); color: var(--term-text); font: 400 13px/1.6 var(--f-mono); }
.prose pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.timeline-body { min-width: 0; }

/* Diagrams: ```flow blocks */
.flow { list-style: none; display: flex; flex-wrap: wrap; gap: 0; margin: 6px 0 26px !important; padding: 0 !important; counter-reset: fl; }
.flow li {
    position: relative; flex: 1 1 0; min-width: 130px; margin: 0 !important; padding: 14px 14px 14px 16px;
    background: var(--card); border: 1px solid var(--rule-2); border-left-width: 0; counter-increment: fl;
}
.flow li:first-child { border-left-width: 1px; border-radius: var(--r) 0 0 var(--r); }
.flow li:last-child { border-radius: 0 var(--r) var(--r) 0; background: var(--lime-soft); border-color: color-mix(in srgb, var(--lime) 45%, var(--rule-2)); }
.flow li:not(:last-child)::after {
    content: ""; position: absolute; z-index: 1; right: -9px; top: 50%; width: 16px; height: 16px; margin-top: -8px;
    background: var(--card); border-top: 1px solid var(--rule-2); border-right: 1px solid var(--rule-2); transform: rotate(45deg);
}
.flow li::before { content: counter(fl); display: block; font: 700 11.5px/1 var(--f-mono); color: var(--muted); margin-bottom: 6px; }
.flow b { display: block; font-size: 14.5px; line-height: 1.3; color: var(--ink); }
.flow span { display: block; margin-top: 3px; font-size: 13px; line-height: 1.4; color: var(--muted); }
@media (max-width: 720px) {
    .flow { flex-direction: column; }
    .flow li { border-left-width: 1px; border-top-width: 0; }
    .flow li:first-child { border-top-width: 1px; border-radius: var(--r) var(--r) 0 0; }
    .flow li:last-child { border-radius: 0 0 var(--r) var(--r); }
    .flow li:not(:last-child)::after { right: auto; left: 24px; top: auto; bottom: -9px; margin-top: 0; transform: rotate(135deg); }
}
.flow.stack { gap: 8px; }
.flow.stack li, .flow.stack li:first-child, .flow.stack li:last-child { border-width: 1px; border-radius: var(--r); background: var(--card); border-color: var(--rule-2); }
.flow.stack li::before, .flow.stack li::after { display: none; }
@media (max-width: 720px) { .flow.stack li { border-top-width: 1px !important; } }

/* Sticky, clickable step map (```flow with #anchors) */
.flow-nav { position: sticky; top: 64px; z-index: 20; margin: 0 0 30px; padding: 10px 0; background: var(--paper); }
.flow-nav.is-stuck { box-shadow: 0 10px 18px -16px rgba(20, 32, 26, .45); }
.flow-nav ol { list-style: none; display: flex; margin: 0 !important; padding: 0 !important; counter-reset: fn; }
.flow-nav li { position: relative; flex: 1 1 0; min-width: 0; margin: 0 !important; counter-increment: fn; }
.flow-nav a, .flow-nav li > div { display: block; height: 100%; padding: 12px 14px 12px 18px; border: 1px solid var(--rule-2); border-left-width: 0;
    background: var(--card, var(--paper)); text-decoration: none !important; color: var(--ink) !important; transition: background .2s, border-color .2s; }
.flow-nav li:first-child > * { border-left-width: 1px; border-radius: 10px 0 0 10px; }
.flow-nav li:last-child > * { border-radius: 0 10px 10px 0; }
.flow-nav li > *::before { content: counter(fn); display: inline-grid; place-items: center; width: 20px; height: 20px; margin-bottom: 6px; border-radius: 50%;
    border: 1px solid var(--rule-2); font: 700 11px/1 var(--f-mono); color: var(--muted); transition: all .2s; }
.flow-nav b { display: block; font-size: 14.5px; line-height: 1.3; }
.flow-nav span { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.35; color: var(--muted); }
.flow-nav a:hover { background: color-mix(in srgb, var(--lime) 8%, var(--paper)); }
.flow-nav li.is-done > *::before { content: "✓"; background: var(--lime-soft); border-color: var(--lime); color: var(--lime-ink); }
.flow-nav li.is-active > * { background: var(--lime-soft); border-color: color-mix(in srgb, var(--lime) 55%, var(--rule-2)); }
.flow-nav li.is-active > *::before { background: var(--lime); border-color: var(--lime); color: #14201A; }
.flow-nav li:not(:last-child)::after { content: ""; position: absolute; z-index: 1; right: -8px; top: 50%; width: 14px; height: 14px; margin-top: -7px;
    background: inherit; border-top: 1px solid var(--rule-2); border-right: 1px solid var(--rule-2); transform: rotate(45deg); background: var(--paper); pointer-events: none; }
.flow-nav li.is-active:not(:last-child)::after { background: var(--lime-soft); }
@media (max-width: 760px) {
    .flow-nav { top: 56px; margin-left: -20px; margin-right: -20px; padding: 8px 20px; overflow-x: auto; scrollbar-width: none; }
    .flow-nav::-webkit-scrollbar { display: none; }
    .flow-nav li { flex: 0 0 auto; }
    .flow-nav a { padding: 8px 14px 8px 16px; }
    .flow-nav li > *::before { display: inline-grid; margin: 0 6px 0 0; vertical-align: -4px; }
    .flow-nav b { display: inline; font-size: 14px; }
    .flow-nav span { display: none; }
}
.flow-nav li > div { color: var(--ink); }
.flow-nav li > div b { color: var(--ink); }
.flow-nav b, .flow-nav span { margin-left: 0; }
.flow-nav { top: var(--nav-h, 64px); }
@media (max-width: 760px) { .flow-nav { top: var(--nav-h, 56px); } }
@media (max-width: 900px) { body.docs .flow-nav { top: calc(var(--nav-h, 56px) + 46px); } }

/* Guides linked from a docs page */
.doc-guides { margin: 48px 0 8px; padding: 22px 22px 18px; border: 1px solid color-mix(in srgb, var(--lime) 45%, var(--rule-2)); border-radius: 14px; background: color-mix(in srgb, var(--lime) 6%, var(--paper)); }
.doc-guides h2 { margin: 0 0 12px; font-size: 18px; }
.doc-guides ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.doc-guides a { display: block; height: 100%; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); text-decoration: none; color: var(--ink); }
.doc-guides a:hover { border-color: var(--ink-2); }
.doc-guides b { display: block; font-size: 15px; line-height: 1.3; }
.doc-guides span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; font-size: 13.5px; line-height: 1.45; color: var(--muted); }
@media (max-width: 720px) { .doc-guides ul { grid-template-columns: minmax(0, 1fr); } }
/* Reference docs box at the end of a guide */
.art-refs { margin-top: 36px; padding: 18px 20px; border: 1px dashed var(--rule-2); border-radius: 12px; }
.art-refs h2 { margin: 0 0 8px !important; padding: 0 !important; border: 0 !important; font-size: 16px !important; }
.art-refs ul { margin: 0 !important; padding: 0 !important; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.art-refs li { margin: 0 !important; }
.art-refs a { display: inline-block; padding: 5px 11px; border: 1px solid var(--rule); border-radius: 999px; font-size: 14px; text-decoration: none; }
.art-refs a:hover { border-color: var(--ink-2); }

/* Step-by-step explainers (```flow with "> explanation" lines) */
.fx { margin: 6px 0 28px; }
.fx .flow { margin: 0 !important; }
.fx-steps li { padding: 0 !important; }
.fx-steps button { all: unset; box-sizing: border-box; display: block; width: 100%; height: 100%; padding: 12px 22px 12px 14px; cursor: pointer; }
.fx-steps li::before { position: absolute; top: 12px; left: 14px; }
.fx-steps button b { margin-top: 18px; }
.fx-steps button:focus-visible { outline: 2px solid var(--ink); outline-offset: -3px; border-radius: 8px; }
.fx-steps li:hover { background: color-mix(in srgb, var(--lime) 7%, var(--paper)); }
.fx-steps li.is-done { background: color-mix(in srgb, var(--lime) 10%, var(--paper)); }
.fx-steps li.is-active { background: var(--lime-soft); box-shadow: inset 0 -3px 0 var(--ink); }
.fx-steps li:last-child:not(.is-active) { background: var(--card, var(--paper)); border-color: var(--rule-2); }
.fx-steps li { position: relative; }
.fx-panel { margin-top: 10px; padding: 18px 20px 14px; border: 1px solid var(--rule-2); border-radius: var(--r); background: var(--card, var(--paper)); }
.fx-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; }
.fx-head b { font-size: 16px; color: var(--ink); }
.fx-n { font: 600 12px/1 var(--f-mono); color: var(--muted); }
.fx-pane p { margin: 0 0 10px; font-size: 15px; line-height: 1.6; }
.fx-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--rule); }
.fx-nav button { font: inherit; font-size: 14px; font-weight: 600; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--rule-2); background: var(--paper); color: var(--ink); cursor: pointer; }
.fx-nav .fx-next { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.fx-nav button:disabled { opacity: .4; cursor: default; }
@media (min-width: 721px) { .fx-steps { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: thin; } .fx-steps li { min-width: 112px; } }
@media (max-width: 720px) {
    .fx .fx-steps { flex-direction: row !important; flex-wrap: nowrap !important; overflow-x: auto; scroll-snap-type: x mandatory; }
    .fx .fx-steps li { flex: 0 0 auto; min-width: 128px; max-width: 170px; border-top-width: 1px !important; border-left-width: 0 !important; border-radius: 0 !important; scroll-snap-align: start; }
    .fx .fx-steps li:first-child { border-left-width: 1px !important; border-radius: 10px 0 0 10px !important; }
    .fx .fx-steps li:last-child { border-radius: 0 10px 10px 0 !important; }
    .fx .fx-steps li::after { display: none; }
    .fx .fx-steps button span { display: none; }
    .fx .fx-steps button { padding: 10px 12px; }
    .fx .fx-steps button b { margin-top: 16px; font-size: 13.5px; }
    .fx .fx-steps li::before { top: 10px; left: 12px; }
}
