/* hero.css — the home hero of apolllogroup.tv
 *
 * Three jobs:
 *   1. stop the carousel stacking every slide it has already shown
 *   2. hide the lead-capture form (owner's request)
 *   3. run the carousel full-bleed across the hero with the copy laid over it
 *
 * All of it is CSS rather than markup edits because the page is a hydrated React app:
 * anything cut from the static HTML is rebuilt on hydration. CSS survives re-render.
 */

/* ---------- 1. one slide at a time ----------
 * The carousel uses Swiper's "fade" effect: all ten slides sit at the same spot and opacity
 * decides which is seen. Measured on the live page, Swiper sets a slide's inline opacity to 1
 * when it becomes active but never back to 0 when it leaves, so every slide already shown
 * stays painted — the visible count climbed 4 -> 7 -> 9 -> 10 over 18 seconds, which is the
 * overlapping titles. !important is required: Swiper writes opacity inline, and an inline
 * style beats a stylesheet without it.
 */
.home-swiper .swiper-slide {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.7s ease !important;
}
.home-swiper .swiper-slide.swiper-slide-active {
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* ---------- 2. the lead-capture form ---------- */
header form { display: none !important; }

/* ---------- 3. full-bleed carousel, copy over it ----------
 * Applied at every width: the owner asked for the top of the site to be the rotating video.
 */
@media (min-width: 0px) {

  /* The carousel sits two wrappers deep inside the hero's right-hand column. Resetting their
     `position` does NOT free it: the inner wrapper runs a transform ANIMATION, and Chromium
     keeps an element with a transform animation as the containing block for absolutely
     positioned descendants even when the computed transform is `none` — verified, offsetParent
     stayed on that wrapper after `transform: none !important`. So stretch the wrappers across
     the hero rather than trying to escape them. */
  header div:has(> div > .home-swiper) {        /* the right-hand column */
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    z-index: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
  }
  header div:has(> .home-swiper) {              /* the inner, animated wrapper */
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    animation: none !important;
  }

  /* the carousel itself — the Tailwind height steps (h-[420px] lg:h-[507px] xl:h-[550px])
     have to be beaten or it stays card-sized */
  header .home-swiper,
  header .home-swiper .swiper-wrapper,
  header .home-swiper .swiper-slide {
    height: 100% !important;
    max-height: none !important;
    min-height: 0 !important;
  }
  header .home-swiper {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    max-width: none !important;
    border-radius: 0 !important;
  }

  /* the original design zooms the video to fill a small card; at full width that over-crops */
  header .home-swiper video {
    transform: none !important;
    object-fit: cover !important;
    width: 100% !important;
    height: 100% !important;
  }

  /* darken enough for white type to hold, heaviest where the copy sits */
  header .home-swiper::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background:
      linear-gradient(90deg, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.80) 36%, rgba(0,0,0,0.28) 66%, rgba(0,0,0,0.22) 100%),
      linear-gradient(180deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.08) 30%, rgba(0,0,0,0.10) 66%, rgba(0,0,0,0.72) 100%);
  }

  /* The slide's own caption fills the slide and sits top-left, where it fights the headline.
     Bottom-right does not work either: the hero is 1040px tall against a 900px viewport, so
     anything pinned to its bottom edge falls below the fold. Top-right is always on screen
     and balances the headline. */
  header .home-swiper .swiper-slide > div[class*="pointer-events-none"] {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: flex-end !important;
    text-align: right !important;
    padding: 48px 56px 0 0 !important;
  }

  /* the copy rides on top: left, vertically centred */
  header div:has(> div > h1) {
    position: relative !important;
    z-index: 2 !important;
    justify-content: center !important;
    align-items: flex-start !important;
    text-align: left !important;
    margin-right: auto !important;
    max-width: min(620px, 48%) !important;
  }

  /* the slide caption needs its own contrast where the frame behind it is bright */
  header .home-swiper .swiper-slide > div[class*="pointer-events-none"] * {
    text-shadow: 0 1px 14px rgba(0, 0, 0, 0.95), 0 1px 3px rgba(0, 0, 0, 0.9) !important;
  }
}

/* narrow screens: the hero stacks, so centre the copy and pull the caption in */
@media (max-width: 767px) {
  header div:has(> div > h1) {
    align-items: center !important;
    text-align: center !important;
    margin-right: 0 !important;
    max-width: 100% !important;
    padding: 0 20px !important;
  }
  header .home-swiper .swiper-slide > div[class*="pointer-events-none"] {
    padding: 24px 20px 0 0 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-swiper .swiper-slide { transition: none !important; }
}
