/* =========================================
   hero_banners.css
   Responsive hero with rotating banner slots
   ========================================= */

/* Shared basics */
.banner-slot {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: #fff;                 /* white behind banners */
  border: 1px solid #e9ecef;        /* subtle frame */
}

.banner-slot a,
.banner-slot img {
  display: block;
  width: 100%;
  height: 100%;
}

.banner-slot img {
  object-fit: cover;                /* fill without distortion */
  object-position: center;
}

/* Rotator frames (cross-fade) */
.banner-slot .frame {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .35s ease;
}

.banner-slot .frame.active {
  opacity: 1;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .banner-slot .frame { transition: none; }
}

/* Non-link wrapper fills slot (when href is empty) */
.banner-slot .nolink {
  display: block;
  width: 100%;
  height: 100%;
}

/* Ensure <picture> behaves like <img> inside slots */
.banner-slot picture,
.banner-slot picture img {
  display: block;
  width: 100%;
  height: 100%;
}

/* Hero text card */
.hero-copy {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.06);
  text-align: center;

  /* stack headline above subtext and center vertically */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .25rem;
}

/* Tighter default spacing */
.hero-copy h1 { margin-bottom: .25rem; }
.hero-copy p  { margin-top: 0; }

/* ===========================
   Desktop (lg+): side banners + centered copy
   =========================== */
@media (min-width: 992px) {
  .hero-grid {
    display: grid;
    gap: 16px;
    align-items: stretch; /* side banners match hero-copy height */
    grid-template-columns: minmax(160px, 300px) 1fr minmax(160px, 300px); /* default: both sides */
  }

  /* Adapt grid when side slots are hidden */
  .hero-grid.no-sides  { grid-template-columns: 1fr; }
  .hero-grid.only-left { grid-template-columns: minmax(160px, 300px) 1fr; }
  .hero-grid.only-right{ grid-template-columns: 1fr minmax(160px, 300px); }

  /* Side banner containers:
     - Same height as the center column
     - Width driven by aspect ratio of 1536×1034 (~1.486:1)
  */
  .banner-slot.side {
    height: 100%;                  /* match hero-copy height */
    aspect-ratio: 1536 / 1034;     /* keep banner’s native ratio */
    max-width: 300px;              /* tidy on wide screens */
    min-width: 160px;              /* avoid too skinny */
  }
}

/* ===========================
   Tablet/Mobile (lt lg): top & bottom full-width banners
   =========================== */
@media (max-width: 991.98px) {
  .hero-copy {
    border-radius: 10px;
    padding: .75rem 1rem;
    box-shadow: 0 4px 14px rgba(0,0,0,.05);
  }

  /* Short, wide banners above/below the text */
  .banner-slot.wide {
    width: 100%;
    height: 50px;                  /* 50–60px works well */
    border-radius: 10px;
  }

  .banner-slot.wide img,
  .banner-slot.wide picture img {
    object-fit: cover;
    object-position: center;
  }
}

/* Ultra-narrow phones: prioritize full text over full-bleed */
@media (max-width: 360px) {
  .banner-slot.wide img,
  .banner-slot.wide picture img {
    object-fit: contain;
    background: #fff;
  }
}
