/* ---------- Tokens ---------- */
:root {
  --bg: #ffffff;
  --fg: #0d0d0d;
  --muted: #6b6b6b;
  --line: #e4e4e4;
  --panel: #f4f4f3;
  --ink: #0a0a0a;        /* always-dark surfaces */
  --ink-fg: #f5f5f4;
  --pad: clamp(16px, 4vw, 48px);
  --max: 1320px;
  --display: "Inter Tight", "Inter", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0b;
    --fg: #f2f2f1;
    --muted: #9a9a96;
    --line: #262626;
    --panel: #151515;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 17px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.03em; line-height: 1.02; margin: 0; }

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

.eyebrow {
  font: 500 12px/1 var(--body);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .6em;
  padding: 14px 22px;
  font: 500 15px/1 var(--body);
  text-decoration: none;
  border: 1px solid currentColor;
  transition: background .2s, color .2s;
}
.btn-solid { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn-solid:hover { background: transparent; color: var(--fg); }
.btn-ghost:hover { background: var(--fg); color: var(--bg); }
.on-dark .btn-solid { background: #fff; color: #000; border-color: #fff; }
.on-dark .btn-solid:hover { background: transparent; color: #fff; }
.on-dark .btn-ghost { color: #fff; }
.on-dark .btn-ghost:hover { background: #fff; color: #000; }
.arrow::after { content: "→"; transition: transform .2s; }
a:hover .arrow::after, .arrow:hover::after { transform: translateX(4px); }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  color: #fff;
  transition: background .25s, color .25s, border-color .25s;
  border-bottom: 1px solid transparent;
}
.nav.solid { background: var(--bg); color: var(--fg); border-bottom-color: var(--line); }
.nav .container { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.nav .brand { font: 600 17px/1 var(--display); letter-spacing: -0.01em; text-decoration: none; }
.nav ul { display: flex; gap: clamp(14px, 3vw, 32px); list-style: none; margin: 0; padding: 0; }
.nav ul a { font-size: 14px; text-decoration: none; opacity: .85; }
.nav ul a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 6px; }
@media (max-width: 560px) { .nav .hide-sm { display: none; } }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: max(560px, 100svh);
  display: flex; align-items: flex-end;
  background: var(--ink); color: var(--ink-fg);
  overflow: hidden;
}
.hero.short { min-height: max(460px, 72svh); }
.hero > img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.78) 0%, rgba(0,0,0,.25) 45%, rgba(0,0,0,.15) 100%);
}
.hero .container { position: relative; z-index: 1; width: 100%; padding-bottom: clamp(40px, 8vh, 96px); }
.hero .eyebrow { color: rgba(255,255,255,.7); }
.hero h1 { font-size: clamp(2.6rem, 7.2vw, 6.4rem); margin: 18px 0 22px; max-width: 14ch; }
.hero p.lede { font-size: clamp(1.05rem, 1.6vw, 1.3rem); max-width: 46ch; color: rgba(255,255,255,.85); margin: 0 0 32px; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Home hero: name-first */
.hero h1.hero-name { font-size: clamp(3.6rem, 12.5vw, 11.5rem); line-height: .9; letter-spacing: -0.02em; margin: 20px 0 24px; max-width: none; }
.hero .hero-tagline { font: 500 clamp(1.3rem, 2.4vw, 2rem)/1.2 var(--display); letter-spacing: -0.02em; margin: 0 0 14px; max-width: 34ch; }

/* Home hero photo */
.hero-photo > img { object-position: 70% 35%; }
.hero-photo::after {
  background:
    linear-gradient(to top, rgba(0,0,0,.85) 0%, rgba(0,0,0,.3) 45%, rgba(0,0,0,.15) 100%),
    linear-gradient(to right, rgba(0,0,0,.62) 0%, rgba(0,0,0,.3) 45%, transparent 70%);
}
@media (max-width: 760px) { .hero-photo > img { object-position: 76% 30%; } }


/* Home hero stops short of the fold so the Work heading peeks in. */
.hero.home { min-height: max(560px, 88svh); }

/* ---------- Home sections: Work (cards under the hero) and Projects ---------- */
.glance { padding: clamp(48px, 6vw, 80px) 0 clamp(24px, 3vw, 40px); }
.glance + section.block { border-top: 1px solid var(--line); }
#work, #projects, #about { scroll-margin-top: 64px; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 clamp(20px, 2.5vw, 32px); }
.card { display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.card-img { margin: 0 0 18px; aspect-ratio: 4 / 3; overflow: hidden; background: var(--panel); }
.card-img img {
  display: block; width: 100%; height: 100%; object-fit: cover; object-position: var(--pos, 50% 50%);
  transform: scale(var(--zoom, 1)); transform-origin: var(--origin, 50% 50%);
  transition: transform .6s cubic-bezier(.2,.7,.2,1);
}
.card:hover .card-img img { transform: scale(calc(var(--zoom, 1) * 1.04)); }
.card-meta { display: flex; justify-content: space-between; gap: 12px; }
.card h3 { font-size: clamp(1.2rem, 1.6vw, 1.45rem); letter-spacing: -0.02em; line-height: 1.15; margin: 16px 0 10px; }
.card p { margin: 0 0 20px; color: var(--muted); font-size: 15px; line-height: 1.5; flex: 1; }
.card .arrow { font: 500 14px/1 var(--body); }
.card:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
@media (max-width: 1000px) { .cards { grid-template-columns: repeat(2, 1fr); gap: 40px 24px; } }
@media (max-width: 560px) {
  .cards {
    grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 80%;
    gap: 16px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none;
    margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad);
    scroll-padding: 0 var(--pad);
  }
  .cards::-webkit-scrollbar { display: none; }
  .card { scroll-snap-align: start; }
}

/* ---------- Sections ---------- */
section.block { padding: clamp(72px, 11vw, 150px) 0; }
section.block + section.block { border-top: 1px solid var(--line); }
/* Tighter sections, e.g. the overview line between the two rows of project cards. */
section.block.tight { padding-block: clamp(36px, 4.5vw, 64px); }
section.block.tight-top { padding-top: clamp(36px, 4.5vw, 64px); }

.statement {
  display: grid; grid-template-columns: 1fr 3fr; gap: 24px 48px;
}
.statement p {
  font: 500 clamp(1.5rem, 3vw, 2.5rem)/1.2 var(--display);
  letter-spacing: -0.02em; margin: 0;
}
.statement p .dim { color: var(--muted); }
@media (max-width: 760px) { .statement { grid-template-columns: 1fr; } }

.section-head {
  display: flex; justify-content: space-between; align-items: end; gap: 24px;
  padding-bottom: 28px; margin-bottom: clamp(40px, 6vw, 72px);
  border-bottom: 1px solid var(--fg);
}
.section-head h2 { font-size: clamp(2rem, 4.6vw, 3.6rem); }
.section-head .eyebrow + h2 { margin-top: 14px; }
.head-link { font: 500 15px/1 var(--body); text-decoration: none; white-space: nowrap; padding-bottom: 6px; }
.head-link:hover { text-decoration: underline; text-underline-offset: 6px; }

/* ---------- Mosaic ---------- */
.mosaic {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: clamp(70px, 14vw, 200px);
  gap: 8px;
}
.mosaic figure {
  position: relative; margin: 0; overflow: hidden; background: var(--panel);
  grid-column: span var(--c, 6);
  grid-row: span var(--r, 3);
}
.mosaic img {
  width: 100%; height: 100%; object-fit: cover; object-position: var(--pos, 50% 50%);
  transition: transform .6s cubic-bezier(.2,.7,.2,1);
}
.mosaic figure.contain { background: #0e0e0e; }
.mosaic figure.contain img { object-fit: contain; padding: 4%; }
.mosaic a:hover img, .mosaic figure[data-zoom]:hover img { transform: scale(1.03); }
.mosaic figure.contain:hover img { transform: none; }
.mosaic figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 28px 14px 12px;
  font-size: 13px; line-height: 1.35; color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,.65), transparent);
  opacity: 0; transform: translateY(6px);
  transition: opacity .25s, transform .25s;
}
.mosaic figure:hover figcaption { opacity: 1; transform: none; }
.mosaic figure[data-zoom] { cursor: zoom-in; }
.mosaic + .mosaic { margin-top: 8px; }
/* Justified row: every photo at its own aspect ratio (--ar), all the same height, nothing cropped. */
.mosaic.justified { display: flex; gap: 8px; }
.mosaic.justified figure { flex: var(--ar) 1 0; aspect-ratio: var(--ar); }

@media (max-width: 720px) {
  .mosaic { grid-template-columns: 1fr 1fr; grid-auto-rows: auto; }
  .mosaic figure { grid-column: 1 / -1; grid-row: auto; aspect-ratio: var(--m, 4 / 3); }
  .mosaic figure.half { grid-column: span 1; aspect-ratio: 3 / 4; }
  .mosaic figcaption { opacity: 1; transform: none; }
  .mosaic.justified { flex-direction: column; }
}

/* ---------- Story: photo + description, one panel ---------- */
.stories { display: grid; gap: clamp(16px, 2vw, 24px); }
.stories + .mosaic,
.stories + .statement { margin-top: clamp(40px, 6vw, 72px); }
.story {
  scroll-margin-top: 88px;
  --img: 7fr; --txt: 5fr;
  display: grid; grid-template-columns: var(--img) var(--txt);
  background: var(--panel);
}
.story.tall { --img: 4fr; --txt: 6fr; }
.story figure { margin: 0; overflow: hidden; aspect-ratio: var(--a, 3 / 2); align-self: stretch; width: 100%; cursor: zoom-in; }
.story.tall figure { aspect-ratio: var(--a, 4 / 5); }
.story img {
  display: block; width: 100%; height: 100%; object-fit: cover; object-position: var(--pos, 50% 50%);
  transition: transform .6s cubic-bezier(.2,.7,.2,1);
}
.story figure:hover img { transform: scale(1.03); }
.story-text { padding: clamp(24px, 3.5vw, 48px); align-self: center; }
.story-text h3 { font-size: clamp(1.4rem, 2.3vw, 2rem); letter-spacing: -0.02em; line-height: 1.1; margin: 14px 0 16px; }
.story-text p { color: var(--muted); margin: 0; max-width: 46ch; }
@media (max-width: 860px) {
  .story, .story.tall { grid-template-columns: 1fr; }
  .story.tall figure { aspect-ratio: 4 / 3; }
}

/* ---------- Full-bleed band ---------- */
.band {
  position: relative; height: clamp(360px, 70vh, 760px);
  background: var(--ink); color: var(--ink-fg); overflow: hidden;
}
.band img { width: 100%; height: 100%; object-fit: cover; }
.band .caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 24px 0; background: linear-gradient(to top, rgba(0,0,0,.6), transparent);
}
.band .caption .container { display: flex; justify-content: space-between; gap: 16px; font-size: 13px; color: rgba(255,255,255,.8); }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: 5fr 7fr; gap: clamp(32px, 6vw, 96px); align-items: center; }
.about figure { margin: 0; aspect-ratio: 4 / 5; overflow: hidden; }
.about figure img { width: 100%; height: 100%; object-fit: cover; object-position: 40% 50%; }
.about h2 { font-size: clamp(2rem, 4.2vw, 3.4rem); margin: 16px 0 24px; }
.about p { color: var(--muted); max-width: 54ch; }
.about .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
@media (max-width: 860px) { .about { grid-template-columns: 1fr; } }

/* ---------- Project page ---------- */
.overview {
  display: grid; grid-template-columns: 2fr 1fr; gap: 32px clamp(32px, 6vw, 96px);
}
.overview p.big {
  font: 500 clamp(1.35rem, 2.4vw, 2rem)/1.3 var(--display); letter-spacing: -0.015em; margin: 0 0 20px;
}
.overview p { color: var(--muted); margin: 0 0 16px; }
.facts { margin: 0; border-top: 1px solid var(--line); }
.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; }
@media (max-width: 860px) { .overview { grid-template-columns: 1fr; } }

.chapter { margin-top: clamp(72px, 9vw, 128px); }
.chapter-head {
  display: grid; grid-template-columns: 1fr 2fr; gap: 16px 48px;
  padding-top: 20px; margin-bottom: 32px; border-top: 1px solid var(--fg);
}
.chapter-head h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
.chapter-head p { margin: 0; color: var(--muted); max-width: 60ch; }
@media (max-width: 760px) { .chapter-head { grid-template-columns: 1fr; } }

.credit { margin-top: 16px; font-size: 13px; color: var(--muted); }

.next {
  display: block; text-decoration: none;
  background: var(--ink); color: var(--ink-fg);
  padding: clamp(56px, 9vw, 112px) 0;
}
.next .eyebrow { color: rgba(255,255,255,.6); }
.next h2 { font-size: clamp(2.2rem, 6vw, 5rem); margin-top: 16px; }

/* ---------- Footer ---------- */
footer.site {
  background: var(--ink); color: var(--ink-fg);
  padding: clamp(72px, 10vw, 128px) 0 32px;
}
footer.site h2 { font-size: clamp(2.6rem, 7vw, 6rem); margin-bottom: 32px; }
footer.site .row {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px;
  margin-top: clamp(56px, 8vw, 96px); padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,.15);
  font-size: 14px; color: rgba(255,255,255,.6);
}
footer.site .row nav { display: flex; gap: 24px; }
footer.site .row a { text-decoration: none; }
footer.site .row a:hover { color: #fff; }

/* ---------- Lightbox ---------- */
dialog.lightbox {
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: rgba(5,5,5,.96); color: #fff;
}
dialog.lightbox::backdrop { background: transparent; }
/* minmax(0, 1fr): let the image row shrink to the screen instead of growing to the photo. */
dialog.lightbox[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
dialog.lightbox img {
  box-sizing: border-box; width: 100%; height: 100%; min-height: 0; max-width: 100%;
  object-fit: contain; padding: 56px 16px 0; cursor: zoom-out;
}
dialog.lightbox p { margin: 0; padding: 16px; text-align: center; font-size: 14px; color: rgba(255,255,255,.75); }
dialog.lightbox button {
  position: absolute; top: 12px; background: none; border: 1px solid rgba(255,255,255,.3);
  color: #fff; font: 500 14px/1 var(--body); padding: 10px 14px; cursor: pointer;
}
dialog.lightbox button:hover { background: #fff; color: #000; }
dialog.lightbox .close { right: 12px; }
dialog.lightbox .prev { left: 12px; }
dialog.lightbox .next-img { left: 64px; }

/* ---------- Motion ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .mosaic img { transition: none; }
}
