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

:root {
  --bg: #0a0a0a;
  --fg: #f0ede8;
  --fg-dim: rgba(240, 237, 232, 0.38);
  --serif: 'Georgia', 'Times New Roman', serif;
  --sans: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mono: 'Courier Prime', 'Courier New', Courier, monospace;
}

html {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
}

body {
  overflow-x: hidden;
  overflow-y: scroll;
}

/* ── Nav ──────────────────────────────────────────────────── */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 36px 40px;
  z-index: 1000;
  pointer-events: none;
}

.brand {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  line-height: 1;
  text-decoration: none;
  pointer-events: auto;
  transition: color 0.4s ease;
}

.nav-links {
  display: flex;
  gap: 32px;
  pointer-events: auto;
}

.nav-link {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
  text-decoration: none;
  transition: color 0.4s ease, opacity 0.2s;
}

.nav-link:hover { opacity: 0.7; }

/* Dark nav — applied when scrolled into light sections */
nav.nav--dark .brand,
nav.nav--dark .nav-link { color: #111; }

/* ── Sections ─────────────────────────────────────────────── */
section {
  position: relative;
  height: 150vh;   /* taller than viewport — gives scroll travel per section */
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

/* ── Frame link — click target and scale wrapper ──────────── */
/* display: flex makes it a proper flex item inside the        */
/* section so it scales as a whole unit without clipping.     */
.frame-link {
  display: flex;
  transition: transform 0.8s ease;
  will-change: transform;
}

.frame-link:hover {
  transform: scale(1.05);
}

section::after {
  content: '';
  position: absolute;
  inset: 0;
  background: transparent;
  z-index: 2;
  pointer-events: none;
}

/* ── Background image ─────────────────────────────────────── */
/*
  Overshoots the section by 30% top and bottom so the parallax
  drift never reveals a gap. With K=0.35 and 150vh sections the
  max shift is ~0.35 × 150vh ≈ 52vh — well within the 30% buffer.
*/
.bg {
  position: absolute;
  top: -30%;
  left: 0;
  width: 100%;
  height: 160%;
  background-size: cover;
  background-position: center 50%;

  /* GPU compositor layer — eliminates sub-pixel jitter */
  will-change: transform;
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
}

/* Bottom vignette */
.bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(10, 10, 10, 0.72) 0%,
    rgba(10, 10, 10, 0.06) 44%,
    transparent 100%
  );
}

/* ── Hero section (first) — centred title ─────────────────── */
section.section--hero {
  align-items: center;
  justify-content: center;
  /* Stronger all-over vignette so centred text reads clearly */
  background: none;
}

section.section--hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.30);
  z-index: 1;
  pointer-events: none;
}

section.section--hero .info {
  /* Pin to the viewport centre, not the section centre.
     The section is 150vh tall; align-items:center would put
     the title at 75vh — below the visible midpoint.
     Instead, anchor absolutely at 50vh from the section top
     (= window centre while scroll = 0) and offset upward by
     half the element's own height with translateY(-50%). */
  position: absolute;
  top: 50vh;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 0;
  text-align: left;
  padding-left: 40px;
  z-index: 11;
  width: 100%;
}

section.section--hero .title {
  font-size: clamp(1.1rem, 2.2vw, 1.8rem);
}

/* ── Title (hero section only — others use #fixed-label) ──── */
.info {
  position: relative;
  z-index: 11;
  padding: 0 44px 44px;
}

.title {
  font-family: var(--mono);
  font-weight: 400;
  font-size: clamp(1.1rem, 2.2vw, 1.8rem);
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: var(--fg);
}

/* ── Fixed title label — replaced by per-section labels ───── */
#fixed-label { display: none; }

/* ── Per-section title label ───────────────────────────────── */
.section-label {
  /* top set by JS to section centre (page coords); left 50% + translateX(-50%) centres horizontally */
  position: absolute;
  left: 50%;
  z-index: 50;
  font-family: 'Pinyon Script', cursive;
  font-weight: 400;
  font-size: clamp(2.8rem, 6vw, 5.5rem);
  letter-spacing: 0.01em;
  color: var(--fg);
  text-align: left;
  padding-left: 40px;
  text-shadow: 0 1px 20px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  will-change: transform;
  backface-visibility: hidden;
  /* opacity driven by JS scroll calculation — no CSS transition needed */
  opacity: 0;
}

/* ══════════════════════════════════════════════════════════
   SECTION VARIANTS
   ══════════════════════════════════════════════════════════ */

/* ── Variant: video ────────────────────────────────────────
   100vh height so the section exactly fills the viewport and
   no empty gap appears between it and the next section.
   The video element still has the overscan buffer (top:-30%,
   height:160%) for the parallax drift.                      */
section.section--video {
  height: 100vh;
}

section.section--video .bg-video {
  position: absolute;
  top: -10%;
  left: 0;
  width: 100%;
  height: 120%;   /* 10% overscan top + bottom — keeps parallax gap-free  */
  object-fit: cover; /* centres video content within the overscan box */
  will-change: transform;
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
  display: block;
}

/* ── Video section: title block ────────────────────────────── */
.video-title-block {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 900;
  pointer-events: none;
  line-height: 1.55;
  text-align: center;
  transition: opacity 0.4s ease;
}

.video-title-main {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg);
}

.video-title-sub {
  font-family: 'Times New Roman', 'Georgia', serif;
  font-weight: 200;
  font-style: italic;
  font-size: 13px;
  color: var(--fg);
}

/* Vignette gradient for video sections (normally on .bg::after) */
section.section--video .vignette {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(10, 10, 10, 0.72) 0%,
    rgba(10, 10, 10, 0.06) 44%,
    transparent 100%
  );
  z-index: 1;
  pointer-events: none;
}

/* ── Variant: framed, framed-right, sized ──────────────────
   These sections are 100 vh (no scroll-through needed),
   show a solid background colour, and contain the image
   in a centred or offset frame box.                        */
section.section--framed,
section.section--framed-right,
section.section--framed-left,
section.section--sized {
  height: 100vh;
  align-items: center;
  justify-content: center;
}

/* Right-offset: push frame toward the right edge */
section.section--framed-right {
  justify-content: flex-end;
  padding-right: 8%;
}

/* Left-offset: push frame toward the left edge */
section.section--framed-left {
  justify-content: flex-start;
  padding-left: 8%;
}

/*
  The frame drifts as a whole unit — the image simply fills it.
  Parallax transform is applied to .frame itself (via JS), so the
  entire box floats at a slower speed than the page scroll.
  No overscan needed on the image since it never moves independently.
*/
.frame {
  flex-shrink: 0;
  overflow: hidden;

  /* GPU compositor layer — parallax transform applied here by JS */
  will-change: transform;
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
}

.frame img,
.frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.frame-link .frame {
  cursor: pointer;
}

/* Default frame sizes per variant
   Override per-project with inline style on the .frame element  */
section.section--framed       .frame { width: 64%; aspect-ratio: 4/3; }
section.section--framed-right .frame { width: 55%; aspect-ratio: 4/3; }
section.section--framed-left  .frame { width: 55%; aspect-ratio: 4/3; }
section.section--sized        .frame { width: 36%; aspect-ratio: 2/3; }

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 600px) {
  nav                  { padding: 24px; }
  .info                { padding: 0 24px 38px; }
  #fixed-label         { bottom: 32px; left: 24px; }
}

/* ── Site credit ───────────────────────────────────────────── */
.site-credit {
  text-align: left;
  padding: 40px 20px 40px 40px;
  font-family: 'Times New Roman', 'Georgia', serif;
  font-weight: 200;
  font-style: italic;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--fg);
  opacity: 0.45;
}
.site-credit a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* ── Page transition overlay ───────────────────────────────── */
#page-transition {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  opacity: 1;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
