/* ============================================================
   Films page — additive layer on top of styles.css.
   Sections:
     1. Page-level overrides (allow scrolling)
     2. Page intro (heading)
     3. Grid + cell
     4. Cell info overlay + scrim
     5. Fade-up entrance (shared shape with about/contact)
     6. Active-nav indicator
   ============================================================ */


/* -------------------------------------------------------
   1. Page-level overrides
   ------------------------------------------------------- */
/* Allow the document to scroll naturally on these pages — base
   styles.css locks html/body to 100vh/overflow:hidden for the
   homepage, so we override with overflow:visible here. Nested
   overflow:auto on both html and body confuses iOS Safari and
   can leave scroll completely stuck. */
html {
  height: auto;
  width: auto;
  overflow: visible;
}
body {
  height: auto;
  min-height: 100vh;
  width: auto;
  overflow-x: hidden;
  overflow-y: visible;
}
body.page-films { background: var(--bg); }




/* -------------------------------------------------------
   2. Page wrapper

   Goal: visual distance from the TOP OF THE "M" glyph in
   "FILMS" down to the top of the screen ==
   visual distance from the underline DOWN to the top of
   the grid.

   Top of the "M" glyph in screen coords:
     topbar pad-top                               24
   + center-offset of link in 36px topbar         5.5
   + link's own padding-top                        4
   + half-leading (12 × 1.4 = 16.8 → 4.8 / 2)      2.4
   + Montserrat cap descent inside em-box          ~1.5
   ≈ 37.4 px

   Underline bottom in screen coords:
     link top (29.5)
   + link content height (16.8 + 4 + 4)
   ≈ 54.3 px

   Grid top = underline + 37.4 ≈ 92 px.
   ------------------------------------------------------- */
.films-page {
  position: relative;
  z-index: 5;
  /* Top padding clears the topbar; bottom padding gives the last row a
     bit of breathing room before the viewport edge (without the old
     fixed-position footer that used to sit below). */
  padding: 92px 0 32px;
}


/* -------------------------------------------------------
   3. Grid + cell
   Each cell is locked to a 2.4 : 1 cinematic aspect ratio
   and holds a looping silent video that plays when the
   cell scrolls into view.
   ------------------------------------------------------- */
.films-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.films-cell {
  position: relative;
  aspect-ratio: 2.4 / 1;
  overflow: hidden;
  background: #000;
  text-decoration: none;
  color: inherit;
  display: block;
  cursor: pointer;
  /* Reveal animation is hooked up via @supports (animation-timeline) below. */
}


.films-cell video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.films-cell:hover video {
  transform: scale(1.06);
}

/* Subtle hairline that slides in from the left along the bottom edge */
.films-cell::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.45);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 3;
  pointer-events: none;
}
.films-cell:hover::before {
  transform: scaleX(1);
}


/* -------------------------------------------------------
   4. Cell info overlay
   Title and type tag use absolute positioning with fixed
   bottom offsets, so the title sits at the SAME y position
   in every cell regardless of whether the type is present.
   ------------------------------------------------------- */
.films-info {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 0;
  z-index: 2;
  pointer-events: none;
}

.films-info h3,
.films-info .type {
  position: absolute;
  left: 0;
  right: 0;
  transition:
    transform 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    color 0.4s ease;
  will-change: transform;
}

.films-info h3 {
  bottom: 44px;             /* always 44px from cell bottom */
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.55);
}

.films-info .type {
  bottom: 24px;             /* always 24px from cell bottom */
  font-family: var(--mono);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
  white-space: nowrap;
}

/* Hover: lift the title block up a touch and tint the type tag */
.films-cell:hover .films-info h3,
.films-cell:hover .films-info .type {
  transform: translateY(-6px);
}
.films-cell:hover .films-info .type {
  color: var(--accent);
}


/* -------------------------------------------------------
   5. Active-nav indicator
   ------------------------------------------------------- */
.topnav a.is-current {
  color: #fff;
}
.topnav a.is-current::after {
  transform: scaleX(1);
  transform-origin: left center;
}


/* -------------------------------------------------------
   Responsive
   ------------------------------------------------------- */
@media (max-width: 900px) {
  .films-info             { left: 22px; right: 22px; }
  .films-info h3          { bottom: 36px; }
  .films-info .type       { bottom: 18px; }
}

@media (max-width: 640px) {
  /* Topbar's mobile padding is 24px and the logo is still 36px tall, so
     the same calculation applies — top of glyph ≈ underline-to-grid. */
  .films-page { padding: 92px 0 24px; }
  .films-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .films-info             { left: 18px; right: 18px; }
  .films-info h3          { font-size: 18px; bottom: 32px; }
  .films-info .type       { font-size: 9px; letter-spacing: 0.2em; bottom: 16px; }
}

