/* ---------- Tokens ---------- */
:root {
  --bg: #fafafa;
  --ink: #0d0d0d;
  --muted: #6e6e6e;
  --line: #e4e4e4;
  --surface: #efefef;

  --gutter: clamp(24px, 3vw, 48px);     /* page margin */
  --gap: clamp(10px, 1.1vw, 20px);      /* between images and grid columns */
  --space: clamp(112px, 11vw, 176px);   /* between sections */
  --max: 1920px;

  --font: "Geist", "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--font);
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
}
img, picture { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 4px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }
h1 { font-size: clamp(40px, 5.2vw, 84px); line-height: 1; letter-spacing: -0.04em; }
h2 { font-size: clamp(20px, 1.8vw, 26px); line-height: 1.25; letter-spacing: -0.02em; }
h3 { font-size: 17px; line-height: 1.4; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
.muted { color: var(--muted); }

.page { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* Two-column grid shared by text and images, so everything lines up */
.row { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--gap); margin-top: var(--space); }
.row > :last-child { max-width: 600px; }
@media (max-width: 760px) {
  .row { grid-template-columns: 1fr; row-gap: 20px; }
}

/* ---------- Header + nav ---------- */
.site-header { position: relative; z-index: 20; height: clamp(72px, 7vw, 96px); }
.site-header .page { display: flex; align-items: center; justify-content: space-between; height: 100%; }
.logo { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; text-decoration: none; white-space: nowrap; }
.nav { display: flex; gap: 28px; font-size: 15px; font-weight: 500; }
.nav a { text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { text-decoration: underline; }
.menu-btn { display: none; }

@media (max-width: 640px) {
  .menu-btn {
    display: grid; place-items: center; width: 44px; height: 44px; margin-right: -10px;
    border: 0; background: none; color: var(--ink); cursor: pointer; position: relative; z-index: 2;
  }
  .menu-btn span, .menu-btn span::before, .menu-btn span::after {
    display: block; width: 22px; height: 2px; background: currentColor;
    transition: transform 0.25s ease, background 0.25s ease;
  }
  .menu-btn span { position: relative; }
  .menu-btn span::before, .menu-btn span::after { content: ""; position: absolute; left: 0; }
  .menu-btn span::before { top: -7px; }
  .menu-btn span::after { top: 7px; }
  .menu-open .menu-btn span { background: transparent; }
  .menu-open .menu-btn span::before { transform: translateY(7px) rotate(45deg); }
  .menu-open .menu-btn span::after { transform: translateY(-7px) rotate(-45deg); }

  .nav {
    position: fixed; inset: 0; z-index: 1;
    flex-direction: column; justify-content: center; gap: 4px;
    padding: 0 var(--gutter); background: var(--bg);
    opacity: 0; visibility: hidden; transition: opacity 0.25s ease, visibility 0.25s;
  }
  .nav a { font-size: 48px; font-weight: 600; letter-spacing: -0.04em; line-height: 1.15; }
  .nav a[aria-current="page"] { text-decoration: none; color: var(--muted); }
  .menu-open .nav { opacity: 1; visibility: visible; }
  .menu-open { overflow: hidden; }
  .menu-open .logo { position: relative; z-index: 2; }
  .menu-open .site-header .page { position: fixed; inset: 0 0 auto 0; height: clamp(72px, 7vw, 96px); }
}

/* ---------- Media: two ratios only ----------
   .wide  = 2:1, full width
   .pair  = two 1:1 images side by side (stacked on phones) */
.stack { display: grid; gap: var(--gap); margin-top: var(--space); }
.row + .stack { margin-top: clamp(48px, 6vw, 96px); }
.stack img { width: 100%; background: var(--surface); cursor: zoom-in; }
.wide { aspect-ratio: 2 / 1; object-fit: cover; object-position: var(--focus, 50% 50%); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.pair img { aspect-ratio: 1 / 1; object-fit: cover; }
/* Phones: every body image is square, so the stack reads as one rhythm */
@media (max-width: 760px) {
  .pair { grid-template-columns: 1fr; }
  .stack .wide { aspect-ratio: 1 / 1; }
}

/* ---------- Home ---------- */
.intro { padding: clamp(40px, 8vw, 128px) 0 clamp(48px, 7vw, 112px); }
.intro h1 { max-width: 16ch; }
.intro p { margin: 28px 0 0; max-width: 34ch; color: var(--muted); font-size: clamp(18px, 1.5vw, 21px); line-height: 1.45; }

.work { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }

.card { position: relative; display: block; text-decoration: none; overflow: hidden; }
.card__label { display: flex; justify-content: space-between; gap: 16px; margin: 12px 0 0; font-size: 15px; white-space: nowrap; }
.card__label strong { font-weight: 600; }
.card__label span { color: var(--muted); }
.card img { transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }

/* Project tile: the same image is the home card and the case study hero.
   3:2 on desktop, 4:5 on phones (separate *-m.jpg crop via <picture>). */
.tile { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }

@media (max-width: 760px) {
  .intro { padding: 56px 0 64px; }
  .intro p { margin-top: 20px; }
  .work { grid-template-columns: 1fr; row-gap: 72px; }
  .tile { aspect-ratio: 4 / 5; }
  .card__label { margin-top: 16px; font-size: 16px; align-items: baseline; }
  .card__label strong { font-size: 22px; letter-spacing: -0.02em; }
}

/* Mouse devices: name appears over the image on hover */
@media (hover: hover) and (pointer: fine) {
  .card__label {
    position: absolute; inset: auto 0 0 0; margin: 0; padding: 96px 28px 24px;
    align-items: baseline; color: #fff;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent);
    opacity: 0; transition: opacity 0.35s ease;
  }
  .card__label strong { font-size: clamp(22px, 2vw, 32px); letter-spacing: -0.02em; }
  .card__label span { color: rgba(255, 255, 255, 0.85); }
  .card:hover .card__label, .card:focus-visible .card__label { opacity: 1; }
  .card:hover img { transform: scale(1.025); }
}

/* ---------- Case study: hero → content → images → next ---------- */
@media (max-width: 760px) {
  .hero { margin: 0 calc(var(--gutter) * -1); }   /* edge to edge on phones */
}

/* One column of content, about two-thirds of the page, left-aligned */
.cs-content { max-width: 820px; margin-top: clamp(80px, 10vw, 176px); }
.eyebrow { margin: 0 0 20px; font-size: 15px; font-weight: 500; color: var(--muted); }
.cs-content h1 { font-size: clamp(36px, 4.4vw, 64px); font-weight: 500; line-height: 1.06; letter-spacing: -0.035em; margin-bottom: clamp(32px, 3.5vw, 56px); }
.prose p, .outcomes { font-size: 17px; line-height: 1.75; }
.prose p { margin: 0; }
.prose p + p { margin-top: 1.4em; }
.outcomes-label { margin: clamp(40px, 4vw, 56px) 0 8px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.outcomes { list-style: none; padding: 0; margin: 0; }
.outcomes li { position: relative; padding-left: 1.4em; }
.outcomes li + li { margin-top: 0.6em; }
.outcomes li::before { content: "•"; position: absolute; left: 0; }
.outcomes strong { font-weight: 600; }

.cs-content + .stack { margin-top: clamp(80px, 9vw, 144px); }

.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 20px 0; border-top: 1px solid var(--line); }
.list li:last-child { border-bottom: 1px solid var(--line); }
.list p { margin: 4px 0 0; color: var(--muted); }

.next-cta {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: clamp(64px, 7vw, 112px); padding-top: 20px; border-top: 1px solid var(--line);
  font-size: 15px; font-weight: 500;
}
.next-cta a { text-decoration: none; }
.next-cta a:hover { text-decoration: underline; }
.next-cta .back { color: var(--muted); }

/* ---------- About ---------- */
.about-intro { align-items: start; margin-top: clamp(40px, 8vw, 128px); }
.about-intro > div { max-width: 600px; padding-right: clamp(24px, 5vw, 96px); box-sizing: content-box; } /* breathing room before the photo */
.about-intro h1 { margin-bottom: 40px; }
.about-intro p { font-size: clamp(18px, 1.4vw, 20px); line-height: 1.5; }
.about-intro img { aspect-ratio: 1 / 1; object-fit: cover; object-position: 50% 20%; width: 100%; }
@media (max-width: 760px) { .about-intro { row-gap: 48px; } .about-intro > div { padding-right: 0; } }
.experience-intro { margin-bottom: 40px; font-size: clamp(17px, 1.3vw, 19px); line-height: 1.6; }
.experience-intro p { margin: 0; }
.experience-intro p + p { margin-top: 1em; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; justify-content: space-between; gap: 24px; padding: 16px 0; border-top: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 1px solid var(--line); }
.timeline span { color: var(--muted); white-space: nowrap; }
@media (max-width: 480px) { .timeline li { flex-direction: column; gap: 2px; } .timeline span { font-size: 15px; } }

/* ---------- Footer ---------- */
.site-footer { margin-top: var(--space); padding-bottom: 32px; }
.site-footer .row { margin-top: 0; padding-top: 40px; border-top: 1px solid var(--line); }
.site-footer h2 { font-size: clamp(40px, 5.2vw, 84px); letter-spacing: -0.04em; line-height: 1; }
.footer-links { display: flex; flex-direction: column; gap: 4px; font-size: clamp(18px, 1.4vw, 20px); }
.footer-links a { text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.copyright { margin-top: clamp(64px, 8vw, 128px); font-size: 14px; color: var(--muted); }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; margin: 0; border: 0; padding: 0; width: 100%; height: 100%; max-width: none; max-height: none; background: rgba(10, 10, 10, 0.95); }
.lightbox::backdrop { background: transparent; }
.lightbox .lb-inner { width: 100%; height: 100%; overflow: auto; display: grid; place-items: center; padding: 64px 16px 16px; }
.lightbox img { max-width: min(1800px, 100%); }
.lightbox button {
  position: fixed; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: #fff; color: var(--ink); font-size: 22px; line-height: 1; cursor: pointer;
}
@media (max-width: 760px) {
  .lightbox .lb-inner { place-items: start; }
  .lightbox img { max-width: none; width: 200vw; }
}
body:has(dialog[open]) { overflow: hidden; }

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