/* ---------- Fonts (self-hosted, latin subset) ---------- */
@font-face {
    font-family: "Inter";
    src: url("../fonts/inter-var.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Newsreader";
    src: url("../fonts/newsreader-500.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Newsreader";
    src: url("../fonts/newsreader-400-italic.woff2") format("woff2");
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
    --bg: #fbfaf7;
    --surface: #ffffff;
    --surface-2: #f3f1ec;
    --text: #1c1b19;
    --muted: #5f5b55;
    --border: #e6e2db;
    --border-strong: #cfc9bf;
    --accent: #c2410c;
    --accent-hover: #9a3412;
    --accent-soft: rgba(194, 65, 12, 0.08);
    --ok: #15803d;
    --error: #b91c1c;

    --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
    --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

    --step--1: clamp(0.83rem, 0.81rem + 0.1vw, 0.88rem);
    --step-0: clamp(1rem, 0.97rem + 0.15vw, 1.08rem);
    --step-1: clamp(1.2rem, 1.14rem + 0.3vw, 1.35rem);
    --step-2: clamp(1.5rem, 1.38rem + 0.6vw, 1.85rem);
    --step-3: clamp(1.9rem, 1.7rem + 1vw, 2.5rem);
    --step-4: clamp(2.3rem, 2rem + 1.6vw, 3.2rem);

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --space-8: 4.5rem;
    --space-9: 6rem;

    --measure: 42rem;
    --radius: 10px;
    --nav-height: 3.75rem;

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #141311;
        --surface: #1c1a17;
        --surface-2: #23211d;
        --text: #ece8e1;
        --muted: #a39e95;
        --border: #2e2b27;
        --border-strong: #45413b;
        --accent: #f08a4b;
        --accent-hover: #f6a873;
        --accent-soft: rgba(240, 138, 75, 0.1);
        --ok: #4ade80;
        --error: #f87171;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #141311;
    --surface: #1c1a17;
    --surface-2: #23211d;
    --text: #ece8e1;
    --muted: #a39e95;
    --border: #2e2b27;
    --border-strong: #45413b;
    --accent: #f08a4b;
    --accent-hover: #f6a873;
    --accent-soft: rgba(240, 138, 75, 0.1);
    --ok: #4ade80;
    --error: #f87171;
    color-scheme: dark;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-height) + var(--space-4));
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: var(--step-0);
    line-height: 1.65;
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

h1,
h2,
h3 {
    font-family: var(--font-serif);
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0;
}

p {
    margin: 0 0 var(--space-4);
}

ul {
    margin: 0 0 var(--space-4);
    padding-left: 1.2rem;
}

li {
    margin-bottom: var(--space-2);
}

li::marker {
    color: var(--muted);
}

strong {
    font-weight: 600;
}

a {
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--border-strong);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    transition: color 0.15s, text-decoration-color 0.15s;
}

a:hover {
    color: var(--accent);
    text-decoration-color: currentColor;
}

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

::selection {
    background: var(--accent);
    color: var(--bg);
}

.skip-link {
    position: absolute;
    left: var(--space-4);
    top: -100px;
    z-index: 100;
    background: var(--text);
    color: var(--bg);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius);
}

.skip-link:focus {
    top: var(--space-3);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- Layout ---------- */
.container {
    width: 100%;
    max-width: calc(var(--measure) + 2 * var(--space-4));
    margin: 0 auto;
    padding: 0 var(--space-4);
}

.section {
    padding: var(--space-8) 0 0;
}

.section-title {
    font-size: var(--step-3);
    margin-bottom: var(--space-5);
}

.section-intro {
    color: var(--muted);
    margin-bottom: var(--space-6);
}

.mono {
    font-family: var(--font-mono);
    font-size: 0.85em;
    letter-spacing: -0.01em;
}

.muted {
    color: var(--muted);
}

/* ---------- Top nav ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.site-header.is-scrolled {
    border-bottom-color: var(--border);
}

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

.nav-name {
    font-family: var(--font-serif);
    font-size: var(--step-1);
    font-weight: 500;
    text-decoration: none;
    color: var(--text);
    white-space: nowrap;
}

.nav-name .dud {
    color: var(--accent);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links li {
    margin: 0;
}

.nav-links a {
    font-size: var(--step--1);
    color: var(--muted);
    text-decoration: none;
}

.nav-links a:hover,
.nav-links a[aria-current="true"] {
    color: var(--text);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.icon-btn:hover {
    border-color: var(--border-strong);
    background: var(--surface-2);
}

.icon-btn svg {
    width: 1.05rem;
    height: 1.05rem;
}

.theme-toggle .icon-sun {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun {
        display: block;
    }

    :root:not([data-theme="light"]) .theme-toggle .icon-moon {
        display: none;
    }
}

.menu-toggle {
    display: none;
}

@media (max-width: 640px) {
    .menu-toggle {
        display: inline-grid;
    }

    .nav-links {
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: var(--space-2) var(--space-4) var(--space-4);
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        display: none;
    }

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

    .nav-links a {
        display: block;
        padding: var(--space-3) 0;
        font-size: var(--step-0);
        border-bottom: 1px solid var(--border);
    }

    .nav-links li:last-child a {
        border-bottom: 0;
    }
}

/* ---------- Intro ---------- */
.intro {
    padding-top: var(--space-8);
}

.intro-photo {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: var(--space-5);
    background: var(--surface-2);
}

.intro h1 {
    font-size: var(--step-4);
    margin-bottom: var(--space-2);
}

.intro-role {
    color: var(--muted);
    margin-bottom: var(--space-5);
}

.intro-text {
    font-size: var(--step-1);
    line-height: 1.6;
}

.link-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-5);
    padding: 0;
    list-style: none;
}

.link-row li {
    margin: 0;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0.55rem 1rem;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: var(--step--1);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn:hover {
    border-color: var(--text);
    color: var(--text);
}

.btn-primary {
    background: var(--text);
    border-color: var(--text);
    color: var(--bg);
}

.btn-primary:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

.btn[disabled] {
    opacity: 0.6;
    cursor: progress;
}

/* ---------- What I work on ---------- */
.areas {
    display: grid;
    gap: var(--space-5);
}

@media (min-width: 640px) {
    .areas {
        grid-template-columns: 1fr 1fr;
    }
}

.area {
    padding: var(--space-5);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.area h3 {
    font-size: var(--step-1);
    margin-bottom: var(--space-3);
}

.area p {
    color: var(--muted);
    margin: 0;
}

/* ---------- Case studies ---------- */
.work {
    padding: var(--space-6) 0;
    border-top: 1px solid var(--border);
}

.work:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.work h3 {
    font-size: var(--step-2);
    margin-bottom: var(--space-1);
}

.work-meta {
    display: block;
    color: var(--muted);
    margin-bottom: var(--space-4);
}

.work-lede {
    font-size: var(--step-1);
    line-height: 1.55;
}

.work ul {
    padding-left: 1.1rem;
}

.work .tags {
    padding-left: 0;
}

.work li strong {
    color: var(--text);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    list-style: none;
    padding: 0;
    margin: var(--space-4) 0 0;
}

.tags li {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--muted);
    padding: 0.15rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
}

.metric {
    color: var(--accent);
    font-weight: 600;
}

.work-head {
    margin-bottom: var(--space-1);
}

.work-list {
    padding-left: 1.1rem;
}

/* ---------- Headline numbers (used by some layouts) ---------- */
.metrics {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4) var(--space-6);
    margin: 0;
}

.metric-item dt {
    font-family: var(--font-serif);
    font-size: var(--step-3);
    line-height: 1;
    color: var(--accent);
}

.metric-item dd {
    margin: var(--space-1) 0 0;
    font-size: var(--step--1);
    color: var(--muted);
}

.work-metrics {
    margin: var(--space-2) 0 var(--space-5);
}

/* ---------- Cards (smaller builds) ---------- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
    gap: var(--space-4);
    list-style: none;
    padding: 0;
    margin: 0;
}

.card {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin: 0;
    padding: var(--space-5);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.card-title {
    font-family: var(--font-sans);
    font-size: var(--step-0);
    font-weight: 600;
    letter-spacing: 0;
}

.card p {
    margin: 0;
    color: var(--muted);
    font-size: var(--step--1);
    line-height: 1.6;
}

.card-where {
    margin-top: auto;
    padding-top: var(--space-2);
    color: var(--muted);
    font-size: 0.78rem;
}

/* ---------- Uploaded images (projects, smaller builds) ---------- */
.work-figure {
    margin: var(--space-2) 0 var(--space-5);
}

.work-figure img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
}

/* Image flush with the card's top edge; the card's own padding stays for the text */
.card-media {
    margin: calc(-1 * var(--space-5)) calc(-1 * var(--space-5)) var(--space-2);
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.card-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-title a {
    color: inherit;
    text-decoration: none;
}

.card-title a:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* ---------- Diagrams (projects; switched on per project in the admin) ---------- */
.diagram {
    margin: var(--space-5) 0;
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.diagram-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.diagram svg {
    width: 100%;
    min-width: 560px;
    height: auto;
    font-family: var(--font-sans);
}

.diagram figcaption {
    margin-top: var(--space-3);
    font-size: var(--step--1);
    color: var(--muted);
}

.diagram-hint {
    display: none;
}

@media (max-width: 600px) {
    .diagram-hint {
        display: inline;
    }
}

.d-box {
    fill: var(--surface-2);
    stroke: var(--border-strong);
    stroke-width: 1;
}

.d-box-mine {
    fill: var(--accent-soft);
    stroke: var(--accent);
    stroke-width: 1.25;
}

.d-box-dashed {
    fill: none;
    stroke: var(--border-strong);
    stroke-dasharray: 4 4;
}

.d-title {
    fill: var(--text);
    font-size: 13px;
    font-weight: 600;
}

.d-sub {
    fill: var(--muted);
    font-size: 11.5px;
}

.d-note {
    fill: var(--muted);
    font-size: 12px;
}

.d-arrow {
    fill: none;
    stroke: var(--muted);
    stroke-width: 1.25;
}

.d-arrowhead {
    fill: var(--muted);
}

.d-accent-fill {
    fill: var(--accent);
}

/* ---------- Hover glow on boxes (.glow) ----------
   A soft light follows the pointer, the border lights up near it, and the box lifts.
   Uses `translate` (not `transform`) so it stacks with the scroll animation. site.js sets --mx/--my. */
.glow {
    position: relative;
    isolation: isolate;
    transition: border-color 0.25s, box-shadow 0.3s, translate 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.glow::before,
.glow::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.glow::before {
    z-index: -1;
    background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--accent) 13%, transparent), transparent 65%);
}

.glow::after {
    inset: -1px;
    padding: 1px;
    background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 0%), var(--accent), transparent 70%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}

.glow h3 {
    transition: color 0.25s;
}

@media (hover: hover) {
    .glow:hover {
        translate: 0 -4px;
        box-shadow: 0 22px 44px -28px rgba(0, 0, 0, 0.35);
    }

    .glow:hover::before,
    .glow:hover::after {
        opacity: 1;
    }

    .glow:hover h3 {
        color: var(--accent);
    }
}

.glow:focus-within::after {
    opacity: 1;
}

:root[data-theme="dark"] .glow:hover {
    box-shadow: 0 22px 44px -24px rgba(0, 0, 0, 0.8);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .glow:hover {
        box-shadow: 0 22px 44px -24px rgba(0, 0, 0, 0.8);
    }
}

@media (prefers-reduced-motion: reduce) {
    .glow:hover {
        translate: none;
    }
}

/* ---------- Tools ---------- */
.tool-groups {
    display: grid;
    gap: var(--space-5);
}

.tool-group-title {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--muted);
    margin-bottom: var(--space-3);
}

.tool-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    list-style: none;
    padding: 0;
    margin: 0;
}

.tool {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    padding: 0.35rem 0.75rem 0.35rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: var(--step--1);
    transition: border-color 0.2s, transform 0.2s;
}

.tool:hover {
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.tool-icon {
    width: 1rem;
    height: 1rem;
    flex: none;
    fill: currentColor;
    color: var(--brand, var(--text));
}

:root[data-theme="dark"] .tool-icon {
    color: var(--brand-dark, var(--text));
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .tool-icon {
        color: var(--brand-dark, var(--text));
    }
}

.tool-dot {
    width: 0.45rem;
    height: 0.45rem;
    margin: 0 0.28rem;
    border-radius: 50%;
    background: var(--accent);
    flex: none;
}

/* ---------- Thumbnails (earlier projects) ---------- */
.thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.5rem), 1fr));
    gap: var(--space-5) var(--space-4);
    list-style: none;
    padding: 0;
    margin: var(--space-4) 0 var(--space-5);
}

.thumb {
    margin: 0;
}

.thumb-link {
    display: block;
    text-decoration: none;
}

.thumb-link img {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    filter: saturate(0.55);
    transition: filter 0.3s, transform 0.3s;
}

.thumb-link:hover img {
    filter: none;
    transform: translateY(-2px);
}

.thumb-title {
    display: block;
    margin-top: var(--space-3);
    font-weight: 600;
    font-size: var(--step--1);
}

.thumb p {
    margin: var(--space-1) 0 0;
    color: var(--muted);
    font-size: var(--step--1);
    line-height: 1.55;
}

/* ---------- Compact lists (smaller things, research, earlier) ---------- */
.compact {
    list-style: none;
    padding: 0;
    margin: 0;
}

.compact > li {
    padding: var(--space-4) 0;
    border-top: 1px solid var(--border);
    margin: 0;
}

.compact > li:first-child {
    border-top: 0;
    padding-top: 0;
}

.compact h3,
.compact .item-title {
    font-family: var(--font-sans);
    font-size: var(--step-0);
    font-weight: 600;
    letter-spacing: 0;
    margin-bottom: var(--space-1);
}

.compact p {
    margin: 0;
    color: var(--muted);
}

.subsection-title {
    font-size: var(--step-2);
    margin: var(--space-7) 0 var(--space-4);
}

/* ---------- Experience ---------- */
.jobs {
    list-style: none;
    padding: 0;
    margin: 0;
}

.job {
    display: grid;
    gap: var(--space-1) var(--space-5);
    padding: var(--space-5) 0;
    border-top: 1px solid var(--border);
    margin: 0;
}

.job:first-child {
    border-top: 0;
    padding-top: 0;
}

@media (min-width: 640px) {
    .job {
        grid-template-columns: 11rem 1fr;
    }
}

.job-dates {
    color: var(--muted);
    white-space: nowrap;
    padding-top: 0.2rem;
}

.job h3 {
    font-family: var(--font-sans);
    font-size: var(--step-0);
    font-weight: 600;
    letter-spacing: 0;
}

.job-role {
    color: var(--muted);
    margin-bottom: var(--space-2);
}

.job p:last-child {
    margin: 0;
}

/* ---------- Certification ---------- */
.cert {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.cert img {
    width: 56px;
    height: 56px;
    flex: none;
}

.cert p {
    margin: 0;
}

/* ---------- Two-up small facts ---------- */
.facts {
    display: grid;
    gap: var(--space-5);
}

@media (min-width: 640px) {
    .facts {
        grid-template-columns: 1fr 1fr;
    }
}

.facts h3 {
    font-size: var(--step-1);
    margin-bottom: var(--space-2);
}

.facts p {
    margin: 0;
}

.book-title {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.1em;
}

/* ---------- Contact ---------- */
.contact-form {
    display: grid;
    gap: var(--space-4);
    margin-top: var(--space-5);
}

.field {
    display: grid;
    gap: var(--space-1);
}

.field label {
    font-size: var(--step--1);
    font-weight: 500;
}

.field input,
.field textarea {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    transition: border-color 0.15s;
}

.field textarea {
    min-height: 9rem;
    resize: vertical;
}

.field input:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-hint {
    font-size: var(--step--1);
    color: var(--muted);
}

.field-error {
    font-size: var(--step--1);
    color: var(--error);
    min-height: 0;
}

.honeypot {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-4);
}

.form-status {
    margin: 0;
    font-size: var(--step--1);
}

.form-status[data-state="ok"] {
    color: var(--ok);
}

.form-status[data-state="error"] {
    color: var(--error);
}

.email-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    margin-top: var(--space-6);
    color: var(--muted);
}

/* ---------- Footer ---------- */
.site-footer {
    margin-top: var(--space-9);
    padding: var(--space-6) 0 var(--space-7);
    border-top: 1px solid var(--border);
    font-size: var(--step--1);
    color: var(--muted);
}

.footer-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-3);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-links li {
    margin: 0;
}

.footer-links a {
    color: var(--muted);
}

/* ---------- Depth animation ----------
   Things come forward from the background as they scroll into view, and sink back as they
   scroll out, in both directions. .reveal = one element; .reveal-each = each direct child. */
@keyframes depth-in {
    from {
        opacity: 0;
        transform: perspective(1000px) translate3d(0, 56px, -260px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes depth-out {
    from {
        opacity: 1;
        transform: none;
    }

    to {
        opacity: 0;
        transform: perspective(1000px) translate3d(0, -36px, -260px);
    }
}

@keyframes intro-in {
    from {
        opacity: 0;
        transform: perspective(1000px) translate3d(0, 24px, -120px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: no-preference) {
    /* Intro plays once on load, each line slightly after the last */
    .intro > * {
        animation: intro-in 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
    }

    .intro > :nth-child(2) { animation-delay: 0.08s; }
    .intro > :nth-child(3) { animation-delay: 0.16s; }
    .intro > :nth-child(4) { animation-delay: 0.24s; }
    .intro > :nth-child(5) { animation-delay: 0.32s; }

    /* Scroll-linked where supported (Chrome, Edge, Safari 26+): the motion follows the scrollbar */
    @supports (animation-timeline: view()) {
        .reveal,
        .reveal-each > * {
            animation: depth-in linear both, depth-out linear forwards;
            animation-timeline: view(), view();
            animation-range: cover 0% cover 32vh, cover calc(100% - 12vh) cover 100%;
        }

        /* Items side by side arrive one after another */
        .reveal-each > :nth-child(2) { animation-range: cover 3vh cover 35vh, cover calc(100% - 12vh) cover 100%; }
        .reveal-each > :nth-child(3) { animation-range: cover 6vh cover 38vh, cover calc(100% - 12vh) cover 100%; }
        .reveal-each > :nth-child(4) { animation-range: cover 9vh cover 41vh, cover calc(100% - 12vh) cover 100%; }
        .reveal-each > :nth-child(n + 5) { animation-range: cover 12vh cover 44vh, cover calc(100% - 12vh) cover 100%; }
    }
}

/* Fallback (Firefox, older Safari): JS adds .js-reveal and toggles .is-visible / .is-above */
.js-reveal .reveal,
.js-reveal .reveal-each > * {
    opacity: 0;
    transform: perspective(1000px) translate3d(0, 56px, -260px);
    transition: opacity 0.7s ease, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.js-reveal .is-above {
    transform: perspective(1000px) translate3d(0, -36px, -260px);
}

.js-reveal .is-visible {
    opacity: 1;
    transform: none;
}

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

    .js-reveal .reveal,
    .js-reveal .reveal-each > * {
        opacity: 1;
        transform: none;
        transition: none;
    }

    * {
        transition-duration: 0s !important;
    }
}

/* ---------- 404 ---------- */
.not-found {
    min-height: 70vh;
    display: grid;
    align-content: center;
    gap: var(--space-4);
}

.not-found h1 {
    font-size: var(--step-4);
}

.facts .subsection-title {
    margin-top: 0;
}

.compact a.item-title {
    display: inline-block;
}
