/* ============================================================
   Location Impact Explorer — Site Design System
   Implements DESIGN.md. Pages must consume tokens from here;
   no off-system colours, sizes or spacing in page styles.
   ============================================================ */

/* ===== Tokens ===== */
:root {
    --bg: #070B14;
    --surface: #0D1526;
    --surface-raised: #131E33;
    --text: #F2F6FC;
    --text-muted: #9FB0C7;
    --text-faint: #75889E;
    --ember: #FF8A3D;
    --ember-bright: #FFC94D;
    --aurora: #57D7FF;
    --border: rgba(159, 176, 199, 0.16);
    --border-strong: rgba(159, 176, 199, 0.32);
    --success: #3ECF8E;
    --warning: #EAB308;
    --danger: #EF4444;
    --marker-town: #3B82F6;

    /* Light-surface roles (docs pages) */
    --paper: #F7F9FC;
    --ink: #16233A;
    --ink-muted: #51637F;

    /* Type */
    --font-display: 'Sora', 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --fs-xs: 12px;
    --fs-sm: 13px;
    --fs-base: 16px;
    --fs-md: 20px;
    --fs-lg: 25px;
    --fs-xl: 31px;
    --fs-2xl: 39px;
    --fs-hero: clamp(40px, 6vw, 68px);

    /* Space */
    --s-1: 8px;
    --s-2: 16px;
    --s-3: 24px;
    --s-4: 32px;
    --s-5: 48px;
    --s-6: 64px;
    --s-7: 96px;
    --s-8: 128px;

    /* Shape */
    --r-sm: 10px;
    --r-md: 16px;
    --r-lg: 24px;
    --r-pill: 999px;

    /* Elevation */
    --shadow-1: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-2: 0 12px 40px rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 8px 40px rgba(255, 138, 61, 0.25);
    --max-w: 1160px;

    /* Motion */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --t-micro: 160ms;
    --t-panel: 280ms;
}

/* ===== Reset & base ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: var(--fs-base);
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--aurora);
    text-decoration: none;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

:focus-visible {
    outline: 2px solid var(--aurora);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Anchor targets rest clear of the fixed navbar on hash jumps */
[id] {
    scroll-margin-top: 96px;
}

/* ===== Accessibility utilities ===== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    top: -48px;
    left: var(--s-3);
    z-index: 200;
    padding: 10px 20px;
    border-radius: var(--r-sm);
    background: linear-gradient(135deg, var(--ember), var(--ember-bright));
    color: #201005;
    font-weight: 600;
    transition: top var(--t-micro) ease-out;
}

.skip-link:focus {
    top: var(--s-2);
}

/* Links inside prose and table cells are underlined so they never rely
   on colour alone (WCAG 1.4.1); nav/button/footer links keep their own cues. */
p a:not(.btn),
td a:not(.btn),
.footnote a,
.section-intro a {
    text-decoration: underline;
    text-decoration-color: rgba(87, 215, 255, 0.55);
    text-underline-offset: 3px;
}

::selection {
    background: rgba(255, 138, 61, 0.35);
}

/* ===== Layout primitives ===== */
.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--s-4);
}

.section {
    padding: var(--s-8) 0;
    position: relative;
}

.section-tight {
    padding: var(--s-7) 0;
}

.section-alt {
    background: linear-gradient(180deg, transparent 0%, rgba(13, 21, 38, 0.9) 18%, rgba(13, 21, 38, 0.9) 82%, transparent 100%);
}

/* ===== Eyebrow / section headers ===== */
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--s-1);
    font-size: var(--fs-xs);
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ember);
    margin-bottom: var(--s-2);
}

.eyebrow::before {
    content: "";
    width: 24px;
    height: 1px;
    background: var(--ember);
    opacity: 0.7;
}

.section-head {
    max-width: 720px;
    margin-bottom: var(--s-6);
}

.section-head.center {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.section-head h2 {
    font-size: var(--fs-2xl);
    margin-bottom: var(--s-2);
}

.section-head p {
    color: var(--text-muted);
    font-size: var(--fs-md);
    line-height: 1.55;
}

.grad-text {
    background: linear-gradient(135deg, var(--ember) 20%, var(--ember-bright) 90%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 30px;
    border-radius: var(--r-pill);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 15px;
    line-height: 1.2;
    cursor: pointer;
    border: none;
    transition: transform var(--t-micro) ease-out, box-shadow var(--t-micro) ease-out,
        background-color var(--t-micro) ease-out, border-color var(--t-micro) ease-out;
}

.btn-primary {
    background: linear-gradient(135deg, var(--ember), var(--ember-bright));
    color: #201005;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border-strong);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--text-muted);
}

.btn-sm {
    padding: 9px 20px;
    font-size: var(--fs-sm);
    min-height: 44px;
}

.btn[disabled] {
    opacity: 0.5;
    pointer-events: none;
}

/* ===== Navbar ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    transition: background-color var(--t-panel) var(--ease-out),
        border-color var(--t-panel) var(--ease-out),
        padding var(--t-panel) var(--ease-out);
    border-bottom: 1px solid transparent;
    padding: var(--s-3) env(safe-area-inset-right, 0px) var(--s-3) env(safe-area-inset-left, 0px);
}

.navbar.scrolled {
    background: rgba(7, 11, 20, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom-color: var(--border);
    padding: var(--s-2) env(safe-area-inset-right, 0px) var(--s-2) env(safe-area-inset-left, 0px);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-4);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 17px;
    color: var(--text);
}

.nav-logo .flame {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: var(--r-sm);
    background: linear-gradient(135deg, var(--ember), var(--ember-bright));
    color: #201005;
    font-size: 15px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    list-style: none;
}

.nav-links a:not(.btn) {
    color: var(--text-muted);
    font-size: 14.5px;
    font-weight: 500;
    transition: color var(--t-micro) ease-out;
}

.nav-links a:not(.btn):hover {
    color: var(--text);
}

.nav-toggle {
    display: none;
    flex-shrink: 0;
    background: none;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    color: var(--text);
    width: 44px;
    height: 44px;
    font-size: 18px;
    cursor: pointer;
}

@media (max-width: 800px) {
    .nav-toggle {
        display: grid;
        place-items: center;
    }
}

/* Very narrow phones: keep brand + toggle on one line */
@media (max-width: 400px) {
    .nav-inner {
        gap: var(--s-2);
    }

    .nav-logo {
        font-size: 15px;
    }
}

@media (max-width: 800px) {
    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: rgba(7, 11, 20, 0.97);
        backdrop-filter: blur(14px);
        border-bottom: 1px solid var(--border);
        padding: var(--s-2) var(--s-4) var(--s-3);
        display: none;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a:not(.btn) {
        display: block;
        padding: 12px 4px;
        border-bottom: 1px solid var(--border);
    }

    .nav-links .btn {
        margin-top: var(--s-2);
        justify-content: center;
    }
}

/* ===== Sweeping graphics layers ===== */
.gfx {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.gfx-aurora {
    position: absolute;
    inset: -20%;
    background:
        radial-gradient(42% 38% at 18% 22%, rgba(255, 138, 61, 0.14) 0%, transparent 68%),
        radial-gradient(46% 42% at 84% 16%, rgba(87, 215, 255, 0.10) 0%, transparent 70%),
        radial-gradient(50% 48% at 55% 95%, rgba(255, 201, 77, 0.07) 0%, transparent 72%);
    animation: aurora-drift 36s linear infinite alternate;
}

@keyframes aurora-drift {
    from {
        transform: translate3d(-2%, -1%, 0) scale(1);
    }

    to {
        transform: translate3d(2%, 2%, 0) scale(1.06);
    }
}

.gfx-graticule {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(159, 176, 199, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(159, 176, 199, 0.05) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(75% 65% at 50% 40%, black 30%, transparent 100%);
    -webkit-mask-image: radial-gradient(75% 65% at 50% 40%, black 30%, transparent 100%);
}

.gfx-contours {
    position: absolute;
    inset: 0;
    opacity: 0.55;
}

.gfx-contours svg {
    width: 200%;
    height: 100%;
    animation: contour-drift 60s linear infinite alternate;
}

@keyframes contour-drift {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-12%);
    }
}

.gfx-vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(90% 80% at 50% 35%, transparent 40%, rgba(7, 11, 20, 0.72) 100%);
}

#emberCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* ===== Hero ===== */
.hero {
    min-height: 100svh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding: 140px 0 var(--s-7);
}

.hero-content {
    position: relative;
    z-index: 3;
    max-width: 820px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    border-radius: var(--r-pill);
    border: 1px solid var(--border-strong);
    background: rgba(13, 21, 38, 0.55);
    backdrop-filter: blur(8px);
    color: var(--text-muted);
    font-size: var(--fs-xs);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 500;
    margin-bottom: var(--s-3);
}

.hero-badge .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 12px var(--success);
}

.hero h1 {
    font-size: var(--fs-hero);
    font-weight: 700;
    line-height: 1.06;
    letter-spacing: -0.02em;
    margin-bottom: var(--s-3);
}

.hero-sub {
    font-size: var(--fs-md);
    color: var(--text-muted);
    max-width: 620px;
    margin-bottom: var(--s-5);
}

.hero-ctas {
    display: flex;
    gap: var(--s-2);
    flex-wrap: wrap;
    margin-bottom: var(--s-6);
}

/* Hero stat strip */
.hero-stats {
    display: flex;
    gap: var(--s-5);
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
    padding-top: var(--s-3);
}

.hero-stat .num {
    font-family: var(--font-display);
    font-size: var(--fs-lg);
    font-weight: 700;
}

.hero-stat .lbl {
    font-size: var(--fs-xs);
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 2px;
}

/* ===== Cards ===== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--s-3);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--s-4);
    transition: transform var(--t-panel) var(--ease-out), border-color var(--t-panel) var(--ease-out),
        box-shadow var(--t-panel) var(--ease-out);
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-2);
}

.card .icon-chip {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: var(--r-sm);
    background: rgba(255, 138, 61, 0.12);
    border: 1px solid rgba(255, 138, 61, 0.25);
    color: var(--ember);
    font-size: 19px;
    margin-bottom: var(--s-2);
}

.card h3 {
    font-size: var(--fs-md);
    margin-bottom: 10px;
}

.card p {
    color: var(--text-muted);
    font-size: 15px;
}

/* ===== Stats ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--s-4);
    text-align: center;
}

.stat .figure {
    font-family: var(--font-display);
    font-size: var(--fs-2xl);
    font-weight: 700;
}

.stat .label {
    color: var(--text-muted);
    font-size: 14.5px;
    margin-top: var(--s-1);
}

/* ===== Country tabs & live map ===== */
.map-shell {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: var(--shadow-2);
}

.map-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-2);
    flex-wrap: wrap;
    padding: var(--s-2) var(--s-3);
    border-bottom: 1px solid var(--border);
}

.country-tabs {
    display: flex;
    gap: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    padding: 5px;
}

.country-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 18px;
    border-radius: var(--r-pill);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--t-micro) ease-out, color var(--t-micro) ease-out;
}

.country-tab:hover {
    color: var(--text);
}

.country-tab.active {
    background: linear-gradient(135deg, var(--ember), var(--ember-bright));
    color: #201005;
}

.map-meta {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    font-size: var(--fs-sm);
    color: var(--text-muted);
    font-family: var(--font-mono);
}

#landingMap {
    height: 520px;
    width: 100%;
    background: #0B1220;
}

.map-legend {
    position: absolute;
    z-index: 500;
    bottom: 18px;
    left: 18px;
    display: flex;
    gap: var(--s-2);
    padding: 10px 16px;
    border-radius: var(--r-pill);
    background: rgba(7, 11, 20, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

.map-legend .key {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.map-legend .swatch {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 1.5px solid #fff;
}

/* Leaflet dark-theme touch-ups */
.leaflet-container {
    font-family: var(--font-body);
    background: #0B1220;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: var(--surface-raised);
    color: var(--text);
    box-shadow: var(--shadow-2);
}

.leaflet-popup-content b {
    font-family: var(--font-display);
}

.leaflet-control-zoom a {
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    background: var(--surface-raised) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

.leaflet-control-attribution {
    background: rgba(7, 11, 20, 0.7) !important;
    color: var(--text-faint) !important;
}

.leaflet-control-attribution a {
    color: var(--text-muted) !important;
}

/* ===== CTA band ===== */
.cta-band {
    position: relative;
    overflow: hidden;
    text-align: center;
    padding: var(--s-7) 0;
    background:
        radial-gradient(60% 120% at 50% 120%, rgba(255, 138, 61, 0.16) 0%, transparent 70%),
        var(--surface);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.cta-band h2 {
    font-size: var(--fs-xl);
    margin-bottom: var(--s-2);
}

.cta-band p {
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto var(--s-4);
}

.cta-actions {
    display: flex;
    gap: var(--s-2);
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== Footer ===== */
.site-footer {
    background: #05080F;
    border-top: 1px solid var(--border);
    padding: var(--s-6) 0 var(--s-4);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--s-4);
    margin-bottom: var(--s-5);
}

.footer-brand p {
    color: var(--text-muted);
    font-size: 14.5px;
    max-width: 300px;
    margin-top: var(--s-2);
}

.footer-col h4 {
    font-size: var(--fs-sm);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-faint);
    margin-bottom: var(--s-2);
    font-family: var(--font-body);
    font-weight: 600;
}

.footer-col ul {
    list-style: none;
}

.footer-col li {
    margin-bottom: 10px;
}

.footer-col a {
    color: var(--text-muted);
    font-size: 14.5px;
    transition: color var(--t-micro) ease-out;
}

.footer-col a:hover {
    color: var(--aurora);
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: var(--s-3);
    display: flex;
    justify-content: space-between;
    gap: var(--s-2);
    flex-wrap: wrap;
    color: var(--text-faint);
    font-size: var(--fs-sm);
}

@media (max-width: 800px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ===== Responsive tables ===== */
/* Tables keep their natural width and scroll inside their own box instead of
   widening the page on small screens. */
@media (max-width: 800px) {

    .doc-table,
    table.mini,
    .ba-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 520px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Scroll reveal ===== */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Docs components (shared by showcase / docs / data-sources) ===== */

/* Wide tables scroll inside their own box instead of breaking narrow viewports */
.doc-table,
table.mini,
.ba-table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.doc-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--s-4) 0;
    font-size: 14.5px;
}

.doc-table th {
    text-align: left;
    font-family: var(--font-body);
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-faint);
    padding: 12px var(--s-2);
    border-bottom: 1px solid var(--border-strong);
}

.doc-table td {
    padding: 14px var(--s-2);
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    color: var(--text-muted);
}

.doc-table td strong {
    color: var(--text);
    font-weight: 600;
}

.doc-table tr:hover td {
    background: rgba(159, 176, 199, 0.05);
}

.pill {
    display: inline-block;
    padding: 3px 12px;
    border-radius: var(--r-pill);
    font-size: var(--fs-xs);
    font-weight: 600;
    white-space: nowrap;
}

.pill-red {
    background: rgba(239, 68, 68, 0.15);
    color: #F87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.pill-yellow {
    background: rgba(234, 179, 8, 0.13);
    color: #FACC15;
    border: 1px solid rgba(234, 179, 8, 0.35);
}

.pill-blue {
    background: rgba(59, 130, 246, 0.15);
    color: #7EB3FF;
    border: 1px solid rgba(59, 130, 246, 0.35);
}

.pill-green {
    background: rgba(62, 207, 142, 0.13);
    color: var(--success);
    border: 1px solid rgba(62, 207, 142, 0.35);
}

.page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: var(--s-3);
}

a.page-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    color: inherit;
    transition: transform var(--t-panel) var(--ease-out), border-color var(--t-panel) var(--ease-out),
        box-shadow var(--t-panel) var(--ease-out);
}

a.page-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 138, 61, 0.45);
    box-shadow: var(--shadow-2);
}

.page-thumb {
    height: 110px;
    display: grid;
    place-items: center;
    font-size: 40px;
    background: linear-gradient(135deg, var(--surface-raised), var(--surface));
    border-bottom: 1px solid var(--border);
}

.page-body {
    padding: var(--s-2) var(--s-3) var(--s-3);
}

.page-body h3 {
    font-size: 17px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.page-body p {
    color: var(--text-muted);
    font-size: 14px;
}

.tech-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tech-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--r-pill);
    border: 1px solid var(--border-strong);
    background: rgba(13, 21, 38, 0.6);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
}

/* ===== Docs page chrome (pagehead + legacy class bridge) ===== */
.pagehead {
    padding: 170px 0 var(--s-6);
    text-align: center;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    background:
        radial-gradient(55% 90% at 50% -10%, rgba(255, 138, 61, 0.12) 0%, transparent 70%),
        radial-gradient(40% 70% at 80% 0%, rgba(87, 215, 255, 0.07) 0%, transparent 70%);
}

.pagehead h1 {
    font-size: var(--fs-2xl);
    margin-bottom: var(--s-2);
}

.pagehead p {
    color: var(--text-muted);
    font-size: var(--fs-md);
    max-width: 640px;
    margin: 0 auto;
}

.kicker {
    font-size: var(--fs-xs);
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ember);
    margin-bottom: var(--s-2);
}

.stitle {
    font-size: var(--fs-xl);
    margin-bottom: var(--s-2);
}

.section-intro {
    color: var(--text-muted);
    max-width: 680px;
    margin-bottom: var(--s-4);
}

table.mini,
.ba-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--s-3) 0;
    font-size: 14.5px;
}

table.mini th,
.ba-table th {
    text-align: left;
    font-family: var(--font-body);
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-faint);
    padding: 12px var(--s-2);
    border-bottom: 1px solid var(--border-strong);
}

table.mini td,
.ba-table td {
    padding: 14px var(--s-2);
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    color: var(--text-muted);
}

table.mini td strong,
.ba-table td strong {
    color: var(--text);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--s-3);
}

.grid-2 .card {
    text-align: left;
}

.grid-2 .card .icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: var(--r-sm);
    background: rgba(255, 138, 61, 0.12);
    border: 1px solid rgba(255, 138, 61, 0.25);
    margin-bottom: var(--s-2);
    font-size: 19px;
}

.dark-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--s-4);
    transition: transform var(--t-panel) var(--ease-out), border-color var(--t-panel) var(--ease-out);
}

.dark-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
}

.dark-card h3 {
    font-size: var(--fs-md);
    margin-bottom: 10px;
}

.dark-card p {
    color: var(--text-muted);
    font-size: 15px;
}

.tree {
    background: #05080F;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--s-3);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    line-height: 1.8;
    color: var(--text-muted);
}

.tree .hl {
    color: var(--ember-bright);
}

.tree .dim {
    color: var(--text-faint);
}

.steps {
    list-style: none;
    counter-reset: step;
    max-width: 720px;
    margin: var(--s-4) auto 0;
}

.steps li {
    counter-increment: step;
    position: relative;
    padding: 0 0 var(--s-4) 64px;
}

.steps li::before {
    content: counter(step, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: 0;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: var(--r-sm);
    background: rgba(255, 138, 61, 0.12);
    border: 1px solid rgba(255, 138, 61, 0.25);
    color: var(--ember);
    font-family: var(--font-display);
    font-weight: 700;
}

.steps h3 {
    font-size: var(--fs-md);
    margin-bottom: 6px;
}

.steps p {
    color: var(--text-muted);
    font-size: 15px;
}

.next-steps {
    display: flex;
    gap: var(--s-2);
    justify-content: center;
    flex-wrap: wrap;
    margin-top: var(--s-5);
}

.ba-table .ba-before {
    width: 42%;
    color: var(--text-muted);
}

.ba-table .ba-arrow {
    width: 6%;
    text-align: center;
    color: var(--ember);
    font-weight: 600;
}

.ba-table .ba-after strong {
    color: var(--text);
}

.problem-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--s-3);
}

.pcard {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--s-4);
}

.pcard .icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: var(--r-sm);
    background: rgba(87, 215, 255, 0.1);
    border: 1px solid rgba(87, 215, 255, 0.25);
    margin-bottom: var(--s-2);
    font-size: 19px;
}

.pcard h3 {
    font-size: var(--fs-md);
    margin-bottom: 10px;
}

.pcard p {
    color: var(--text-muted);
    font-size: 15px;
}

.audience-band {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: var(--s-3);
}

.acard {
    background: rgba(13, 21, 38, 0.7);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--s-3);
}

.acard h3 {
    font-size: 17px;
    margin-bottom: 8px;
}

.acard p {
    color: var(--text-muted);
    font-size: 14.5px;
}

blockquote.big {
    max-width: 760px;
    margin: 0 auto;
    text-align: center;
    font-family: var(--font-display);
    font-size: var(--fs-lg);
    line-height: 1.45;
    color: var(--text);
    padding: 0 var(--s-4);
}

blockquote.big span {
    background: linear-gradient(135deg, var(--ember), var(--ember-bright));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ===== Docs page aliases & misc ===== */
.section-light,
.section-dark {
    background: transparent;
    color: inherit;
}

code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: rgba(159, 176, 199, 0.12);
    padding: 2px 7px;
    border-radius: 6px;
}

.footnote {
    text-align: center;
    color: var(--text-muted);
    font-size: 14.5px;
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {

    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}

/* ===== Globe fly-in intro (index hero) ===== */
/* Hero copy dims while the fly-in plays (globe-intro.js toggles the class) */
.hero-content {
    transition: opacity 0.6s ease;
}

.hero.intro-playing .hero-content {
    opacity: 0.08;
    pointer-events: none;
}

/* OSM raster tiles, filtered to match the dark theme */
#landingMap .leaflet-tile {
    filter: invert(1) hue-rotate(185deg) brightness(0.82) contrast(0.92) saturate(0.65);
}

.globe-intro {
    position: absolute;
    inset: 0;
    z-index: 6;
    opacity: 1;
    transition: opacity 0.7s ease;
}

.globe-intro.globe-intro-out {
    opacity: 0;
    pointer-events: none;
}

/* Handoff: pin the overlay to the viewport with a solid backing so the page
   can swap to the live map underneath, then dissolve straight onto the map */
.globe-intro.globe-intro-handoff {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: var(--bg);
}

.globe-host {
    position: absolute;
    inset: 0;
    cursor: grab;
}

.globe-host:active {
    cursor: grabbing;
}

.globe-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 16%;
    z-index: 2;
    text-align: center;
    padding: 0 24px;
    pointer-events: none;
}

.globe-caption-line {
    display: inline-block;
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    font-size: clamp(1.15rem, 2.6vw, 1.9rem);
    color: var(--text);
    text-shadow: 0 2px 24px rgba(7, 11, 20, 0.9);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.globe-caption-line.show {
    opacity: 1;
    transform: none;
}

.globe-skip {
    position: absolute;
    top: 104px;
    right: 24px;
    z-index: 3;
}

html.intro-lock {
    overflow: hidden;
}

/* ===== Map instructions card ===== */
.map-intro {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 600;
    max-width: 300px;
    padding: 18px 20px;
    border-radius: 16px;
    border: 1px solid var(--border-strong);
    background: rgba(13, 21, 38, 0.92);
    backdrop-filter: blur(10px);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.map-intro h3 {
    margin: 0 0 10px;
    font-size: 1rem;
    color: var(--text);
}

.map-intro ol {
    margin: 0;
    padding-left: 20px;
    display: grid;
    gap: 8px;
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.5;
}

.map-intro strong {
    color: var(--text);
}

.map-intro-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    background: none;
    border: 0;
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
}

.map-intro-close:hover {
    color: var(--text);
    background: rgba(159, 176, 199, 0.12);
}

@media (max-width: 800px) {
    .globe-skip {
        top: 84px;
        right: 16px;
    }

    .map-intro {
        top: 8px;
        right: 8px;
        left: 8px;
        max-width: none;
        padding: 14px 16px;
    }
}
