/* ==========================================================================
   Movies page: fixed-background hero, a self-hosted-video Screenings grid,
   YouTube trailer embed, and an About section with credits. The stills
   grid further down reuses the shared .gallery-grid component from
   css/gallery.css (same as the portfolio pages), so it isn't styled here
   -- see that file instead.
   ========================================================================== */

/* ---- Hero ---- */

.movie-hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: calc(var(--nav-height) + 40px) 6vw 80px;
  overflow: hidden; /* the ::before background scales up to 1.1x -- this keeps its edges from ever showing a gap */
}

/* --movie-hero-image is set inline per film on the generated
   movies/{slug}.html pages (admin/lib/publish-movies.php); the original
   movies.html sets nothing, so it falls back to its own image below. */

/* The background image lives here, on its own layer behind .movie-hero-content,
   so the push-in animation's transform only ever touches the photo -- never
   the title/tagline/button, which stay perfectly still and sharp.

   Note: this used to also carry background-attachment: fixed for a desktop
   parallax effect. CSS spec (and every mainstream browser) neutralizes
   background-attachment: fixed on an element that has its own transform --
   it silently falls back to scroll -- so that couldn't coexist with the
   scale() animation below on the same layer. Traded it for the zoom, since
   mobile already used scroll-attachment anyway (unaffected either way). */
.movie-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.4), rgba(10, 10, 10, 0.55) 60%, var(--bg) 100%),
    var(--movie-hero-image, url('../images/movie/cover/jameson-thermitus-movie-une-seconde-chance-background.jpg'));
  background-size: cover;
  background-position: center;
  animation: hero-push-in 16s ease-in-out infinite alternate;
}

.movie-hero-content {
  position: relative;
  z-index: 1;
}

/* "All Films" link on generated film pages -- pinned top-left, just
   under the fixed nav, so it never competes with the centered title. */
.movie-back-link {
  position: absolute;
  z-index: 1;
  top: calc(var(--nav-height) + 24px);
  left: 6vw;
  font-size: 0.72rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
  transition: color 0.3s var(--ease);
}

.movie-back-link:hover {
  color: #fff;
}

@keyframes hero-push-in {
  from { transform: scale(1); }
  to   { transform: scale(1.1); }
}

@media (prefers-reduced-motion: reduce) {
  .movie-hero::before {
    animation: none;
  }
}

/* At mobile widths the viewport is much taller/narrower than this image's
   own 16:9 shot, so background-size: cover crops almost entirely on the
   sides, not top/bottom. The subject's face in the shot sits well right
   of center (~68% across), so the default centered crop pushed it past
   the right edge of the visible window. 70% keeps it in frame with room
   on both sides at common phone widths (checked 375/390/430px) without
   touching the desktop rule above, where the viewport's aspect ratio is
   close enough to the image's own that centered cover already shows
   nearly the whole frame. */
@media (max-width: 640px) {
  .movie-hero::before {
    background-position: 70% center;
  }
}

.movie-hero-eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
}

.movie-hero-title {
  margin-top: 18px;
  font-size: clamp(2.5rem, 8vw, 5.5rem);
  font-weight: 300;
  letter-spacing: 0.02em;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.6);
}

.movie-hero-tagline {
  margin-top: 22px;
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-style: italic;
  color: rgba(255, 255, 255, 0.85);
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
}

.movie-hero-cta-group {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 40px;
}

.movie-hero-cta {
  display: inline-block;
  padding: 16px 36px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text);
  transition: background 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.movie-hero-cta:hover {
  background: #fff;
  color: #000;
  border-color: #fff;
}

@media (max-width: 480px) {
  .movie-hero-cta-group {
    flex-direction: column;
    gap: 14px;
  }
}

/* ---- Screenings ---- */

.screenings-section {
  padding: 100px 0;
}

.screenings-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* desktop default */
  gap: 20px; /* comfortable breathing room -- these are 4 large items, not a dense photo grid */
  margin-top: 8px;
}

@media (max-width: 1024px) {
  .screenings-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.screening-item {
  display: flex;
  flex-direction: column;
}

.screening-video-wrap {
  position: relative; /* anchors the absolutely-positioned play icon */
}

.screening-video {
  width: 100%;
  height: auto; /* native aspect ratio, not forced/cropped -- these are portrait phone-shot clips */
  display: block;
  background: #000;
  cursor: pointer;
}

.screening-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none; /* purely visual -- clicks pass through to the video beneath */
  opacity: 1;
  transition: opacity 0.2s ease;
}

/* js/screening-video.js toggles this on the wrap based on the video's own
   play/pause/ended events, so it's correct regardless of what changed
   playback state -- the first click, native controls, or another video's
   script-driven .pause(). */
.screening-video-wrap.is-playing .screening-play-icon {
  opacity: 0;
}

.screening-caption {
  margin-top: 10px;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: center;
}

@media (max-width: 640px) {
  .screenings-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

/* ---- Trailer ---- */

.trailer-section {
  padding: 100px 0;
  text-align: center;
}

.trailer-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 6vw;
}

.video-responsive {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  background: #000;
}

.video-responsive iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---- About the film ---- */

.about-film-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 64px;
  align-items: center;
}

.about-film-copy .body-text {
  margin-bottom: 28px;
}

.about-film-copy .body-text.is-draft-note {
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  border-left: 2px solid var(--border);
  padding-left: 14px;
}

.credits-list {
  margin-top: 8px;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 2;
}

.credits-list strong {
  color: var(--text);
  font-weight: 400;
}

.about-film-image img {
  width: 100%;
  height: auto;
  display: block;
}

/* No cover image -- the copy takes the full width instead of leaving an
   empty right-hand column. */
.about-film-grid--text-only {
  grid-template-columns: 1fr;
  max-width: 760px;
}

@media (max-width: 860px) {
  .about-film-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .about-film-image {
    order: -1;
    max-width: 420px;
    margin: 0 auto;
  }
}

/* ---- Gallery ---- */
/* The stills grid itself is the shared .gallery-grid component (see
   css/gallery.css, also used by the portfolio pages) -- nothing
   movie-page-specific needed here beyond linking that stylesheet, which
   movies.html already does. */

/* ---- Films grid (movies/index.html) ---- */
/* Generated by Publish (admin/lib/publish-movies.php). Same type language
   as the film page hero -- spaced uppercase eyebrow, light oversized title
   -- with landscape (16:9) cover cards. Flex-wrap + centered rather than a
   fixed CSS grid, so a short list (one or two films) sits centered on
   the page instead of hugging the left edge. */

.movies-intro {
  padding: calc(var(--nav-height) + 72px) 6vw 56px;
  text-align: center;
}

.movies-intro .movie-hero-eyebrow {
  text-shadow: none;
  color: var(--text-faint);
}

.movies-intro-title {
  margin-top: 14px;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 300;
  letter-spacing: 0.02em;
}

.movies-section {
  padding: 0 6vw 120px;
}

.movies-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 56px 32px;
  max-width: 1280px;
  margin: 0 auto;
}

.movie-card {
  flex: 0 1 calc((100% - 64px) / 3);
  display: block;
  color: var(--text);
}

.movie-card-image {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #111;
}

.movie-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s var(--ease), opacity 0.3s var(--ease);
}

.movie-card:hover .movie-card-image img {
  transform: scale(1.04);
}

.movie-card-title {
  margin-top: 20px;
  font-size: 1.3rem;
  font-weight: 300;
  letter-spacing: 0.02em;
}

.movie-card-year {
  margin-top: 6px;
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  color: var(--text-faint);
}

.movies-empty-message {
  color: var(--text-dim);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .movie-card-image img {
    transition: none;
  }

  .movie-card:hover .movie-card-image img {
    transform: none;
  }
}

/* Desktop: two wide cards per row filling most of the screen. column-gap
   and flex-basis must agree (2 x basis + gap = 100%), or the second card
   wraps onto its own row. */
@media (min-width: 901px) {
  .movies-grid {
    max-width: 1680px;
    column-gap: 48px;
    row-gap: 72px;
  }

  .movie-card {
    flex-basis: calc((100% - 48px) / 2);
  }
}

@media (max-width: 860px) {
  .movie-card {
    flex-basis: calc((100% - 32px) / 2);
  }
}

/* Phones: one full-width landscape card per row, with title/year type a
   step down from desktop. */
@media (max-width: 640px) {
  .movies-grid {
    gap: 40px;
  }

  .movie-card {
    flex-basis: 100%;
  }

  .movie-card-title {
    margin-top: 14px;
    font-size: 1.15rem;
    line-height: 1.3;
  }

  .movie-card-year {
    margin-top: 4px;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
  }
}

@media (max-width: 480px) {
  .movies-intro {
    padding-top: calc(var(--nav-height) + 48px);
    padding-bottom: 40px;
  }
}
