/* ============================================================================
 *  SHIFT — styles
 *  Black everywhere (so a momentary gap is never a white flash), a pinned
 *  full-bleed video stage, and editorial copy that rises from below — the
 *  copy reveal is a CSS animation triggered when each section becomes active,
 *  so it stays smooth independently of the video scrub.
 * ========================================================================== */

/* ----------------------------------------------------------------------------
 *  FONTS
 *  MVRDV brand face is Graphik. Drop the licensed web fonts into /fonts and
 *  these @font-face rules pick them up automatically. Until then the site
 *  falls back to a close neo-grotesque stack so it still looks right.
 *  See fonts/README.md.
 * -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Graphik';
  src: url('../fonts/Graphik-Thin.woff2') format('woff2');
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Graphik';
  src: url('../fonts/Graphik-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Type — swap these to change every headline / paragraph at once */
  --font-display: 'Graphik', 'Helvetica Neue', 'Inter', Arial, sans-serif; /* Medium */
  --font-body:    'Graphik', 'Helvetica Neue', 'Inter', Arial, sans-serif; /* Thin   */
  --font-brand:   var(--font-display);   /* the Amsterhive wordmark (set to DIN here if licensed) */

  --weight-display: 500; /* Graphik Medium */
  --weight-body:    100; /* Graphik Thin   */

  /* Colour */
  --bg:   #000000;
  --ink:  #f4f1ea;   /* warm off-white for legibility on video */

  /* Rhythm */
  --edge: clamp(1.5rem, 6vw, 6rem);   /* page margin around the copy */

  /* Copy reveal (overridden from js/config.js at runtime) */
  --copy-travel: 64px;  /* how far the copy rises */
  --copy-in:  0.9s;     /* entry animation length */
  --copy-out: 0.55s;    /* exit animation length  */
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: var(--weight-body);
  overflow-x: hidden;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ----------------------------------------------------------------------------
 *  SCROLL ENGINE
 *  .scroll-root is tall (its height is set in JS); .stage pins inside it.
 * -------------------------------------------------------------------------- */
.scroll-root { position: relative; width: 100%; }

.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;          /* avoids mobile URL-bar jump where supported */
  width: 100%;
  overflow: hidden;
  background: var(--bg);
}

/* ----------------------------------------------------------------------------
 *  VIDEO LAYER — all clips stacked, only the active one is opaque
 * -------------------------------------------------------------------------- */
.video-layer { position: absolute; inset: 0; }

.video-layer video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--bg);          /* never shows through as white */
  opacity: 0;
  will-change: opacity;
  /* crossfade duration is applied inline from the config */
}
.video-layer video.is-active { opacity: 1; }

/* Hero still — a high-res first frame that dissolves into its video.
   Stacked on top of the clips (appended last); opacity is driven per-frame. */
.poster {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: var(--bg);
  opacity: 0;
  will-change: opacity;
  pointer-events: none;
}

/* ----------------------------------------------------------------------------
 *  SCRIM — keeps copy readable over bright footage
 * -------------------------------------------------------------------------- */
.scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to top,    rgba(0,0,0,0.55) 0%, rgba(0,0,0,0) 38%),
    linear-gradient(to bottom, rgba(0,0,0,0.30) 0%, rgba(0,0,0,0) 30%);
}

/* ----------------------------------------------------------------------------
 *  TEXT LAYER — copy sits above the video. The reveal is driven by classes
 *  (.is-active / .is-exiting) toggled in JS when a section becomes active,
 *  NOT by the scroll position — so it animates smoothly on its own timeline.
 * -------------------------------------------------------------------------- */
.text-layer { position: absolute; inset: 0; pointer-events: none; }

.copy {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;       /* sit in the lower band, rise from below */
  padding: var(--edge);
  padding-bottom: clamp(4rem, 12vh, 9rem);
  opacity: 0;
  transform: translateY(var(--copy-travel));   /* resting state: waiting below */
  will-change: transform, opacity;
}
.copy--left  { align-items: flex-start; text-align: left;  }
.copy--right { align-items: flex-end;   text-align: right; }

.copy.is-active {
  opacity: 1;
  transform: translateY(0);
  transition:
    transform var(--copy-in) cubic-bezier(0.16, 1, 0.3, 1),
    opacity   var(--copy-in) ease;
}
.copy.is-exiting {
  opacity: 0;
  transform: translateY(calc(var(--copy-travel) * -0.5));   /* continue upward, fade */
  transition:
    transform var(--copy-out) ease,
    opacity   var(--copy-out) ease;
}

.copy__title {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: clamp(3rem, 11vw, 11rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.copy__body {
  font-family: var(--font-body);
  font-weight: var(--weight-body);
  font-size: clamp(1.05rem, 1.7vw, 1.55rem);
  line-height: 1.5;
  white-space: nowrap;     /* subtitle stays on a single line… */
  max-width: 100%;         /* …and JS (fitBody) shrinks it if it would overflow */
  margin-top: clamp(1rem, 2vw, 1.75rem);
  opacity: 0.9;
}

/* ----------------------------------------------------------------------------
 *  INTERFACE CHROME — minimal, easily removed
 * -------------------------------------------------------------------------- */
.chrome {
  position: fixed;
  left: 0; right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: clamp(1.1rem, 3vw, 2rem) var(--edge);
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  mix-blend-mode: difference;      /* legible over any frame */
  pointer-events: none;
}
.chrome--top    { top: 0; }
.chrome--bottom { bottom: 0; }

/* The Amsterhive wordmark — larger, set in its own case */
.chrome__brand {
  margin-right: auto;
  font-family: var(--font-brand);
  font-size: clamp(1.15rem, 2.7vw, 1.9rem);
  letter-spacing: -0.01em;
  text-transform: none;
}
.chrome__total { opacity: 0.6; }

.chrome__track {
  position: relative;
  flex: 1;
  height: 1px;
  margin-left: 1rem;
  background: rgba(244, 241, 234, 0.25);
}
.chrome__progress {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: var(--ink);
  transform-origin: left;
}

/* ----------------------------------------------------------------------------
 *  SCROLL HINT
 * -------------------------------------------------------------------------- */
.scroll-hint {
  position: fixed;
  left: 50%;
  bottom: clamp(2.5rem, 6vh, 4rem);
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  mix-blend-mode: difference;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.scroll-hint.is-hidden { opacity: 0; }
.scroll-hint__dot { animation: hintDrop 1.8s ease-in-out infinite; }
@keyframes hintDrop {
  0%, 100% { transform: translateY(0);   opacity: 1;   }
  50%      { transform: translateY(6px); opacity: 0.3; }
}

/* ----------------------------------------------------------------------------
 *  LOADER
 * -------------------------------------------------------------------------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: var(--bg);
  transition: opacity 0.8s ease;
}
.loader.is-hidden { opacity: 0; pointer-events: none; }
.loader__bar {
  width: clamp(140px, 22vw, 240px);
  height: 1px;
  background: rgba(244, 241, 234, 0.2);
  overflow: hidden;
}
.loader__fill {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--ink);
  transition: width 0.3s ease;
}
.loader__label {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  opacity: 0.7;
}

/* ----------------------------------------------------------------------------
 *  MOBILE — phones (portrait): tighter margins, a type scale that fits, and
 *  the copy lifted clear of the bottom chrome. Touch scrolling drives the same
 *  scrub engine as the wheel, so behaviour is identical — only the fit changes.
 * -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  :root { --edge: clamp(1.15rem, 5.5vw, 2rem); }

  body { -webkit-tap-highlight-color: transparent; }

  .copy {
    padding-bottom: clamp(5rem, 18vh, 8rem);   /* sit above the progress bar */
  }
  .copy__title {
    font-size: clamp(2.5rem, 14vw, 4.75rem);
    line-height: 0.98;
    letter-spacing: -0.015em;
  }
  .copy__body {
    font-size: clamp(1rem, 4.2vw, 1.2rem);
    line-height: 1.45;
    margin-top: 0.9rem;
  }

  .chrome        { font-size: 0.62rem; gap: 0.5rem; letter-spacing: 0.14em; }
  .chrome__brand { font-size: clamp(1.05rem, 5.5vw, 1.5rem); }
  .scroll-hint   { font-size: 0.6rem; bottom: clamp(2rem, 5vh, 3rem); }
}

/* Phones in landscape are short — shrink the headline and lift the copy. */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 540px) {
  .copy        { padding-bottom: clamp(3rem, 14vh, 5rem); }
  .copy__title { font-size: clamp(2rem, 9vw, 3.25rem); }
  .copy__body  { font-size: clamp(0.9rem, 2.4vw, 1.05rem); }
}

/* ----------------------------------------------------------------------------
 *  ACCESSIBILITY — calmer for reduced-motion users (JS also shortens reveals)
 * -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .scroll-hint__dot { animation: none; }
}
