:root {
    --paper: #eaf2f8;
    --ink: #1f2d3d;
    --quiet-ink: #66788a;
    --accent: #3b7bb8;
    --line: #1f2d3d30;
    --fine-line: #1f2d3d1f;
    --sans: "DM Sans", system-ui, sans-serif;
    --serif: "Newsreader", Georgia, serif;
    --width: min(100% - 80px, 1320px);
}

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

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--serif);
    -webkit-font-smoothing: antialiased;
    overflow-x: clip;
}

a { color: inherit; text-decoration: none; }

a:focus-visible, button:focus-visible, img:focus-visible {
    outline: 1px solid var(--ink);
    outline-offset: 5px;
}

.container { width: var(--width); margin: 0 auto; }

/* ── Top bar ── */
.topbar { position: relative; z-index: 10; padding-top: 27px; }

.topbar-inner {
    width: var(--width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.brand { font: 500 18px/1 var(--serif); }

.nav-links {
    display: flex;
    gap: 27px;
    color: var(--quiet-ink);
    font: 400 12px/1 var(--sans);
}

.nav-links a { transition: color .2s; }
.nav-links a:hover { color: var(--accent); }

.nav-toggle {
    display: none;
    padding: 3px;
    border: 0;
    background: none;
    color: var(--ink);
    cursor: pointer;
}

/* ── Hero ── */
.hero {
    position: relative;
    min-height: 540px;
    padding: 108px 0 110px;
}

.hero-copy { position: relative; z-index: 1; max-width: 560px; }

.hero h1 {
    margin: 0 0 26px;
    font: 400 clamp(3.5rem, 7vw, 6.35rem)/.94 var(--serif);
    letter-spacing: -.045em;
}

.hero-plate {
    position: absolute;
    top: 104px;
    right: 0;
    width: 50%;
    max-width: 640px;
    margin: 0;
}

.hero-plate img {
    display: block;
    width: 100%;
    height: auto;
}

.lede {
    max-width: 505px;
    margin: 0;
    color: var(--quiet-ink);
    font: 400 18px/1.48 var(--serif);
}

.lede-follow-up { margin-top: 16px; }

/* ── Sections ── */
.section { padding: 95px 0 110px; }
.section-rule { border-top: 1px solid var(--line); }
.section-heading { margin-bottom: 42px; }

.section-heading h2 {
    margin: 0;
    font: 400 clamp(2.65rem, 5vw, 4.4rem)/.95 var(--serif);
    letter-spacing: -.04em;
}

/* ── Projects ── */
#projects .section-heading {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px 40px;
}

.project-filters { display: flex; flex-wrap: wrap; gap: 8px; }

.filter-btn {
    padding: 8px 15px;
    border: 1.5px solid #3b7bb84d;
    border-radius: 8px;
    background: #ffffff80;
    color: var(--quiet-ink);
    font: 400 12px/1 var(--sans);
    cursor: pointer;
    transition: color .2s, border-color .2s, background .2s;
}

.filter-btn:hover { color: var(--accent); border-color: var(--accent); }
.filter-btn[aria-pressed="true"] { background: #3b7bb81f; border-color: var(--accent); color: var(--accent); }
.filter-btn[hidden] { display: none; }

.row-list { border-top: 1px solid var(--line); }
.project-row[hidden] { display: none; }
.project-row.is-filtered-in { animation: filter-in .4s ease-out both; }

@keyframes filter-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.project-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 40px;
    padding: 28px 0 30px;
    border-bottom: 1px solid var(--line);
}

.project-title {
    margin: 0;
    font: 400 27px/1.1 var(--serif);
    letter-spacing: -.025em;
}

.project-meta { margin: 5px 0 0; font: 500 13px/1.3 var(--sans); }

.project-description {
    max-width: 760px;
    margin: 13px 0 0;
    color: var(--quiet-ink);
    font: 400 16px/1.45 var(--serif);
}

.project-title a { transition: color .2s; }
.project-title a:hover { color: var(--accent); }

.project-links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 14px; }

.project-link {
    display: inline-block;
    color: var(--accent);
    font: 400 12px/1 var(--sans);
    border-bottom: 1px solid currentColor;
    padding-bottom: 2px;
}

.project-link:hover { color: var(--ink); }

.project-media { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-self: start; }

.project-media img, .project-media video {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 4px;
    background: var(--fine-line);
}

.project-media [role="button"] { cursor: zoom-in; }
.project-media:not(.is-wide) img, .project-media video { aspect-ratio: 3 / 4; object-fit: cover; }
.project-media.is-wide img { aspect-ratio: 4 / 3; object-fit: cover; object-position: left top; }

/* ── Project pages ── */
.post { max-width: 760px; padding: 72px 0 96px; }

.post-back {
    display: inline-block;
    margin-bottom: 44px;
    color: var(--quiet-ink);
    font: 400 12px/1 var(--sans);
    transition: color .2s;
}

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

.post-header h1 {
    margin: 0;
    font: 400 clamp(2.6rem, 6vw, 4.4rem)/.98 var(--serif);
    letter-spacing: -.04em;
}

.post-header .project-meta { margin-top: 14px; }

.post-lede {
    margin: 20px 0 0;
    color: var(--quiet-ink);
    font: 400 20px/1.45 var(--serif);
}

.post-gallery { margin: 44px 0 0; }
.post-gallery.is-wide { grid-template-columns: 1fr; }
.post-gallery.is-wide img { aspect-ratio: auto; }

.post-body { margin-top: 20px; font: 400 18px/1.65 var(--serif); }

.post-body h2 {
    margin: 52px 0 12px;
    font: 400 30px/1.1 var(--serif);
    letter-spacing: -.025em;
}

.post-body p, .post-body ul, .post-body ol { margin: 0 0 18px; }
.post-body li { margin-bottom: 6px; }
.post-body strong { font-weight: 500; }
.post-body a { color: var(--accent); border-bottom: 1px solid currentColor; }
.post-body a:hover { color: var(--ink); }

.post-body code {
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--fine-line);
    font-size: .88em;
}

.post-body figure { margin: 32px 0; }
.post-body figure img { display: block; width: 100%; height: auto; border-radius: 4px; }

.post-body figcaption {
    margin-top: 8px;
    color: var(--quiet-ink);
    font: 400 12px/1.4 var(--sans);
}

.post-pager {
    max-width: 760px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 26px 0 30px;
    border-top: 1px solid var(--line);
}

.post-pager a { display: block; transition: color .2s; }
.post-pager a:hover { color: var(--accent); }
.post-pager .is-next { grid-column: 2; text-align: right; }

.post-pager span {
    display: block;
    margin-bottom: 6px;
    color: var(--quiet-ink);
    font: 400 11px/1 var(--sans);
}

.post-pager strong { font: 400 21px/1.2 var(--serif); letter-spacing: -.02em; }

/* ── Footer ── */
.footer { padding: 23px 0 27px; border-top: 1px solid var(--line); color: var(--quiet-ink); }

.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    font: 400 10px/1.2 var(--sans);
    letter-spacing: .04em;
}

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

/* ── Lightbox ── */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #1f2d3de6;
}

.lightbox[hidden] { display: none; }

.lightbox-img { max-width: 100%; max-height: 90vh; border-radius: 4px; }
.lightbox-img[hidden], .lightbox-nav[hidden] { display: none; }
video.lightbox-img { width: auto; height: 90vh; aspect-ratio: 9 / 16; background: #000; }

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    border: 0;
    background: none;
    color: var(--paper);
    font-size: 32px;
    cursor: pointer;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: #ffffff1f;
    color: var(--paper);
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    transition: background .2s;
}

.lightbox-nav:hover,
.lightbox-nav:focus-visible { background: #ffffff40; }
.lightbox-nav.is-prev { left: 16px; }
.lightbox-nav.is-next { right: 16px; }

/* ── Reveal ── */
.reveal { opacity: 0; transform: translateY(13px); transition: opacity .7s, transform .7s; }
.reveal.is-visible { opacity: 1; transform: none; }
.delay-1 { transition-delay: .1s; }
.delay-2 { transition-delay: .2s; }

/* ── Responsive ── */
@media (max-width: 1000px) {
    .hero { display: flex; flex-direction: column; min-height: 0; padding-bottom: 76px; }
    .hero-plate { position: static; order: 1; width: 100%; max-width: 645px; margin-top: 40px; }
}

@media (max-width: 760px) {
    :root { --width: min(100% - 32px, 1320px); }
    .topbar { padding-top: 22px; }
    .nav-toggle { display: block; }

    .nav-links {
        position: absolute;
        top: 57px;
        left: 16px;
        right: 16px;
        display: none;
        flex-direction: column;
        gap: 0;
        padding: 8px 14px;
        border: 1px solid var(--line);
        background: var(--paper);
    }

    .nav-links.is-open { display: flex; }
    .nav-links a { padding: 12px 0; border-bottom: 1px solid var(--fine-line); }
    .nav-links a:last-child { border-bottom: 0; }

    .hero { padding-top: 102px; }
    .hero h1 { font-size: clamp(3.4rem, 15vw, 5.2rem); }
    .section { padding: 76px 0; }
    .section-heading { margin-bottom: 32px; }
    .project-row { grid-template-columns: 1fr; gap: 20px; padding: 23px 0 26px; }
    .project-title { font-size: 24px; }
    .project-description { font-size: 15px; }
    .post { padding: 56px 0 72px; }
    .post-back { margin-bottom: 32px; }
    .post-lede { font-size: 18px; }
    .post-body { font-size: 17px; }
    .post-body h2 { margin-top: 40px; font-size: 26px; }
    .post-pager strong { font-size: 18px; }
    .footer-inner { flex-direction: column; gap: 11px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; transition: none; }
    .project-row.is-filtered-in { animation: none; }
}
