/* =============================================================
   THE NOITE — homepage
   ============================================================= */

/* ---------- hero ---------- */
.hero {
  position: relative;
  z-index: 2;
  height: 100vh;
  height: 100svh;
  min-height: calc(600 * var(--u));
  overflow: hidden;
}

/* first-load sequence starts from black (only when JS is running it) */
.js .hero__media, .js .hero__title, .js .hero .nav, .js .hero__scroll { opacity: 0; }

.hero__media { position: absolute; inset: 0; background: var(--void); }
/* the footage always fills the hero edge to edge; wider or taller screens crop it, centred */
.hero__video { width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: 50% 50%; }
/* very wide screens crop away most of the height: keep the upper part, where faces usually are */
@media (min-aspect-ratio: 2 / 1) { .hero__video { object-position: 50% 30%; } }
/* the phone cut on squarish screens (tablets, half-width windows) loses height instead:
   keep the upper part there too, so heads stay in */
@media (max-aspect-ratio: 1 / 1) { .hero__video { object-position: 50% 28%; } }
/* a soft shade at the top keeps the nav readable over bright shots; the bottom melts
   into the page; a corner shade behind the title keeps it readable over the white floors
   and the flash at 10.4s, and leaves the rest of the footage untouched */
.hero__scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 72% 58% at 0% 100%, rgba(9, 9, 11, .62) 0, rgba(9, 9, 11, .42) 40%, rgba(9, 9, 11, .14) 72%, rgba(9, 9, 11, 0) 100%),
    linear-gradient(to bottom, rgba(9, 9, 11, .5) 0, rgba(9, 9, 11, 0) 20%),
    linear-gradient(to top, var(--void) 0, rgba(9, 9, 11, .55) 12%, rgba(9, 9, 11, 0) 28%);
}

.hero__title { position: absolute; left: 0; right: 0; bottom: calc(64 * var(--u)); z-index: 3; }
.hero__h1 { max-width: calc(var(--hero-title-w) * var(--u)); font-size: max(11px, calc(var(--fs-hero) * var(--u))); line-height: var(--lh-hero); letter-spacing: var(--ls-hero); }
.hero__scroll { position: absolute; right: var(--gutter); bottom: calc(268 * var(--u)); z-index: 3; }

/* ---------- documentaries ---------- */
.docs {
  /* card width: the design's share of the screen, capped so card, heading and
     progress bar all fit in one screen height. The 16:9 card follows from it. */
  --fit: calc((85vh - 121 * var(--u)) * 16 / 9);
  --cw: min(76vw, var(--fit));
  position: relative;
  z-index: 1;
  overflow-x: clip; /* side cards run off screen; they must not widen the page on phones */
  padding: min(calc(128 * var(--u)), 10vh) 0 calc(200 * var(--u));
}
.docs__head { align-items: end; }
.docs__h { grid-column: 1 / span 6; }
.docs__count { grid-column: 9 / span 4; display: flex; justify-content: flex-end; }
.docs__paused { display: none; }
.docs__count.is-paused .docs__paused { display: inline; }

.carousel {
  --gap: calc(24 * var(--u));
  --step: calc(var(--cw) * .95 + var(--gap));
  position: relative;
  margin-top: min(calc(56 * var(--u)), 5vh);
  touch-action: pan-y;
}
.carousel__sizer { width: var(--cw); aspect-ratio: 16 / 9; margin: 0 auto; }

.card {
  --off: 0;
  position: absolute;
  top: 0;
  left: calc(50% + var(--off) * var(--step) * var(--spread, 1));
  width: var(--cw);
  aspect-ratio: 16 / 9;
  transform: translateX(-50%) scale(.9);
  opacity: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--surface-1);
  border: 1px solid var(--line);
  transition:
    left .75s var(--ease-slide),
    transform .75s var(--ease-slide),
    opacity .75s ease,
    box-shadow .75s ease,
    border-color .75s ease;
  user-select: none;
  -webkit-user-select: none;
}
.card.is-near { opacity: .4; z-index: 2; pointer-events: auto; }
.card.is-active {
  opacity: 1;
  z-index: 3;
  pointer-events: auto;
  transform: translateX(-50%) scale(1);
  border-color: rgba(var(--uv-rgb), .4);
  box-shadow: 0 calc(30 * var(--u)) calc(140 * var(--u)) rgba(var(--wick-rgb), .42);
}
.card.is-far { transition: none; }
.carousel.is-revealing .card { transition: none; }
.card__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* desktop hover on the centre card: the thumbnail starts a slow zoom and brightens a little
   straight away; leaving eases it back */
.carousel--hover .card__img { transition: transform 1s ease, filter .6s ease; }
.carousel--hover .card.is-active:hover .card__img {
  transform: scale(1.08);
  filter: brightness(1.1);
  transition: transform 6s cubic-bezier(.2, .6, .3, 1), filter .4s ease;
}

/* touch (no hover): the centre card's thumbnail zooms in slowly while it is showing */
.carousel--touch .card__img { transition: transform 1s ease; }
.carousel--touch.is-running .card.is-active .card__img { transform: scale(1.08); transition: transform 6s cubic-bezier(.2, .6, .3, 1); }

/* legibility over busy thumbnails: deep bottom scrim + soft left falloff */
.card__scrim {
  position: absolute; left: 0; right: 0; bottom: 0; height: 78%;
  background: linear-gradient(to top, rgba(9, 9, 11, .96) 0%, rgba(9, 9, 11, .86) 30%, rgba(9, 9, 11, .4) 64%, rgba(9, 9, 11, 0) 100%);
}
.card__falloff {
  position: absolute; left: 0; top: 0; bottom: 0; width: 70%;
  background: linear-gradient(to right, rgba(9, 9, 11, .55), rgba(9, 9, 11, 0));
}
.card__body {
  position: absolute;
  inset: 0;
  padding: calc(48 * var(--u)) calc(56 * var(--u));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  gap: calc(16 * var(--u));
}
.card__meta { font-size: max(11px, calc(12 * var(--u))); color: var(--text-2); }
.card__title { max-width: 56%; font-size: max(11px, calc(var(--fs-card) * var(--u))); line-height: var(--lh-card); letter-spacing: var(--ls-card); text-wrap: balance; }
.card__watch { margin-top: calc(8 * var(--u)); visibility: hidden; }
.card.is-active .card__watch { visibility: visible; }
.card__watch svg { width: calc(10 * var(--u)); height: calc(12 * var(--u)); }
.card__watch-short { display: none; }
.card__peek {
  all: unset;
  position: absolute;
  inset: 0;
  cursor: pointer;
  border-radius: var(--radius-card);
  display: none;
}
.card.is-near .card__peek { display: block; }
.card__peek:focus-visible { outline: 1px solid var(--ultraviolet); outline-offset: calc(4 * var(--u)); }

.carousel__foot { width: var(--cw); margin: calc(28 * var(--u)) auto 0; }
.progress { position: relative; height: 2px; background: var(--surface-3); }
.progress__bar {
  position: absolute; inset: 0;
  background: var(--ultraviolet);
  box-shadow: 0 0 calc(8 * var(--u)) rgba(var(--uv-rgb), .8);
  transform: scaleX(0);
  transform-origin: left center;
}
.carousel__caption { display: none; }
.carousel__all { display: flex; justify-content: flex-end; margin-top: calc(12 * var(--u)); }

/* ---------- tablet ---------- */
@media (max-width: 1100px) {
  .hero__title { bottom: calc(56 * var(--u)); }
  .hero__scroll { display: none; }

  /* never so small on a landscape tablet or phone that the title stops fitting */
  .docs { --cw: max(56vw, min(80vw, var(--fit))); padding: min(calc(112 * var(--u)), 10vh) 0 calc(160 * var(--u)); }
  .docs__head { display: flex; justify-content: space-between; align-items: flex-end; gap: calc(24 * var(--u)); }
  .carousel { --gap: calc(16 * var(--u)); margin-top: min(calc(48 * var(--u)), 5vh); }
  .carousel__foot { margin-top: calc(24 * var(--u)); }
  .card { transition-duration: .7s; }
  .card.is-active { box-shadow: 0 calc(24 * var(--u)) calc(96 * var(--u)) rgba(var(--wick-rgb), .42); }
  .card__scrim { height: 80%; }
  .card__body { padding: calc(28 * var(--u)) calc(32 * var(--u)); gap: calc(12 * var(--u)); }
  .card__meta { font-size: max(11px, calc(11 * var(--u))); }
  .card__title { max-width: 72%; }
  .card__watch { min-height: max(44px, calc(44 * var(--u))); margin-top: calc(4 * var(--u)); padding: 0 calc(18 * var(--u)); gap: calc(8 * var(--u)); }
}

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  .hero__title { bottom: calc(44 * var(--u)); }

  .docs { --cw: 78vw; padding: calc(96 * var(--u)) 0 calc(120 * var(--u)); }
  .docs__head { gap: calc(16 * var(--u)); }
  .carousel { --gap: calc(8 * var(--u)); --step: calc(var(--cw) * .96 + var(--gap)); margin-top: calc(36 * var(--u)); }
  .carousel__foot { margin-top: calc(20 * var(--u)); }
  .card { transform: translateX(-50%) scale(.92); transition-duration: .6s; }
  .card.is-active { box-shadow: 0 calc(18 * var(--u)) calc(72 * var(--u)) rgba(var(--wick-rgb), .42); }
  .card__falloff { display: none; }
  .card__scrim { height: 40%; background: linear-gradient(to top, rgba(9, 9, 11, .75), rgba(9, 9, 11, 0)); }
  /* the title lives below the card on phones: real thumbnails already carry big type */
  .card__body { padding: calc(10 * var(--u)) calc(12 * var(--u)); flex-direction: row; justify-content: flex-end; align-items: flex-end; }
  .card__meta, .card__title { display: none; }
  .card__watch { min-height: calc(32 * var(--u)); height: calc(32 * var(--u)); margin: 0; padding: 0 calc(12 * var(--u)); gap: calc(6 * var(--u)); font-size: max(11px, calc(10 * var(--u))); letter-spacing: .12em; }
  .card__watch svg { width: calc(8 * var(--u)); height: calc(10 * var(--u)); }
  .card__watch-long { display: none; }
  .card__watch-short { display: inline; }
  .carousel__caption { display: block; margin-top: calc(18 * var(--u)); }
  .carousel__caption-meta { letter-spacing: .12em; }
  .carousel__caption-title { margin-top: calc(8 * var(--u)); min-height: calc(2.2em); font-size: max(11px, calc(var(--fs-caption) * var(--u))); line-height: var(--lh-caption); letter-spacing: var(--ls-caption); }
  .carousel__all { margin-top: calc(4 * var(--u)); }
  .carousel__all .mono-link { font-size: max(11px, calc(11 * var(--u))); letter-spacing: .14em; }
}

@media (prefers-reduced-motion: reduce) {
  .card { transition: opacity .3s ease; }
  .carousel--touch .card__img, .carousel--touch.is-running .card.is-active .card__img,
  .carousel--hover .card__img, .carousel--hover .card.is-active:hover .card__img { transform: none; filter: none; transition: none; }
}
