:root {
    --bg: #f5efe4;
    --bg-accent: #efe4d2;
    --paper: #fbf8f2;
    --ink: #1f1a16;
    --ink-soft: #4f453d;
    --ink-muted: #75685d;
    --rule: #cfbfab;
    --rule-strong: #b79e84;
    --accent: #bb4332;
    --accent-soft: rgba(187, 67, 50, 0.1);
    --accent-cool: #0d6e88;
    --shadow: 0 16px 32px rgba(74, 56, 35, 0.08);
}

[data-theme="dark"] {
    --bg: #11100e;
    --bg-accent: #171411;
    --paper: #181512;
    --ink: #efe6dc;
    --ink-soft: #d3c3b2;
    --ink-muted: #ab9784;
    --rule: #4a3d33;
    --rule-strong: #6b5848;
    --accent: #e06b57;
    --accent-soft: rgba(224, 107, 87, 0.12);
    --accent-cool: #79bdd0;
    --shadow: 0 20px 36px rgba(0, 0, 0, 0.22);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(187, 67, 50, 0.08), transparent 26%),
        radial-gradient(circle at 85% 12%, rgba(13, 110, 136, 0.08), transparent 24%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 18%),
        var(--bg);
    color: var(--ink);
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 18px;
    line-height: 1.82;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, transparent 0, transparent 7%, rgba(187, 67, 50, 0.04) 7%, rgba(187, 67, 50, 0.04) 7.14%, transparent 7.14%, transparent 100%),
        linear-gradient(rgba(119, 104, 93, 0.045) 1px, transparent 1px);
    background-size: 100% 100%, 100% 38px;
    opacity: 0.5;
}

a {
    color: inherit;
}

img {
    max-width: 100%;
}

p,
li {
    color: var(--ink-soft);
}

strong {
    color: var(--ink);
}

code {
    font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.88em;
    padding: 0.12em 0.38em;
    border-radius: 3px;
    background: var(--accent-soft);
}

.progress-track {
    position: fixed;
    inset: 0 0 auto;
    height: 3px;
    background: rgba(101, 86, 72, 0.12);
    z-index: 1200;
}

.progress-fill {
    height: 100%;
    width: 100%;
    transform: scaleX(0);
    transform-origin: left center;
    background: linear-gradient(90deg, var(--accent), var(--accent-cool));
}

.page-controls {
    position: fixed;
    top: 18px;
    left: 0;
    right: 0;
    z-index: 1100;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    pointer-events: none;
}

.page-controls > * {
    pointer-events: auto;
}

.control-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.control-link,
.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid var(--rule);
    border-radius: 999px;
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--ink);
    font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.theme-toggle {
    cursor: pointer;
}

.control-link i,
.theme-toggle i {
    color: var(--accent);
}

.report-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 104px 18px 64px;
}

.masthead {
    padding-top: 26px;
}

.masthead-top {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--rule);
    font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.masthead-title {
    margin: 22px 0 0;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(3.4rem, 9vw, 5.9rem);
    line-height: 0.92;
    letter-spacing: -0.035em;
    font-weight: 700;
    max-width: 12ch;
}

.standfirst {
    max-width: 60ch;
    margin: 18px 0 0;
    font-size: clamp(1.08rem, 2.4vw, 1.28rem);
    line-height: 1.7;
    color: var(--ink-soft);
}

.fact-strip {
    margin: 28px 0 0;
    padding: 14px 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    border-top: 1px solid var(--rule-strong);
    border-bottom: 1px solid var(--rule-strong);
}

.fact-strip div {
    display: grid;
    gap: 6px;
}

.fact-strip dt {
    font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.fact-strip dd {
    margin: 0;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(1.45rem, 3vw, 2.3rem);
    line-height: 1;
    color: var(--ink);
}

.masthead-figure {
    margin: 24px 0 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    padding: 18px 0 14px;
}

.masthead-image {
    display: block;
    width: 100%;
    border: 1px solid var(--rule);
    background: var(--paper);
}

.figure-caption {
    margin: 10px 0 0;
    font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.jump-nav {
    margin: 24px 0 0;
    padding: 12px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    border-bottom: 1px solid var(--rule);
}

.jump-nav a {
    text-decoration: none;
    font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.jump-nav a:hover {
    color: var(--accent);
}

.intro-note {
    max-width: 780px;
    margin: 34px auto 0;
    padding-left: 20px;
    border-left: 3px solid var(--accent);
}

.intro-note p {
    margin: 0 0 0.9rem;
}

.intro-note p:last-child {
    margin-bottom: 0;
}

.lead-line {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(1.8rem, 3vw, 2.45rem);
    line-height: 1.08;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.essay {
    margin-top: 28px;
}

.essay-section {
    display: grid;
    grid-template-columns: 150px minmax(0, 780px);
    gap: 28px;
    padding: 28px 0 34px;
    border-top: 1px solid var(--rule);
}

.section-rail {
    padding-top: 6px;
}

.section-index {
    margin: 0;
    font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
}

.section-topic {
    margin: 9px 0 0;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.15rem;
    line-height: 1.2;
    color: var(--ink-muted);
}

.section-body h2 {
    margin: 0 0 14px;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(2rem, 4vw, 3.05rem);
    line-height: 0.98;
    letter-spacing: -0.025em;
    color: var(--ink);
}

.section-body p {
    margin: 0 0 1.08rem;
}

.section-body ul {
    margin: 0 0 1.15rem;
    padding-left: 1.15rem;
}

.section-body li {
    margin-bottom: 0.35rem;
}

.pull-quote {
    margin: 1.4rem 0 1.4rem 0;
    padding: 0.3rem 0 0.3rem 1rem;
    border-left: 2px solid var(--accent);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.55rem;
    line-height: 1.2;
    color: var(--ink);
}

.metric-line {
    margin: 1.35rem 0 1.5rem;
    padding: 12px 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}

.metric-line div {
    display: grid;
    gap: 5px;
}

.metric-line strong {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.8rem;
    line-height: 1;
}

.metric-line span {
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--ink-soft);
}

.compare-line {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    margin: 1.35rem 0 1.5rem;
    padding: 14px 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}

.compare-line h3 {
    margin: 0 0 10px;
    font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.compare-line ul {
    margin: 0;
}

.afterword {
    max-width: 780px;
    padding: 28px 0 0;
    border-top: 1px solid var(--rule-strong);
}

.afterword-title {
    margin: 0 0 14px;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 0.98;
    letter-spacing: -0.025em;
    color: var(--ink);
}

.afterword p {
    margin: 0 0 0.9rem;
}

.afterword a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid color-mix(in srgb, var(--accent) 52%, transparent);
}

.afterword a:hover {
    border-bottom-color: var(--accent);
}

.page-footer {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 18px 34px;
}

.page-footer-inner {
    padding-top: 18px;
    border-top: 1px solid var(--rule);
    font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.site-related-links {
    max-width: 780px;
    margin: 22px 0 0;
    padding: 0;
}

.site-related-inner {
    border: 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 18px 0;
}

.site-related-kicker {
    color: var(--ink-muted);
}

.site-related-list {
    gap: 14px;
}

.site-related-list a {
    color: var(--ink);
}

@media (max-width: 940px) {
    .page-controls {
        position: static;
        padding-top: 16px;
        margin-bottom: 8px;
    }

    .report-shell {
        padding-top: 8px;
    }

    .fact-strip,
    .metric-line,
    .compare-line {
        grid-template-columns: 1fr;
    }

    .essay-section {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .section-rail {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 12px;
    }

    .section-topic {
        margin-top: 0;
        text-align: right;
    }
}

@media (max-width: 620px) {
    body {
        font-size: 17px;
    }

    .page-controls {
        align-items: flex-start;
        flex-direction: column;
    }

    .control-links {
        width: 100%;
    }

    .control-link,
    .theme-toggle {
        font-size: 10px;
    }

    .masthead-title {
        max-width: none;
    }

    .jump-nav {
        gap: 8px 12px;
    }

    .lead-line {
        font-size: 1.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}
