/* =========================
   FONTS (self-hosted, latin subset, variable)
========================= */

@font-face {
    font-family: 'Newsreader';
    src: url('assets/fonts/newsreader-latin.woff2') format('woff2');
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
    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: 'Hanken Grotesk';
    src: url('assets/fonts/hanken-grotesk-latin.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    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;
}

/* =========================
   TOKENS
========================= */

:root {
    --paper: #F6F5F1;
    --ink: #1B1D1C;
    --stone: #8A877F;
    --muted: #6B6862;
    --rule: #E2DFD8;
    --slate: #2E474B;

    --serif: 'Newsreader', Georgia, serif;
    --sans: 'Hanken Grotesk', system-ui, sans-serif;

    --gutter: clamp(20px, 3vw, 40px);
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 72px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.6;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

a:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--slate);
    outline-offset: 4px;
}

/* on the dark hero photo a slate outline disappears */
.hero a:focus-visible,
.topbar:not(.scrolled) a:focus-visible {
    outline-color: #fff;
}

/* =========================
   TOPBAR
========================= */

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 64px;

    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 var(--gutter);

    color: #fff;
    background: transparent;
    transition: background 0.3s ease, color 0.3s ease;
    z-index: 999;
}

.topbar.scrolled {
    color: var(--ink);
    background: var(--paper);
    box-shadow: 0 1px 0 var(--rule);
}

.nav {
    display: flex;
    gap: 22px;
}

.nav-right {
    justify-content: flex-end;
}

.nav a,
.mobile-nav a {
    text-decoration: none;
    font-size: 0.9rem;
}

/* comfortable 24px+ targets without changing the look */
.nav a:not(.nav-cta) {
    padding: 6px 0;
}

.nav a:hover {
    text-decoration: underline;
    text-underline-offset: 5px;
    text-decoration-thickness: 1px;
}

.logo {
    font-family: var(--serif);
    font-size: 1.15rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    text-decoration: none;
}

/* icon on mobile, wordmark on desktop */
.logo img {
    display: none;
    width: 30px;
    height: auto;
    transition: filter 0.3s ease;
}

/* the icon is white: darken it on the light topbar */
.topbar.scrolled .logo img {
    filter: invert(1);
}

/* =========================
   MOBILE NAV
========================= */

/* visually hidden but still keyboard-focusable */
#menu-toggle {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

#menu-toggle:focus-visible ~ .topbar .hamburger {
    outline: 2px solid var(--slate);
    outline-offset: 6px;
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 6px;
    justify-self: end;
    padding: 8px 0;
    cursor: pointer;
}

.hamburger span {
    width: 22px;
    height: 1px;
    background: currentColor;
    transition: transform 0.2s ease;
}

#menu-toggle:checked ~ .topbar .hamburger span:first-child {
    transform: translateY(3.5px) rotate(45deg);
}

#menu-toggle:checked ~ .topbar .hamburger span:last-child {
    transform: translateY(-3.5px) rotate(-45deg);
}

.mobile-nav {
    display: none;
    position: fixed;
    inset: 64px 0 0 0;
    flex-direction: column;
    padding: 24px var(--gutter);
    background: var(--paper);
    z-index: 998;
}

.mobile-nav a {
    font-family: var(--serif);
    font-size: 2rem;
    font-weight: 300;
    padding: 6px 0;
}

/* =========================
   HERO
========================= */

.hero {
    position: relative;
    height: 100vh;
    height: 100svh;
    min-height: 560px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    padding: 0 var(--gutter);

    text-align: center;
    color: #fff;
    background:
        linear-gradient(rgba(20, 24, 24, 0.45), rgba(20, 24, 24, 0.55)),
        url('assets/img/hero-1920.webp')
        center/cover no-repeat #2a2f2f;
}

/* portrait crop at half the weight for phones */
@media (max-width: 820px) {
    .hero {
        background-image:
            linear-gradient(rgba(20, 24, 24, 0.45), rgba(20, 24, 24, 0.55)),
            url('assets/img/hero-960.webp');
    }
}

.hero-name {
    font-family: var(--serif);
    font-weight: 300;
    font-size: clamp(2.6rem, 7vw, 5.2rem);
    line-height: 1.02;
    letter-spacing: 0.06em;
    text-transform: uppercase;

    animation: settle 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero-role {
    font-size: 0.95rem;
    opacity: 0.85;

    animation: fade 1.6s ease 0.4s both;
}

/* the one orchestrated moment: name settles in from a soft blur.
   No opacity: 0 start, so the name paints immediately and LCP isn't delayed. */
@keyframes settle {
    from {
        filter: blur(6px);
        letter-spacing: 0.14em;
    }
}

@keyframes fade {
    from { opacity: 0; }
}

/* =========================
   LAYOUT
========================= */

main {
    padding: 0 var(--gutter);
}

.row {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    column-gap: var(--gutter);
    padding: clamp(72px, 11vw, 150px) 0;
    border-top: 1px solid var(--rule);
}

.row:first-child {
    border-top: 0;
}

.label {
    grid-column: 1 / span 3;
    font-family: var(--sans);
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--muted);
    padding-top: 0.6em;
}

.label h2 {
    font: inherit;
}

.label-note {
    margin-top: 10px;
    max-width: 22ch;
    color: var(--muted);
}

.content {
    grid-column: 4 / -1;
    max-width: 62rem;
}

/* =========================
   STATEMENTS & PROSE
========================= */

.statement {
    font-family: var(--serif);
    font-weight: 300;
    font-size: clamp(1.9rem, 4.2vw, 3.4rem);
    line-height: 1.16;
    color: var(--stone);
    max-width: 30ch;
}

.prose {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gutter);
    margin-top: clamp(48px, 6vw, 80px);
    max-width: 52rem;
}

.prose p,
.entry-body p {
    font-family: var(--serif);
    font-size: 1.12rem;
    line-height: 1.6;
    max-width: 34em;
}

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 28px;
    margin-top: 48px;
}

.links a {
    padding: 5px 0;
    font-size: 0.9rem;
    text-decoration: underline;
    text-underline-offset: 6px;
    text-decoration-thickness: 1px;
    text-decoration-color: var(--stone);
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.links a:hover {
    color: var(--slate);
    text-decoration-color: var(--slate);
}

.hero-links {
    justify-content: center;
    margin-top: 18px;
    animation: fade 1.6s ease 0.6s both;
}

.hero-links a {
    text-decoration-color: rgba(255, 255, 255, 0.55);
}

.hero-links a:hover {
    color: #fff;
    text-decoration-color: #fff;
}

/* the one prominent CTA in the bar: same type, just boxed */
/* fixed height + flex centering: the font's line box sits high, so padding alone looked off-centre */
.nav .nav-cta {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 16px;
    line-height: 1;
    border: 1px solid currentColor;
    border-radius: 999px;
}

.nav .nav-cta:hover {
    text-decoration: none;
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
}

.contact-email {
    display: inline-block;
    margin-top: 40px;
    font-family: var(--serif);
    font-weight: 300;
    font-size: clamp(1.4rem, 3.2vw, 2.4rem);
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 8px;
    text-decoration-thickness: 1px;
    overflow-wrap: anywhere;
    transition: color 0.2s ease;
}

.contact-email:hover {
    color: var(--slate);
}

.contact-note {
    margin-top: 20px;
    max-width: 46ch;
    color: var(--muted);
}

/* =========================
   TOOLKIT
========================= */

.tool-group {
    padding: 22px 0;
    border-bottom: 1px solid var(--rule);
}

.tool-group:first-child {
    padding-top: 0;
}

.tool-group dt {
    font-family: var(--serif);
    font-weight: 300;
    font-size: clamp(1.7rem, 3.2vw, 2.5rem);
    line-height: 1.15;
}

.tool-group sup {
    font-family: var(--sans);
    font-size: 0.8rem;
    color: var(--muted);
    vertical-align: top;
    margin-right: 10px;
    position: relative;
    top: 0.5em;
}

.tool-group dd {
    margin-top: 8px;
    color: var(--muted);
    max-width: 60ch;
}

/* =========================
   SERVICES
========================= */

.services {
    list-style: none;
    columns: 2;
    column-gap: var(--gutter);
}

.services li {
    font-family: var(--serif);
    font-weight: 300;
    font-size: clamp(1.3rem, 2.1vw, 1.7rem);
    line-height: 1.25;
    padding-bottom: 0.5em;
    break-inside: avoid;
}

/* =========================
   ENTRIES (projects, experience, education)
========================= */

.entry {
    border-bottom: 1px solid var(--rule);
}

.entry:first-child {
    border-top: 1px solid var(--rule);
}

.entry summary,
.entry-head {
    display: grid;
    grid-template-columns: 9rem 1fr auto;
    align-items: baseline;
    column-gap: 20px;
    padding: 22px 0;
}

.entry summary {
    list-style: none;
    cursor: pointer;
}

.entry summary::-webkit-details-marker {
    display: none;
}

.entry summary::after {
    content: '+';
    grid-column: 3;
    grid-row: 1;
    font-size: 1.3rem;
    font-weight: 300;
    color: var(--muted);
    transition: transform 0.25s ease;
}

.entry[open] summary::after {
    transform: rotate(45deg);
}

.entry-years {
    grid-column: 1;
    font-size: 0.88rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.entry-title {
    grid-column: 2;
    font-family: var(--serif);
    font-weight: 300;
    font-size: clamp(1.4rem, 2.6vw, 2rem);
    line-height: 1.2;
    transition: color 0.2s ease;
}

/* project rows have no years: title spans the first two columns */
.entry summary > .entry-title:first-child {
    grid-column: 1 / span 2;
}

.entry summary:hover .entry-title {
    color: var(--slate);
}

.entry-org {
    grid-column: 2;
    font-size: 0.9rem;
    color: var(--muted);
    margin-top: 4px;
}

.entry-body {
    padding: 0 0 32px 0;
    display: grid;
    gap: 16px;
}

.entry-body .stack {
    font-family: var(--sans);
    font-size: 0.88rem;
    color: var(--muted);
}

/* =========================
   404
========================= */

.not-found {
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.not-found .row {
    width: 100%;
    border-top: 0;
}

/* =========================
   FOOTER
========================= */

footer {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 28px var(--gutter);
    border-top: 1px solid var(--rule);
    font-size: 0.85rem;
    color: var(--muted);
}

/* =========================
   RESPONSIVE
========================= */

@media (min-width: 821px) {
    /* no hamburger on desktop, so no invisible tab stop either */
    #menu-toggle {
        display: none;
    }

    .entry-body {
        padding-left: calc(9rem + 20px);
    }

    /* projects have no dates column: keep the body flush with the title */
    .entries-untimed .entry-body {
        padding-left: 0;
    }
}

@media (max-width: 820px) {

    .topbar {
        grid-template-columns: 1fr auto;
    }

    .nav {
        display: none;
    }

    .logo img {
        display: block;
    }

    .logo span {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    #menu-toggle:checked ~ .mobile-nav {
        display: flex;
    }

    .label,
    .content {
        grid-column: 1 / -1;
    }

    .label {
        padding: 0 0 20px;
    }

    .label-note {
        max-width: none;
    }

    .prose {
        grid-template-columns: 1fr;
    }

    .services {
        columns: 1;
    }

    .entry summary,
    .entry-head {
        grid-template-columns: 1fr auto;
    }

    .entry-years {
        grid-column: 1;
        grid-row: 1;
    }

    .entry-title,
    .entry-org,
    .entry summary > .entry-title:first-child {
        grid-column: 1;
    }

    .entry summary::after {
        grid-row: 1 / span 2;
        align-self: center;
    }
}

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

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
