/* ==========================================================================
   TJ Mauck Films — carousel homepage
   Fullscreen video carousel with intro stack animation and transparent nav.
   Desktop: wheel-driven horizontal carousel (JS). Mobile: vertical snap scroll.
   ========================================================================== */

:root {
  --bg: #0e0e0e;
  --text: #f2f2f2;
  --nav-pad: 44px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; margin: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Lato', sans-serif;
  overscroll-behavior: none;
}

body { overflow: hidden; }

img, video { display: block; }

/* --------------------------------------------------------------------------
   Nav — transparent over video, drops in after the intro
   -------------------------------------------------------------------------- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* Height matches the 2.39:1 letterbox band baked into scope-ratio loops
     (12.8% of a 16:9 frame), so the nav sits centered inside the black bar */
  height: 12.8svh;
  min-height: 68px;
  padding: 0 var(--nav-pad);
  transform: translateY(-140%);
  opacity: 0;
  transition: transform .9s var(--ease-out), opacity .9s var(--ease-out);
}

body.ready .nav {
  transform: translateY(0);
  opacity: 1;
}

.nav a {
  pointer-events: auto;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: .2px;
  text-shadow: 0 0 24px rgba(0, 0, 0, .35);
}

.nav a:hover { opacity: .7; }

.nav-title {
  display: block;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .4px;
  line-height: 1.15;
}

.nav-sub {
  display: block;
  font-size: 13px;
  font-weight: 300;
  letter-spacing: .6px;
  margin-top: 2px;
}

body.film-open .nav-links {
  opacity: 0;
  pointer-events: none;
}

.nav-links { transition: opacity .3s ease; }

.nav-links a {
  margin-left: 28px;
  font-weight: 300;
}

/* --------------------------------------------------------------------------
   Carousel
   -------------------------------------------------------------------------- */

.carousel {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.track {
  display: flex;
  height: 100%;
  will-change: transform;
}

.slide {
  position: relative;
  width: 100vw;
  height: 100%;
  flex-shrink: 0;
  overflow: hidden;
}

/* Desktop JS engine: slides are absolutely positioned and placed per-frame
   at their shortest wrapped offset — the real slides close the loop, no clones */
.carousel.js-slides .track { position: relative; }

.carousel.js-slides .slide {
  position: absolute;
  inset: 0;
  will-change: transform;
}

.media, .media video {
  width: 100%;
  height: 100%;
}

.media video {
  object-fit: cover;
  background: var(--bg) center / cover no-repeat;
}

/* Scrim: slight overall dim + stronger falloff at the edges so the nav and
   slide titles read cleanly over bright footage */
.media::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom,
      rgba(0, 0, 0, .38) 0%,
      rgba(0, 0, 0, 0) 18%,
      rgba(0, 0, 0, 0) 72%,
      rgba(0, 0, 0, .42) 100%),
    rgba(0, 0, 0, .23);
}

.media { position: relative; }

/* Slide title — bottom left, follows the active slide */
.slide-title {
  position: absolute;
  left: var(--nav-pad);
  bottom: calc(var(--nav-pad) - 4px);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .7s var(--ease-out) .15s, transform .7s var(--ease-out) .15s;
  text-shadow: 0 0 24px rgba(0, 0, 0, .4);
  pointer-events: none;
}

body.ready .slide.active .slide-title {
  opacity: 1;
  transform: translateY(0);
}

.st-client {
  display: block;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
}

.st-name {
  display: block;
  font-size: 14px;
  font-weight: 300;
  letter-spacing: .3px;
  margin-top: 2px;
}

/* --------------------------------------------------------------------------
   Film overlay — full piece over a wall of stills (mirrors the Work page)
   -------------------------------------------------------------------------- */

.slide { cursor: pointer; }

.film-view {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: var(--bg);
  overflow: hidden;
}

.film-view[hidden] { display: none; }

.fv-close {
  position: absolute;
  top: 18px;
  right: 26px;
  z-index: 1520;
  font-size: 40px;
  line-height: 1;
  color: #fff;
  background: none;
  border: 0;
  cursor: pointer;
  opacity: .8;
  font-family: inherit;
}

.fv-close:hover { opacity: 1; }

.fv-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(62vw, calc(72svh * 16 / 9));
  z-index: 1510;
  margin: 0;
}

.fv-media {
  aspect-ratio: 16 / 9;
  background: #000;
  box-shadow: 0 40px 120px rgba(0, 0, 0, .6);
}

.fv-media iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.fv-title {
  margin-top: 12px;
  font-size: 13px;
  letter-spacing: .8px;
  text-transform: uppercase;
}

.fv-collage {
  position: absolute;
  inset: 0;
  z-index: 1505;
  pointer-events: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: calc(33.34vw * 9 / 16);
  overflow: hidden;
}

.fv-collage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  filter: brightness(.55);
}

.film-view.open .fv-collage img {
  opacity: 1;
  transition: opacity .7s ease var(--d, 0s);
}

@media (max-width: 767px) {
  .fv-stage { width: 92vw; }

  .fv-collage {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: auto;
    grid-template-rows: repeat(6, 1fr);
  }
}

/* --------------------------------------------------------------------------
   Intro — stacked posters spread; top poster expands to fullscreen
   -------------------------------------------------------------------------- */

.intro {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  transition: opacity .4s ease;
}

.intro.done {
  opacity: 0;
  pointer-events: none;
}

.intro-stack {
  position: absolute;
  inset: 0;
  perspective: 1200px;
  perspective-origin: 50% 50%;
}

/* Fullscreen cards scaled to .25 — the finale is simply scaling the top card
   back to 1. Start pose: below the viewport, tilted back 80° (JS animates). */
.intro-card {
  position: absolute;
  inset: 0;
  overflow: hidden;
  transform: translateY(95%) scale(.8) rotateX(-80deg);
  will-change: transform;
  background: var(--bg);
}

.intro-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.6);
  will-change: transform;
}

/* Reduced motion: no show, straight to the site */
@media (prefers-reduced-motion: reduce) {
  .intro { display: none; }
  .nav { transition: none; }
  .slide-title { transition: none; }
}

/* --------------------------------------------------------------------------
   Mobile — vertical snap scrolling, portrait videos
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
  .carousel {
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .track {
    display: block;
    height: auto;
  }

  .slide {
    width: 100%;
    height: 100svh;
    scroll-snap-align: start;
  }

  .intro-thumb { width: 72vw; }

  .nav {
    height: 12.8svh;
    min-height: 56px;
    padding: 0 24px;
  }

  .nav-title { font-size: 18px; }

  .nav-sub { font-size: 11px; }

  .slide-title {
    left: 20px;
    bottom: 22px;
  }
}
