/* ═══════════════════════════════════════════════════════
   DESIGN TOKENS
   ═══════════════════════════════════════════════════════ */

/*
 * Custom Font: PP Neue Montreal Book
 * Files located in /fonts/ directory
 */
@font-face {
  font-family: 'PPNeueMontreal-Book';
  src: url('fonts/PPNeueMontreal-Book.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'PPNeueMontreal-Medium';
  src: url('fonts/PPNeueMontreal-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --c-bg:           #f8f8f6;
  --c-surface:      #ffffff;
  --c-text:         #1a1a1a;
  --c-text-muted:   rgba(26, 26, 26, 0.5);
  --c-text-faint:   rgba(26, 26, 26, 0.28);
  --c-border:       rgba(26, 26, 26, 0.1);
  /* Easing */
  --ease-expo:      cubic-bezier(0.19, 1, 0.22, 1);

  /* Typography System - PP Neue Montreal Book */
  --ff-sans:        'PPNeueMontreal-Book', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --ff-medium:      'PPNeueMontreal-Medium', 'Helvetica Neue', Helvetica, Arial, sans-serif;

  --text-hero:      clamp(2.5rem, 6vw, 4.5rem);       /* 40px - 72px */
  --text-h1:        clamp(2rem, 4.8vw, 3.5rem);       /* 32px - 56px */
  --text-h2:        clamp(1.5rem, 3vw, 2.25rem);      /* 24px - 36px */
  --text-h3:        clamp(1.25rem, 2.2vw, 1.75rem);   /* 20px - 28px */
  --text-h4:        clamp(1.125rem, 1.8vw, 1.375rem); /* 18px - 22px */
  --text-lede:      clamp(1.125rem, 1.8vw, 1.375rem); /* 18px - 22px */
  --text-body:      clamp(1rem, 1.1vw, 1.125rem);     /* 16px - 18px */
  --text-small:     0.875rem;                      /* 14px */
  --text-label:     0.75rem;                       /* 12px */

  /* Spacing & Layout */
  --sp-xs:          0.5rem;
  --sp-sm:          1rem;
  --sp-md:          2rem;
  --sp-lg:          4rem;
  --sp-xl:          6rem;
  --sp-2xl:         10rem;

  /* Fluid cards. The carousel is height-constrained, so the card tracks
     viewport height (and width as a secondary cap) instead of sitting at
     a fixed 420x540 — which reads oversized on laptop displays, where a
     MacBook Pro reports only 1512-1728 logical px. Ratio held at 1:1.286. */
  --card-w:         min(420px, 38.9vh);
  --card-h:         min(540px, 50vh);
}

/* ═══════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background-color: var(--c-bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--c-bg);
  color: var(--c-text);
  font-family: var(--ff-sans);
  overflow-x: hidden;
  cursor: none;
  font-size: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Typography Hierarchy */
h1, .h1 { 
  font-family: var(--ff-medium);
  font-size: var(--text-h1); 
  line-height: 1.05; 
  letter-spacing: -0.03em; 
  font-weight: 500;
}

h2, .h2 { 
  font-family: var(--ff-medium);
  font-size: var(--text-h2); 
  line-height: 1.1; 
  letter-spacing: -0.02em; 
  font-weight: 500;
}

h3, .h3 { 
  font-family: var(--ff-medium);
  font-size: var(--text-h3); 
  line-height: 1.15; 
  letter-spacing: -0.01em;
  font-weight: 500;
}

h4, .h4 { 
  font-family: var(--ff-medium);
  font-size: var(--text-h4); 
  line-height: 1.2; 
  font-weight: 500;
}

p {
  max-width: 70ch;
  line-height: 1.6;
}

.lede {
  font-size: var(--text-lede);
  line-height: 1.5;
  letter-spacing: -0.01em;
  max-width: 48ch;
}

body:has(.carousel) {
  overflow: hidden;
  height: 100vh;
}

a, button {
  cursor: none;
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
}

img {
  display: block;
  max-width: 100%;
}

/* ═══════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ═══════════════════════════════════════════════════════
   GRAIN OVERLAY
   ═══════════════════════════════════════════════════════ */
.grain {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ═══════════════════════════════════════════════════════
   NAVIGATION
   ═══════════════════════════════════════════════════════ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: var(--sp-md) 3rem;
  padding-bottom: var(--sp-lg);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 100;
  font-family: var(--ff-medium);
  font-size: var(--text-h4);
  font-weight: 500;
  letter-spacing: -0.02em;
  pointer-events: none;
  cursor: none;
  color: var(--c-text);
  background: linear-gradient(to bottom, var(--c-bg) 40%, transparent 100%);
}

.navbar a,
.navbar span,
.navbar div,
.navbar time,
.navbar nav {
  pointer-events: auto;
  text-decoration: none;
  color: inherit;
  cursor: none;
}

.nav-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--sp-sm);
  white-space: nowrap;
  font-feature-settings: "tnum";
}

.time-colon {
  display: inline-block;
}

.is-live .time-colon {
  animation: colon-blink 1s step-end infinite;
}

@keyframes colon-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.nav-center a,
.nav-right a {
  position: relative;
}

.nav-center a::after,
.nav-right a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s var(--ease-expo);
}

.nav-center a:hover::after,
.nav-right a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.navbar > * {
  opacity: 0;
}

/* ── Navbar on project / about pages ──────────────────────────────
   The landing page hides navbar contents until the typewriter reveals
   them; here they must simply be visible. Plain ink — difference
   blending muddies the antialiasing into heavy, ghosted type. */
.project-body .navbar {
  /* A masthead, not a fixed bar: it hands the page over to the work
     once you start reading, and never sits over gallery imagery */
  position: absolute;
  background: none;
  padding-bottom: var(--sp-md);
}

.project-body .navbar > * {
  opacity: 1;
}

/* Air-Lighting alone opens on a full-bleed dark video, so its navbar
   needs adaptive contrast — the one place blending is worth it */
.air-lighting .navbar {
  color: #fff;
  mix-blend-mode: difference;
}

/* Split heroes need no clearance of their own — .grid-container already
   carries the navbar offset (project-animations.css) */

/* ═══════════════════════════════════════════════════════
   PRELOADER — hairline between the name and the time/city
   stamp. Fills with combined load + typing progress, fades
   before the stamp glides up. JS reveals it on first visit.
   ═══════════════════════════════════════════════════════ */
.preload-line {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translateX(-50%);
  width: 160px;
  height: 1px;
  background: var(--c-border);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
}

.preload-line span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--c-text);
  transform: scaleX(0);
  transform-origin: left center;
}

/* ═══════════════════════════════════════════════════════
   LANDING COPYRIGHT
   ═══════════════════════════════════════════════════════ */
.landing-copy {
  position: fixed;
  bottom: var(--sp-md);
  right: 3rem;
  z-index: 100;
  font-size: var(--text-small);
  color: var(--c-text-muted);
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════
   CAROUSEL WRAPPER
   ═══════════════════════════════════════════════════════ */
.carousel {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh; /* stable against mobile browser chrome */
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ═══════════════════════════════════════════════════════
   CAROUSEL VIEWPORT
   ═══════════════════════════════════════════════════════ */
.portfolio-container {
  display: flex;
  gap: 2vw;
  position: relative;
  width: 100%;
  height: 80vh;
  height: 80dvh;
  min-height: 600px;
  margin: 0;
  overflow: hidden;
  cursor: none;
  user-select: none;
  -webkit-user-select: none;
  z-index: 1;
  transition: opacity 0.45s var(--ease-expo), visibility 0s linear 0s;
}

.carousel.view-list .portfolio-container {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s var(--ease-expo), visibility 0s linear 0.45s;
}

/* ═══════════════════════════════════════════════════════
   VIEW TOGGLE — Carousel / List
   ═══════════════════════════════════════════════════════ */
.view-toggle {
  position: absolute;
  bottom: 2.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.85rem 2.1rem;
  background: var(--c-text);
  border-radius: 999px;
  box-shadow: 0 2px 14px rgba(26, 26, 26, 0.14);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s var(--ease-expo);
}

.carousel.controls-ready .view-toggle {
  opacity: 1;
  pointer-events: auto;
}

/* Liquid tap — invisible at rest; a droplet blooms under the tapped
   label, wobbles, and dissolves (JS drives it; see liquidTap) */
.view-toggle-blob {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: rgba(248, 248, 246, 0.18);
  opacity: 0;
  pointer-events: none;
}

.view-toggle-btn {
  position: relative;
  z-index: 1; /* labels above the blob */
  background: none;
  border: none;
  padding: 0.1rem 0;
  font-family: var(--ff-sans);
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  text-transform: lowercase;
  color: rgba(248, 248, 246, 0.4);
  cursor: none;
  transition: color 0.3s ease;
}

.view-toggle-btn:hover,
.view-toggle-btn.is-active {
  color: var(--c-bg);
}

.view-toggle-btn:focus-visible {
  outline: 1px solid var(--c-bg);
  outline-offset: 3px;
  border-radius: 2px;
}

.view-toggle-sep {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(248, 248, 246, 0.55);
}

/* ═══════════════════════════════════════════════════════
   PROJECT LIST VIEW
   ═══════════════════════════════════════════════════════ */
.project-list {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--sp-xl) var(--sp-lg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.5s var(--ease-expo), visibility 0s linear 0.5s;
}

.carousel.view-list .project-list {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.5s var(--ease-expo), visibility 0s linear 0s;
}

.project-list ul {
  list-style: none;
}

.list-row {
  display: grid;
  grid-template-columns: 3.5rem 1fr auto 5rem;
  align-items: baseline;
  gap: var(--sp-md);
  padding: 1.4rem 0.25rem;
  border-top: 1px solid var(--c-border);
  text-decoration: none;
  color: var(--c-text);
  cursor: none;
  transition: opacity 0.35s ease, transform 0.6s var(--ease-expo);
}

.project-list li:last-child .list-row {
  border-bottom: 1px solid var(--c-border);
}

.list-row:focus-visible {
  outline: 1px solid var(--c-text);
  outline-offset: -1px;
}

/* Rows rise in one after another when the view opens */
@keyframes row-in {
  from { opacity: 0; transform: translateY(26px); }
}
.carousel.view-list .list-row {
  animation: row-in 0.8s var(--ease-expo) backwards;
}
/* One line per row — extend when adding a project, or the new row
   gets no delay and pops in before the cascade (the Louella bug) */
.carousel.view-list li:nth-child(1) .list-row { animation-delay: 0.05s; }
.carousel.view-list li:nth-child(2) .list-row { animation-delay: 0.11s; }
.carousel.view-list li:nth-child(3) .list-row { animation-delay: 0.17s; }
.carousel.view-list li:nth-child(4) .list-row { animation-delay: 0.23s; }
.carousel.view-list li:nth-child(5) .list-row { animation-delay: 0.29s; }
.carousel.view-list li:nth-child(6) .list-row { animation-delay: 0.35s; }
.carousel.view-list li:nth-child(7) .list-row { animation-delay: 0.41s; }
.carousel.view-list li:nth-child(8) .list-row { animation-delay: 0.47s; }

/* Hovered row stays ink, the rest recede — pointer devices only,
   so touch taps don't flash a phantom dim state */
@media (hover: hover) {
  .project-list ul:hover .list-row { opacity: 0.3; }
  .project-list ul .list-row:hover {
    opacity: 1;
    transform: translateX(10px);
  }
}

/* Touch: brief press feedback instead of hover */
.list-row:active { opacity: 0.55; }

.list-index {
  font-size: var(--text-label);
  letter-spacing: 0.1em;
  color: var(--c-text-muted);
}

.list-title {
  font-family: var(--ff-medium);
  font-size: var(--text-h2);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.list-meta,
.list-year {
  font-size: var(--text-small);
  color: var(--c-text);
}

.list-year {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Floating image preview that trails the cursor over the list */
.list-preview {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 330px;
  overflow: hidden;
  pointer-events: none;
  z-index: 8000;
  opacity: 0;
  transition: opacity 0.35s ease;
  will-change: transform;
}

/* Frames are stacked and cross-faded — see initListView */
.list-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.08);
  transition: transform 0.6s var(--ease-expo), opacity 0.25s ease;
}

.list-preview img.is-active { opacity: 1; }

.list-preview.visible { opacity: 1; }
.list-preview.visible img.is-active { transform: scale(1); }

/* ═══════════════════════════════════════════════════════
   PROJECT CARDS
   ═══════════════════════════════════════════════════════ */
.project-card {
  position: absolute;
  left: 0;
  top: 50%;
  margin-top: calc(var(--card-h) / -2);
  width: var(--card-w);
  max-width: 80vw;
  height: var(--card-h);
  cursor: none;
  will-change: transform;
  background-color: var(--c-bg);
  visibility: hidden; /* JS reveals after positioning */
}

.project-card:focus-visible {
  outline: 2px solid var(--c-text);
  outline-offset: 4px;
}

.image-wrapper {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.project-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background-color: var(--c-bg);
  opacity: var(--overlay-opacity, 0);
  pointer-events: none;
  z-index: 5;
}

.project-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  background-color: #e8e8e6;
}

/* Step Into the Lens — shift the crop so the subject sits in the right
   third of the card rather than dead center (lower % = further right) */
.project-card[data-url="step-into-the-lens.html"] .project-image {
  object-position: 17% center;
}

/* --- Project info overlay --- */
.project-info {
  position: absolute;
  bottom: 100%;
  left: 50%;
  width: calc(100% * var(--card-scale, 1));
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  opacity: 1; /* Container stays visible to allow children to animate */
  transform: translate(-50%, 0) scale(calc(1 / var(--card-scale, 1)));
  transform-origin: bottom center;
  pointer-events: none;
  z-index: -1;
  padding-bottom: 15px;
}

.project-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.project-header,
.project-meta {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s var(--ease-expo), transform 0.8s var(--ease-expo);
}

.project-title,
.project-year,
.project-meta {
  font-family: var(--ff-medium);
  font-size: var(--text-h4) !important;
  font-weight: 500;
  line-height: 1.1;
  color: var(--c-text);
  margin: 0;
  text-transform: none;
  letter-spacing: -0.01em; /* Synchronized tracking */
}

.project-meta {
  display: block;
  text-align: right; /* Pushes meta text to the right edge */
  flex-shrink: 0;
}

.project-year {
  margin-bottom: 2px;
  color: var(--c-text-muted);
}

/* Suppress CSS title transitions while the intro animation is running */
.intro-playing .project-header,
.intro-playing .project-meta {
  transition: none !important;
}

/* GSAP controls scale/position; .active only drives the info overlay */
.project-card.active .project-header,
.project-card.active .project-meta {
  opacity: 1;
  transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════
   ABOUT SECTION
   ═══════════════════════════════════════════════════════ */
.about-section {
  padding: var(--sp-2xl) 4vw var(--sp-xl);
  max-width: 1400px;
  margin: 0 auto;
  border-top: 1px solid var(--c-border);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--sp-lg);
  margin-bottom: var(--sp-xl);
}

.section-number {
  display: block;
  font-size: var(--text-label);
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--c-text-faint);
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.about-heading {
  font-family: var(--ff-medium);
  font-size: var(--text-h2); 
  line-height: 1.1; 
  letter-spacing: -0.02em; 
  margin-bottom: var(--sp-md);
}

.about-lead {
  font-size: var(--text-lede);
  line-height: 1.5;
  letter-spacing: -0.01em;
  max-width: 48ch;
  color: var(--c-text);
}

.about-details-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-lg);
  padding-top: var(--sp-lg);
  border-top: 1px solid var(--c-border);
}

.about-detail h3 {
  font-size: var(--text-label);
  text-transform: uppercase;
  line-height: 1.4;
  letter-spacing: 0.08em;
  color: var(--c-text-muted);
  margin-bottom: var(--sp-xs);
}

.about-detail p,
.about-detail a {
  font-size: var(--text-body);
  line-height: 1.6;
  color: var(--c-text);
}

.about-detail a {
  transition: opacity 0.3s ease;
}

.about-detail a:hover {
  opacity: 0.6;
}

/* ═══════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════ */
.site-footer {
  padding: var(--sp-lg) 4vw;
  padding-bottom: var(--sp-xl);
  margin-top: var(--sp-xl);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--sp-md);
  border-top: 1px solid var(--c-border);
}

.footer-copy {
  font-size: var(--text-small);
  color: var(--c-text-muted);
}

.footer-links {
  display: flex;
  gap: var(--sp-md);
}

.footer-links a {
  font-size: var(--text-small);
  color: var(--c-text-muted);
  position: relative;
  transition: color 0.3s ease;
}

.footer-links a:hover {
  color: var(--c-text);
}

.footer-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s var(--ease-expo);
}

.footer-links a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* ═══════════════════════════════════════════════════════
   SCROLL-REVEAL ANIMATIONS
   ═══════════════════════════════════════════════════════ */
.reveal-fade {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.9s var(--ease-expo), transform 0.9s var(--ease-expo);
}

.reveal-fade.revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal-slide {
  opacity: 0;
  transform: translateY(60px);
  transition: opacity 1.1s var(--ease-expo), transform 1.1s var(--ease-expo);
}

.reveal-slide.revealed {
  opacity: 1;
  transform: translateY(0);
}

.about-details-grid .reveal-fade:nth-child(2) { transition-delay: 0.1s; }
.about-details-grid .reveal-fade:nth-child(3) { transition-delay: 0.2s; }

/* ═══════════════════════════════════════════════════════
   CUSTOM CURSOR
   ═══════════════════════════════════════════════════════ */
.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  border: 1.5px solid #fff;
  mix-blend-mode: difference !important;
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  transition: width 0.45s var(--ease-expo),
              height 0.45s var(--ease-expo),
              background-color 0.4s ease,
              backdrop-filter 0.4s ease,
              border-color 0.4s ease;
  will-change: transform, width, height;
}

.cursor.active {
  background-color: #fff;
}

.cursor.clicked {
  width: 14px;
  height: 14px;
}

/* Touch devices: no mouse — remove the custom cursor (it would sit
   stranded at the top-left corner), the cursor-trailing list preview,
   and restore native cursor behavior everywhere */
@media (hover: none), (pointer: coarse) {
  .cursor       { display: none !important; }
  .list-preview { display: none !important; }
  * { cursor: auto !important; }
}

/* ═══════════════════════════════════════════════════════
   PAGE TRANSITIONS
   ═══════════════════════════════════════════════════════ */
.transition-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--c-bg);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s var(--ease-expo);
}

.transition-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--c-bg);
  z-index: 9999;
  transform: translateY(101%);
  pointer-events: none;
  transition: transform 0.6s cubic-bezier(0.7, 0, 0.2, 1);
}

body.exiting::after {
  transform: translateY(0);
  pointer-events: auto;
}

/* No element scaling on exit — the curtain above carries the transition.
   (The landing page runs its own GSAP exit and never sets .exiting.) */

/* Landing → project handoff: fades up over the stage in the last
   beat of the exit, matching the html background the project page opens on */
.transition-veil {
  position: fixed;
  inset: 0;
  background: var(--c-bg);
  z-index: 9500;
  opacity: 0;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════
   PROJECT DETAIL PAGES
   ═══════════════════════════════════════════════════════ */
/* Entrance mirrors the landing exit: the landing fades to the html
   background (--c-bg) through the veil, and the project page fades up
   from that same tone at the same tempo — one continuous gesture */
.project-body {
  background-color: var(--c-surface);
  color: #111;
  opacity: 0;
  animation: project-fade-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.05s forwards;
}

@keyframes project-fade-in {
  to { opacity: 1; }
}

.detail-hero {
  max-width: 1600px;
  width: 100%;
  height: auto;
  margin: 0 auto;
  padding: 0 4vw;
  padding-top: 8.75rem;   /* rem so it scales with the laptop type step */
  margin-bottom: var(--sp-lg);
  position: relative;
}

/* Hero settle is GSAP-owned (project-animations.js) — the CSS initial
   scale matches the GSAP start value so there's no flash before JS runs */
.detail-hero img {
  width: 100%;
  height: auto;
  object-fit: contain;
  transform: scale(1.05);
}

/* ─── Portrait hero: split layout (text left, tall image right) ───
   Landscape heroes keep the standard full-width .detail-hero on top;
   a portrait hero (e.g. Louella) pairs the image beside the intro so a
   tall image doesn't overwhelm the page. */
.detail-split {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-lg);
  align-items: start;
}

.detail-split__text {
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
}

/* The 12-col placement rules are inert once these are nested in a flex
   column; reset the intro's right-shove so it reads left-aligned here */
.detail-split .detail-meta,
.detail-split .detail-intro { grid-column: auto; }
.detail-split .intro-desc {
  margin-left: 0;
  max-width: 62ch;
}

/* Reuse .detail-hero on the media (keeps the GSAP settle) but drop its
   full-width framing; the image hugs the right and caps at viewport height */
.detail-split__media {
  display: flex;
  justify-content: flex-end;
}
.detail-split .detail-hero {
  padding: 0;
  margin: 0;
  max-width: none;
  width: 100%;
}
.detail-split .detail-hero img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 82vh;
  object-fit: contain;
}

@media (max-width: 900px) {
  .detail-split {
    grid-template-columns: 1fr;
    gap: var(--sp-lg);
  }
  .detail-split__media {
    order: -1;
    justify-content: center;
  }
  .detail-split .detail-hero img { max-height: 62vh; }
}

/* Video Hero for Project Pages */
.detail-hero.video-mode {
  padding: 0;
  max-width: 100%;
  width: 100%;
  height: 100vh;
  margin-top: 0;
  margin-bottom: var(--sp-xl);
  overflow: hidden;
  background-color: #000;
}

.video-background iframe {
  position: absolute;
  pointer-events: none;
  top: 50%;
  left: 50%;
  width: 100vw;
  height: 56.25vw; /* 16:9 aspect ratio width */
  min-height: 100vh;
  min-width: 177.77vh; /* 16:9 aspect ratio height */
  transform: translate(-50%, -50%);
}

.grid-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 4vw;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--sp-md);
  margin-bottom: var(--sp-xl);
}

.detail-meta {
  grid-column: 1 / 4;
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.detail-meta p {
  font-family: var(--ff-medium);
  font-weight: 500;
  font-size: var(--text-body);
  color: #000000;
}

.meta-block h4 {
  font-size: var(--text-label);
  text-transform: uppercase;
  line-height: 1.4;
  letter-spacing: 0.08em;
  margin-bottom: var(--sp-xs);
}

.detail-intro {
  grid-column: 5 / -1;
}

.intro-desc {
  font-family: var(--ff-medium);
  font-weight: 500;
  font-size: var(--text-body);
  max-width: 70ch;
  line-height: 1.6;
  color: #000000;
  margin-left: auto;
}

/* --- Text reveal animations (project pages) --- */
.anim-text-wrap {
  overflow: hidden;
  display: block;
}

.anim-text {
  display: block;
  transform: translateY(110%);
  transition: transform 1s var(--ease-expo);
}

.in-view .anim-text {
  transform: translateY(0);
}

.fade-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1s ease, transform 1s ease;
}

.fade-up.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */

/* Laptop displays — MacBook Pro reports 1512 (14") or 1728 (16") logical
   px, well under the ~1920 the type scale's maximums were tuned against,
   so everything lands at full size in a smaller frame and reads zoomed-in.
   Stepping the root size down carries every rem-based size and spacing
   token with it, in proportion. */
@media (min-width: 901px) and (max-width: 1800px) {
  html { font-size: 15px; }
}

@media (max-width: 900px) {
  .navbar {
    padding: var(--sp-sm) var(--sp-md);
  }

  .nav-center {
    gap: var(--sp-sm);
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: var(--sp-md);
  }

  .about-details-grid {
    grid-template-columns: 1fr;
    gap: var(--sp-md);
  }

  .footer-inner {
    flex-direction: column;
    gap: var(--sp-sm);
    text-align: center;
  }

  /* Two even columns instead of content-sized flex items, which wrapped
     into ragged, unaligned rows */
  .detail-meta {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-md) var(--sp-sm);
    border-bottom: 1px solid var(--c-border);
    padding-bottom: var(--sp-md);
    margin-bottom: var(--sp-md);
  }

  .detail-intro {
    grid-column: 1 / -1;
  }

}

@media (max-width: 600px) {
  :root {
    /* Narrow enough that the neighbouring projects read as real cards
       (~21vw visible each side). Height is derived from width (x1.286)
       to hold the desktop proportion, so the image crop matches; the
       vh term is a safety cap on short screens. */
    --card-w: min(58vw, 280px);
    --card-h: min(74.6vw, 45vh, 360px);
  }

  .navbar {
    padding: calc(var(--sp-sm) + env(safe-area-inset-top, 0px)) var(--sp-sm) var(--sp-md);
    font-size: 1rem;
  }

  /* Keep About reachable — drop the decorative clock instead */
  .nav-center {
    display: none;
  }

  .portfolio-container {
    min-height: 0; /* fixed 600px floor overflows short phone screens */
  }

  .view-toggle {
    bottom: calc(3rem + env(safe-area-inset-bottom, 0px));
    padding: 0.75rem 1.8rem;
  }

  /* Overlaps the toggle on phones; the footer carries the notice */
  .landing-copy { display: none; }

  .project-list {
    padding: var(--sp-lg) var(--sp-sm);
  }

  .list-row {
    grid-template-columns: 2rem 1fr auto;
    gap: var(--sp-sm);
    padding: 1.1rem 0; /* comfortable tap height */
  }

  .list-meta { display: none; }
  .list-preview { display: none; }

  .detail-hero {
    padding-top: 96px;
  }

  /* Video hero: a fullscreen cover-crop shows only a sliver of a 16:9
     video on a portrait phone — show it as a natural 16:9 band instead */
  .detail-hero.video-mode {
    height: 56.25vw;
    min-height: 0;
    margin-top: 72px; /* clear the fixed back button */
    margin-bottom: var(--sp-lg);
  }

  .video-background iframe {
    min-height: 0;
    min-width: 0;
    width: 100vw;
    height: 56.25vw;
  }

  .about-section {
    padding: var(--sp-xl) var(--sp-md) var(--sp-lg);
  }

  .site-footer {
    padding: var(--sp-md);
  }
}

/* ═══════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
