/* File name: carouselHeroStyling.css */

/* -------------------- GLOBAL WRAPPER -------------------- */
@media only screen and (max-width: 1199px) {
  .main-wrapper {
    padding: 0 16px;
  }
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

/* -------------------------------------------------------
   CATEGORY HERO — NO-CLS VISIBILITY / RESERVATION SYSTEM
   -------------------------------------------------------
   JS contract:
   - On init: ensure .promo-hero-section does NOT have .promo-visible
   - If heroes exist: add .promo-reserved immediately, build DOM, then add .promo-visible
   - If NO heroes: ensure .promo-visible and .promo-reserved are both removed,
     optionally add .promo-hero-section-hidden
*/

/* Base: fully collapsed & hidden (prevents white space + CLS) */
.promo-hero-section {
  position: relative;
  width: 100%;
  padding: 0 8px;

  /* collapse the block until we decide what to do */
  height: 0;
  min-height: 0;
  overflow: hidden;

  /* hide without layout jump */
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s;
}

/* Prefer reduced motion: no fade */
@media (prefers-reduced-motion: reduce) {
  .promo-hero-section {
    transition: none;
  }
}

/* Explicit hard-hide (authoritative) */
.promo-hero-section.promo-hero-section-hidden {
  height: 0 !important;
  min-height: 0 !important;
  visibility: hidden !important;
  opacity: 0 !important;
  overflow: hidden !important;
}

/* When we KNOW heroes exist, reserve space BEFORE showing to avoid CLS */
.promo-hero-section.promo-reserved {
  height: auto;
  /* sensible mobile baseline; overridden by breakpoints below */
  min-height: 390px;
}

/* Reveal (after DOM is built) — keeps the reserved height, just fades content in */
.promo-hero-section.promo-visible {
  visibility: visible;
  opacity: 1;
}

/* If NOT reserved/visible, neuter inner wrappers so they don't create gaps */
.promo-hero-section:not(.promo-reserved):not(.promo-visible) .promo-hero-tabs,
.promo-hero-section:not(.promo-reserved):not(.promo-visible)
  .promo-hero-carousel,
.promo-hero-section:not(.promo-reserved):not(.promo-visible)
  .promo-hero-carousel-wrapper {
  min-height: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* -------------------- LOADER -------------------- */
.promo-hero-loader {
  display: flex;
  justify-content: center;
  align-items: center;
  align-content: center;
  width: 100%;
}

/* -------------------- CAROUSEL -------------------- */
.promo-hero-carousel,
.promo-hero-carousel.promo-loaded {
  width: 100%;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  border-radius: inherit;
  margin: 0 auto;
  max-width: 760px;
  scroll-behavior: smooth;
  background: #ffffff;
  box-shadow: 0 3px 6px #00000029;
}

.promo-hero-carousel {
  overflow-x: hidden;
  overflow-y: visible;
  -ms-overflow-style: none; /* IE & Edge */
  scrollbar-width: none; /* Firefox */
  position: relative;
}

.promo-hero-carousel::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* -------------------- TABS -------------------- */
@media (max-width: 375px) {
  .promo-hero-tabs {
    min-height: 100px;
  }
}

.promo-hero-tabs {
  display: flex;
  margin: 16px auto 8px;
  max-width: 760px;
  width: 100%;
  min-height: 60px;
}

.hero-tab {
  width: calc((100% - 48px) / 4);
  align-items: center;
  background: #f5f5f5;
  border: 1px solid #f5f5f5;
  cursor: pointer;
  display: flex;
  justify-content: center;
  padding: 8px;
  text-align: center;
  font-size: 12px;
  font: var(--font-11px-small-regular);
  flex-direction: column;
  flex: 1;
  word-break: break-all;
}

.hero-tab:not(:first-child) {
  margin-left: 16px;
}

.hero-tab.active {
  border-bottom: 2px solid #f1912b;
  font-weight: 600;
}

/* -------------------- CARD/WRAPPER -------------------- */
.promo-hero-carousel-container {
  position: relative;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16);
  border-radius: 6px;
  padding: 0;
  max-width: 380px;
  margin: 0 auto;
  overflow: visible;
}

.promo-hero-card {
  flex: 0 0 100%;
  margin-right: 16px;
  scroll-snap-align: start;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  margin-bottom: 0;
}

.promo-hero-card:last-child {
  margin-right: 0;
}

.promo-hero-link,
.promo-hero-carousel-wrapper .banner-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.promo-hero-carousel-wrapper {
  position: relative;
  width: 100%;
  height: 425px;
}

.promo-hero-content {
  min-height: 227px;
}

/* -------------------- IMAGE & TEXT -------------------- */
.promo-hero-carousel-wrapper img {
  width: 100%;
  max-width: 376px;
  min-height: 160px;
  object-fit: cover;
  aspect-ratio: 4 / 1.5;
  margin: 0 auto;
}

/* (duplicate selector consolidated above)
.promo-hero-section { position: relative; width: 100%; padding: 0 8px; }
*/

.promo-hero-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.promo-hero-text {
  flex-grow: 1;
  overflow: auto;
}

.promo-hero-text h2 {
  margin: 16px 16px 0;
  font: var(--font-18px-large-semi-bold);
  color: #222;
}

.carousel__slide-p,
.carousel__slide-terms {
  margin: 16px;
  font-weight: 400;
  font-size: 14px;
  color: #333;
}

.carousel__slide-p {
  overflow: auto;
}

.promo-hero-button {
  width: 100%;
  border-radius: 0 0 3px 3px;
  font-display: optional;
  padding: 12px 20px;
  font-size: 1rem;
}

/* ------------------- MEDIA QUERIES ------------------- */

/* Reserve responsive heights only when .promo-reserved is present */
@media (min-width: 425px) and (max-width: 767px) {
  .promo-hero-tabs {
    min-height: 70px;
  }

  .promo-hero-carousel-wrapper img {
    aspect-ratio: 3 / 1.5;
    width: 100%;
    max-width: 100%;
    max-height: 196px;
    object-position: top;
  }
  .carousel__slide-p {
    min-height: 105px;
  }

  /* Apply min-heights only when we’ve reserved space */
  .promo-hero-section.promo-reserved .promo-hero-carousel-wrapper,
  .promo-hero-section.promo-reserved .promo-hero-carousel {
    min-height: 468px;
    height: 468px;
  }
}

@media (min-width: 768px) {
  .promo-hero-carousel-wrapper img {
    min-height: 365px;
    max-width: 100%;
  }

  .promo-hero-tabs {
    min-height: 40px;
  }
  .carousel__slide-p {
    min-height: 80px;
  }

  /* Apply min-heights only when we’ve reserved space */
  .promo-hero-section.promo-reserved .promo-hero-carousel-wrapper,
  .promo-hero-section.promo-reserved .promo-hero-carousel {
    min-height: 598px;
    height: 598px;
  }

  .promo-hero-content {
    min-height: 228px;
  }
  .hero-tab {
    word-break: break-word;
  }
}

@media (min-width: 1200px) {
  .promo-hero-carousel,
  .promo-hero-carousel.promo-loaded {
    max-width: 1200px;
  }

  .hero-tab:not(:first-child) {
    margin-left: 0;
  }
  .hero-tab {
    background: none;
    border: none;
    font: var(--font-14px-body-regular);
  }

  .hero-tab.active {
    border-bottom: 2px solid #f1912b;
    font-weight: 600;
  }

  .promo-hero-tabs {
    min-height: 50px;
    max-width: 830px;
  }

  .carousel__slide-p {
    min-height: auto;
  }

  .promo-hero-carousel-wrapper img {
    min-height: 316px;
  }

  /* Apply min-heights only when we’ve reserved space */
  .promo-hero-section.promo-reserved .promo-hero-carousel-wrapper,
  .promo-hero-section.promo-reserved .promo-hero-carousel {
    min-height: 310px;
    height: 310px;
  }

  .promo-hero-content {
    min-height: 310px;
  }

  .promo-hero-card {
    margin: 0 auto 0 0;
    display: flex;
    flex-direction: row;
  }

  .promo-hero-link,
  .promo-hero-carousel-wrapper .banner-wrapper {
    flex-direction: row;
    width: 100%;
  }

  .promo-hero-image {
    flex: 0 0 50%;
    padding: 0;
  }

  .promo-hero-content {
    flex: 1;
    padding: 16px;
    justify-content: center;
  }

  .promo-hero-text {
    margin-bottom: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 0;
  }

  .promo-hero-button {
    width: 253px;
    border-radius: 44px;
    margin-left: 16px;
  }

  .promo-hero-carousel-wrapper img {
    width: 50%;
  }
}

/* Optional: ensure hero images don’t blow layout while loading */
.promo-hero-image {
  max-width: 100%;
  height: auto;
  display: block;
}
