/* ==========================================================================
   A2Z "First Light" film hero — scroll-scrubbed cinematic opening
   Scope: homepage film stage, sticky quote pill, First-Light token overrides.
   Degrades: no-JS / prefers-reduced-motion → static poster hero, form in place.
   ========================================================================== */

/* Tokens, fonts and the site-wide reskin live in a2z-first-light.css (loaded
   on every page). This file is homepage-only: the film stage + quote pill. */

/* ---- Film scroll driver + sticky stage ---------------------------------- */
body.a2z-home {
  background: var(--fl-ink, #0f172a);
}
.a2z-film { position: relative; background: var(--fl-ink); }
.js .a2z-film { height: 420vh; } /* scroll-scrub chapters + settle */
.a2z-film__stage {
  position: relative;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
}
.js .a2z-film__stage { position: sticky; top: 0; }
.js .a2z-film__stage.is-scrubbing .a2z-film__grain { animation-play-state: paused; opacity: 0.12; }

.a2z-film__poster,
.a2z-film__canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 55%; /* favour the car + headlight beam */
}
.a2z-film__poster {
  /* Clarity without heavy filters — slight lift only */
  filter: contrast(1.04) saturate(1.05);
  image-rendering: auto;
}
.a2z-film__canvas { display: none; filter: contrast(1.03) saturate(1.04); }
.js .a2z-film__canvas { display: block; }
.js .a2z-film__stage.is-scrubbing .a2z-film__canvas { will-change: contents; }
.js .a2z-film__poster.is-hidden { opacity: 0; transition: opacity 0.5s ease; }

/* Grain + vignette — dialled down so the hero stays clear */
.a2z-film__vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 42%, transparent 62%, rgba(4, 10, 20, 0.28) 100%);
  opacity: calc(0.7 - var(--fl-fade, 0) * 0.7);
}
.a2z-film__grain {
  position: absolute; inset: -50%; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  animation: fl-grain 0.9s steps(3) infinite;
  opacity: calc(0.22 * (1 - var(--fl-fade, 0)));
}
@keyframes fl-grain {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-2%, 1%); }
  66% { transform: translate(1%, -2%); }
}

/* Bottom seam ramp — colour set by JS from frames/manifest.json seam hex */
.a2z-film__seam {
  position: absolute; left: 0; right: 0; bottom: 0; height: 34vh;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--fl-seam, var(--a2z-primary-soft, #e6f4fe)));
  opacity: var(--fl-fade, 0);
}

/* ---- Hero copy (real H1, visible at scroll 0) --------------------------- */
.a2z-film__copy {
  position: absolute; z-index: 4;
  left: 0; right: 0;
  top: 18svh;
  text-align: center;
  padding: 0 20px;
  color: var(--fl-cream);
  text-shadow: 0 2px 24px rgba(4, 10, 20, 0.6);
}
.a2z-film__kicker {
  font: 700 0.78rem/1 var(--fl-ui);
  letter-spacing: 0.22em; text-transform: uppercase;
  color: #cfe3ff;
  margin: 0 0 14px;
}
.a2z-film__headline {
  font: 500 clamp(2.1rem, 5.2vw, 4rem)/1.08 var(--fl-display);
  letter-spacing: -0.015em;
  margin: 0 auto 14px; max-width: 17ch;
  color: var(--fl-cream);
}
.a2z-film__sub {
  font: 500 clamp(0.98rem, 1.6vw, 1.15rem)/1.55 var(--fl-ui);
  color: var(--fl-mist);
  margin: 0 auto; max-width: 52ch;
}

/* ---- Beat overlays (decorative, aria-hidden; real copy lives below) ----- */
.a2z-film__beat {
  position: absolute; z-index: 3;
  left: 0; right: 0; top: 50%;
  transform: translateY(-50%);
  text-align: center; padding: 0 24px;
  color: var(--fl-cream);
  text-shadow: 0 2px 28px rgba(4, 10, 20, 0.7);
  opacity: 0; pointer-events: none;
}
.a2z-film__beat-title {
  font: 500 clamp(1.7rem, 4vw, 3rem)/1.15 var(--fl-display);
  margin: 0 0 10px;
  color: var(--fl-cream);
}
.a2z-film__beat-sub {
  font: 500 clamp(0.95rem, 1.5vw, 1.1rem)/1.5 var(--fl-ui);
  color: var(--fl-mist); margin: 0 auto; max-width: 46ch;
}
html:not(.js) .a2z-film__beat { display: none; }

/* Chapter readout — bottom-left narrative + progress */
.a2z-film__readout {
  position: absolute; z-index: 4;
  left: clamp(16px, 4vw, 48px); bottom: 26px;
  color: var(--fl-mist);
  font: 700 0.72rem/1 var(--fl-ui);
  letter-spacing: 0.18em; text-transform: uppercase;
  opacity: calc(1 - var(--fl-fade, 0));
}
html:not(.js) .a2z-film__readout { display: none; }
.a2z-film__readout-bar {
  width: 140px; height: 2px; margin-top: 8px;
  background: rgba(251, 246, 238, 0.25);
}
.a2z-film__readout-fill {
  height: 100%; width: 0;
  background: #7fb1ff;
}

/* Scroll cue */
.a2z-film__cue {
  position: absolute; z-index: 4;
  left: 50%; bottom: 22px; transform: translateX(-50%);
  color: var(--fl-mist);
  font: 700 0.7rem/1 var(--fl-ui); letter-spacing: 0.2em; text-transform: uppercase;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  opacity: 0; animation: fl-cue-in 1s ease 1.4s forwards;
}
.a2z-film__cue::after {
  content: ''; width: 1px; height: 34px;
  background: linear-gradient(to bottom, #cfe3ff, transparent);
  animation: fl-cue-drip 1.8s ease-in-out infinite;
}
@keyframes fl-cue-in { to { opacity: 1; } }
@keyframes fl-cue-drip { 50% { transform: scaleY(0.45); transform-origin: top; } }
html:not(.js) .a2z-film__cue { display: none; }

/* Loader (only until first frames decoded) */
.a2z-film__loader {
  position: absolute; z-index: 5; left: 50%; bottom: 72px;
  transform: translateX(-50%);
  width: 160px; height: 2px;
  background: rgba(251, 246, 238, 0.18);
  opacity: 0; transition: opacity 0.3s ease;
}
.a2z-film__loader.is-visible { opacity: 1; }
.a2z-film__loader-fill { height: 100%; width: 0; background: #7fb1ff; }

/* ---- The quote card / sticky pill --------------------------------------- */
/* One DOM node, three states:
   (a) hero state — card in the stage, below the copy
   (b) pill state — fixed, collapsed (.is-pill)
   (c) sheet state — fixed, expanded from pill (.is-pill.is-open)   */

.a2z-quote {
  position: absolute; z-index: 6;
  left: 50%; transform: translateX(-50%);
  bottom: 16svh;
  width: min(920px, calc(100% - 32px));
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.a2z-quote .a2z-search-card {
  /* Solid card — backdrop-filter + parent transform blurs form text on Chrome/Safari */
  background: #ffffff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid rgba(127, 177, 255, 0.35);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(4, 10, 20, 0.45);
}
.a2z-quote.is-leaving { opacity: 0; transform: translateX(-50%) translateY(24px); pointer-events: none; }

/* Pill trigger — removed from homepage */
.a2z-quote-pill { display: none !important; }

/* Expanded overlay state (desktop: centered modal; mobile: bottom sheet) */
.a2z-quote.is-modal {
  position: fixed; z-index: 990;
  left: 50%; top: 50%; bottom: auto;
  transform: translate(-50%, -50%);
  width: min(920px, calc(100% - 32px));
  max-height: calc(100svh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  opacity: 1 !important;
  pointer-events: auto !important;
}
.a2z-quote.is-modal .a2z-search-card,
.a2z-quote.is-modal .a2z-input,
.a2z-quote.is-modal .a2z-select,
.a2z-quote.is-modal button,
.a2z-quote.is-modal a {
  pointer-events: auto;
}
@media (max-width: 760px) {
  .a2z-quote.is-modal {
    top: auto; bottom: 0; left: 0;
    transform: none; /* avoid transform+backdrop blur bug on mobile */
    width: 100%;
    max-height: min(92svh, calc(100svh - 12px));
    animation: fl-sheet-up 0.32s cubic-bezier(0.32, 0.9, 0.35, 1);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .a2z-quote.is-modal .a2z-search-card {
    border-radius: 20px 20px 0 0;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 40px rgba(4, 10, 20, 0.28);
  }
  .a2z-quote.is-modal .a2z-field-row {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .a2z-quote.is-modal .a2z-tabs {
    margin-bottom: 12px;
  }
  .a2z-quote.is-modal .a2z-search-card__title {
    font-size: 1.15rem;
    margin-bottom: 12px;
  }
  .a2z-quote.is-modal .a2z-btn-book {
    min-height: 52px;
    font-size: 1rem;
  }
}
.a2z-quote.is-modal .a2z-btn-book {
  background: var(--fl-cerulean, #0088f0) !important;
  border-color: var(--fl-cerulean, #0088f0) !important;
  color: #fff !important;
  opacity: 1;
  box-shadow: 0 6px 18px rgba(0, 136, 240, 0.28) !important;
}
.a2z-quote.is-modal .a2z-btn-book:hover {
  background: var(--fl-cerulean-hover, #0070c8) !important;
  border-color: var(--fl-cerulean-hover, #0070c8) !important;
}
@keyframes fl-sheet-up { from { transform: translateY(40%); opacity: 0.92; } }

.a2z-quote-backdrop {
  position: fixed; inset: 0; z-index: 980;
  background: rgba(7, 21, 39, 0.62);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
.a2z-quote-backdrop.is-visible { opacity: 1; pointer-events: auto; }

/* Homepage: hide sticky Compare pill until the film hero is scrolled past */
body.a2z-home:not(.is-past-hero) .a2z-floating-dock__book {
  display: none !important;
}
@media (min-width: 768px) {
  body.a2z-home.is-past-hero .a2z-floating-dock__book {
    display: inline-flex !important;
  }
}

.a2z-quote__close {
  position: absolute; top: 10px; right: 10px;
  display: none;
  width: 36px; height: 36px;
  border: 0; border-radius: 50%;
  background: rgba(11, 31, 58, 0.08);
  color: var(--fl-ink);
  cursor: pointer;
  align-items: center; justify-content: center;
}
.a2z-quote__close:hover { background: rgba(11, 31, 58, 0.16); }
.a2z-quote__close:focus-visible { outline: 3px solid #7fb1ff; }
.a2z-quote.is-modal .a2z-quote__close { display: inline-flex; }

/* ---- Header over the film -----------------------------------------------
   The redesign layer pins the header white with !important — these rules must
   out-gun it while the header floats over the film, then hand back.
   Fixed (not sticky) on the homepage so the film runs beneath it. */
.js .a2z-home .a2z-header {
  position: fixed !important;
  top: 0; left: 0; right: 0;
  z-index: 100;
  /* Own layer — avoids paint thrash while the film canvas scrubs underneath */
  transform: translateZ(0);
  transition: background-color 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}
.a2z-logo-swap--light { display: none; }
.a2z-logo-swap--light img,
.a2z-logo-swap--dark img,
.a2z-header__logo-img {
  display: block;
  height: 48px;
  width: auto;
  max-width: min(168px, 46vw);
  object-fit: contain;
  object-position: left center;
}
.a2z-logo-swap--light img {
  filter: drop-shadow(0 0 12px rgba(207, 227, 255, 0.35)) drop-shadow(0 2px 8px rgba(4, 10, 20, 0.8));
}
.js .a2z-home .a2z-header:not(.is-scrolled-past):not(.on-light) .a2z-logo-swap--dark { display: none; }
.js .a2z-home .a2z-header:not(.is-scrolled-past):not(.on-light) .a2z-logo-swap--light { display: block; }
.js .a2z-home .a2z-header.is-scrolled-past .a2z-logo-swap--light { display: none !important; }
.js .a2z-home .a2z-header.is-scrolled-past .a2z-logo-swap--dark { display: block !important; }
.js .a2z-home .a2z-header:not(.is-scrolled-past) {
  background: transparent !important;
  border-bottom: 1px solid transparent !important;
  backdrop-filter: none !important;
  box-shadow: none;
}
.js .a2z-home .a2z-header:not(.is-scrolled-past):not(.on-light) .a2z-nav a,
.js .a2z-home .a2z-header:not(.is-scrolled-past):not(.on-light) .a2z-header__link,
.js .a2z-home .a2z-header:not(.is-scrolled-past):not(.on-light) .a2z-header__phone {
  color: var(--fl-cream) !important;
}
.js .a2z-home .a2z-header:not(.is-scrolled-past):not(.on-light) .a2z-burger span {
  background: var(--fl-cream) !important;
}
/* Explicit hand-back once past the film — don't rely on competing !important cascades */
.js .a2z-home .a2z-header.is-scrolled-past {
  background: rgba(255, 255, 255, 0.97) !important;
  border-bottom: 1px solid var(--a2z-border, #e2e8f0) !important;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 18px rgba(7, 21, 39, 0.09);
}
.js .a2z-home .a2z-header.is-scrolled-past .a2z-nav a,
.js .a2z-home .a2z-header.is-scrolled-past .a2z-header__link,
.js .a2z-home .a2z-header.is-scrolled-past .a2z-header__phone {
  color: var(--a2z-ink, #0f172a) !important;
}
.js .a2z-home .a2z-header.is-scrolled-past .a2z-burger span {
  background: var(--a2z-ink, #0f172a) !important;
}

/* ---- Compact quote card (hero state, JS only) ----------------------------
   In the film hero the card is a single-purpose strip: airport + dates + CTA.
   Times, flight number, promo, hotels tab and titles live in the expanded
   modal (all fields stay in the DOM, so defaults still POST). No-JS shows
   the full card untouched. */
.js .a2z-quote:not(.is-modal) .a2z-tabs,
.js .a2z-quote:not(.is-modal) .a2z-search-card__title,
.js .a2z-quote:not(.is-modal) #panel-hotels,
.js .a2z-quote:not(.is-modal) .a2z-field-row > div:has(#deptime),
.js .a2z-quote:not(.is-modal) .a2z-field-row > div:has(#returntime),
.js .a2z-quote:not(.is-modal) .a2z-field:has(#flightnumber),
.js .a2z-quote:not(.is-modal) .a2z-field:has(#a2z-promo-toggle),
.js .a2z-quote:not(.is-modal) .a2z-search-secure {
  display: none;
}
.js .a2z-quote:not(.is-modal) .a2z-search-card { padding: 18px 20px 14px; }
.js .a2z-quote:not(.is-modal) #panel-parking form {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}
.js .a2z-quote:not(.is-modal) #panel-parking .a2z-field,
.js .a2z-quote:not(.is-modal) #panel-parking .a2z-field-row { margin: 0; }
.js .a2z-quote:not(.is-modal) #panel-parking .a2z-field-row { display: block; }
.js .a2z-quote:not(.is-modal) #panel-parking .a2z-btn-book {
  width: auto !important;
  white-space: nowrap;
  padding-left: 26px; padding-right: 26px;
}
.a2z-quote__more {
  display: none;
  border: 0; background: none;
  font: 700 0.78rem/1 var(--fl-ui);
  letter-spacing: 0.04em;
  color: var(--fl-navy);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 10px 0 0;
  grid-column: 1 / -1;
  justify-self: center;
}
.a2z-quote__more:focus-visible { outline: 3px solid #7fb1ff; outline-offset: 2px; }
.js .a2z-quote:not(.is-modal) #panel-parking form .a2z-quote__more { display: inline-block; }
/* trust row stays visible in the compact card — it's a conversion element */
.js .a2z-quote:not(.is-modal) #panel-parking form .fl-trust-row {
  grid-column: 1 / -1;
  margin-top: 2px;
}

@media (max-width: 900px) {
  .js .a2z-quote:not(.is-modal) #panel-parking form {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
  }
  .js .a2z-quote:not(.is-modal) #panel-parking .a2z-field:has(#airport),
  .js .a2z-quote:not(.is-modal) #panel-parking .a2z-btn-book { grid-column: 1 / -1; }
  .js .a2z-quote:not(.is-modal) #panel-parking .a2z-field { min-width: 0; }
  .js .a2z-quote:not(.is-modal) #panel-parking .a2z-input,
  .js .a2z-quote:not(.is-modal) #panel-parking .a2z-select { min-width: 0; width: 100%; }
}
@media (max-width: 760px) {
  body.a2z-home { overflow-x: clip !important; overscroll-behavior-x: none; }
  .js .a2z-film { height: auto !important; }
  .js .a2z-film__stage {
    position: relative !important;
    height: auto !important;
    min-height: 0;
    overflow: visible !important;
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  }
  .a2z-film__copy {
    position: relative;
    top: auto;
    /* Small nudge below the fixed header so the kicker clears the logo */
    padding: calc(var(--a2z-header-h, 70px) + 8px + env(safe-area-inset-top, 0px)) 20px 12px;
  }
  .a2z-film__kicker {
    letter-spacing: 0.16em;
  }
  .a2z-film__headline { font-size: clamp(1.7rem, 7vw, 2.2rem); max-width: 14ch; }
  .a2z-film__sub { display: none; } /* keep H1 + kicker; form is the CTA */
  .a2z-quote {
    position: relative;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    margin: 8px auto 0;
    width: calc(100% - 24px);
  }
  .a2z-quote.is-leaving {
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
  }
  .js .a2z-quote:not(.is-modal) #panel-parking form {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .js .a2z-quote:not(.is-modal) #panel-parking .a2z-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .js .a2z-quote:not(.is-modal) .a2z-search-card {
    padding: 14px 14px 12px;
    border-radius: 16px;
  }
  .js .a2z-quote:not(.is-modal) #panel-parking .a2z-btn-book {
    width: 100% !important;
    min-height: 50px;
  }
  .js .a2z-quote:not(.is-modal) #panel-parking form .fl-trust-row {
    font-size: 0.68rem;
    gap: 4px 8px;
    line-height: 1.35;
  }
  .fl-trust-row {
    font-size: 0.72rem;
    gap: 4px 10px;
  }
  /* Mobile: static poster only — no multi-frame scrub (PageSpeed) */
  .a2z-film__canvas,
  .a2z-film__beat,
  .a2z-film__readout,
  .a2z-film__cue,
  .a2z-film__grain,
  .a2z-film__loader { display: none !important; }
  .a2z-film__vignette { opacity: 0.35 !important; }
  .a2z-film__poster { opacity: 1 !important; filter: contrast(1.05) saturate(1.06); }
  .a2z-film__seam { opacity: 0.85; height: 28vh; }
  /* Keep floating dock clear of the mobile contact bar on the hero */
  body.a2z-home .a2z-floating-dock {
    bottom: calc(104px + env(safe-area-inset-bottom, 0px));
  }
}

/* Opt-out only (?film=0) — cinematic scrub remains the default */
html.a2z-film-static .a2z-film { height: auto !important; }
html.a2z-film-static .a2z-film__stage { position: relative !important; min-height: 78svh; }
html.a2z-film-static .a2z-film__canvas,
html.a2z-film-static .a2z-film__beat,
html.a2z-film-static .a2z-film__readout,
html.a2z-film-static .a2z-film__cue,
html.a2z-film-static .a2z-film__grain,
html.a2z-film-static .a2z-film__loader { display: none !important; }
html.a2z-film-static .a2z-film__poster { opacity: 1 !important; }
html.a2z-film-static .a2z-film__seam { opacity: 0.9; height: 22vh; }
html.a2z-film-static .a2z-film__copy { opacity: 1 !important; visibility: visible !important; }
.a2z-home .a2z-trust-strip,
.a2z-home .a2z-film + .a2z-trust-strip,
.a2z-home .a2z-quote-backdrop + * {
  background: linear-gradient(
    to bottom,
    var(--a2z-primary-soft, #e6f4fe) 0%,
    var(--tw-mist, #f8fafc) 35%,
    #ffffff 100%
  ) !important;
}

/* ---- Reduced motion / no-JS: static poster hero -------------------------- */
@media (prefers-reduced-motion: reduce) {
  .js .a2z-film { height: auto !important; }
  .js .a2z-film__stage { position: relative !important; }
  .a2z-film__canvas, .a2z-film__beat, .a2z-film__readout,
  .a2z-film__cue, .a2z-film__grain { display: none !important; }
  .a2z-film__poster { opacity: 1 !important; }
  .a2z-film__seam { opacity: 1; }
  .a2z-quote-pill { display: none !important; }
  .a2z-quote.is-leaving { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
}
