/* =========================================================
   PALETTE & TYPE — change here, rest of file references it.
========================================================= */
:root {
  --bg:        #131313;
  --panel:     #262626;
  --line:      #3D3D3D;
  --text:      #F5F5F5;
  --muted:     #949494;

  --font-sans: 'Geist', sans-serif;
  --font-mono: 'Geist Mono', monospace;
  --font-serif: 'Instrument Serif', serif;

  /* Slate text font — swap this one line to change the slate font everywhere */
  --mask-font: var(--font-sans);

  --margin:    32px;
  --card-w:    44vw;
  --gap:       8vh;
}

/* =========================================================
   RESET & BASE
========================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { display: block; max-width: 100%; }

/* =========================================================
   UTILITIES
========================================================= */
.mono {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* =========================================================
   PERSISTENT CORNERS — always on screen.
========================================================= */
.corner {
  position: fixed;
  z-index: 50;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
}
.corner-main {
  text-decoration: none;
  border: 1px solid var(--text); border-radius: 999px;
  padding: 8px 16px;
  transition: background-color 0.25s, color 0.25s, opacity 0.3s;
  display: none;                 /* only on the home view (set below) */
}
.corner-main:hover { background: var(--text); color: var(--bg); }
body.on-home .corner-main { display: inline-block; }

.corner.top-left  { top: var(--margin); left: var(--margin); }
.corner.top-right { top: var(--margin); right: var(--margin); }
.corner.bot-left  { bottom: var(--margin); left: var(--margin); }
.corner.bot-right { bottom: var(--margin); right: var(--margin); }

.corner.top-left {
  display: flex;
  align-items: stretch;
  gap: 10px;
}
.corner-text {
  display: flex;
  flex-direction: column;
}
.corner-square {
  display: block;
  background: #FFF;
  flex-shrink: 0;
}
.corner-square.small { width: 38px; height: 38px; }

/* Cube — sits inside the logo-cluster, fills it.
   Initially translated off-screen right; slides in on intro-cube-in. */
.logo-cluster .hero-mark {
  position: absolute;
  inset: 0;
  background: #1A1A1A;
  transform: translateX(80vw);
  will-change: transform;
  transition: transform 0.7s cubic-bezier(.4, 0, .2, 1), opacity 0.4s ease;
}
body.intro-cube-in .logo-cluster .hero-mark { transform: translateX(0); }
body.on-project    .logo-cluster .hero-mark { opacity: 0; }
.corner.top-left .name {
  display: block;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  text-transform: none;
}
.corner .label {
  color: var(--muted);
  margin-bottom: 4px;
}

/* Project list and its items: stay visible (so the slide is visible),
   but block clicks on the project page. Active-meta-side fades out. */
body.on-project .project-list,
body.on-project .project-list-item,
body.on-project .project-list-meta { pointer-events: none; }
body.on-project .active-meta-side  { opacity: 0; pointer-events: none; }

/* =========================================================
   STAGE — fixed full-bleed; holds the moving track.
   Track is positioned so card[0] center sits at viewport center
   when transform = 0; subsequent cards slide up by unitPx each.
========================================================= */
.stage {
  position: fixed;
  /* Right-side area: after cluster (4vw + 22vh) + gap (8vw) + list (14vw) + gap (4vw) */
  left: calc(30vw + 22vh);
  right: 4vw;
  top: 0;
  bottom: 0;
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
  transform: translateX(0);
}
.track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  pointer-events: auto;
  will-change: transform;
}

/* =========================================================
   CARDS — natural-aspect image. Card width fixed, height
   driven by the image's intrinsic ratio. Title lives in the
   left rail; meta in the side labels.
========================================================= */
.card {
  display: block;
  /* Absolutely stacked at the track's center; JS translates each card to its
     wrapped slot every frame (infinite loop). marginBottom is still read by
     measure() for the gap. Mobile overrides position back to relative (grid). */
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  width: var(--card-w);
  margin: 0 auto var(--gap);
  cursor: pointer;
  container-type: inline-size;     /* enables container-relative font sizing */
}
/* Wrapper that gets scaled — image + label stay glued together */
.card-inner {
  position: relative;
  display: block;
  width: 100%;
  transition: transform 0.5s cubic-bezier(.2,.8,.2,1);
  will-change: transform, opacity, filter;
  overflow: hidden;
}
/* Grey bar behind the card title for legibility. 80% opacity (reduced by 20%). */
.card-inner::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 38%;
  background: linear-gradient(to bottom, transparent, rgba(40, 40, 40, 0.8));
  pointer-events: none;
  z-index: 1;
}
.card-cover {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;       /* 16:9 to match video covers */
  object-fit: cover;
  object-position: center;
  background: var(--panel);
}
/* Video cover behaves identically to image cover */
video.card-cover {
  pointer-events: none;
}
.card-cover.placeholder { aspect-ratio: 16 / 9; }

/* =========================================================
   PROJECT LIST — left rail, vertically scrolls so the active
   project sits at the viewport center row.
========================================================= */
.project-list {
  position: fixed;
  top: 50%;
  left: calc(12vw + 22vh);   /* after cluster (4vw + 22vh) + gap (8vw) */
  width: 14vw;
  height: 58vh;              /* narrower frame — pulls About/Contact closer */
  transform: translate(0, -50%);
  z-index: 40;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.project-list-cycle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, transparent, black 16%, black 84%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 16%, black 84%, transparent);
}
.project-list-cycle ul {
  list-style: none;
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
}
.project-list-meta {
  position: absolute;
  z-index: 2;        /* above the cycling titles so the link always wins the click */
  left: 0;
  right: 0;
  pointer-events: auto;
  font-family: var(--font-mono);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s;
}
.project-list-meta.top { top: 12vh; }
.project-list-meta.bot { bottom: 12vh; }
.project-list-meta:hover { color: var(--muted); }
.project-list-item {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  pointer-events: auto;
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.25;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  padding: 0;
  transform-origin: left center;   /* lens scaling shrinks toward the left edge */
  will-change: transform, opacity;
  transition: color 0.3s, font-weight 0.3s;
}
.project-list-item:hover { color: var(--text); }
.project-list-item.active {
  color: var(--text);
  font-weight: 500;
}

/* =========================================================
   ACTIVE META — side labels flanking the image.
   Show the active card's discipline (left) and role (right).
========================================================= */
.active-meta-side {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 35;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.005em;
  color: var(--text);
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.25s ease;
}
.active-meta-side { display: none; }
.active-meta-side.left  { left: 19vw; max-width: 12vw; text-align: right; }
.active-meta-side.right { right: 19vw; max-width: 12vw; text-align: left; }

/* =========================================================
   PRELOADER
========================================================= */
.preloader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100;
  display: grid;
  place-items: center;
}
.preloader.gone { opacity: 0; pointer-events: none; }

/* Intro variant A: GSAP owns the letter motion (entrance + collapse). Disable the
   CSS letter keyframe + the rest-group letter transition so the two systems don't
   fight over opacity/transform. The slide-to-cube + cube-in stay CSS-driven. */
body.intro-gsap .logo-mark .letter { animation: none !important; }
body.intro-gsap .logo-mark .rest-group .letter { transition: none !important; }
/* GSAP also drives the cube's grow + slide during the intro. */
body.intro-gsap .logo-cluster .hero-mark { transition: none !important; }
/* Logo cluster — leftmost on home page. Cube + FT live inside. */
.logo-cluster {
  position: fixed;
  top: 50%;
  left: calc(2vw + 11vh);    /* margin 2vw + half-cluster-width */
  width: 22vh;
  height: 22vh;
  transform: translate(-50%, -50%);
  z-index: 105;
  pointer-events: none;
}

/* FT mark inside cluster. Default state (final): centered on cluster,
   scaled down. Intro state: translated to viewport center, full size. */
.logo-cluster .logo-mark {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  font-family: var(--font-sans);
  font-size: 100px;
  font-weight: 200;
  letter-spacing: -0.03em;
  white-space: nowrap;
  color: var(--text);
  /* Intro: shifted from cluster (left) to viewport center, full size */
  transform: translate(-50%, -50%) translateX(calc(48vw - 11vh)) scale(1);
  will-change: transform;
  transition: transform 0.7s cubic-bezier(.4, 0, .2, 1), opacity 0.4s ease;
}
body.intro-slide-right .logo-cluster .logo-mark {
  /* Final: centered on cluster, scaled down */
  transform: translate(-50%, -50%) scale(0.64);
}
.logo-mark .word { display: inline-block; white-space: nowrap; }
.logo-mark .letter {
  display: inline-block;
  opacity: 0;
  animation: letter-in 0.45s ease-out forwards;
}
@keyframes letter-in { to { opacity: 1; } }

.logo-mark .rest-group {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  max-width: 12ch;
  will-change: max-width;
  transition: max-width 0.7s cubic-bezier(.4, 0, .2, 1);
}
.logo-mark .rest-group .letter {
  transition: transform 0.4s ease, opacity 0.35s ease;
}
.logo-mark .space {
  display: inline-block;
  width: 0.35em;
  overflow: hidden;
  will-change: width;
  transition: width 0.7s cubic-bezier(.4, 0, .2, 1);
}

/* Phase 1 — letters collapse to a point in place (GPU only) */
body.intro-collapse .logo-mark .rest-group .letter {
  transform: scale(0);
  opacity: 0;
}

/* Phase 2 — F, T and cube all move to the final position together:
   rest-group + space collapse (T joins F), logo-mark transforms
   to land at cube position scaled down. All same duration/curve. */
body.intro-slide-right .logo-mark .rest-group { max-width: 0; }
body.intro-slide-right .logo-mark .space      { width: 0; }
body.intro-slide-right .logo-mark {
  /* slide right by (cube_x - viewport_center) and scale down */
  transform: translate(calc(-50% + 25vw + var(--card-w) / 4), -50%) scale(0.64);
}

/* Sub-label at the bottom of the cube — appears after the intro */
.logo-sub {
  position: absolute;
  bottom: 10%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s ease 0.7s;
}
body.intro-slide-right .logo-sub { opacity: 1; }

/* Hidden on project pages */
body.on-project .logo-cluster .logo-mark,
body.on-project .logo-cluster .logo-sub { opacity: 0; }
.preloader-count {
  position: absolute;
  top: var(--margin);
  right: var(--margin);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text);
}

/* =========================================================
   PROJECT VIEW — fixed full-screen flex row.
   25px padding on all sides. Left text container has fixed
   width; right image container fills remaining space and
   scales uniformly with browser size.
========================================================= */
/* Always rendered so children can animate in/out. Hidden visually
   on home because its children are off-screen-right by default. */
.project-view {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 25px;
  gap: 2.5vw;
  pointer-events: none;
}
body.on-project .project-view { pointer-events: auto; }

.project-info {
  flex: 0 0 auto;
  width: 260px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;                /* spacing handled per group below */
  align-self: center;
  text-align: left;
  /* Float centered in the space between viewport-left and the buttons.
     Auto margins absorb leftover space equally; when space runs out,
     the text gets pushed off the left rather than resized. */
  margin-left: auto;
  margin-right: auto;
}
/* Kicker (overline) — small mono label above the title */
.project-info .kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 14px;
}
.project-info .title {
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.05;
  /* hairline separates the header from the meta block */
  padding-bottom: 20px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.project-info .meta {
  display: flex;
  flex-direction: column;
  gap: 0;
}
/* stacked label-above-value with hairline dividers */
.project-info .meta-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.project-info .meta-row .meta-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.project-info .meta-row .meta-value {
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}
.project-info .body p { margin-bottom: 0.8em; }
.project-info .body p:last-child { margin-bottom: 0; }
.project-info .client-date {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.project-info .body {
  font-size: 14px;
  line-height: 1.6;
  max-width: 36ch;
  color: var(--text);
}
.project-info .back {
  font-family: var(--font-mono);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  cursor: pointer;
  margin-top: 28px;
}
.project-sections {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.section-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.section-btn:hover { border-color: var(--text); }
.section-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
/* small overline so the view buttons read as a labelled control */
.sections-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 6px;
}

/* Project-view flex items, in this order from left to right:
   .project-info  → .logo-cluster  → .project-sections  → .project-media-stack */


/* Project-view section buttons — wider vertical column so the views read as a
   prominent control (the gallery auto-shrinks to make room). */
.project-view .project-sections {
  flex: 0 0 auto;
  width: 150px;
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

/* Gallery wrapper — grid so stack and dots share the same column.
   Dots' width is bounded to stack width (no overflow when many dots). */
.project-gallery {
  position: relative;   /* anchors the prev/next arrows */
  flex: 0 0 auto;
  align-self: center;
  display: grid;
  grid-template-columns: auto;
  grid-auto-rows: auto;
  row-gap: 16px;
  justify-items: center;
}

/* Image stack: 16:9 aspect, width/height set by JS */
.project-media-stack {
  position: relative;
  overflow: hidden;
}

/* Thin prev/next chevrons over the gallery */
.gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  background: none;
  border: none;
  color: var(--text);
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
}
.gallery-arrow:hover { opacity: 1; }
.gallery-arrow.prev { left: -10px; }
.gallery-arrow.next { right: -10px; }
.gallery-arrow.prev:hover { transform: translateY(-50%) translateX(-3px); }
.gallery-arrow.next:hover { transform: translateY(-50%) translateX(3px); }
.gallery-arrow svg { display: block; }

/* Dot pagination — kept on a single line; JS scales the container
   down (transform) if its natural width would exceed the image width. */
.project-dots {
  display: flex;
  flex-wrap: nowrap;
  gap: 11px;
  align-items: center;
  justify-content: center;
  transform-origin: center top;
}
.project-dots .dot {
  appearance: none;
  width: 6px;
  height: 6px;
  border: 1px solid var(--text);
  border-radius: 50%;
  background: transparent;
  padding: 0;
  cursor: pointer;
  transform-origin: center center;
  /* JS sets scale/opacity from cursor distance (dock magnify); transition smooths it */
  transition: transform 0.22s cubic-bezier(.2, .8, .2, 1), background 0.2s, opacity 0.22s;
  opacity: 0.6;
}
.project-dots .dot.active {
  background: var(--text);
  opacity: 1;
}
.project-media {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transform: translateX(2vw);
  transition: opacity 0.7s ease, transform 0.9s cubic-bezier(.4, 0, .2, 1);
  pointer-events: none;
  will-change: opacity, transform;
}
.project-media.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
  z-index: 2;
}
.project-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.project-media video {
  display: block;
  width: 100%;
  height: 100%;
  /* preserve native aspect ratio — videos may be 16:9, 9:16, 1:1, etc.
     Letterbox in --bg so off-aspect bars blend with the page. */
  object-fit: contain;
  background: var(--bg);
}

/* ===== Project intro slate — first slide of every project gallery.
   Blurred cover image as backdrop + dark translucent overlay + description text.
   Behaves like any other slide (fade transitions). ===== */
.project-media.slate {
  background: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5vh 5vw;
  box-sizing: border-box;
  overflow: hidden;
}
.slate-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(28px) saturate(110%);
  /* scale up slightly so the blur softness doesn't bleed past edges */
  transform: scale(1.08);
  pointer-events: none;
  z-index: 0;
}
.slate-overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 20, 0.58);
  pointer-events: none;
  z-index: 1;
}
.slate-text {
  position: relative;
  z-index: 2;
  color: #fff;
  text-align: center;
  max-width: 88%;
  font-family: var(--mask-font, var(--font-sans));
}
.slate-tagline {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(15px, 1.3vw, 20px);
  color: rgba(255, 255, 255, 0.62);
  margin: 0 0 32px 0;
  letter-spacing: 0;
}
.slate-status {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 28px;
  color: rgba(255, 255, 255, 0.55);
}
.slate-status.status-realized   { color: rgba(170, 220, 170, 0.8); }
.slate-status.status-unrealized { color: rgba(220, 180, 140, 0.8); }
.slate-body {
  font-family: var(--mask-font, var(--font-sans));
  font-weight: 300;
  font-size: clamp(16px, 1.4vw, 22px);
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: rgba(255, 255, 255, 0.92);
  max-width: 56ch;
  margin: 0 auto 18px;
}
.slate-body p { margin: 0 0 0.8em 0; }
.slate-body p:last-child { margin-bottom: 0; }
.slate-body em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.08em;
  color: rgba(255, 255, 255, 0.75);
}
.slate-role {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.82);
  margin-top: 24px;
}
.slate-role-label {
  color: rgba(255, 255, 255, 0.5);
  margin-right: 4px;
}
.project-media.placeholder {
  background: var(--panel);
}

/* Suppress page-transition transitions while the user is resizing.
   The vw-based transforms otherwise re-animate as the viewport changes,
   briefly revealing off-screen elements. */
body.resizing .logo-cluster,
body.resizing .project-list,
body.resizing .stage,
body.resizing .project-view .project-info,
body.resizing .project-view .project-sections,
body.resizing .project-view .project-gallery,
body.resizing .about-view .about-text,
body.resizing .about-view .about-photo,
body.resizing .about-back {
  transition: none !important;
}

/* =========================================================
   ROUTE TRANSITION — staggered slide in/out
   Home items (logo / list / stage) slide off-screen LEFT.
   Project items (info / sections / gallery) slide in from RIGHT.
   transit-to-project / transit-to-home set direction-aware delays.
========================================================= */
.logo-cluster,
.project-list,
.stage {
  transition: transform 0.6s cubic-bezier(.4, 0, .2, 1);
}

.project-view .project-info,
.project-view .project-sections,
.project-view .project-gallery {
  transition: transform 0.6s cubic-bezier(.4, 0, .2, 1);
  transform: translateX(120vw);   /* default: off-screen right */
}

/* End state: on project — home slides off-left, project slides in */
body.on-project .logo-cluster {
  transform: translate(calc(-50% - 130vw), -50%);
}
body.on-project .project-list {
  transform: translate(-110vw, -50%);
}
body.on-project .stage {
  transform: translateX(-110vw);
}
body.on-project .project-view .project-info,
body.on-project .project-view .project-sections,
body.on-project .project-view .project-gallery {
  transform: translateX(0);
}

/* Direction: home → project. Home leaves first (delays 0/0.1/0.2),
   project enters after (delays 0.5/0.6/0.7). */
body.transit-to-project .logo-cluster                            { transition-delay: 0s; }
body.transit-to-project .project-list                            { transition-delay: 0.1s; }
body.transit-to-project .stage                                   { transition-delay: 0.2s; }
body.transit-to-project .project-view .project-info              { transition-delay: 0.5s; }
body.transit-to-project .project-view .project-sections          { transition-delay: 0.6s; }
body.transit-to-project .project-view .project-gallery           { transition-delay: 0.7s; }

/* Direction: project → home. Reverse order:
   gallery leaves first → sections → text; then stage (card gallery) enters → list → logo. */
body.transit-to-home .project-view .project-gallery              { transition-delay: 0s; }
body.transit-to-home .project-view .project-sections             { transition-delay: 0.1s; }
body.transit-to-home .project-view .project-info                 { transition-delay: 0.2s; }
body.transit-to-home .stage                                      { transition-delay: 0.5s; }
body.transit-to-home .project-list                               { transition-delay: 0.6s; }
body.transit-to-home .logo-cluster                               { transition-delay: 0.7s; }

/* =========================================================
   ABOUT VIEW
   Right: logo cluster (re-positioned from left to right edge).
   Center: photo. Left: text. Both slide in from off-screen left.
========================================================= */
.about-view {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  /* leave room on the right for the relocated logo cluster */
  padding: 25px calc(8vw + 22vh) 25px 4vw;
  gap: 4vw;
  pointer-events: none;
}
body.on-about .about-view { pointer-events: auto; }

.about-text {
  flex: 0 0 auto;
  width: clamp(360px, 30vw, 460px);
  display: flex;
  flex-direction: column;
  gap: 22px;
  color: var(--text);
  /* center horizontally in space between photo and logo */
  margin-left: auto;
  margin-right: auto;
}
.about-text .title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  line-height: 1;
}
.about-text .body {
  font-family: var(--font-sans);
  font-size: clamp(17px, 1.4vw, 22px);
  font-weight: 300;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--text);
}
.about-text .body p { margin-bottom: 0.8em; }
.about-text .body p:last-child { margin-bottom: 0; }
/* Key phrases — serif italic, slightly larger. Magazine pull-quote feel. */
.about-text .body em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.3em;
  letter-spacing: -0.005em;
  color: var(--text);
}
/* Back link — sits under the logo cluster on the right side. */
.about-back {
  position: absolute;
  /* cluster center is at top:50%; cluster height 22vh → bottom at 50%+11vh.
     Place back ~24px below that. Left edge aligned to the cube's left edge
     (on-about the cluster spans [94vw - 22vh, 94vw]). */
  top: calc(50% + 11vh + 24px);
  left: calc(94vw - 22vh);
  right: auto;
  font-family: var(--font-mono);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  /* enters from the left, travelling in with the cube (was inverted: from right) */
  transform: translateX(-130vw);
  transition: transform 0.6s cubic-bezier(.4, 0, .2, 1);
  will-change: transform;
}
body.on-about .about-back { transform: translateX(0); }

.about-photo {
  /* Allowed to shrink below 42vw when the row gets tight, so the text never
     spills right into the relocated cube on narrower viewports. */
  flex: 0 1 42vw;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 42vw;
  height: 82vh;
  max-height: 82vh;
  overflow: hidden;
}
.about-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 75% center;  /* crop from left, show more of the right side */
}

/* About items default off-screen left */
.about-view .about-text,
.about-view .about-photo {
  transform: translateX(-130vw);
  transition: transform 0.6s cubic-bezier(.4, 0, .2, 1);
  will-change: transform;
}
body.on-about .about-view .about-text,
body.on-about .about-view .about-photo {
  transform: translateX(0);
}

/* on-about end states for home elements:
   - logo: slides RIGHT and stops at right side (mirror of home's left position)
   - project-list: slides off-screen right
   - stage: slides off-screen right
*/
body.on-about .logo-cluster {
  transform: translate(calc(-50% + 92vw - 22vh), -50%);
}
body.on-about .project-list  { transform: translate(110vw, -50%); }
body.on-about .stage         { transform: translateX(110vw); }

/* hide preloader-style elements that should not show on about */
body.on-about .logo-cluster .logo-mark,
body.on-about .logo-cluster .logo-sub { opacity: 1; }

/* Transit home → about. Home elements clear right (stage + list off-screen,
   logo lands on right side), then about content slides in from left. */
body.transit-to-about .stage                       { transition-delay: 0s; }
body.transit-to-about .project-list                { transition-delay: 0.1s; }
body.transit-to-about .logo-cluster                { transition-delay: 0.2s; }
/* New layout: photo on left, text in middle. Arrival follows right→left:
   text (middle, closer to logo) lands first, then photo (left), then back. */
/* Back is the cube's companion: it moves right AFTER the square (logo) on the
   way in, and AFTER the square again on the way out. */
body.transit-to-about .about-back                  { transition-delay: 0.35s; }
body.transit-to-about .about-view .about-text     { transition-delay: 0.7s; }
body.transit-to-about .about-view .about-photo    { transition-delay: 0.8s; }

/* Transit about → home. About content leaves first, then the back leaves
   BEFORE the square, then the home elements (square/list/stage) return. */
body.transit-from-about .about-view .about-photo  { transition-delay: 0s; }
body.transit-from-about .about-view .about-text   { transition-delay: 0.1s; }
body.transit-from-about .about-back                { transition-delay: 0.4s; }
body.transit-from-about .logo-cluster              { transition-delay: 0.6s; }
body.transit-from-about .project-list              { transition-delay: 0.7s; }
body.transit-from-about .stage                     { transition-delay: 0.8s; }

/* =========================================================
   CONTACT MODAL — overlay on top of any page with blurred
   backdrop. Closes via X / Esc / backdrop click / browser back.
========================================================= */
.contact-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(19, 19, 19, 0.5);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease, backdrop-filter 0.45s ease;
}
body.on-contact .contact-overlay {
  opacity: 1;
  pointer-events: auto;
}

.contact-modal {
  position: relative;
  width: min(480px, 92vw);
  max-height: 88vh;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 56px 48px 44px;
  overflow-y: auto;
  transform: translateY(24px);
  transition: transform 0.5s cubic-bezier(.4, 0, .2, 1);
}
body.on-contact .contact-modal { transform: translateY(0); }

.contact-modal .close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 18px;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
  transition: color 0.2s;
}
.contact-modal .close:hover { color: var(--muted); }

.contact-modal .label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 20px;
}

.contact-modal .lead {
  font-family: var(--font-sans);
  font-size: clamp(20px, 1.8vw, 26px);
  font-weight: 300;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 32px;
}
.contact-modal .lead em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.18em;
  letter-spacing: -0.005em;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 32px;
}
.contact-form .field { display: flex; flex-direction: column; }
.contact-form input,
.contact-form textarea {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.contact-form input::placeholder,
.contact-form textarea::placeholder { color: var(--muted); }
.contact-form input:focus,
.contact-form textarea:focus { border-bottom-color: var(--text); }
.contact-form textarea {
  resize: vertical;
  min-height: 88px;
  max-height: 200px;
  font-family: var(--font-sans);
  line-height: 1.4;
}
.contact-form button {
  align-self: flex-start;
  margin-top: 12px;
  background: none;
  border: 1px solid var(--text);
  padding: 12px 24px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.contact-form button:hover {
  background: var(--text);
  color: var(--bg);
}

.contact-direct {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.contact-direct .row {
  display: flex;
  gap: 16px;
  align-items: baseline;
  font-family: var(--font-sans);
  font-size: 13px;
}
.contact-direct .row .key {
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
  width: 60px;
  flex-shrink: 0;
}
.contact-direct .row a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.contact-direct .row a:hover { border-bottom-color: var(--text); }
.contact-direct .row .val { color: var(--text); }

/* Desktop: hide mobile header/menu */
.mobile-header,
.mobile-menu { display: none; }

/* Project title overlay — bottom-right inside each card image */
.card-label {
  position: absolute;
  bottom: 28px;
  left: 28px;
  color: #fff;
  font-family: var(--font-sans);
  font-size: clamp(22px, 2vw, 36px);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.05;
  text-align: left;
  max-width: 65%;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  z-index: 2;
}

/* =========================================================
   RESPONSIVE — phone (≤ 800px)
   Desktop is layered/absolute with custom scroll mechanics.
   Mobile is plain vertical native-scroll. The JS detects mobile
   at boot and skips all layout-affecting paths (tick loop, body
   height, wheel handlers). CSS resets the absolute positions to
   normal document flow.
========================================================= */
@media (max-width: 800px) {
  /* Hide all desktop elements completely */
  body.mobile .logo-cluster,
  body.mobile .preloader,
  body.mobile .corner,
  body.mobile .active-meta-side {
    display: none !important;
  }

  /* Reset body to normal document flow. Keep overflow only on <html> so the
     document is the scroll container — putting overflow on <body> makes it an
     intermediate scroller and breaks position:sticky inside it. */
  /* overflow-anchor:none — stop the browser from shifting scroll when the new
     section's images load (was dragging the view into the middle on switch). */
  html { overflow-x: hidden; overflow-anchor: none; }
  html, body.mobile {
    height: auto;
    width: 100%;
  }
  body.mobile, body.mobile * { overflow-anchor: none; }
  body.mobile {
    padding: 0;
    margin: 0;
    /* overflow MUST stay visible (overrides the global body{overflow-x:hidden}),
       otherwise body becomes a scroll container and position:sticky breaks.
       <html> clips horizontal overflow at the root instead. */
    overflow: visible;
    background: var(--bg);
    color: var(--text);
  }
  /* Home is engine + touch driven → lock native scroll. Sub-pages: document scrolls. */
  body.mobile.on-home { position: fixed; inset: 0; overflow: hidden; }
  body.mobile.on-project, body.mobile.on-about { position: static; }

  /* ===== MOBILE HEADER ===== */
  .mobile-header {
    display: flex !important;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    padding: 0 18px;
    z-index: 300;
    background: rgba(19, 19, 19, 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    align-items: center;
    justify-content: space-between;
  }
  .mobile-logo {
    font-family: var(--font-sans);
    font-size: 18px;
    font-weight: 400;
    letter-spacing: 0.06em;
    color: var(--text);
    text-decoration: none;
  }
  .mobile-burger {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 32px;
    height: 32px;
    justify-content: center;
    align-items: center;
  }
  .mobile-burger span {
    display: block;
    width: 18px;
    height: 1.5px;
    background: var(--text);
    transition: transform 0.3s, opacity 0.3s;
  }
  body.menu-open .mobile-burger span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
  body.menu-open .mobile-burger span:nth-child(2) { opacity: 0; }
  body.menu-open .mobile-burger span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

  /* ===== MOBILE MENU OVERLAY ===== */
  .mobile-menu {
    display: flex !important;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 299;
    flex-direction: column;
    align-items: flex-start;
    padding: 40px 24px;
    gap: 28px;
    background: var(--bg);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(.4, 0, .2, 1);
  }
  body.menu-open .mobile-menu { transform: translateX(0); }
  .mobile-menu a {
    font-family: var(--font-sans);
    font-size: 32px;
    font-weight: 300;
    letter-spacing: -0.02em;
    color: var(--text);
    text-decoration: none;
  }

  /* ===== VIEW SWITCHING — only ONE view visible at a time ===== */
  body.mobile .stage,
  body.mobile .project-view,
  body.mobile .about-view { display: none !important; }
  body.mobile .stage { display: block !important; }
  body.mobile.on-project .stage { display: none !important; }
  body.mobile.on-project .project-view { display: block !important; }
  body.mobile.on-about .stage { display: none !important; }
  body.mobile.on-about .about-view { display: block !important; }

  /* ===== HOME — left title rail + right cover stack (engine-driven, touch).
     Mirrors the desktop home, re-laid-out for portrait. The scroll engine runs
     on mobile too (its isMobile bail-outs were removed); touch-drag scrolls it. */
  body.mobile .stage {
    position: fixed !important;
    left: 4vw !important; right: 4vw !important;
    top: 0 !important; bottom: 0 !important;
    width: auto !important; height: auto !important;
    padding: 0 !important;
    overflow: hidden !important;
    transform: none !important;
    pointer-events: auto;
  }
  body.mobile .track {
    position: absolute !important;
    top: 50% !important; left: 0 !important; right: 0 !important;
    display: block !important;
    transform: none;
  }
  body.mobile .card {
    position: absolute !important;
    width: 92vw !important;
    left: 0 !important; right: 0 !important;
    margin: 0 auto 6vh !important;   /* bottom gap → engine's unit spacing */
    pointer-events: auto;
  }
  /* engine controls .card-inner transform/opacity/filter — no overrides here */
  body.mobile .card-inner { display: block; }
  body.mobile .card-cover {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9 !important;
    object-fit: cover;
    display: block;
  }
  body.mobile .card-label {
    position: absolute;
    bottom: 14px;
    left: 16px;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 16px;
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.1;
    text-align: left;
    max-width: 90%;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    z-index: 2;
    padding: 0;
    margin: 0;
    text-transform: none;
  }

  /* No title rail on mobile — each cover carries its own title. */
  body.mobile .project-list { display: none !important; }

  /* ===== PROJECT PAGE — stacked ===== */
  body.mobile .project-view {
    position: relative !important;
    inset: auto !important;
    padding: 76px 24px 60px;
    height: auto;
    transform: none !important;
    pointer-events: auto !important;
    gap: 0;
  }
  body.mobile .project-info {
    width: 100% !important;
    margin: 0 0 20px 0 !important;
    padding: 0;
    gap: 0;
    transform: none !important;
    text-align: left;
  }
  body.mobile .project-info .kicker { margin-bottom: 6px; }
  body.mobile .project-info .title {
    font-size: 28px;
    line-height: 1.05;
    padding-bottom: 0;
    margin-bottom: 8px;
    border-bottom: none;          /* drop the divider on phone — saves height */
  }
  /* compact meta: Client on its own line, then Date + Location side by side */
  body.mobile .project-info .meta {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px 24px;
    margin: 0;
  }
  body.mobile .project-info .meta-row {
    border: none !important;
    padding: 0 !important;
    gap: 1px;
    flex: 0 0 auto;
  }
  body.mobile .project-info .meta-row:first-child { flex-basis: 100%; }   /* Client full width */
  body.mobile .project-info .meta-row .meta-label { font-size: 9px; }
  body.mobile .project-info .meta-row .meta-value { font-size: 13px; line-height: 1.2; }
  body.mobile .project-info .body { font-size: 14px; line-height: 1.55; }

  /* Views — pill buttons, pinned to the top so they stay reachable while the
     photos scroll underneath (the title/meta above scroll away). */
  body.mobile .project-sections {
    position: sticky !important;
    top: 56px;                 /* sits just under the fixed mobile header */
    z-index: 20;
    width: 100% !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px 0;
    padding: 12px 0;
    background: var(--bg);
    transform: none !important;
  }
  body.mobile .project-sections .sections-label {
    flex-basis: 100%;
    margin-bottom: 4px;
    font-size: 11px;
    color: var(--muted);
  }
  body.mobile .project-sections .section-btn {
    font-size: 12px;
    padding: 8px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
  }
  body.mobile .project-sections .section-btn.active {
    background: var(--text);
    color: var(--bg);
    border: 1px solid var(--text);
  }
  body.mobile .project-gallery {
    width: 100% !important;
    transform: none !important;
    margin: 0;
    padding: 0;
  }
  body.mobile .project-media-stack {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    /* always tall enough that the pills can scroll to the top on any section,
       even short ones (otherwise the page can't scroll far enough to pin them) */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  body.mobile .project-media {
    position: relative !important;
    width: 100%;
    height: auto;
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
    z-index: auto !important;
  }
  body.mobile .project-media img,
  body.mobile .project-media video {
    width: 100% !important;
    height: auto !important;
    object-fit: contain;
    display: block;
  }
  body.mobile .project-media video {
    /* fallback while metadata loads so the box isn't 0-height */
    min-height: 30vh;
    background: #000;
  }
  /* Mobile slate: stacks as a normal block, min-height for visual presence */
  body.mobile .project-media.slate {
    min-height: 60vh;
    padding: 8vh 6vw;
  }
  body.mobile .slate-text {
    font-size: 18px;
    line-height: 1.4;
  }
  body.mobile .project-dots { display: none !important; }
  body.mobile .gallery-arrow { display: none !important; }
  body.mobile .project-info .back {
    display: inline-block;
    margin-top: 12px;
  }

  /* ===== ABOUT PAGE — uses a dedicated mobile structure ===== */
  body.mobile .about-view {
    position: relative !important;
    inset: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    display: none !important;
  }
  body.mobile.on-about .about-view {
    display: block !important;
    pointer-events: auto !important;
  }
  .about-mobile {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 70px 20px 50px;
    width: 100%;
    box-sizing: border-box;
  }
  .about-mobile-photo {
    width: 100%;
    max-width: 100%;
    height: 72vh;
    max-height: 72vh;
    object-fit: cover;
    object-position: 75% center;
    display: block;
    margin: 0;
  }
  .about-mobile-label {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin: 4px 0 0 0;
  }
  .about-mobile-body {
    font-family: var(--font-sans);
    font-size: 17px;
    font-weight: 300;
    line-height: 1.5;
    color: var(--text);
    letter-spacing: -0.01em;
  }
  .about-mobile-body p { margin: 0; }
  .about-mobile-body em {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
    font-size: 1.18em;
    letter-spacing: -0.005em;
    color: var(--text);
  }
  .about-mobile-back {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text);
    text-decoration: none;
    margin: 8px 0 0 0;
    display: inline-block;
    align-self: flex-start;
  }

  /* ===== CONTACT — full page on mobile, no blur backdrop ===== */
  body.mobile .contact-overlay {
    background: var(--bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
    align-items: flex-start;
    justify-content: stretch;
  }
  body.mobile .contact-modal {
    width: 100vw;
    max-width: 100vw;
    max-height: none;
    height: 100vh;
    min-height: 100vh;
    padding: 70px 24px 40px;
    border: none;
    overflow-y: auto;
    transform: none !important;
  }
  body.mobile .contact-modal .close {
    top: 16px;
    right: 16px;
    font-size: 22px;
    padding: 8px 12px;
  }
  body.mobile .contact-modal .lead {
    font-size: 22px;
    margin-bottom: 28px;
  }

  /* ===== Page titles on mobile — for Projects, Studio ===== */
  .page-title-mobile {
    grid-column: 1 / -1;
    font-family: var(--font-sans);
    font-size: 32px;
    font-weight: 300;
    letter-spacing: -0.02em;
    color: var(--text);
    margin: 0 0 20px 0;
    line-height: 1;
  }
}
