.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: var(--border-width) solid var(--border);
}

/* Mobile base: brand + toggle on row one, nav links wrap to their own
   full-width row. Unwraps to a single row once there's room (see the
   min-width query at the bottom of this file). */
.nav-wrap {
    max-width: var(--max-width-wide);
    margin-inline: auto;
    padding: var(--space-3) var(--space-4);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
}

.nav__brand {
    font-family: var(--font-display);
    font-weight: 650;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    color: var(--text);
    text-decoration: none;
    margin-right: auto;
}

.nav {
    min-width: 0;
    order: 3;
    width: 100%;
}

.nav__links {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-1) var(--space-4);
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: var(--step--1);
}

.nav__links a {
    display: inline-block;
    padding: 0.35em 0;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
}

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

main {
    max-width: var(--max-width-wide);
    margin-inline: auto;
    padding-inline: var(--space-4);
}

/* Mobile base: single column, tighter vertical rhythm — a phone screen
   can't spare 6rem of empty padding before the first word. Both the hero
   grid and its padding open up once there's room (see min-width query). */
.hero {
    max-width: var(--max-width-wide);
    padding-block: var(--space-6);
}

.hero__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
    align-items: center;
}

.hero__copy {
    max-width: none;
}

@media (min-width: 60rem) {
    .hero {
        padding-block: var(--space-8) var(--space-7);
    }

    .hero__grid {
        grid-template-columns: 1.15fr 0.85fr;
        gap: var(--space-8);
    }

    .hero__copy {
        max-width: 34rem;
    }
}

.eyebrow {
    font-family: var(--font-mono);
    color: var(--accent);
    font-size: var(--step--1);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 var(--space-3);
}

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

.hero__lead {
    color: var(--text-muted);
    font-size: var(--step-1);
    max-width: 55ch;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-5);
}

.section {
    max-width: var(--max-width);
    padding-block: var(--space-6);
    border-top: var(--border-width) solid var(--border);
}

#hero + .section {
    border-top: none;
}

@media (min-width: 48rem) {
    .section {
        padding-block: var(--space-7);
    }
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
    gap: var(--space-5);
    margin-top: var(--space-5);
}

.site-footer {
    max-width: var(--max-width-wide);
    margin-inline: auto;
    padding: var(--space-6) var(--space-4) var(--space-7);
    color: var(--text-muted);
    font-size: var(--step--1);
}

.case-study {
    max-width: var(--max-width);
    padding-block: var(--space-6);
}

@media (min-width: 48rem) {
    .case-study {
        padding-block: var(--space-7);
    }
}

.case-study section {
    margin-top: var(--space-6);
}

.back-link {
    display: inline-block;
    margin-bottom: var(--space-5);
    color: var(--text-muted);
    text-decoration: none;
    font-size: var(--step--1);
}

.back-link:hover {
    color: var(--accent);
}

.cv {
    max-width: var(--max-width);
    padding-block: var(--space-6);
}

@media (min-width: 48rem) {
    .cv {
        padding-block: var(--space-7);
    }
}

.cv section {
    margin-top: var(--space-6);
}

.skill-groups {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
    gap: var(--space-5);
}

.skill-group h3 {
    font-size: var(--step-0);
    margin-bottom: var(--space-2);
}

.skill-group ul {
    padding-left: 1.1em;
    color: var(--text-muted);
}

@media (min-width: 30rem) {
    /* .nav (not .nav__links) is the actual flex child of .nav-wrap, so the
       unwrap-from-its-own-row has to apply here for order/width to take effect. */
    .nav {
        order: 0;
        width: auto;
    }

    .nav__links {
        justify-content: flex-start;
    }
}

/* Hidden-until-scrolled only applies once JS confirms it can reveal them
   again (see theme-init.js) — without JS, content is visible by default. */
.js .reveal {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 500ms ease, transform 500ms ease;
}

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

@media (prefers-reduced-motion: reduce) {
    .js .reveal {
        transition: none;
        opacity: 1;
        transform: none;
    }
}
