/*
 * One stylesheet, no framework. The site is light by design, so the tokens are
 * declared once on :root and there is no dark branch to keep in step.
 */
:root {
    --bg: #ffffff;
    --hero-top: #eaf1fe;
    --band: #f4f7fc;
    --surface: #ffffff;
    --surface-2: #eef1f7;
    --text: #0d1526;
    --muted: #596274;
    --border: #e1e6ef;
    --accent: #2f6bff;
    --accent-hi: #1b4fd8;
    --shadow: 0 1px 2px rgb(13 21 38 / .04), 0 8px 24px rgb(13 21 38 / .06);
    --radius: 12px;
    --shell: 76rem;
    --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --display: 'Poppins', var(--font);
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

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

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

.shell { width: 100%; max-width: var(--shell); margin-inline: auto; padding-inline: 1.5rem; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }

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

h1, h2, h3 { font-family: var(--display); line-height: 1.12; letter-spacing: -.02em; margin: 0; }

.display { font-size: clamp(1.9rem, 3.6vw, 2.9rem); font-weight: 700; }
.eyebrow {
    font-size: .78rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase;
    color: var(--muted); margin: 0 0 .75rem;
}
.eyebrow span { color: var(--accent); margin-right: .4rem; }
.label {
    font-size: .76rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase;
    color: var(--text); margin: 0 0 .7rem;
}
.lede { color: var(--muted); }
.body-copy { color: var(--muted); margin: 0 0 1.1rem; max-width: 46ch; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus {
    left: 1rem; top: 1rem; z-index: 50; padding: .6rem .9rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}

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

/* ---------- header ---------- */

.site-header {
    position: sticky; top: 0; z-index: 40;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.site-header .bar { padding-block: 1.1rem; }
.brand {
    display: inline-flex; align-items: center; gap: .6rem;
    font-family: var(--display); font-weight: 700; font-size: 1.15rem;
    color: var(--text); text-decoration: none; white-space: nowrap;
}
.brand-mark { color: var(--accent); font-family: var(--mono); font-size: 1.05rem; }

.site-header nav { display: flex; gap: 2rem; margin-left: auto; }
.site-header nav a {
    color: var(--muted); text-decoration: none; font-size: .95rem; font-weight: 500;
}
.site-header nav a:hover { color: var(--text); }
.site-header nav a[aria-current="page"] { color: var(--text); font-weight: 600; }

.menu-toggle {
    display: none;
    flex-direction: column; justify-content: center; gap: 5px;
    width: 44px; height: 44px; padding: 0;
    background: none; border: 0; cursor: pointer;
}
.menu-toggle span { display: block; height: 2px; width: 26px; background: var(--text); transition: transform .2s, opacity .2s; }
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- hero ---------- */

.hero {
    position: relative; overflow: hidden;
    background: linear-gradient(180deg, var(--hero-top) 0%, var(--bg) 82%);
}
.hero-main {
    display: grid;
    /* The portrait is capped at 20rem, so spare width goes to the headline. */
    grid-template-columns: minmax(0, 1.3fr) minmax(0, .7fr);
    gap: 3rem;
    align-items: center;
    min-height: min(560px, 68vh);
    padding-block: 4rem 3.5rem;
}
.hero-copy { align-self: center; }
.rule { display: block; width: 8rem; height: 4px; background: var(--accent); margin-bottom: 2rem; }
.hero-copy h1 { font-size: clamp(2rem, 3.8vw, 3.1rem); font-weight: 800; text-wrap: balance; }
.hero-strong { display: inline-block; }
.hero-copy .lede { margin: 1.5rem 0 0; max-width: 34ch; }

.scroll-cue {
    display: grid; place-items: center;
    width: 76px; height: 76px; margin-top: 2.5rem;
    background: var(--accent); border-radius: 50%;
    transition: transform .2s, background .2s;
}
.scroll-cue svg { width: 30px; height: 30px; fill: none; stroke: #fff; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.scroll-cue:hover { background: var(--accent-hi); transform: translateY(3px); }

/*
 * The portrait is a normal photograph with its own background, not a cut-out,
 * so it is presented as a framed panel rather than floated against the page.
 * The accent block behind it gives the hero its diagonal weight.
 */
.hero-figure {
    position: relative;
    margin: 0 auto;
    /*
     * Capped so a 400px source is never upscaled: at 20rem the 4/5 frame is
     * 320x400, which uses the image at its native height exactly.
     */
    max-width: 20rem;
}
.hero-figure::before {
    content: '';
    position: absolute;
    inset: 2.4rem -1.9rem -1.9rem 2.4rem;
    border-radius: 18px;
    background: var(--accent);
    opacity: .16;
}
/*
 * Sized from the container, never from the image, so the hero keeps its
 * proportions whatever is dropped in. A source image that is not already
 * portrait is cropped rather than letterboxed; the focal point sits high
 * because that is where a face is.
 */
.hero-figure img {
    position: relative;
    display: block;
    width: 100%; height: auto;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    object-position: 50% 22%;
    border-radius: 18px;
    box-shadow: 0 18px 40px rgb(13 21 38 / .18);
}

/* The rail runs across the foot of the hero, divided by vertical hairlines. */
.hero-rail {
    display: grid;
    /* The third column holds only icons, so it does not need equal width. */
    grid-template-columns: 1fr 1fr .75fr;
    border-top: 1px solid var(--border);
    padding-block: 2.75rem 3.5rem;
}
.rail-block { padding-inline: 2.5rem; }
.rail-block:first-child { padding-left: 0; }
.rail-block:last-child { padding-right: 0; }
.rail-block + .rail-block { border-left: 1px solid var(--border); }
.rail-block p { color: var(--muted); font-size: .95rem; margin: 0 0 1rem; }

.arrow-link {
    display: inline-flex; align-items: center; gap: .5rem;
    font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
    color: var(--text); text-decoration: none;
    border-bottom: 2px solid var(--accent); padding-bottom: .25rem;
}
.arrow-link:hover { color: var(--accent-hi); }

.socials { display: flex; flex-wrap: wrap; gap: 1.1rem; list-style: none; margin: 0; padding: 0; }
.socials a { display: grid; place-items: center; width: 24px; height: 24px; color: var(--text); }
.socials svg { width: 20px; height: 20px; fill: currentColor; }
.socials a:hover { color: var(--accent-hi); }

/* ---------- bands & sections ---------- */

.band {
    background: var(--band);
    border-block: 1px solid var(--border);
    padding-block: 5.5rem;
}
.section { padding-block: 5.5rem; }
.page { padding-block: 4.5rem; max-width: 68rem; }

.about-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 4rem; align-items: center; }
.about-grid .display { margin-bottom: 1.4rem; }

.button {
    display: inline-block; margin-top: .75rem;
    padding: .85rem 1.6rem; border-radius: 999px;
    background: var(--accent); color: #fff; text-decoration: none;
    font-weight: 600; font-size: .95rem;
}
.button:hover { background: var(--accent-hi); }

.stats { list-style: none; margin: 0; padding: 0; display: grid; gap: 2rem; }
.stat-value { display: block; font-family: var(--display); font-size: clamp(2.6rem, 5vw, 3.6rem); font-weight: 800; line-height: 1; }
.stat-value em { color: var(--accent); font-style: normal; }
.stat-label { display: block; margin-top: .4rem; color: var(--muted); font-size: .9rem; }

.section-head {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem;
    margin-bottom: 2.5rem;
}
.page-head { margin-bottom: 2.5rem; }
.page-head h1 { font-size: clamp(2rem, 4.5vw, 3rem); font-weight: 800; }
.page-head .lede { margin: .75rem 0 0; }

.meta { color: var(--muted); font-size: .85rem; margin: .4rem 0 .7rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.badge {
    font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
    padding: .15rem .5rem; border-radius: 4px;
    background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent-hi);
}
.empty { color: var(--muted); }
.back { margin-top: 3rem; font-size: .95rem; }
.back a { text-decoration: none; }
.back a:hover { text-decoration: underline; }

/* ---------- projects ---------- */

.project-grid {
    list-style: none; margin: 0; padding: 0;
    display: grid; gap: 1.25rem;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
}
.project-card article {
    height: 100%; display: flex; flex-direction: column;
    padding: 1.6rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: border-color .2s, transform .2s, box-shadow .2s;
}
.project-card:hover article {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 2px 4px rgb(13 21 38 / .05), 0 16px 34px rgb(47 107 255 / .14);
}
.project-card .year { margin: 0 0 .5rem; font-size: .78rem; letter-spacing: .12em; color: var(--accent); font-variant-numeric: tabular-nums; }
.project-card h3 { font-size: 1.2rem; margin-bottom: .5rem; }
.project-card h3 a { color: var(--text); text-decoration: none; }
.project-card p { margin: 0; color: var(--muted); font-size: .94rem; }
.stack { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; margin: 1.2rem 0 0; padding: 0; }
.stack li {
    font-size: .74rem; color: var(--muted);
    padding: .2rem .55rem; border: 1px solid var(--border); border-radius: 999px;
}

.facts { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1.5rem; margin: 2rem 0 0; font-size: .95rem; }
.facts dt { color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; padding-top: .18rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- blog ---------- */

.post-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; }
.post-item article {
    padding: 1.6rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: border-color .2s, box-shadow .2s;
}
.post-item:hover article {
    border-color: var(--accent);
    box-shadow: 0 2px 4px rgb(13 21 38 / .05), 0 16px 34px rgb(47 107 255 / .12);
}
.post-item h3 { font-size: 1.25rem; }
.post-item h3 a { color: var(--text); text-decoration: none; }
.post-item p:last-child { margin: 0; color: var(--muted); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2.5rem; }
.tag-cloud a, .tag-row a {
    font-size: .85rem; text-decoration: none;
    padding: .3rem .8rem; border: 1px solid var(--border); border-radius: 999px;
    color: var(--muted);
}
.tag-cloud a:hover, .tag-row a:hover { border-color: var(--accent); color: var(--text); }
.tag-cloud a.is-current { background: var(--accent); border-color: var(--accent); color: #fff; }
.tag-cloud span { opacity: .6; }
.tag-row { display: flex; flex-wrap: wrap; gap: .45rem; margin: 1rem 0 0; }

/* ---------- long-form ---------- */

.prose { max-width: 44rem; }
.prose h2 { margin: 3rem 0 .9rem; font-size: 1.6rem; }
.prose h3 { margin: 2.2rem 0 .6rem; font-size: 1.25rem; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.25rem; color: #3d4557; }
.prose li + li { margin-top: .35rem; }
.prose strong { color: var(--text); }
.prose img { border-radius: var(--radius); height: auto; }
.prose blockquote {
    margin: 1.75rem 0; padding: .3rem 0 .3rem 1.25rem;
    border-left: 3px solid var(--accent); color: var(--muted);
}
.prose code {
    font-family: var(--mono); font-size: .86em;
    background: var(--surface-2); color: #16203a;
    padding: .15rem .4rem; border-radius: 5px;
}
.prose pre {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.1rem; overflow-x: auto;
}
.prose pre code { background: none; padding: 0; font-size: .85rem; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 1.25rem; font-size: .94rem; }
.prose th, .prose td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--border); }
.prose th { color: var(--text); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 3rem 0; }

/* ---------- footer ---------- */

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; }
.site-footer .bar { padding-block: 2rem; flex-wrap: wrap; }
.site-footer p { margin: 0; }
.footer-right { display: flex; align-items: center; gap: 1.5rem; }
.feed-link { color: var(--muted); text-decoration: none; }
.feed-link:hover { color: var(--text); }

/* ---------- responsive ---------- */

/*
 * Below the hero's two-column width the top half becomes a single stack in DOM
 * order (copy, portrait). No grid-column/grid-row placement here: an explicit
 * span left over from a wider breakpoint silently collapsed the portrait to
 * nothing once the grid dropped to one column.
 */
@media (max-width: 1080px) {
    .hero-main {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        min-height: 0;
        padding-block: 3.5rem 3rem;
    }
    .hero-rail { gap: 0; }
    .rail-block { padding-inline: 1.75rem; }

    .about-grid { grid-template-columns: 1fr; gap: 3rem; }
    .stats { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
}

@media (max-width: 760px) {
    .menu-toggle { display: flex; }
    .site-header nav {
        display: none;
        position: absolute; left: 0; right: 0; top: 100%;
        flex-direction: column; gap: 0;
        padding: .5rem 1.5rem 1.25rem;
        background: var(--bg); border-bottom: 1px solid var(--border);
    }
    .site-header nav.is-open { display: flex; }
    .site-header nav a { padding-block: .7rem; }

    .hero-figure { max-width: 17rem; }
    .scroll-cue { width: 62px; height: 62px; margin-top: 2rem; }

    /* Stacked, the dividers go back to being horizontal. */
    .hero-rail { grid-template-columns: 1fr; padding-block: 2.25rem 3rem; }
    .rail-block { padding-inline: 0; }
    .rail-block + .rail-block {
        border-left: 0;
        border-top: 1px solid var(--border);
        margin-top: 1.75rem; padding-top: 1.75rem;
    }

    .band, .section { padding-block: 3.5rem; }
    .page { padding-block: 3rem; }
    .section-head { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .stats { grid-template-columns: 1fr; gap: 1.75rem; }
    .facts { grid-template-columns: 1fr; gap: .15rem; }
    .facts dt { margin-top: .75rem; }
}
