/* Herdr Handbook - offline static docs */
:root {
    --bg: #0b1020;
    --surface: #11182b;
    --surface2: #172038;
    --text: #e8edf8;
    --muted: #9aa8c3;
    --line: #263454;
    --accent: #7bdcff;
    --accent2: #a8ffcf;
    --warn: #ffd27a;
    --danger: #ff9a9a;
    --code: #080d18;
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
    --radius: 14px;
    --sidebar: 280px;
    --toc: 240px;
}
[data-theme="light"] {
    --bg: #f5f7fb;
    --surface: #fff;
    --surface2: #eef3fb;
    --text: #172038;
    --muted: #5f6f8e;
    --line: #d9e1ef;
    --accent: #0b7fab;
    --accent2: #087a49;
    --warn: #8a5b00;
    --danger: #a83535;
    --code: #101827;
    --shadow: 0 14px 36px rgba(26, 43, 75, 0.1);
}
* {
    box-sizing: border-box;
}
html {
    scroll-behavior: smooth;
}
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font:
        15.5px/1.72 ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}
a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
code,
kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: 64px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
}
.brand {
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    display: flex;
    gap: 10px;
    align-items: center;
}
.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: grid;
    place-items: center;
    color: #07111b;
    font-weight: 950;
}
.top-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}
.btn {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    padding: 8px 11px;
    border-radius: 10px;
    cursor: pointer;
}
.btn:hover {
    background: var(--surface2);
}
.shell {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--toc);
    min-height: calc(100vh - 64px);
}
.sidebar {
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow: auto;
    border-right: 1px solid var(--line);
    padding: 16px;
    background: var(--surface);
}
.sidebar-search {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    margin-bottom: 12px;
}
.nav-group {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    color: var(--muted);
    font-weight: 800;
    margin: 18px 10px 7px;
}
.nav a {
    display: block;
    padding: 8px 10px;
    margin: 2px 0;
    border-radius: 8px;
    color: var(--muted);
}
.nav a:hover,
.nav a.active {
    background: var(--surface2);
    color: var(--text);
    text-decoration: none;
}
.nav a.active {
    box-shadow: inset 3px 0 var(--accent);
}
.main {
    min-width: 0;
    padding: 42px clamp(24px, 4vw, 64px) 80px;
    max-width: 1120px;
    margin: 0 auto;
    width: 100%;
}
.toc {
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow: auto;
    border-left: 1px solid var(--line);
    padding: 24px 18px;
}
.toc-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    font-weight: 800;
}
.toc a {
    display: block;
    color: var(--muted);
    padding: 5px 0;
    font-size: 13px;
}
.toc a:hover {
    color: var(--text);
}
.breadcrumb {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 20px;
}
.eyebrow {
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent2);
    font-weight: 900;
}
.hero {
    padding: 8px 0 20px;
}
.hero h1 {
    font-size: clamp(38px, 5vw, 66px);
    line-height: 1.02;
    letter-spacing: -0.045em;
    margin: 10px 0 16px;
}
.hero p {
    font-size: 18px;
    color: var(--muted);
    max-width: 790px;
}
.page-title {
    font-size: 42px;
    line-height: 1.1;
    letter-spacing: -0.035em;
    margin: 8px 0 12px;
}
.lead {
    font-size: 18px;
    color: var(--muted);
    max-width: 840px;
    margin-bottom: 30px;
}
h2 {
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: -0.025em;
    margin: 46px 0 14px;
    scroll-margin-top: 82px;
}
h3 {
    font-size: 20px;
    margin: 28px 0 10px;
    scroll-margin-top: 82px;
}
p {
    margin: 10px 0 16px;
}
ul,
ol {
    padding-left: 22px;
}
.muted {
    color: var(--muted);
}
.small {
    font-size: 13px;
}
.strong {
    font-weight: 800;
}
.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}
.card h3 {
    margin-top: 0;
}
.card-link {
    display: block;
    color: var(--text);
}
.card-link:hover {
    text-decoration: none;
    border-color: var(--accent);
}
.tag {
    display: inline-flex;
    border: 1px solid var(--line);
    background: var(--surface2);
    color: var(--muted);
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 12px;
    margin: 2px;
}
.callout {
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    background: var(--surface);
    padding: 14px 16px;
    border-radius: 10px;
    margin: 18px 0;
}
.callout.warn {
    border-left-color: var(--warn);
}
.callout.danger {
    border-left-color: var(--danger);
}
.callout.success {
    border-left-color: var(--accent2);
}
pre {
    position: relative;
    background: var(--code);
    color: #eaf3ff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px;
    overflow: auto;
    line-height: 1.55;
    margin: 14px 0 22px;
}
pre code {
    white-space: pre;
}
.copy {
    position: absolute;
    right: 9px;
    top: 8px;
    border: 1px solid #31405f;
    background: #121b30;
    color: #bdd0ef;
    border-radius: 7px;
    padding: 5px 8px;
    font-size: 11px;
    cursor: pointer;
}
kbd {
    border: 1px solid var(--line);
    background: var(--surface2);
    border-bottom-width: 2px;
    border-radius: 6px;
    padding: 1px 6px;
    color: var(--text);
}
table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0 24px;
    font-size: 14px;
}
th,
td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.flow {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px;
    white-space: pre;
    overflow: auto;
    color: var(--accent2);
}
.checklist {
    list-style: none;
    padding: 0;
}
.checklist li {
    padding: 8px 0 8px 30px;
    position: relative;
}
.checklist li:before {
    content: "□";
    position: absolute;
    left: 5px;
    color: var(--accent);
    font-size: 18px;
}
.steps {
    counter-reset: step;
    list-style: none;
    padding: 0;
}
.steps > li {
    counter-increment: step;
    position: relative;
    padding: 0 0 24px 48px;
}
.steps > li:before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--surface2);
    border: 1px solid var(--line);
    font-weight: 900;
    color: var(--accent);
}
.section-index {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 22px 0;
}
.section-index a {
    border: 1px solid var(--line);
    background: var(--surface);
    padding: 14px 16px;
    border-radius: 10px;
    color: var(--text);
}
.section-index a:hover {
    text-decoration: none;
    border-color: var(--accent);
}
.nextprev {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--line);
    padding-top: 24px;
    margin-top: 48px;
}
.nextprev a {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--text);
    min-width: 180px;
}
.footer-note {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}
.search-results {
    display: none;
    position: fixed;
    z-index: 100;
    left: 50%;
    top: 90px;
    transform: translateX(-50%);
    width: min(720px, 92vw);
    max-height: 70vh;
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    border-radius: 14px;
    padding: 10px;
}
.search-results.show {
    display: block;
}
.search-item {
    display: block;
    padding: 12px;
    border-radius: 10px;
    color: var(--text);
}
.search-item:hover {
    background: var(--surface2);
    text-decoration: none;
}
.mobile-menu {
    display: none;
}
@media (max-width: 1100px) {
    .shell {
        grid-template-columns: 250px 1fr;
    }
    .toc {
        display: none;
    }
}
@media (max-width: 760px) {
    .topbar {
        padding: 0 12px;
    }
    .mobile-menu {
        display: inline-block;
    }
    .shell {
        display: block;
    }
    .sidebar {
        display: none;
        position: fixed;
        z-index: 60;
        top: 64px;
        left: 0;
        width: min(330px, 90vw);
        height: calc(100vh - 64px);
        box-shadow: var(--shadow);
    }
    .sidebar.open {
        display: block;
    }
    .main {
        padding: 28px 18px 70px;
    }
    .grid,
    .grid-3,
    .section-index {
        grid-template-columns: 1fr;
    }
    .page-title {
        font-size: 34px;
    }
    .hero h1 {
        font-size: 42px;
    }
    .topbar .hide-sm {
        display: none;
    }
    .nextprev {
        flex-direction: column;
    }
}
@media print {
    .topbar,
    .sidebar,
    .toc,
    .copy,
    .nextprev {
        display: none !important;
    }
    .shell {
        display: block;
    }
    .main {
        max-width: none;
        padding: 0;
        color: #111;
    }
    .card,
    .callout,
    pre {
        box-shadow: none;
        break-inside: avoid;
    }
    body {
        background: #fff;
        color: #111;
    }
}

/* Official resources + live homepage preview */
.official-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0 28px;
}
.official-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    padding: 8px 11px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
}
.official-link:hover {
    text-decoration: none;
    border-color: var(--accent);
    background: var(--surface2);
}
.official-link:after {
    content: "↗";
    color: var(--accent);
}
.official-resource {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.official-resource .resource-title {
    font-weight: 850;
    font-size: 17px;
}
.official-resource .resource-url {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    color: var(--muted);
    word-break: break-all;
}
.external-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.external-list .card {
    box-shadow: none;
}
.evergreen-note {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 12px;
    padding: 14px 16px;
    margin: 18px 0 26px;
}
.evergreen-note .mark {
    font-size: 20px;
    line-height: 1;
}
.live-preview {
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow);
    margin: 18px 0;
}
.live-preview-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--surface2);
}
.live-preview-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--muted);
    opacity: 0.6;
}
.live-preview-url {
    margin-left: 6px;
    color: var(--muted);
    font:
        12px ui-monospace,
        SFMono-Regular,
        Menlo,
        Consolas,
        monospace;
}
.live-preview iframe {
    display: block;
    width: 100%;
    height: 600px;
    border: 0;
    background: #fff;
}
.preview-fallback {
    padding: 12px 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}
.visual-caption {
    color: var(--muted);
    font-size: 13px;
    margin-top: 8px;
}
@media (max-width: 760px) {
    .external-list {
        grid-template-columns: 1fr;
    }
    .live-preview iframe {
        height: 460px;
    }
}
