:root {
    --brand: #ef233d;
    --brand-glow: rgba(239, 35, 61, 0.09);
    --bg: #080c18;
    --surface: #0e1224;
    --text: #e6e2d8;
    --text-muted: rgba(230, 226, 216, 0.48);
    --text-dim: rgba(230, 226, 216, 0.22);
    --border: rgba(255, 255, 255, 0.07);
    --border-2: rgba(255, 255, 255, 0.13);
    --nav-h: 56px;
    --sidebar-w: 200px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    font-size: 15.5px;
    line-height: 1.8;
    color: var(--text);
    background: var(--bg);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 600; color: var(--text); }
p { margin: 0 0 14px; color: rgba(230, 226, 216, 0.78); font-family: 'Source Serif 4', Georgia, serif; font-size: 15px; }
ul, ol { padding-left: 0; list-style: none; margin: 0 0 14px; }
li {
    position: relative;
    padding: 4px 0 4px 16px;
    color: rgba(230, 226, 216, 0.75);
    margin-bottom: 2px;
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 15px;
}
li::before {
    content: '–';
    position: absolute;
    left: 0;
    color: var(--text-dim);
    line-height: inherit;
}

/* ── Nav ───────────────────────────────────────────────────────── */
.site-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    padding: 0 28px;
    background: rgba(7, 7, 13, 0.88);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-bottom: 1px solid var(--border);
}

.site-nav-inner {
    width: 100%;
    max-width: 1160px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    line-height: 1;
}
.nav-logo .w { color: var(--text); }
.nav-logo .r { color: var(--brand); }

.nav-cta {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #fff !important;
    background: var(--brand);
    padding: 6px 16px;
    border-radius: 4px;
    text-decoration: none;
    transition: opacity 0.15s;
}
.nav-cta:hover { opacity: 0.82; text-decoration: none; }

.in-app .site-nav { display: none; }
.in-app { --nav-h: 0px; }

/* ── Page header ────────────────────────────────────────────────── */
.page-header {
    padding: calc(var(--nav-h) + 52px) 24px 40px;
    text-align: center;
}

.page-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.63rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 14px;
}

.page-header h1 {
    font-family: 'Big Shoulders Display', sans-serif;
    font-style: normal;
    font-weight: 800;
    font-size: clamp(2.8rem, 7vw, 5rem);
    letter-spacing: 0.01em;
    color: var(--text);
    margin: 0;
    line-height: 0.95;
    animation: hdr-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes hdr-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Layout ─────────────────────────────────────────────────────── */
.doc-layout {
    max-width: 1060px;
    margin: 0 auto;
    padding: 0 28px 80px;
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    gap: 0 56px;
    align-items: start;
}

@media (max-width: 840px) {
    .doc-layout { grid-template-columns: 1fr; }
}

/* ── Sidebar ────────────────────────────────────────────────────── */
.doc-sidebar {
    position: sticky;
    top: calc(var(--nav-h) + 28px);
    max-height: calc(100vh - var(--nav-h) - 56px);
    overflow-y: auto;
    scrollbar-width: none;
}
.doc-sidebar::-webkit-scrollbar { display: none; }

.toc-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.58rem;
    font-weight: 500;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    padding: 0;
    margin: 0;
}
.toc-list li::before { display: none; }

.toc-list a {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 4.5px 0;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
    text-decoration: none;
    border-left: none;
    line-height: 1.4;
    transition: color 0.14s;
    position: relative;
    padding-left: 12px;
}

.toc-list a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 0;
    background: var(--brand);
    transition: height 0.2s;
    border-radius: 1px;
}

.toc-list a:hover { color: var(--text); text-decoration: none; }

.toc-list a.active {
    color: var(--text);
    font-weight: 500;
}

.toc-list a.active::before { height: 14px; }

.toc-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.58rem;
    color: var(--text-dim);
    flex-shrink: 0;
    min-width: 18px;
    transition: color 0.14s;
}

.toc-list a.active .toc-num { color: var(--brand); }

/* Mobile TOC */
.toc-mobile {
    display: none;
    margin-bottom: 28px;
    border: 1px solid var(--border-2);
    border-radius: 4px;
    overflow: hidden;
}

.toc-mobile-toggle {
    width: 100%;
    background: var(--surface);
    border: none;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    padding: 12px 16px;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toc-mobile-toggle svg { transition: transform 0.2s; flex-shrink: 0; }
.toc-mobile-toggle.open svg { transform: rotate(180deg); }

.toc-mobile-body {
    display: none;
    padding: 6px 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
}
.toc-mobile-body.open { display: block; }

.toc-mobile-body a {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 6px 16px;
    font-size: 0.84rem;
    color: var(--text-muted);
    text-decoration: none;
}
.toc-mobile-body a:hover { color: var(--text); }

@media (max-width: 840px) {
    .doc-sidebar { display: none; }
    .toc-mobile { display: block; }
}

/* ── Content ────────────────────────────────────────────────────── */
.doc-content { min-width: 0; }

/* ── Meta bar ───────────────────────────────────────────────────── */
.meta-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
}

.meta-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.63rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.meta-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--brand);
    background: var(--brand-glow);
    border: 1px solid rgba(239, 35, 61, 0.2);
    border-radius: 3px;
    padding: 2px 9px;
}

/* ── TL;DR ──────────────────────────────────────────────────────── */
.tldr-card {
    border: 1px solid var(--border-2);
    border-top: 2px solid var(--brand);
    border-radius: 0 0 4px 4px;
    background: var(--surface);
    margin-bottom: 40px;
    overflow: hidden;
}

.tldr-header {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--brand);
    padding: 9px 20px;
    background: rgba(239, 35, 61, 0.05);
    border-bottom: 1px solid rgba(239, 35, 61, 0.1);
}

.tldr-list {
    list-style: none;
    padding: 12px 20px 16px;
    margin: 0;
    columns: 2;
    column-gap: 28px;
}

@media (max-width: 580px) { .tldr-list { columns: 1; } }

.tldr-list li {
    font-size: 0.85rem;
    line-height: 1.55;
    padding: 7px 0 7px 14px;
    border-bottom: 1px solid var(--border);
    color: rgba(230, 226, 216, 0.68);
    break-inside: avoid;
    margin: 0;
}
.tldr-list li:last-child { border-bottom: none; }

.tldr-list li::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--brand);
    top: 14px;
    left: 0;
    font-size: unset;
}

.tldr-list li strong { color: var(--text); font-weight: 600; }

/* ── Intro ──────────────────────────────────────────────────────── */
.intro {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 0.94rem;
    line-height: 1.82;
    color: rgba(230, 226, 216, 0.58);
    margin-bottom: 40px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border);
}

/* ── Sections ───────────────────────────────────────────────────── */
.doc-section {
    margin-top: 48px;
    padding-top: 48px;
    border-top: 1px solid var(--border);
}

.intro + .doc-section {
    border-top: none;
}

.section-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.58rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 4px;
}

h3.section-title {
    font-family: 'Big Shoulders Display', sans-serif;
    font-style: normal;
    font-weight: 800;
    font-size: 2rem;
    letter-spacing: 0.01em;
    color: var(--text);
    margin: 0 0 16px;
    line-height: 1;
}

h4.subsection-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(230, 226, 216, 0.4);
    margin: 28px 0 10px;
}

/* ── Callouts ───────────────────────────────────────────────────── */
.callout-safe {
    border-left: 2px solid rgba(255, 255, 255, 0.09);
    padding-left: 16px;
    margin-bottom: 12px;
}

.callout-safe li::before {
    content: '✓';
    color: rgba(80, 200, 100, 0.6);
    font-size: 0.7rem;
    top: 6px;
}

.callout-warning {
    border-left: 2px solid rgba(245, 159, 0, 0.3);
    padding: 10px 0 10px 16px;
    margin-bottom: 12px;
    font-size: 0.875rem;
    color: rgba(230, 226, 216, 0.5);
}
.callout-warning strong { color: rgba(245, 159, 0, 0.85); }

.callout-premium {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 12px;
}
.callout-premium strong { color: var(--brand); font-style: normal; }

/* ── Service links ──────────────────────────────────────────────── */
.service-links {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 0;
    margin: 12px 0;
}
.service-links li { padding: 0; margin: 0; }
.service-links li::before { display: none; }

.service-links a {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 5px 11px;
    border: 1px solid var(--border-2);
    border-radius: 3px;
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: border-color 0.15s, color 0.15s;
}
.service-links a:hover { border-color: rgba(239, 35, 61, 0.4); color: var(--text); text-decoration: none; }

/* ── Contact card ───────────────────────────────────────────────── */
.contact-card {
    border: 1px solid var(--border-2);
    border-radius: 4px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background: var(--surface);
}
.contact-card p { margin: 0; font-size: 0.86rem; color: var(--text-muted); }

.email-btn {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.73rem;
    background: var(--brand);
    color: #fff !important;
    padding: 8px 16px;
    border-radius: 3px;
    text-decoration: none !important;
    display: inline-block;
    letter-spacing: 0.02em;
    transition: opacity 0.15s;
}
.email-btn:hover { opacity: 0.82; text-decoration: none; }

/* ── Back to top ────────────────────────────────────────────────── */
.back-to-top {
    margin-top: 52px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: right;
}
.back-to-top a {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-dim);
    text-decoration: none;
    transition: color 0.15s;
}
.back-to-top a:hover { color: var(--brand); text-decoration: none; }

/* ── Footer ─────────────────────────────────────────────────────── */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 24px;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px 22px;
    list-style: none;
    padding: 0;
    margin: 0 0 10px;
}
.footer-links li { padding: 0; }
.footer-links li::before { display: none; }
.footer-links a { font-size: 0.78rem; color: var(--text-dim); text-decoration: none; transition: color 0.15s; }
.footer-links a:hover { color: var(--text); }

.footer-copy {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.63rem;
    color: var(--text-dim);
    margin: 0;
}
.footer-copy a { color: rgba(239, 35, 61, 0.7); }
