/* ==========================================================================
   Koen de Bonth — portfolio
   Design system: "instrument panel" — precise, technical, editorial.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Fonts (self-hosted, variable, latin subset)
   -------------------------------------------------------------------------- */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/inter-var-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
        U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
        U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/jetbrains-mono-var-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
        U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
        U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --------------------------------------------------------------------------
   2. Design tokens
   -------------------------------------------------------------------------- */

:root {
    color-scheme: dark;

    /* Surfaces & ink — dark is the default brand look */
    --bg: #070b14;
    --bg-soft: #0a1020;
    --surface: #0d1526;
    --surface-2: #121c31;
    --surface-hover: #16223a;
    --line: rgba(148, 163, 184, 0.16);
    --line-hover: rgba(34, 211, 238, 0.42);
    --text: #e8eefc;
    --text-2: #a8b8d4;
    --text-3: #7d8fad;

    /* Accents */
    --accent: #22d3ee;
    --accent-text: #22d3ee;
    --accent-ink: #04202b;
    --accent-soft: rgba(34, 211, 238, 0.12);
    --violet: #a78bfa;
    --emerald: #34d399;
    --amber: #fbbf24;

    --grad-brand: linear-gradient(120deg, #22d3ee 0%, #38bdf8 45%, #a78bfa 100%);
    --grad-surface: linear-gradient(160deg, rgba(34, 211, 238, 0.07), rgba(167, 139, 250, 0.04) 55%, transparent);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 12px 30px -12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 30px 60px -24px rgba(0, 0, 0, 0.75);
    --ring: 0 0 0 3px rgba(34, 211, 238, 0.35);

    /* Type scale — fluid from 360px to 1280px */
    --text-xs: clamp(0.75rem, 0.73rem + 0.11vw, 0.813rem);
    --text-sm: clamp(0.875rem, 0.85rem + 0.13vw, 0.938rem);
    --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
    --text-lg: clamp(1.125rem, 1.06rem + 0.29vw, 1.313rem);
    --text-xl: clamp(1.313rem, 1.2rem + 0.5vw, 1.625rem);
    --text-2xl: clamp(1.563rem, 1.36rem + 0.9vw, 2.125rem);
    --text-3xl: clamp(1.875rem, 1.53rem + 1.54vw, 2.875rem);
    --text-4xl: clamp(2.25rem, 1.68rem + 2.54vw, 4rem);

    /* Space scale */
    --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: clamp(2.5rem, 1.75rem + 3vw, 4rem);
    --space-9: clamp(3.5rem, 2.25rem + 4.5vw, 5.5rem);

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 22px;
    --radius-xl: 32px;
    --radius-full: 999px;

    --wrap: 1140px;
    --wrap-narrow: 780px;
    --header-h: 68px;

    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --dur: 260ms;
    --dur-slow: 620ms;

    --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', 'Cascadia Code', monospace;
}

/* Light palette — applied when the OS asks for it, unless the user forced dark */
@media (prefers-color-scheme: light) {
    :root:not([data-theme='dark']) {
        color-scheme: light;
        --bg: #f5f8fd;
        --bg-soft: #eef3fa;
        --surface: #ffffff;
        --surface-2: #f2f6fc;
        --surface-hover: #eaf1fa;
        --line: rgba(15, 23, 42, 0.11);
        --line-hover: rgba(8, 145, 178, 0.5);
        --text: #0b1220;
        --text-2: #475569;
        --text-3: #64748b;
        --accent: #0891b2;
        --accent-text: #0e7490;
        --accent-ink: #ffffff;
        --accent-soft: rgba(8, 145, 178, 0.1);
        --violet: #7c3aed;
        --emerald: #059669;
        --amber: #b45309;
        --grad-brand: linear-gradient(120deg, #0891b2 0%, #0284c7 45%, #7c3aed 100%);
        --grad-surface: linear-gradient(160deg, rgba(8, 145, 178, 0.06), rgba(124, 58, 237, 0.03) 55%, transparent);
        --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
        --shadow-md: 0 12px 30px -14px rgba(15, 23, 42, 0.22);
        --shadow-lg: 0 30px 60px -28px rgba(15, 23, 42, 0.3);
        --ring: 0 0 0 3px rgba(8, 145, 178, 0.3);
    }
}

/* Explicit light choice from the theme toggle */
:root[data-theme='light'] {
    color-scheme: light;
    --bg: #f5f8fd;
    --bg-soft: #eef3fa;
    --surface: #ffffff;
    --surface-2: #f2f6fc;
    --surface-hover: #eaf1fa;
    --line: rgba(15, 23, 42, 0.11);
    --line-hover: rgba(8, 145, 178, 0.5);
    --text: #0b1220;
    --text-2: #475569;
    --text-3: #64748b;
    --accent: #0891b2;
    --accent-text: #0e7490;
    --accent-ink: #ffffff;
    --accent-soft: rgba(8, 145, 178, 0.1);
    --violet: #7c3aed;
    --emerald: #059669;
    --amber: #b45309;
    --grad-brand: linear-gradient(120deg, #0891b2 0%, #0284c7 45%, #7c3aed 100%);
    --grad-surface: linear-gradient(160deg, rgba(8, 145, 178, 0.06), rgba(124, 58, 237, 0.03) 55%, transparent);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 12px 30px -14px rgba(15, 23, 42, 0.22);
    --shadow-lg: 0 30px 60px -28px rgba(15, 23, 42, 0.3);
    --ring: 0 0 0 3px rgba(8, 145, 178, 0.3);
}

/* --------------------------------------------------------------------------
   3. Reset & base
   -------------------------------------------------------------------------- */

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

* {
    margin: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + var(--space-5));
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.65;
    min-height: 100svh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-synthesis-weight: none;
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

/* Ambient backdrop: two soft light sources over a fading technical grid. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(60rem 40rem at 12% -10%, rgba(34, 211, 238, 0.16), transparent 60%),
        radial-gradient(50rem 38rem at 92% 8%, rgba(167, 139, 250, 0.14), transparent 62%),
        radial-gradient(45rem 35rem at 50% 105%, rgba(52, 211, 153, 0.08), transparent 60%);
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.55;
    background-image:
        linear-gradient(to right, var(--line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--line) 1px, transparent 1px);
    background-size: 64px 64px;
    -webkit-mask-image: radial-gradient(75rem 55rem at 50% 0%, #000 5%, transparent 75%);
    mask-image: radial-gradient(75rem 55rem at 50% 0%, #000 5%, transparent 75%);
}

:root[data-theme='light'] body::before,
:root[data-theme='light'] body::after {
    opacity: 0.7;
}

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

img {
    height: auto;
}

a {
    color: var(--accent-text);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
}

h1,
h2,
h3,
h4 {
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.022em;
    text-wrap: balance;
}

p {
    text-wrap: pretty;
}

ul,
ol {
    padding-left: 1.15rem;
}

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

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

/* Cross-document transitions where the browser supports them */
@view-transition {
    navigation: auto;
}

/* --------------------------------------------------------------------------
   4. Layout primitives
   -------------------------------------------------------------------------- */

.wrap {
    width: min(100% - 2.5rem, var(--wrap));
    margin-inline: auto;
}

.wrap-narrow {
    width: min(100% - 2.5rem, var(--wrap-narrow));
    margin-inline: auto;
}

@media (max-width: 480px) {
    .wrap,
    .wrap-narrow {
        width: min(100% - 2rem, var(--wrap));
    }
}

main {
    display: block;
}

.section {
    padding-block: var(--space-9);
}

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

/* Consecutive panels that read as one document (the CV) */
.section--stack {
    padding-block: var(--space-4);
}

.skip-link {
    position: absolute;
    left: 50%;
    top: 0;
    translate: -50% -150%;
    z-index: 2000;
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 650;
    padding: 0.7rem 1.25rem;
    border-radius: 0 0 var(--radius) var(--radius);
    text-decoration: none;
    transition: translate 180ms var(--ease);
}

.skip-link:focus-visible {
    translate: -50% 0;
    outline-offset: -4px;
}

/* --------------------------------------------------------------------------
   5. Typography helpers
   -------------------------------------------------------------------------- */

.kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent-text);
}

.kicker::before {
    content: '';
    width: 1.75rem;
    height: 1px;
    background: currentColor;
    opacity: 0.6;
}

.kicker--dot::before {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--emerald);
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
    animation: pulse 2.4s var(--ease) infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6); }
    70% { box-shadow: 0 0 0 0.65rem rgba(52, 211, 153, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-7);
}

.section-head h2 {
    font-size: var(--text-3xl);
    margin-top: var(--space-3);
}

.section-head p {
    color: var(--text-2);
    max-width: 52ch;
    margin-top: var(--space-3);
}

.lead {
    font-size: var(--text-lg);
    color: var(--text-2);
    max-width: 62ch;
}

.grad-text {
    background: var(--grad-brand);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

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

/* --------------------------------------------------------------------------
   6. Header & navigation
   -------------------------------------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    border-bottom: 1px solid transparent;
    transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.site-header.is-scrolled {
    border-bottom-color: var(--line);
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    box-shadow: var(--shadow-sm);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    min-height: var(--header-h);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 700;
    font-size: 1.02rem;
    letter-spacing: -0.02em;
    color: var(--text);
    text-decoration: none;
    padding: 0.35rem;
    margin-left: -0.35rem;
    border-radius: var(--radius-sm);
}

.brand__mark {
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: 9px;
    transition: transform var(--dur) var(--ease);
}

.brand:hover .brand__mark {
    transform: rotate(-8deg) scale(1.06);
}

.brand__sub {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-3);
    margin-top: -2px;
}

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

.nav {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.nav a {
    position: relative;
    color: var(--text-2);
    font-size: var(--text-sm);
    font-weight: 550;
    text-decoration: none;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-sm);
    transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.nav a:hover {
    color: var(--text);
    background: var(--surface-2);
}

.nav a[aria-current='page'] {
    color: var(--text);
}

.nav a[aria-current='page']::after {
    content: '';
    position: absolute;
    left: 0.85rem;
    right: 0.85rem;
    bottom: 0.15rem;
    height: 2px;
    border-radius: 2px;
    background: var(--grad-brand);
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: none;
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease),
        background-color var(--dur) var(--ease);
}

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

.icon-btn svg {
    width: 18px;
    height: 18px;
}

/* Theme toggle: sun and moon swap places */
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    grid-area: 1 / 1;
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.theme-toggle > span {
    display: grid;
    place-items: center;
}

.theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(-70deg) scale(0.5);
}

:root[data-theme='light'] .theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(70deg) scale(0.5);
}

:root[data-theme='light'] .theme-toggle .icon-moon {
    opacity: 1;
    transform: none;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme='dark']) .theme-toggle .icon-sun {
        opacity: 0;
        transform: rotate(70deg) scale(0.5);
    }

    :root:not([data-theme='dark']) .theme-toggle .icon-moon {
        opacity: 1;
        transform: none;
    }
}

/* Mobile menu button */
.menu-btn {
    display: none;
}

.menu-btn__bars {
    display: grid;
    gap: 5px;
    width: 18px;
}

.menu-btn__bars span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}

.menu-btn[aria-expanded='true'] .menu-btn__bars span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.menu-btn[aria-expanded='true'] .menu-btn__bars span:nth-child(2) {
    opacity: 0;
}

.menu-btn[aria-expanded='true'] .menu-btn__bars span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 800px) {
    .menu-btn {
        display: inline-flex;
    }

    .nav {
        position: fixed;
        inset: var(--header-h) 0 auto 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: var(--space-4) 1.25rem calc(var(--space-6) + env(safe-area-inset-bottom));
        background: var(--bg);
        border-bottom: 1px solid var(--line);
        box-shadow: var(--shadow-lg);
        transform-origin: top;
        opacity: 0;
        translate: 0 -12px;
        visibility: hidden;
        transition: opacity var(--dur) var(--ease), translate var(--dur) var(--ease),
            visibility 0s linear var(--dur);
    }

    .nav.is-open {
        opacity: 1;
        translate: 0;
        visibility: visible;
        transition-delay: 0s;
    }

    .nav a {
        font-size: var(--text-lg);
        font-weight: 600;
        padding: 0.85rem 0.5rem;
        border-radius: var(--radius-sm);
        border-bottom: 1px solid var(--line);
    }

    .nav a:last-of-type {
        border-bottom: 0;
    }

    .nav a[aria-current='page']::after {
        left: 0.5rem;
        right: auto;
        top: 50%;
        bottom: auto;
        width: 3px;
        height: 1.4rem;
        translate: -0.75rem -50%;
    }

    body.nav-open {
        overflow: hidden;
    }
}

/* --------------------------------------------------------------------------
   7. Buttons
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1;
    padding: 0.85rem 1.4rem;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
        background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
        color var(--dur) var(--ease);
}

.btn svg {
    width: 17px;
    height: 17px;
    flex: none;
}

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

.btn--primary {
    background: var(--grad-brand);
    color: var(--accent-ink);
    box-shadow: 0 8px 24px -10px rgba(34, 211, 238, 0.8);
}

.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px -12px rgba(34, 211, 238, 0.95);
}

.btn--ghost {
    background: var(--surface);
    color: var(--text);
    border-color: var(--line);
}

.btn--ghost:hover {
    border-color: var(--line-hover);
    background: var(--surface-hover);
    transform: translateY(-2px);
}

.btn--quiet {
    background: transparent;
    color: var(--text-2);
    padding-inline: 0.35rem;
}

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

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
}

/* Arrow that slides on hover */
.btn .arrow,
.link-arrow .arrow {
    transition: transform var(--dur) var(--ease);
}

.btn:hover .arrow,
.link-arrow:hover .arrow {
    transform: translateX(3px);
}

.link-arrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--accent-text);
    text-decoration: none;
}

.link-arrow:hover {
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   8. Cards & surfaces
   -------------------------------------------------------------------------- */

.card {
    position: relative;
    background: var(--surface);
    background-image: var(--grad-surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-md);
    transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease),
        box-shadow var(--dur) var(--ease);
}

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

.card__icon {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent-text);
    border: 1px solid var(--line);
    margin-bottom: var(--space-4);
}

.card__icon svg {
    width: 21px;
    height: 21px;
}

.card h3 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-2);
}

.card p {
    color: var(--text-2);
    font-size: var(--text-sm);
}

/* --------------------------------------------------------------------------
   9. Hero
   -------------------------------------------------------------------------- */

.hero {
    padding-block: clamp(2.5rem, 1rem + 6vw, 5.5rem) var(--space-8);
}

.hero__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: clamp(2rem, 1rem + 4vw, 4.5rem);
    align-items: center;
}

.hero h1 {
    font-size: var(--text-4xl);
    margin-block: var(--space-4) var(--space-5);
    letter-spacing: -0.035em;
}

.hero .lead {
    margin-bottom: var(--space-6);
}

.hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-5);
    margin-top: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-3);
}

.hero__meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.hero__meta svg {
    width: 14px;
    height: 14px;
    color: var(--accent-text);
}

/* Portrait panel */
.portrait {
    position: relative;
    justify-self: center;
    width: min(100%, 380px);
}

.portrait__frame {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    background: var(--surface);
}

.portrait__frame img {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
}

.portrait__badge {
    position: absolute;
    left: -1.25rem;
    bottom: 1.75rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 1rem;
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    animation: float 6s ease-in-out infinite;
}

.portrait__badge svg {
    width: 20px;
    height: 20px;
    color: var(--emerald);
}

.portrait__badge b {
    display: block;
    font-size: var(--text-sm);
    line-height: 1.25;
}

.portrait__badge small {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-3);
    letter-spacing: 0.04em;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-7px); }
}

@media (max-width: 900px) {
    .hero__grid {
        grid-template-columns: 1fr;
        gap: var(--space-7);
    }

    .portrait {
        order: -1;
        width: min(100%, 300px);
    }

    .portrait__badge {
        left: -0.5rem;
    }
}

/* --------------------------------------------------------------------------
   10. Stat strip
   -------------------------------------------------------------------------- */

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.stat {
    background: var(--surface);
    padding: var(--space-5) var(--space-4);
    text-align: center;
    transition: background-color var(--dur) var(--ease);
}

.stat:hover {
    background: var(--surface-hover);
}

.stat__value {
    font-size: var(--text-2xl);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    background: var(--grad-brand);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    font-variant-numeric: tabular-nums;
}

.stat__label {
    display: block;
    margin-top: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-3);
    font-family: var(--font-mono);
    letter-spacing: 0.03em;
}

@media (max-width: 720px) {
    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* --------------------------------------------------------------------------
   11. Grids
   -------------------------------------------------------------------------- */

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

.grid--3 {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

.grid--2 {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
}

/* Form beside the direct-contact column, stacking on narrow screens */
.contact-grid {
    display: grid;
    gap: var(--space-6);
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    align-items: start;
}

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

/* --------------------------------------------------------------------------
   12. Project cards — compact grid + featured row
   -------------------------------------------------------------------------- */

.work-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: var(--space-5);
    align-items: stretch;
}

.pcard {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

/* Per-category hue; data projects keep the brand cyan. Zero-specificity
   default so the attribute overrides below always win, wherever the
   component rules live in this file. */
:where(.pcard, .case, .archive__row) {
    --pc: var(--accent-text);
}

[data-category~='app'] {
    --pc: var(--violet);
}

[data-category~='onderzoek'] {
    --pc: var(--emerald);
}

/* The lead project claims the full row and gains a metric panel. */
.pcard--featured {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    border-color: color-mix(in srgb, var(--accent) 34%, transparent);
}

.pcard__media {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 10;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    overflow: hidden;
}

.pcard__media--grid {
    background-color: color-mix(in srgb, var(--pc) 4%, var(--surface-2));
    background-image:
        linear-gradient(to right, var(--line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--line) 1px, transparent 1px);
    background-size: 28px 28px;
}

/* Soft light source behind the illustration */
.pcard__media--grid::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(70% 70% at 50% 45%, color-mix(in srgb, var(--pc) 13%, transparent), transparent 72%);
    pointer-events: none;
}

.pcard__art {
    position: relative;
    width: 78%;
    max-width: 420px;
    height: auto;
    color: var(--pc);
    opacity: 0.92;
    transition: transform var(--dur-slow) var(--ease);
}

.pcard:hover .pcard__art {
    transform: translateY(-4px) scale(1.02);
}

.pcard__media picture {
    position: absolute;
    inset: 0;
    display: block;
}

.pcard__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    transition: transform var(--dur-slow) var(--ease);
}

.pcard:hover .pcard__media img {
    transform: scale(1.03);
}

.pcard--featured .pcard__media {
    aspect-ratio: auto;
    border-bottom: 0;
    border-right: 1px solid var(--line);
    min-height: 280px;
}

.pcard__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: var(--space-5);
}

.pcard--featured .pcard__body {
    padding: var(--space-6);
}

.pcard__eyebrow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: var(--space-3);
}

.pcard h3 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-2);
}

.pcard--featured h3 {
    font-size: var(--text-2xl);
}

.pcard__org {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--pc);
    letter-spacing: 0.02em;
    margin-bottom: var(--space-3);
}

/* Company mark beside the organisation name */
.org-logo {
    width: 22px;
    height: 22px;
    flex: none;
    border-radius: 6px;
    background: #fff;
    border: 1px solid var(--line);
    object-fit: contain;
}

/* Category tags pick up the project hue */
.pcard .tag--accent {
    color: var(--pc);
    border-color: color-mix(in srgb, var(--pc) 34%, transparent);
    background: color-mix(in srgb, var(--pc) 10%, transparent);
}

.pcard__body > p {
    color: var(--text-2);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
}

.pcard__list {
    color: var(--text-2);
    font-size: var(--text-sm);
    display: grid;
    gap: 0.3rem;
    margin-bottom: var(--space-4);
}

.pcard__list li::marker {
    color: var(--pc, var(--accent));
}

.pcard__stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: var(--space-4);
}

/* Without a footer the tag row becomes the baseline, so push it down. */
.pcard__stack:last-child {
    margin-top: auto;
    margin-bottom: 0;
}

.pcard__foot {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    align-items: center;
    padding-top: var(--space-4);
    border-top: 1px solid var(--line);
}

/* Numbers that carry the weight of a project */
.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: var(--space-5);
}

.metric {
    background: var(--surface-2);
    padding: var(--space-4) var(--space-3);
}

.metric b {
    display: block;
    font-size: var(--text-xl);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--accent-text);
    font-variant-numeric: tabular-nums;
}

.metric span {
    display: block;
    margin-top: 0.35rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    line-height: 1.4;
    color: var(--text-3);
    /* Long Dutch compounds must wrap rather than get clipped by the panel. */
    overflow-wrap: break-word;
    hyphens: auto;
}

@media (max-width: 820px) {
    .pcard--featured {
        grid-template-columns: 1fr;
    }

    .pcard--featured .pcard__media {
        aspect-ratio: 16 / 10;
        min-height: 0;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
}

/* --------------------------------------------------------------------------
   12b. Filter bar
   -------------------------------------------------------------------------- */

/* Row of organisations worked for */
.logo-wall {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3) var(--space-5);
    margin-top: var(--space-5);
}

.logo-wall__item {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-3);
    white-space: nowrap;
}

.logo-wall__item img {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: #fff;
    border: 1px solid var(--line);
    object-fit: contain;
}

/* --------------------------------------------------------------------------
   12c. Case studies — featured work as alternating editorial chapters
   -------------------------------------------------------------------------- */

.cases {
    display: grid;
    gap: var(--space-8);
}

.case {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(2rem, 4vw, 4rem);
    align-items: center;
    padding-top: var(--space-7);
    border-top: 1px solid var(--line);
}

.case:nth-of-type(even) .case__visual {
    order: 2;
}

.case__visual {
    position: relative;
    display: grid;
    place-items: center;
    padding-block: var(--space-4);
}

/* Ambient light in the project's hue */
.case__visual::before {
    content: '';
    position: absolute;
    inset: -10%;
    background: radial-gradient(55% 55% at 50% 50%, color-mix(in srgb, var(--pc) 15%, transparent), transparent 70%);
    pointer-events: none;
}

/* Ghost chapter numeral peeking out from behind the window */
.case__num {
    position: absolute;
    z-index: 0;
    top: -1.5rem;
    left: 0;
    font-family: var(--font-mono);
    font-size: clamp(4rem, 7vw, 6.5rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.04em;
    color: color-mix(in srgb, var(--pc) 24%, transparent);
    user-select: none;
}

.case:nth-of-type(even) .case__num {
    left: auto;
    right: 0;
}

/* The product, shown in its own window */
.case__frame {
    position: relative;
    z-index: 1;
    width: min(100%, 520px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg), 0 0 70px -24px color-mix(in srgb, var(--pc) 45%, transparent);
    transition: transform var(--dur-slow) var(--ease), box-shadow var(--dur-slow) var(--ease);
}

.case:hover .case__frame {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg), 0 0 90px -20px color-mix(in srgb, var(--pc) 60%, transparent);
}

.case__bar {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}

.case__bar i {
    width: 9px;
    height: 9px;
    flex: none;
    border-radius: 50%;
    background: var(--text-3);
    opacity: 0.5;
}

.case__bar i:nth-child(2) {
    opacity: 0.35;
}

.case__bar i:nth-child(3) {
    opacity: 0.2;
}

.case__url {
    margin-left: 0.5rem;
    min-width: 0;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.02em;
    color: var(--text-3);
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 0.2rem 0.7rem;
    border-radius: var(--radius-full);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.case__body {
    position: relative;
    display: grid;
    place-items: center;
    padding: var(--space-5);
    background-color: color-mix(in srgb, var(--pc) 4%, var(--surface-2));
    background-image:
        linear-gradient(to right, var(--line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--line) 1px, transparent 1px);
    background-size: 26px 26px;
}

.case__body svg {
    width: 100%;
    max-width: 400px;
    height: auto;
    color: var(--pc);
}

.case__body--shot {
    padding: 0;
    background: none;
}

.case__body--shot img {
    display: block;
    width: 100%;
    height: auto;
}

/* Terminal body — deliberately dark in both themes */
.case__body--term {
    display: block;
    padding: var(--space-5);
    background-color: #0a1020;
    background-image: none;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 2.1;
    color: #c9d7ee;
}

.case__body--term p {
    /* Full width regardless of the parent's centring grid, so the
       terminal lines hug the left edge like a real prompt. */
    width: 100%;
    margin: 0;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.term-prompt { color: #22d3ee; }
.term-ok { color: #34d399; }
.term-run { color: #a78bfa; }

.term-cursor {
    display: inline-block;
    margin-left: 3px;
    color: #22d3ee;
    animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.case__content h3 {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-2);
}

.case__desc {
    color: var(--text-2);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
}

.case__foot {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    align-items: center;
    margin-top: var(--space-4);
}

@media (max-width: 880px) {
    .case {
        grid-template-columns: 1fr;
        gap: var(--space-5);
    }

    .case:nth-of-type(even) .case__visual {
        order: 0;
    }

    .case__num {
        top: -1rem;
    }
}

/* --------------------------------------------------------------------------
   12d. Archive — earlier work as a ledger
   -------------------------------------------------------------------------- */

.archive {
    list-style: none;
    padding: 0;
    margin: 0;
    border-top: 1px solid var(--line);
}

.archive__row {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr) auto 28px;
    gap: var(--space-2) var(--space-4);
    align-items: center;
    padding: var(--space-5) var(--space-3);
    border-bottom: 1px solid var(--line);
    color: inherit;
    text-decoration: none;
    transition: background-color var(--dur) var(--ease);
}

a.archive__row:hover {
    background: var(--surface);
}

.archive__year {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-3);
    white-space: nowrap;
}

.archive__year::before {
    content: '';
    width: 7px;
    height: 7px;
    flex: none;
    border-radius: 50%;
    background: var(--pc);
}

.archive h3 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: var(--text-lg);
    font-weight: 650;
}

.archive__main p {
    color: var(--text-3);
    font-size: var(--text-sm);
    margin-top: 0.2rem;
}

.archive__tags {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-3);
    white-space: nowrap;
}

.archive__go {
    display: grid;
    place-items: center;
    color: var(--pc);
}

.archive__go svg {
    width: 18px;
    height: 18px;
    transition: transform var(--dur) var(--ease);
}

a.archive__row:hover .archive__go svg {
    transform: translateX(4px);
}

@media (max-width: 760px) {
    .archive__row {
        grid-template-columns: minmax(0, 1fr) 28px;
    }

    .archive__tags {
        display: none;
    }

    .archive__main {
        grid-column: 1 / -1;
    }
}

/* --------------------------------------------------------------------------
   13. Tags & pills
   -------------------------------------------------------------------------- */

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text-2);
    transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease),
        background-color var(--dur) var(--ease);
}

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

.tag--accent {
    background: var(--accent-soft);
    color: var(--accent-text);
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text-2);
    white-space: nowrap;
}

.pill--now {
    color: var(--emerald);
    border-color: color-mix(in srgb, var(--emerald) 35%, transparent);
    background: color-mix(in srgb, var(--emerald) 10%, transparent);
}

/* --------------------------------------------------------------------------
   14. Marquee (tool strip)
   -------------------------------------------------------------------------- */

.marquee {
    position: relative;
    overflow: hidden;
    border-block: 1px solid var(--line);
    padding-block: var(--space-4);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.marquee__track {
    display: flex;
    width: max-content;
    gap: var(--space-6);
    animation: marquee 38s linear infinite;
}

.marquee:hover .marquee__track {
    animation-play-state: paused;
}

.marquee__item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-3);
    white-space: nowrap;
}

.marquee__item::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.7;
}

@keyframes marquee {
    to { transform: translateX(-50%); }
}

/* --------------------------------------------------------------------------
   15. Timeline (CV)
   -------------------------------------------------------------------------- */

.timeline {
    position: relative;
    display: grid;
    gap: var(--space-6);
    padding-left: var(--space-6);
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: linear-gradient(to bottom, var(--accent), var(--line) 22%, var(--line) 78%, transparent);
}

.tl-item {
    position: relative;
}

.tl-item::before {
    content: '';
    position: absolute;
    left: calc(-1 * var(--space-6));
    top: 0.55rem;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--line);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.tl-item:hover::before {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.tl-item--now::before {
    border-color: var(--emerald);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--emerald) 18%, transparent);
}

.tl-item__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    margin-bottom: var(--space-2);
}

.tl-item h3 {
    font-size: var(--text-lg);
}

.tl-item__org {
    font-size: var(--text-sm);
    color: var(--accent-text);
    font-weight: 600;
}

.tl-item__body {
    color: var(--text-2);
    font-size: var(--text-sm);
}

.tl-item__body ul {
    margin-top: var(--space-3);
    display: grid;
    gap: 0.3rem;
}

.tl-item__body li::marker {
    color: var(--accent);
}

/* --------------------------------------------------------------------------
   16. Skill groups
   -------------------------------------------------------------------------- */

.skill-group h3 {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: var(--text-sm);
    font-family: var(--font-mono);
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-3);
    margin-bottom: var(--space-4);
}

.skill-group h3 svg {
    width: 16px;
    height: 16px;
    color: var(--accent-text);
}

.skill-group__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

/* --------------------------------------------------------------------------
   17. Forms
   -------------------------------------------------------------------------- */

.field {
    display: grid;
    gap: 0.4rem;
    margin-bottom: var(--space-5);
}

.field label {
    font-size: var(--text-sm);
    font-weight: 600;
}

.field label .req {
    color: var(--accent-text);
}

.field input,
.field textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: var(--text-sm);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
        background-color var(--dur) var(--ease);
}

.field input::placeholder,
.field textarea::placeholder {
    color: var(--text-3);
}

.field input:focus-visible,
.field textarea:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--ring);
    background: var(--surface);
}

.field textarea {
    min-height: 150px;
    resize: vertical;
}

.field__error {
    font-size: var(--text-xs);
    color: #fb7185;
    min-height: 1.1em;
}

:root[data-theme='light'] .field__error {
    color: #be123c;
}

.field.is-invalid input,
.field.is-invalid textarea {
    border-color: #fb7185;
}

/* Honeypot — hidden from people, tempting to bots */
.hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.form-status {
    margin-top: var(--space-4);
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-status:empty {
    display: none;
}

.form-status[data-state='error'] {
    color: #fb7185;
}

.form-status[data-state='success'] {
    color: var(--emerald);
}

.btn[data-loading='true'] {
    pointer-events: none;
    opacity: 0.7;
}

.spinner {
    width: 15px;
    height: 15px;
    border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Contact channel cards */
.channel {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    text-decoration: none;
    color: inherit;
    transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease),
        background-color var(--dur) var(--ease);
}

.channel:hover {
    border-color: var(--line-hover);
    background: var(--surface-hover);
    transform: translateX(4px);
}

.channel__icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 11px;
    background: var(--accent-soft);
    color: var(--accent-text);
}

.channel__icon svg {
    width: 19px;
    height: 19px;
}

/* Scoped to the text wrapper: a bare `.channel span` would also catch
   .channel__icon (a span) and strip its centring grid and accent colour. */
.channel__text b {
    display: block;
    font-size: var(--text-sm);
}

.channel__text span {
    display: block;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-3);
}

/* --------------------------------------------------------------------------
   18. CTA band
   -------------------------------------------------------------------------- */

.cta {
    position: relative;
    overflow: hidden;
    text-align: center;
    padding: var(--space-8) var(--space-5);
    border-radius: var(--radius-xl);
    border: 1px solid var(--line);
    background: var(--surface);
    background-image: var(--grad-surface);
}

.cta::before {
    content: '';
    position: absolute;
    inset: -50% 30%;
    background: radial-gradient(closest-side, var(--accent-soft), transparent);
    pointer-events: none;
}

.cta > * {
    position: relative;
}

.cta h2 {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-4);
}

.cta p {
    color: var(--text-2);
    max-width: 46ch;
    margin: 0 auto var(--space-6);
}

.cta .btn-row {
    justify-content: center;
}

/* --------------------------------------------------------------------------
   19. Footer
   -------------------------------------------------------------------------- */

.site-footer {
    margin-top: var(--space-9);
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg-soft) 70%, transparent);
    padding-block: var(--space-7) var(--space-5);
}

.site-footer__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
    gap: var(--space-6);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--line);
}

.site-footer h2 {
    font-size: var(--text-xs);
    font-family: var(--font-mono);
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-3);
    margin-bottom: var(--space-4);
}

.site-footer p {
    color: var(--text-2);
    font-size: var(--text-sm);
    max-width: 40ch;
}

.footer-links {
    display: grid;
    gap: 0.55rem;
    list-style: none;
    padding: 0;
}

.footer-links a {
    color: var(--text-2);
    font-size: var(--text-sm);
    text-decoration: none;
    transition: color var(--dur) var(--ease);
}

.footer-links a:hover {
    color: var(--accent-text);
}

.site-footer__bottom {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    justify-content: space-between;
    align-items: center;
    padding-top: var(--space-5);
    font-size: var(--text-xs);
    color: var(--text-3);
    font-family: var(--font-mono);
}

.social-row {
    display: flex;
    gap: 0.5rem;
    margin-top: var(--space-4);
}

@media (max-width: 720px) {
    .site-footer__grid {
        grid-template-columns: 1fr 1fr;
    }

    .site-footer__grid > :first-child {
        grid-column: 1 / -1;
    }
}

/* --------------------------------------------------------------------------
   20. Scroll affordances
   -------------------------------------------------------------------------- */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    height: 2px;
    width: 100%;
    transform: scaleX(0);
    transform-origin: 0 50%;
    background: var(--grad-brand);
    pointer-events: none;
}

/* Native scroll-driven animation where supported — no JS, no jank */
@supports (animation-timeline: scroll()) {
    .scroll-progress {
        animation: progress-grow linear;
        animation-timeline: scroll(root block);
    }

    @keyframes progress-grow {
        to { transform: scaleX(1); }
    }
}

.to-top {
    position: fixed;
    right: clamp(1rem, 3vw, 2rem);
    bottom: clamp(1rem, 3vw, 2rem);
    z-index: 90;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--line);
    color: var(--text-2);
    cursor: pointer;
    opacity: 0;
    translate: 0 12px;
    visibility: hidden;
    transition: opacity var(--dur) var(--ease), translate var(--dur) var(--ease),
        visibility 0s linear var(--dur), border-color var(--dur) var(--ease),
        color var(--dur) var(--ease);
}

.to-top.is-visible {
    opacity: 1;
    translate: 0;
    visibility: visible;
    transition-delay: 0s;
}

.to-top:hover {
    color: var(--accent-text);
    border-color: var(--line-hover);
}

.to-top svg {
    width: 18px;
    height: 18px;
}

/* --------------------------------------------------------------------------
   21. Reveal on scroll
   -------------------------------------------------------------------------- */

.reveal {
    opacity: 0;
    translate: 0 18px;
    transition: opacity var(--dur-slow) var(--ease-out), translate var(--dur-slow) var(--ease-out);
    transition-delay: var(--reveal-delay, 0ms);
}

.reveal.is-in {
    opacity: 1;
    translate: 0;
}

/* Without JS nothing should stay invisible */
.no-js .reveal {
    opacity: 1;
    translate: 0;
}

/* --------------------------------------------------------------------------
   22. Motion & print
   -------------------------------------------------------------------------- */

@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;
        scroll-behavior: auto !important;
    }

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

    .marquee__track {
        animation: none;
        transform: none;
    }

    @view-transition {
        navigation: none;
    }
}

@media print {
    :root {
        --bg: #fff;
        --surface: #fff;
        --surface-2: #fff;
        --text: #000;
        --text-2: #1f2937;
        --text-3: #4b5563;
        --line: #d1d5db;
        --accent-text: #0e7490;
    }

    body::before,
    body::after,
    .site-header,
    .site-footer,
    .to-top,
    .scroll-progress,
    .skip-link,
    .cta,
    .marquee,
    .no-print {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
        font-size: 10.5pt;
    }

    .card,
    .cv-panel {
        box-shadow: none !important;
        border: 1px solid #d1d5db;
        break-inside: avoid;
        background-image: none !important;
    }

    .section {
        padding-block: 0.75rem;
    }

    .tl-item,
    .skill-group {
        break-inside: avoid;
    }

    a[href^='http']::after {
        content: ' (' attr(href) ')';
        font-size: 8pt;
        color: #4b5563;
        word-break: break-all;
    }

    .grad-text,
    .stat__value {
        -webkit-text-fill-color: #0e7490;
        color: #0e7490;
    }
}
