@font-face {
    font-family: "Newsreader";
    src: url("fonts/newsreader-600.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Schibsted Grotesk";
    src: url("fonts/schibsted-grotesk.woff2") format("woff2");
    font-weight: 400 900;
    font-style: normal;
    font-display: swap;
}
/* The header keeps the face of the first preview. */
@font-face {
    font-family: "Instrument Sans";
    src: url("fonts/instrument-sans-latin.woff2") format("woff2");
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: light;
    --paper: #f5f7f3;
    --surface: #ffffff;
    --ink: #1d2722;
    --muted: #434e47;
    --line: #d5ddd3;
    --accent: #2f5c47;
    --soft: #e9eee7;
    --dark: #17392e;
    --dark-surface: #22483b;
    --dark-line: #567165;
    --dark-muted: #d2e1d6;
    --light: #f8fafc;
    --lime: #d4ebc9;
    --danger: #a11928;
    --button-fill: var(--accent);
    --button-hover: color-mix(in srgb, var(--button-fill) 88%, var(--ink));
    --button-ink: var(--light);
    --shadow-soft: 0 10px 40px -12px #102b2429;
    --shadow-lift: 0 18px 40px -18px #0b1f1899;
    --anchor-clearance: 7.1rem;
    --gutter: clamp(1.125rem, 12.17vw - 1.85rem, 8rem);
    --page: min(76rem, 100% - 2 * var(--gutter));
    --header-gap: clamp(.75rem, 2.5vw, 1.5rem);
    --header-h: 4rem;
    --ease-out: cubic-bezier(.23, 1, .32, 1);
    --ease-in-out: cubic-bezier(.77, 0, .175, 1);
    --display: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
    --sans: "Schibsted Grotesk", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --nav-sans: "Instrument Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-family: var(--sans);
    accent-color: var(--accent);
    caret-color: var(--accent);
    scrollbar-color: color-mix(in srgb, var(--accent) 45%, var(--paper)) var(--paper);
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --paper: #121d18;
    --surface: #1c2a23;
    --ink: #f9f3e9;
    --muted: #cbd0c3;
    --line: #495a4c;
    --accent: #add8b7;
    --soft: #28392f;
    --dark: #10271e;
    --dark-surface: #1c3a2e;
    --danger: #ffb4bc;
    --button-ink: var(--paper);
    --shadow-soft: 0 10px 40px -12px #00000073;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: var(--anchor-clearance); }
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    line-height: 1.6;
    font-optical-sizing: auto;
    -webkit-font-smoothing: antialiased;
}
::selection { background: color-mix(in srgb, var(--accent) 26%, transparent); color: var(--ink); }
a { color: inherit; text-underline-offset: .22em; text-decoration-thickness: 1px; -webkit-tap-highlight-color: transparent; }
button, input, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
img, svg { display: block; max-width: 100%; }
figure, dl, dd { margin: 0; }
p { margin: 0 0 1rem; text-wrap: pretty; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.08; text-wrap: balance; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -.022em; }
h2 { font-size: clamp(2rem, 4.3vw, 3.2rem); }
h3 { font-size: clamp(1.5rem, 2.8vw, 2.1rem); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: .25rem; }
[id] { scroll-margin-top: var(--anchor-clearance); }
.container { width: var(--page); margin-inline: auto; }

/* Small metadata line. It sits under its heading, never above it. */
.meta {
    color: var(--accent);
    font-size: .84rem;
    font-weight: 600;
    line-height: 1.45;
    font-variant-numeric: tabular-nums;
}

.icon {
    width: 1em;
    height: 1em;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 220ms var(--ease-out);
}

.skip-link {
    position: absolute;
    z-index: 6;
    top: .5rem;
    left: .5rem;
    padding: .7rem 1rem;
    border-radius: .5rem;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* Header */
.site-header {
    position: sticky;
    z-index: 5;
    top: var(--header-gap);
    width: var(--page);
    margin: var(--header-gap) auto 0;
    border: 1px solid var(--line);
    border-radius: 99rem;
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    backdrop-filter: blur(18px) saturate(1.4);
    box-shadow: var(--shadow-soft);
    view-transition-name: site-header;
}
.nav-layout {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    width: 100%;
    min-height: var(--header-h);
    padding-inline: clamp(.9rem, 2vw, 1.4rem) clamp(.45rem, 1vw, .6rem);
}
.brand { display: inline-flex; align-items: center; width: fit-content; min-height: 2.75rem; font: 700 1.5rem/1 Georgia, "Times New Roman", serif; letter-spacing: -.03em; text-decoration: none; }
.site-nav, .nav-controls { display: flex; align-items: center; }
.site-nav { gap: clamp(.1rem, .8vw, .5rem); }
.site-header .site-nav a, .site-header .nav-control, .site-header .nav-cv { font-family: var(--nav-sans); }
.site-nav a, .nav-control { font-size: .95rem; font-weight: 500; text-decoration: none; }
.site-nav a {
    position: relative;
    padding: .6rem .8rem;
    border-radius: 99rem;
    color: var(--muted);
    transition: color 150ms ease, background-color 150ms ease;
}
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--soft); }
.nav-controls { justify-content: flex-end; gap: clamp(.1rem, .6vw, .45rem); }
.nav-control {
    display: inline-grid;
    place-items: center;
    min-width: 2.75rem;
    min-height: 2.75rem;
    border: 0;
    border-radius: 99rem;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    transition: background-color 150ms ease, transform 160ms var(--ease-out);
}
.nav-control[hidden] { display: none; }
.nav-control:active { transform: scale(.94); }
.nav-control svg { width: 1.15rem; height: 1.15rem; }
.nav-control[data-menu-toggle] { display: none; }
.button.nav-cv { min-height: 2.75rem; padding: .5rem 1.05rem; white-space: nowrap; }
[data-theme="dark"] .theme-moon, :root:not([data-theme="dark"]) .theme-sun { display: none; }
.menu-line { transition: transform 220ms var(--ease-out), opacity 150ms ease; transform-origin: 12px 12px; }
[aria-expanded="true"] .menu-line:nth-child(1) { transform: rotate(45deg) translateY(6px); }
[aria-expanded="true"] .menu-line:nth-child(2) { opacity: 0; }
[aria-expanded="true"] .menu-line:nth-child(3) { transform: rotate(-45deg) translateY(-6px); }

/* Buttons and links */
.button-group, .project-links { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; }
.button {
    display: inline-flex;
    min-height: 3rem;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    padding: .62rem 1.15rem;
    border: 1px solid transparent;
    border-radius: 99rem;
    font-size: .92rem;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: transform 160ms var(--ease-out), background-color 150ms ease, border-color 150ms ease;
}
.button:active { transform: scale(.97); }
.button-primary { color: var(--button-ink); background: var(--button-fill); }
.button-primary:focus-visible { outline-color: var(--ink); }
.button-secondary { border-color: var(--line); color: var(--ink); background: var(--surface); }
.text-link {
    display: inline-flex;
    width: fit-content;
    min-height: 2.75rem;
    align-items: center;
    gap: .45rem;
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
    transition: text-decoration-color 150ms ease;
}

@media (hover: hover) and (pointer: fine) {
    .site-nav a:hover { color: var(--ink); background: var(--soft); }
    .nav-control:hover { background: var(--soft); }
    .button-primary:hover { background: var(--button-hover); }
    .button-secondary:hover { border-color: var(--accent); background: var(--soft); }
    .text-link:hover, .contact-email:hover, .project-links > a:not(.button):hover { text-decoration-color: currentColor; text-decoration-thickness: 2px; }
    a:hover > .icon-ne, a:hover > span > .icon-ne, a:hover > .tile-arrow .icon-ne { transform: translate(2px, -2px); }
    a:hover > .icon-e { transform: translateX(3px); }
    a:hover > .icon-s { transform: translateY(2px); }
    a:hover > .icon-n { transform: translateY(-2px); }
    .social-link:hover { color: var(--accent); }
    a:is(.organization-mark, .cv-overview-logo):hover { box-shadow: 0 0 0 2px var(--accent); }
    .work-tile:hover { border-color: var(--lime); transform: translateY(-2px); box-shadow: var(--shadow-lift); }
    .work-tile:hover .work-tile-art img { transform: scale(1.03); }
    .trajectory-nav a:hover { color: var(--accent); }
    .cv-preview-page:hover { transform: translateY(-2px); box-shadow: 0 1rem 1.6rem -1rem #0e211a66; }
    .contact-form :is(input, textarea):hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
}

/* Home hero */
.hero {
    display: grid;
    align-content: center;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(2.25rem, 7vw, 6rem);
    min-height: calc(100svh - var(--header-h) - 2px - var(--header-gap));
    padding-block: clamp(2.5rem, 6vw, 4rem);
}
.hero h1 { margin: 0 0 .32em; font-size: clamp(2.75rem, 6vw, 5.5rem); line-height: .98; letter-spacing: -.03em; text-wrap: wrap; }
.hero h1 span { display: block; color: var(--accent); }
.hero-intro { max-width: 36rem; color: var(--muted); font-size: clamp(1.06rem, 1.7vw, 1.22rem); line-height: 1.55; margin-bottom: 1.6rem; }
.hero-links { margin-top: 1rem; }
.social-links { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem 1.1rem; }
.social-link {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-height: 2.75rem;
    color: var(--muted);
    font-size: .9rem;
    font-weight: 550;
    text-decoration: none;
    transition: color 150ms ease;
}
.social-link img, .social-link svg { width: 1.05rem; height: 1.05rem; flex-shrink: 0; }
[data-theme="dark"] .social-github img { filter: invert(1); }
.hero-portrait {
    width: min(100%, 25rem);
    justify-self: end;
    padding: .55rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: .9rem;
}
.portrait-media { position: relative; overflow: hidden; border-radius: .52rem; aspect-ratio: 1 / 1.045; background: var(--soft); }
.portrait-media img { width: 100%; height: 100%; object-fit: cover; }
.portrait-box {
    position: absolute;
    inset: .8rem;
    border: 1px solid #ffffffb3;
    box-shadow: 0 0 0 1px #17352d33;
    pointer-events: none;
}
.portrait-corner { position: absolute; width: 1.25rem; height: 1.25rem; border: 0 solid #fff; filter: drop-shadow(0 0 1px #17352d99); }
.top-left { top: -2px; left: -2px; border-width: 3px 0 0 3px; }
.top-right { top: -2px; right: -2px; border-width: 3px 3px 0 0; }
.bottom-left { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; }
.bottom-right { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; }
.portrait-detection {
    position: absolute;
    top: 1.25rem;
    left: 1.25rem;
    padding: .28rem .52rem;
    border-radius: .3rem;
    background: #103329eb;
    color: #fff;
    font-size: .73rem;
    font-weight: 650;
    letter-spacing: .02em;
    font-variant-numeric: tabular-nums;
}

/* Dark project band */
.home-work {
    background: var(--dark);
    color: var(--light);
    padding-block: clamp(3rem, 6vw, 5rem);
}
.home-work ::selection { background: color-mix(in srgb, var(--lime) 35%, transparent); color: #fff; }
.home-work .meta, .home-work .text-link { color: var(--lime); }
.home-work :focus-visible { outline-color: var(--lime); }
.work-tile:focus-visible { outline: 3px solid var(--lime); outline-offset: 4px; border-color: var(--lime); }
.section-heading { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .5rem 2rem; margin-bottom: 1.6rem; }
.section-heading h2 { margin: 0; }
.section-heading > a { margin-bottom: .2rem; }
.work-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1rem, 2.3vw, 1.65rem); }
.work-tile {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--dark-surface);
    border: 1px solid var(--dark-line);
    border-radius: .95rem;
    text-decoration: none;
    transition: border-color 200ms ease, transform 260ms var(--ease-out), box-shadow 260ms var(--ease-out);
}
.work-tile:active { transform: scale(.992); }
.work-tile-art { height: clamp(10rem, 21vw, 16rem); overflow: hidden; }
.work-tile-art img { width: 100%; height: 100%; object-fit: contain; transition: transform 500ms var(--ease-out); }
.redscar-art { background: #fbfbfb; }
.robot-art { background: #fefefe; }
.work-tile-copy { position: relative; padding: 1.45rem 3.5rem 1.45rem 1.45rem; }
.work-tile-copy h3 { margin-bottom: .2em; font-size: clamp(1.4rem, 2.2vw, 1.75rem); }
.work-tile-copy .meta { margin-bottom: .7rem; }
.work-tile-copy p:last-of-type { margin: 0; color: var(--dark-muted); line-height: 1.55; }
.tile-arrow { position: absolute; top: 1.55rem; right: 1.4rem; color: var(--lime); font-size: 1.3rem; }

.home-contact { display: grid; justify-items: start; gap: 1.6rem; padding-block: clamp(2.5rem, 7vw, 5.5rem); }
.home-contact h2 { margin-bottom: .27em; }
.home-contact p { max-width: 62ch; }
.home-contact p:last-child { margin: 0; color: var(--muted); }


.home-organizations { padding-block: clamp(2.75rem, 6vw, 4.5rem); border-bottom: 1px solid var(--line); }
.home-organizations h2 { font-size: clamp(1.9rem, 3.6vw, 2.8rem); }
.organization-mark {
    display: grid;
    min-height: 3.2rem;
    place-items: center;
    padding: .4rem .6rem;
    background: #fff;
    border-radius: .4rem;
    transition: box-shadow 150ms ease;
}
.organization-mark-inverse { background: #25425a; }
.organization-mark img { width: 8.5rem; height: 2.2rem; object-fit: contain; }
.organization-mark-outlier img { width: 5.4rem; }

.site-footer { border-top: 1px solid var(--line); }
.footer-layout { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .4rem 1.25rem; padding-block: 1rem; color: var(--muted); font-size: .85rem; }
.footer-layout p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem 1.1rem; }
.footer-links .social-link { font-size: inherit; }
.footer-links .text-link { min-height: 2.75rem; }

/* Inner pages */
.page-hero { padding-block: clamp(2.8rem, 6.2vw, 5.2rem) clamp(2.5rem, 4.4vw, 3.5rem); }
.page-hero h1 { margin: 0 0 .22em; font-size: clamp(2.7rem, 6.4vw, 4.75rem); letter-spacing: -.03em; }
.page-intro, .page-hero > p:not(.meta) { max-width: 40rem; color: var(--muted); font-size: clamp(1.05rem, 1.8vw, 1.22rem); line-height: 1.6; }
.page-intro:last-child, .page-hero > p:last-child { margin-bottom: 0; }
.project-hero { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 1.1rem 2rem; }
.project-hero > div { flex: 1 1 26rem; }
.project-github img { width: 1.15rem; height: 1.15rem; flex-shrink: 0; }
.project-feature {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: .95rem;
    padding: clamp(1.15rem, 4.5vw, 3rem);
}
.project-feature-head { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; gap: clamp(1.25rem, 5vw, 4rem); }
.project-feature-head h2 { margin-bottom: .12em; }
.project-feature-head .meta { margin-bottom: .9rem; }
.project-feature-head p:last-child, .project-feature-details p, .project-card-body > p:not(.meta, .project-note) { color: var(--muted); }
.project-feature-head p:last-child { margin-bottom: 0; }
.project-visual { overflow: hidden; }
.project-visual img { width: 100%; height: auto; }
.project-visual-redscar { display: grid; place-items: center; background: #f8f8f8; border: 1px solid var(--line); border-radius: .6rem; }
.project-visual-redscar img { max-width: 16rem; }
.project-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-block: clamp(1.5rem, 3.5vw, 2.5rem);
    border-block: 1px solid var(--line);
}
.project-facts > div { padding: 1rem clamp(.65rem, 2.35vw, 1.4rem); }
.project-facts > div:first-child { padding-left: 0; }
.project-facts > div + div { border-left: 1px solid var(--line); }
.project-facts dt { color: var(--muted); font-size: .82rem; line-height: 1.35; }
.project-facts dd { margin-top: .3rem; font-family: var(--display); font-weight: 600; font-size: clamp(1.3rem, 3.3vw, 2.3rem); line-height: 1.15; font-variant-numeric: lining-nums tabular-nums; }
.project-feature-details, .project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1.25rem, 4vw, 2.25rem); }
.project-feature-details { margin-bottom: .7rem; }
.project-feature-details h3 { font-size: clamp(1.4rem, 2.4vw, 1.8rem); }
.project-section { padding-block: clamp(2.75rem, 6.5vw, 5rem); }
.project-section > h2 { margin-bottom: .7em; }
.project-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: .95rem; background: var(--surface); }
.project-card .project-visual { aspect-ratio: 16 / 9; border-bottom: 1px solid var(--line); }
.project-card .project-visual img { height: 100%; object-fit: cover; }
.project-card-body { display: flex; flex-direction: column; align-items: start; padding: clamp(1.1rem, 3vw, 1.75rem); flex: 1; }
.project-card-body h3 { margin-bottom: .2em; }
.project-card-body .meta { margin-bottom: .8rem; }
.project-card-body .project-note { font-size: .88rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.project-card-body .project-links { margin-top: auto; }
.project-links > a:not(.button) { display: inline-flex; min-height: 2.75rem; align-items: center; color: var(--accent); font-size: .9rem; font-weight: 600; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); transition: text-decoration-color 150ms ease; }

/* Disclosure */
.project-detail { width: 100%; margin-block: .2rem 1rem; }
.project-detail p { margin: .6rem 0 0; color: var(--muted); max-width: 68ch; }
:is(.project-detail, .trajectory-details) summary {
    display: flex;
    width: fit-content;
    min-height: 2.75rem;
    align-items: center;
    gap: .5rem;
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}
:is(.project-detail, .trajectory-details) summary::-webkit-details-marker { display: none; }
:is(.project-detail, .trajectory-details) summary::before {
    width: .5rem;
    height: .5rem;
    flex: none;
    margin-inline: .15rem .1rem;
    border: solid currentColor;
    border-width: 0 1.6px 1.6px 0;
    content: "";
    transform: translateY(-.1rem) rotate(-45deg);
    transition: transform 200ms var(--ease-out);
}
:is(.project-detail, .trajectory-details)[open] summary::before { transform: translateY(-.15rem) rotate(45deg); }
@supports (interpolate-size: allow-keywords) {
    :is(.project-detail, .trajectory-details) { interpolate-size: allow-keywords; }
    :is(.project-detail, .trajectory-details)::details-content {
        height: 0;
        overflow: clip;
        opacity: 0;
        transition: height 260ms var(--ease-out), opacity 200ms ease, content-visibility 260ms allow-discrete;
    }
    :is(.project-detail, .trajectory-details)[open]::details-content { height: auto; opacity: 1; }
}

/* About */
.about-hero { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: center; gap: clamp(1.5rem, 7vw, 6rem); }
.about-hero .button { margin-top: .6rem; }
.about-portrait { padding: .55rem; max-width: 18rem; background: var(--surface); border: 1px solid var(--line); border-radius: .9rem; }
.about-portrait img { border-radius: .52rem; height: auto; }
.about-section { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr); gap: 1.25rem clamp(1.25rem, 7vw, 5rem); padding-block: clamp(2rem, 4.4vw, 3.4rem); border-top: 1px solid var(--line); }
.about-heading h2 { font-size: clamp(1.9rem, 3.4vw, 3rem); margin: 0; }
.research-list > div + div { padding-top: 1.05rem; margin-top: 1.05rem; border-top: 1px solid var(--line); }
.research-list dt { margin-bottom: .22rem; font-weight: 700; }
.research-list dd, .about-story p { color: var(--muted); max-width: 60ch; text-wrap: pretty; }

/* Contact */
.contact-layout {
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
    align-items: start;
    gap: clamp(2rem, 7vw, 5rem);
    padding-bottom: clamp(3rem, 6vw, 5rem);
}
.contact-details h2, .contact-form-panel h2 { font-size: clamp(1.45rem, 3vw, 2rem); margin-bottom: .9em; }
.contact-details { padding: .8rem 0; }
.contact-details .social-links { margin-top: 1rem; }
.contact-email { text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); transition: text-decoration-color 150ms ease; display: inline-flex; align-items: center; gap: .6rem; max-width: 100%; min-height: 2.75rem; color: var(--accent); overflow-wrap: anywhere; font-weight: 600; }
.contact-email svg { flex-shrink: 0; }
.contact-actions { margin-top: .8rem; }
.contact-form-panel { padding: clamp(1.25rem, 3.5vw, 2.25rem); border: 1px solid var(--line); border-radius: .95rem; background: var(--soft); }
.contact-form { display: grid; align-content: start; gap: .3rem; }
.contact-form label { font-size: .92rem; font-weight: 600; }
.contact-form input, .contact-form textarea {
    width: 100%;
    min-height: 2.9rem;
    margin-bottom: 1.1rem;
    padding: .7rem .9rem;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: .55rem;
    transition: border-color 150ms ease;
}
.contact-form :is(input, textarea):focus-visible {
    outline: 0;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.contact-form :is(input, textarea):user-invalid { border-color: var(--danger); }
.contact-form textarea { resize: vertical; }
.contact-form .button { width: fit-content; margin-top: .4rem; }
.contact-form .button:disabled { cursor: wait; opacity: .65; }
.contact-status { margin: .4rem 0 0; color: var(--muted); font-size: .9rem; }
.contact-status:empty { margin: 0; }
.contact-status[data-state="success"] { color: var(--accent); }
.contact-status[data-state="error"] { color: var(--danger); }
[data-copy-email][hidden] { display: none; }

/* Motion: one entrance per page, the header stays put between pages. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 180ms; animation-timing-function: ease; }
::view-transition-group(site-header) { animation-duration: 0s; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes settle { from { opacity: 0; transform: translateY(18px) scale(.98); } }
@keyframes lock { from { opacity: 0; transform: scale(1.14); } }

.hero-copy > * { animation: rise 700ms var(--ease-out) backwards; }
.hero-copy > :nth-child(2) { animation-delay: 70ms; }
.hero-copy > :nth-child(3) { animation-delay: 130ms; }
.hero-copy > :nth-child(4) { animation-delay: 180ms; }
.hero-portrait { animation: settle 900ms var(--ease-out) 120ms backwards; }
.portrait-box { animation: lock 650ms var(--ease-out) 620ms backwards; }
.portrait-detection { animation: fade 240ms ease 1000ms backwards; }
.page-hero > *, .cv-heading > * { animation: rise 600ms var(--ease-out) backwards; }
.page-hero > :nth-child(2), .cv-heading > :nth-child(2) { animation-delay: 60ms; }
.page-hero > :nth-child(3) { animation-delay: 110ms; }
.page-hero > :nth-child(4) { animation-delay: 150ms; }

@media (max-width: 48rem) {
    :root { --anchor-clearance: 6.2rem; }
    :root { --header-h: 3.6rem; }
    .nav-layout { grid-template-columns: 1fr auto; gap: 0 .45rem; }
    .site-nav { grid-row: 2; grid-column: 1 / -1; flex-wrap: wrap; padding-bottom: .45rem; }
    .nav-controls { grid-column: 2; grid-row: 1; }
    .nav-control[data-menu-toggle]:not([hidden]) { display: inline-grid; }
    .site-header[data-menu-open] .site-nav {
        position: absolute;
        top: calc(100% + .5rem);
        inset-inline: 0;
        display: grid;
        gap: .15rem;
        padding: .5rem;
        border: 1px solid var(--line);
        border-radius: 1.1rem;
        background: var(--surface);
        box-shadow: var(--shadow-soft);
        transform-origin: top right;
        transition: opacity 160ms var(--ease-out), transform 200ms var(--ease-out), visibility 0s;
    }
    .site-header[data-menu-open="false"] .site-nav {
        visibility: hidden;
        opacity: 0;
        transform: translateY(-.4rem) scale(.97);
        transition: opacity 120ms ease, transform 120ms ease, visibility 0s 120ms;
    }
    .site-header[data-menu-open] .site-nav a { padding: .8rem .9rem; border-radius: .7rem; font-size: 1.02rem; }
    .hero { grid-template-columns: minmax(0, 1fr); gap: 2.25rem; }
    .hero-portrait { width: min(100%, 22rem); justify-self: start; }
    .about-hero { gap: 1.5rem; }
}
@media (max-width: 36rem) {
    .work-grid, .project-feature-head, .project-feature-details, .project-grid,
    .about-hero, .about-section, .contact-layout { grid-template-columns: minmax(0, 1fr); }
    .about-portrait { max-width: 13.5rem; }
    .project-feature-details { gap: .4rem; }
    .hero h1 { font-size: clamp(2.5rem, 12.5vw, 4.4rem); }
    .work-tile-copy { padding-left: 1.1rem; }
    .project-facts dt { hyphens: auto; overflow-wrap: break-word; }
    .hero .button-group .button { flex: 1 1 100%; }
    .home-contact > .button { justify-self: stretch; }
}
@media (prefers-reduced-motion: reduce) {
    @view-transition { navigation: none; }
    .hero-copy > *, .hero-portrait, .portrait-box, .page-hero > *, .cv-heading > * { animation: fade 300ms ease backwards; }
    .icon, .work-tile, .work-tile-art img, .button, .nav-control, .menu-line, .cv-preview-page { transition-property: color, background-color, border-color, opacity; }
    .site-header[data-menu-open] .site-nav { transform: none; }
    :is(.project-detail, .trajectory-details)::details-content { transition: none; }
}

.button.nav-cv[aria-current="page"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
