:root {
  --ink: #11110f;
  --paper: #ffffff;
  --paper-soft: #f7f7f7;
  --muted: #8a857b;
  --muted-2: #5e5950;
  --line: rgba(17, 17, 15, 0.10);
  --line-strong: rgba(17, 17, 15, 0.20);
  --white: #ffffff;
  --sans: "Plus Jakarta Sans", "Helvetica Neue", Arial, sans-serif;
  --serif: "Plus Jakarta Sans", "Helvetica Neue", Arial, sans-serif;
  --display: "Plus Jakarta Sans", "Helvetica Neue", Arial, sans-serif;
  --body: "Plus Jakarta Sans", "Helvetica Neue", Arial, sans-serif;
  --side: clamp(24px, 5vw, 88px);
  --max: 1440px;
  --topbar-h: 56px;
}

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

html {
  scroll-behavior: smooth;
  background: var(--ink);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.45;
  text-rendering: geometricPrecision;
  overflow-x: hidden;
}

img, video { display: block; width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

::selection { background: var(--ink); color: var(--paper); }

/* ─── Page Transition ─── */
.page-transition {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--ink);
  transform: translateY(100%);
  pointer-events: none;
}

.page-transition.is-entering {
  animation: curtain-in 600ms cubic-bezier(.76, 0, .24, 1) forwards;
}

@keyframes curtain-in {
  from { transform: translateY(100%); }
  to   { transform: translateY(0%); }
}

/* ─── Topbar ─── */
.page { max-width: var(--max); margin: 0 auto; }

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 0 var(--side);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.topbar__nav,
.topbar__back,
.eyebrow,
.technical-sheet dt {
  font-size: 11px;
  letter-spacing: 0.16em;
  line-height: 1;
  text-transform: uppercase;
}

.topbar__brand {
  white-space: nowrap;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1;
}

.topbar__nav {
  display: flex;
  justify-content: center;
  gap: clamp(14px, 2.4vw, 40px);
  color: var(--muted);
}

.topbar__nav a,
.topbar__back {
  position: relative;
  color: var(--muted);
  transition: color 180ms ease;
  white-space: nowrap;
}

.topbar__nav a::after,
.topbar__back::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: -4px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 260ms cubic-bezier(.76, 0, .24, 1);
}

.topbar__nav a:hover,
.topbar__back:hover { color: var(--ink); }
.topbar__nav a:hover::after,
.topbar__back:hover::after { transform: scaleX(1); }

/* ─── Project Hero ─── */
.project-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.5fr);
  gap: clamp(28px, 4vw, 72px);
  align-items: end;
  padding: calc(var(--topbar-h) + clamp(32px, 4vw, 56px)) var(--side) clamp(28px, 3.5vw, 48px);
}

.project-hero__title {
  display: grid;
  gap: 20px;
  align-content: end;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
}

.project-hero h1 {
  margin: 0;
  font-family: var(--sans);
  font-size: clamp(48px, 6vw, 96px);
  font-weight: 300;
  line-height: 0.96;
  letter-spacing: -0.035em;
}

.project-hero__desc {
  max-width: 40ch;
  margin: 0;
  color: var(--muted);
  font-size: clamp(15px, 1.2vw, 18px);
  line-height: 1.65;
}

/* Technical sheet */
.technical-sheet {
  display: grid;
  gap: 0;
  margin: 0;
  align-content: end;
}

.technical-sheet div {
  padding: 14px 0;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  align-items: baseline;
}

.technical-sheet div:last-child { border-bottom: 1px solid var(--line); }

.technical-sheet dt {
  margin: 0;
  color: var(--muted);
}

.technical-sheet dd {
  margin: 0;
  font-size: 15px;
}

/* ─── Gallery Grid ─── */
.gallery {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 6px;
  padding: 6px var(--side) clamp(72px, 9vw, 130px);
}

.gallery__item {
  grid-column: span 4;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: #fafafa;
  cursor: zoom-in;
  display: block;
  position: relative;
}

.gallery__item--wide {
  grid-column: span 8;
  aspect-ratio: 16 / 10;
}

.gallery__item--full {
  grid-column: 1 / -1;
  aspect-ratio: 21 / 9;
}

.gallery__item--tall {
  grid-column: span 4;
  grid-row: span 2;
  aspect-ratio: auto;
}

.gallery__item--half {
  grid-column: span 6;
  aspect-ratio: 4 / 3;
}

.gallery__item img,
.gallery__item video {
  height: 100%;
  width: 100%;
  object-fit: contain;
  transition: transform 700ms cubic-bezier(.2,.7,.2,1), filter 400ms ease;
}

.gallery__item:hover img,
.gallery__item:hover video {
  transform: scale(1.02);
  filter: brightness(0.93);
}

/* ─── Next Project ─── */
.next-project {
  position: relative;
  display: grid;
  align-items: center;
  min-height: clamp(360px, 52vh, 620px);
  padding: clamp(48px, 10vw, 120px) var(--side);
  background: var(--ink);
  color: var(--white);
  overflow: hidden;
  isolation: isolate;
}

.next-project__bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  height: 100%;
  width: 100%;
  object-fit: cover;
  filter: saturate(.85) brightness(.5);
  transform: scale(1.05);
  transition: transform 900ms cubic-bezier(.2,.7,.2,1), filter 600ms ease;
}

.next-project::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(0,0,0,.3), rgba(0,0,0,.55));
  pointer-events: none;
}

.next-project:hover .next-project__bg {
  transform: scale(1);
  filter: saturate(.95) brightness(.6);
}

.next-project__inner {
  display: grid;
  gap: clamp(16px, 2vw, 28px);
  justify-items: start;
  max-width: var(--max);
}

.next-project__inner .eyebrow { color: rgba(255, 250, 242, 0.7); }

.next-project__title {
  margin: 0;
  font-family: var(--sans);
  font-size: clamp(48px, 7vw, 120px);
  font-weight: 300;
  line-height: 0.96;
  letter-spacing: -0.035em;
}

.next-project__cue {
  color: rgba(255, 250, 242, 0.8);
  transition: transform 260ms ease, color 200ms ease;
}

.next-project:hover .next-project__cue {
  color: var(--white);
  transform: translateX(6px);
}

/* ─── Lightbox ─── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: clamp(20px, 4vw, 60px);
  background: rgba(8, 8, 7, 0.96);
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
}

.lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox__media {
  max-width: min(96vw, 1600px);
  max-height: 90svh;
  display: grid;
  place-items: center;
}

.lightbox__media img,
.lightbox__media video {
  max-width: 100%;
  max-height: 90svh;
  object-fit: contain;
  box-shadow: 0 40px 120px rgba(0,0,0,0.5);
}

.lightbox__close {
  position: absolute;
  top: 20px;
  right: var(--side);
  border: 0;
  background: transparent;
  color: rgba(255, 250, 242, 0.5);
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  transition: color 180ms ease;
}

.lightbox__close:hover { color: var(--white); }

/* Count indicator */
.lightbox__count {
  position: absolute;
  bottom: 20px;
  left: var(--side);
  color: rgba(255, 250, 242, 0.4);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Lightbox nav arrows */
.lightbox__prev,
.lightbox__next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: rgba(255, 250, 242, 0.4);
  cursor: pointer;
  font-size: 22px;
  padding: 20px;
  transition: color 180ms ease;
}

.lightbox__prev { left: clamp(8px, 2vw, 28px); }
.lightbox__next { right: clamp(8px, 2vw, 28px); }
.lightbox__prev:hover,
.lightbox__next:hover { color: var(--white); }

/* ─── Not found ─── */
.not-found {
  min-height: 100svh;
  display: grid;
  place-content: center;
  gap: 16px;
  text-align: center;
}

/* ─── Responsive ─── */
@media (max-width: 1080px) {
  .project-hero {
    grid-template-columns: 1fr 1fr;
  }

  .project-hero__title {
    grid-column: 1 / -1;
  }

  .gallery__item--wide { grid-column: span 8; }
  .gallery__item--tall { grid-column: span 4; }
  .gallery__item--full { grid-column: 1 / -1; }
  .gallery__item--half { grid-column: span 6; }
}

@media (max-width: 760px) {
  .topbar { grid-template-columns: 1fr auto; }
  .topbar__nav { display: none; }

  .project-hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: calc(var(--topbar-h) + 40px);
  }

  .project-hero h1 { font-size: clamp(52px, 16vw, 96px); }

  .gallery {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 4px var(--side) clamp(60px, 8vw, 100px);
  }

  .gallery__item,
  .gallery__item--wide,
  .gallery__item--full,
  .gallery__item--tall,
  .gallery__item--half {
    grid-column: 1;
    grid-row: auto;
    aspect-ratio: 4 / 5;
  }

  .lightbox__prev,
  .lightbox__next { display: none; }
}

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