/* ==========================================================================
   Template: Home — fullscreen snap transition (madethought.com-style)
   Layer order: media 1..3 → blur → intro → slide titles → outro → preview → foot
   ========================================================================== */

:root {
  --peek: 86svh;          /* where the first slide media sits before the snap */
  --blur-max: 75px;
}
html, body { height: 100%; overflow: hidden; }

/* ── Slide media, parked below the fold ── */
.media {
  position: fixed; inset: 0; z-index: 1;
  transform: translate3d(0, 100vh, 0);
  will-change: transform;
  overflow: hidden;
  background: #111;
}
.media[data-i="1"] { transform: translate3d(0, var(--peek), 0); }
/* Stacking: media 1 · blur 1 · media 2 · blur 2 · media 3 · blur 3 · outro · blur 4 */
.media[data-i="2"] { z-index: 3; }
.media[data-i="3"] { z-index: 5; }
/* Frame carries the 1.12 → 1 zoom and the brightness lift */
.media__frame {
  position: absolute; inset: 0; overflow: hidden;
  transform: scale(1.12); transform-origin: 50% 50%;
  will-change: transform;
}
/* Figma "Fill": cover, centred */
.media__frame > video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
/* Figma "Crop": the fill shows a fixed window of the video. The window keeps
   the Figma frame ratio (1440 × 858) and covers the screen like "Fill" would;
   inside it the video sits at the exact Figma crop. */
.crop {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  width: max(100vw, calc(100vh * 1440 / 858));
  aspect-ratio: 1440 / 858;
  overflow: hidden;
}
.crop > video { position: absolute; display: block; object-fit: fill; }
/* Wellness: videoTransform [[0.8609, 0, 0.0696], [0, 0.9119, -0.0001]] */
.crop--wellness > video { width: 116.160%; height: 109.662%; left: -8.080%; top: 0.012%; }
/* soft top shade so the header stays legible over bright photos */
.media::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 160px;
  background: linear-gradient(rgba(0,0,0,.55), rgba(0,0,0,0));
}

/* ── Full-viewport backdrop blur, one directly above each stage. Turns the
      incoming stage into a soft glow that sharpens as it arrives. Blur 1 is
      on at rest (the intro glow); the others only run during their step. ── */
.blur {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  will-change: backdrop-filter;
}
.blur[data-i="1"] {
  -webkit-backdrop-filter: blur(var(--blur-max));
  backdrop-filter: blur(var(--blur-max));
}
.blur[data-i="2"] { z-index: 4; }
.blur[data-i="3"] { z-index: 6; }
.blur[data-i="4"] { z-index: 8; }

/* ── Intro headline — Figma: Playfair 90 / Apercu Light 27, 20 apart ── */
.intro {
  position: fixed; inset: 0; z-index: 9;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: calc(20 * var(--k)); text-align: center; pointer-events: none;
  padding: 0 16px 8.7svh;   /* Figma centres the block above the middle */
}
.intro h1 { font-family: var(--serif); font-weight: 400; line-height: 1.1; font-size: calc(90 * var(--k)); }
.intro p  { font-size: calc(27 * var(--k)); font-weight: 300; line-height: 1.1; }

/* ── Slide titles — Figma: Playfair 84, centred slightly above the middle ── */
.slide {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none; padding: 0 16px;
  opacity: 0; visibility: hidden;
}
.slide h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: calc(84 * var(--k)); line-height: 1.1;
  margin-bottom: 11.8svh;
}

/* ── Outro — philosophy + client logos, rises over the last slide ── */
.outro {
  position: fixed; inset: 0; z-index: 7;
  background: var(--bg);
  transform: translate3d(0, 100vh, 0);
  will-change: transform;
  overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end;
}
/* Figma: the Technology image blurred (100px) bleeds into the top */
.outro__glow {
  position: absolute; left: -5%; right: -5%; top: -92%; height: 100%;
  background: url("../img/cta-blur.jpg") center / cover no-repeat;
  filter: blur(100px);
  pointer-events: none;
}
.outro__inner {
  position: relative; flex: 1;
  display: flex; flex-direction: column;
  padding-top: calc(74 * var(--k));        /* clear the header */
  padding-bottom: calc(30 * var(--k));
}
/* .philosophy itself lives in style.css (shared) */

/* ── Foot: button + 30 gap + thumbnail strip, 33px above the frame bottom.
      Sits above the project preview so it stays usable while that is open. ── */
.foot {
  position: fixed; left: 0; right: 0; bottom: calc(33 * var(--k)); z-index: 13;
  display: flex; flex-direction: column; align-items: center; gap: calc(30 * var(--k));
  padding: 0 16px; pointer-events: none;
  opacity: 0; visibility: hidden;
}
.foot .btn { pointer-events: auto; }
.actions { display: flex; gap: 1px; }
/* "See project" is folded away until a project preview opens, then the
   pair reads as one split pill (as on madethought.com) */
.btn-see {
  max-width: 0; padding-left: 0; padding-right: 0; opacity: 0; overflow: hidden;
  transition: max-width .5s cubic-bezier(.4,0,.2,1), padding .5s cubic-bezier(.4,0,.2,1),
              opacity .4s ease, background .3s;
}
.pv-open .foot.is-current .btn-see.has-link {
  max-width: 12em; opacity: 1;
  padding-left: calc(21 * var(--k)); padding-right: calc(21 * var(--k));
  border-radius: calc(5 * var(--k)) 0 0 calc(5 * var(--k));
}
.pv-open .foot.is-current .btn-see.has-link + .btn { border-radius: 0 calc(5 * var(--k)) calc(5 * var(--k)) 0; }

/* Figma: 60×60 square tiles, no gap. The hovered one gets a 30% black
   tint, fading over 500ms. */
.thumbs { display: flex; height: calc(60 * var(--k)); pointer-events: auto; }
.thumbs button {
  position: relative; height: 100%; aspect-ratio: 1; border: 0; padding: 0; cursor: pointer;
  background: #333 center/cover no-repeat;
}
.thumbs button::after {
  content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.3);
  opacity: 0; transition: opacity .5s;
}
.thumbs button.on::after { opacity: 1; }
.thumbs button:focus-visible { outline: 1px solid var(--fg); outline-offset: -1px; }

/* ── Project preview (hovering a thumbnail): black base, the project image
      blown up and blurred behind, project name on top, image card in the
      middle. Everything crossfades when moving between thumbnails. ── */
.preview {
  position: fixed; inset: 0; z-index: 12; background: #000; overflow: hidden;
  opacity: 0; visibility: hidden;
  transition: opacity .5s cubic-bezier(.4,0,.2,1), visibility 0s .5s;
}
.pv-open .preview { opacity: 1; visibility: visible; transition: opacity .5s cubic-bezier(.4,0,.2,1); }
.pv-bg { position: absolute; inset: -160px; }
.pv-bg img, .pv-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pv-bg img { filter: blur(40px); opacity: 0; transition: opacity .5s ease; }
.pv-dim { position: absolute; inset: 0; background: rgba(0,0,0,.2); }
/* The hover zone starts at the project name: moving up into the header
   band closes the preview, like on madethought.com. The name sits 30px
   below the header glass (74 high), so it never hides behind it; the image
   card shrinks to fit the remaining space. */
.pv-zone {
  position: absolute; left: 0; right: 0; top: calc(104 * var(--k)); bottom: 0;
  display: flex; flex-direction: column; align-items: center; gap: calc(40 * var(--k));
  padding-bottom: calc(199 * var(--k));   /* clears button + strip below */
}
/* Project name in the client-name style of the expertise pages:
   Apercu Medium 18, uppercase (see .case__name in expertise.css), but light */
.pv-name {
  display: grid; font-weight: 500; font-size: calc(18 * var(--k)); line-height: 1.4;
  text-transform: uppercase;
  color: rgba(var(--fg-rgb), .7);   /* brand white, 30% transparent — reads on any preview */
}
.pv-name span { grid-area: 1 / 1; text-align: center; opacity: 0; transition: opacity .5s ease; }
.pv-stage { position: relative; flex: 1; min-height: 0; width: 100%; container-type: size; }
/* Square card: the expertise-page image, cropped to a square */
.pv-card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(calc(100cqw - 32px), 100cqh); aspect-ratio: 1;
  overflow: hidden; background: rgba(var(--fg-rgb), .06);
  opacity: 0; transition: opacity .5s ease;
}
.pv-bg img.on, .pv-name span.on, .pv-card.on { opacity: 1; }

/* Phones: pinned sizes, same relationships (headline ≈ 3.3× subtitle) */
@media (max-width: 900px) {
  .intro h1, .slide h2 { font-size: 44px; }
  .intro p { font-size: 16px; }
  .intro { gap: 12px; }
  .pv-open .foot.is-current .btn-see.has-link { padding-left: 18px; padding-right: 18px; }
  .pv-name { font-size: 15px; }
  .thumbs { height: 52px; }
  .foot { gap: 18px; bottom: 28px; }
}
