/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
    color-scheme: dark;

    --color-bg: #222831;
    --color-surface: rgb(43 49 59 / 0.85);
    --color-line: rgb(238 238 238 / 0.12);
    --color-text: #eeeeee;
    --color-muted: #aab3bc;
    --color-accent: #76abae;
    --color-accent-strong: #9cc9cb;
    --color-accent-wash: rgb(118 171 174 / 0.14);

    --font-sans: "Outfit", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, monospace;

    --header-height: 4rem;
    --container: 68rem;
    --radius: 0.875rem;
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-height);
}

body {
    margin: 0;
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: 1.0625rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
    margin: 0;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
}

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

#main:focus {
    outline: none;
}

.icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-fill {
    fill: currentColor;
    stroke: none;
}

.visually-hidden:where(:not(:focus-within, :active)) {
    position: absolute !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    white-space: nowrap !important;
}

.skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 100;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    background: var(--color-accent);
    color: var(--color-bg);
    font-weight: 600;
    text-decoration: none;
    transform: translateY(-200%);
}

.skip-link:focus {
    transform: none;
}

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

/* ── Background blobs ───────────────────────────────────────────────────── */
.backdrop {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    width: 60vmax;
    aspect-ratio: 1;
    background: radial-gradient(closest-side, rgb(118 171 174 / 0.28), transparent);
    animation: drift 24s ease-in-out infinite alternate;
}

.blob-1 {
    top: -25vmax;
    left: -25vmax;
}

.blob-2 {
    top: 25vh;
    right: -30vmax;
    animation-duration: 30s;
    animation-delay: -10s;
}

.blob-3 {
    bottom: -35vmax;
    left: 5vw;
    animation-duration: 36s;
    animation-delay: -20s;
}

@keyframes drift {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(8vmax, 5vmax) scale(1.08); }
    100% { transform: translate(-5vmax, 9vmax) scale(0.94); }
}

/* ── Buttons & tags ─────────────────────────────────────────────────────── */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.5rem 1.25rem;
    border: 2px solid var(--color-accent);
    border-radius: 999px;
    font: inherit;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.button-solid {
    background: var(--color-accent);
    color: var(--color-bg);
}

.button-solid:hover {
    background: var(--color-accent-strong);
    border-color: var(--color-accent-strong);
}

.button-outline {
    background: transparent;
    color: var(--color-accent);
}

.button-outline:hover {
    background: var(--color-accent-wash);
    color: var(--color-text);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tag-list li {
    padding: 0.125rem 0.625rem;
    border-radius: 999px;
    background: var(--color-accent-wash);
    color: var(--color-accent-strong);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
}

/* ── Header & navigation ────────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--color-line);
    background: rgb(34 40 49 / 0.82);
    backdrop-filter: blur(12px);
}

.header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: var(--header-height);
}

.brand {
    font-weight: 600;
    text-decoration: none;
}

.menu-toggle {
    display: inline-grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    margin-right: -0.625rem;
    border: 0;
    border-radius: 0.5rem;
    background: none;
    color: inherit;
    cursor: pointer;
}

.menu-toggle .icon {
    width: 1.5rem;
    height: 1.5rem;
}

.menu-toggle[aria-expanded="false"] .icon-close,
.menu-toggle[aria-expanded="true"] .icon-open {
    display: none;
}

/* Download CV: a teal fill sweeps in from the left on hover or focus. */
.site-nav .button {
    position: relative;
    isolation: isolate;
    overflow: hidden;
}

.site-nav .button::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgb(118 171 174 / 0.45);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease-in-out;
}

.site-nav .button:is(:hover, :focus-visible) {
    background: transparent;
    color: #ffffff;
}

.site-nav .button:is(:hover, :focus-visible)::after {
    transform: scaleX(1);
}

.site-nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-nav ul a {
    color: var(--color-muted);
    text-decoration: none;
    transition: color 0.2s;
}

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

@media (width < 48rem) {
    /* The data-nav attribute is only set once the script runs, so without
       JavaScript the links simply stay visible in the header. */
    .site-header[data-nav] .site-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        padding: 0.5rem 1.25rem 1.25rem;
        border-bottom: 1px solid var(--color-line);
        background: var(--color-bg);
    }

    .site-header[data-nav="closed"] .site-nav {
        display: none;
    }

    .site-nav ul a {
        display: block;
        padding-block: 0.75rem;
        font-size: 1.125rem;
    }

    .site-nav .button {
        width: 100%;
        margin-top: 0.75rem;
    }
}

@media (width >= 48rem) {
    .menu-toggle {
        display: none;
    }

    .site-nav,
    .site-nav ul {
        display: flex;
        align-items: center;
        gap: 2rem;
    }

    .site-nav ul {
        gap: 1.75rem;
    }

    .site-nav ul a {
        position: relative;
        padding-block: 0.25rem;
    }

    .site-nav ul a::after {
        content: "";
        position: absolute;
        right: 0;
        bottom: -2px;
        left: 0;
        height: 2px;
        background: var(--color-accent);
        transform: scaleX(0);
        transform-origin: left;
        transition: transform 0.25s var(--ease);
    }

    .site-nav ul a:is(:hover, [aria-current="true"])::after {
        transform: scaleX(1);
    }
}

/* ── Sections ───────────────────────────────────────────────────────────── */
.section {
    padding-block: clamp(4rem, 10vw, 7rem);
}

.section-title {
    margin-bottom: 1.5rem;
    color: var(--color-accent);
    font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
    font-weight: 600;
    line-height: 1.15;
}

.section-lead {
    max-width: 40rem;
    margin-top: -0.75rem;
    margin-bottom: 2.5rem;
    color: var(--color-muted);
}

.subheading {
    margin: 2rem 0 0.75rem;
    color: var(--color-muted);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 500;
}

/* ── Hero ───────────────────────────────────────────────────────────────── */
.hero {
    display: grid;
    align-items: center;
    min-height: calc(100svh - var(--header-height));
    padding-block: 4rem;
}

.eyebrow {
    margin-bottom: 0.75rem;
    color: var(--color-accent);
    font-family: var(--font-mono);
    font-size: 0.9375rem;
}

.hero h1 {
    font-size: clamp(2.125rem, 1rem + 5.5vw, 5rem);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.hero-tagline {
    min-height: 2.4em;
    margin-top: 0.5rem;
    color: var(--color-muted);
    font-size: clamp(1.5rem, 1rem + 2.5vw, 2.75rem);
    font-weight: 600;
    line-height: 1.2;
}

.typewriter::after {
    content: "";
    display: inline-block;
    width: 0.07em;
    height: 0.9em;
    margin-left: 0.08em;
    background: var(--color-accent);
    vertical-align: -0.08em;
    animation: blink 1s steps(1) infinite;
}

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

.hero-lead {
    max-width: 36rem;
    margin-top: 1rem;
    color: var(--color-muted);
    font-size: 1.125rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2rem;
}

@media (width >= 48rem) {
    .hero-tagline {
        min-height: 1.2em;
    }
}

/* ── About ──────────────────────────────────────────────────────────────── */
.about {
    display: grid;
    align-items: center;
    gap: 2.5rem;
}

.about-text p {
    max-width: 38rem;
}

.about-text p + p {
    margin-top: 1rem;
}

.about-photo {
    width: min(100%, 14rem);
    aspect-ratio: 1;
    object-fit: cover;
    border: 1px solid var(--color-line);
    border-radius: 1.25rem;
}

@media (width >= 48rem) {
    .about {
        grid-template-columns: 1fr auto;
        gap: 4rem;
    }

    .about-photo {
        width: 18rem;
    }
}

/* ── Projects ───────────────────────────────────────────────────────────── */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
    gap: 1.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.project-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border: 1px solid var(--color-line);
    border-radius: var(--radius);
    background: var(--color-surface);
    transition: transform 0.25s var(--ease), border-color 0.25s;
}

.project-card:hover {
    border-color: rgb(118 171 174 / 0.5);
    transform: translateY(-4px);
}

.project-card img {
    width: 100%;
    aspect-ratio: 8 / 5;
    object-fit: cover;
}

.project-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem;
}

.project-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.project-body > p:not(.project-links) {
    color: var(--color-muted);
}

.project-links {
    display: flex;
    gap: 1.25rem;
    margin-top: auto;
    padding-top: 0.5rem;
}

.project-links a {
    color: var(--color-accent);
    font-weight: 500;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

.project-links a:hover {
    color: var(--color-accent-strong);
}

/* ── Experience ─────────────────────────────────────────────────────────── */
.timeline {
    max-width: 44rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.timeline-item {
    position: relative;
    padding-bottom: 2.5rem;
    padding-left: 2rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

/* Dot */
.timeline-item::before {
    content: "";
    position: absolute;
    top: 0.3rem;
    left: 0;
    width: 0.75rem;
    height: 0.75rem;
    border: 2px solid var(--color-accent);
    border-radius: 50%;
    background: var(--color-bg);
}

/* The most recent role gets a filled dot. */
.timeline-item:first-child::before {
    background: var(--color-accent);
}

/* Line down to the next dot */
.timeline-item:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 1.35rem;
    bottom: 0.3rem;
    left: calc(0.375rem - 1px);
    width: 2px;
    background: var(--color-line);
}

.timeline-date {
    color: var(--color-accent);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
}

.timeline-role {
    margin-top: 0.25rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.timeline-org {
    color: var(--color-muted);
    font-weight: 400;
}

.timeline-item > p:last-child {
    margin-top: 0.5rem;
    color: var(--color-muted);
}

/* ── Contact ────────────────────────────────────────────────────────────── */
.contact {
    text-align: center;
}

.contact .section-lead {
    margin-inline: auto;
}

.contact-list {
    display: grid;
    justify-items: center;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    /* The email address is long enough to overflow a narrow phone, so the
       type scales down below ~375px and holds at 18px above it. */
    font-size: clamp(1rem, 0.2725rem + 3.64vw, 1.125rem);
    list-style: none;
}

.contact-list a {
    text-decoration: none;
    /* Last resort: an address with nowhere to break must not widen the page. */
    overflow-wrap: anywhere;
}

.contact-list a:hover {
    color: var(--color-accent);
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.social {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin: 1.5rem 0 0;
    padding: 0;
    list-style: none;
}

.social a {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border: 1px solid var(--color-line);
    border-radius: 50%;
    color: var(--color-accent);
    transition: background-color 0.2s, border-color 0.2s;
}

.social a:hover {
    border-color: var(--color-accent);
    background: var(--color-accent-wash);
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
    padding-block: 1.5rem;
    border-top: 1px solid var(--color-line);
    color: var(--color-muted);
    font-size: 0.875rem;
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1rem;
}

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

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

    .blob,
    .typewriter::after {
        animation: none;
    }

    .site-nav .button::after {
        transition: none;
    }

    .project-card:hover {
        transform: none;
    }
}
