/*
 * Cross-theme home hero background layout.
 * Loaded after per-theme responsive.css and storefront-responsive-base.css.
 *
 * Images fill their hero container (object-fit: cover). Text and buttons sit
 * in a higher z-index layer so they stay visible and clickable.
 */

/* --- Shared hero shell --- */
body[class*="storefront-theme-"] .home-slider {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

/* --- Pattern 1: section backdrop (fashion / kids / furniture) --- */
body[class*="storefront-theme-"] .home-slider:has(> .bg-img) {
  min-height: clamp(320px, 52svh, 560px);
}

body[class*="storefront-theme-"] .home-slider > .bg-img {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0;
  padding: 0;
  object-fit: cover;
  object-position: center center;
  pointer-events: none;
  opacity: 1;
  filter: none;
}

body[class*="storefront-theme-"] .home-slider > .bg-img.lazyloaded,
body[class*="storefront-theme-"] .home-slider > .bg-img.blur-up {
  opacity: 1;
  filter: none;
}

body[class*="storefront-theme-"] .home-slider:has(> .bg-img) > .container,
body[class*="storefront-theme-"] .home-slider:has(> .bg-img) > .product-thumb {
  position: relative;
  z-index: 2;
}

body[class*="storefront-theme-"] .home-slider:not(:has(> .bg-img)) > .container {
  position: relative;
  z-index: 1;
}

/* --- Pattern 2: per-slide hero (grocery / electronics / manti) --- */
body[class*="storefront-theme-"] .home-slider .animated-slider.slick-slider {
  margin: 0;
}

/* The list is the visible viewport; keep it full-width and clipped. */
body[class*="storefront-theme-"] .home-slider .animated-slider .slick-list {
  width: 100%;
  max-width: 100%;
  min-height: clamp(280px, 42vw, 520px);
}

/* IMPORTANT: never clamp the track width. Slick sizes it to N slides side by
 * side; max-width here would wrap slides onto multiple rows (blank slides +
 * tall empty space under the hero). */
body[class*="storefront-theme-"] .home-slider .animated-slider .slick-track {
  max-width: none;
  min-height: clamp(280px, 42vw, 520px);
}

body[class*="storefront-theme-"] .home-slider .animated-slider .slick-slide {
  margin-left: 0;
  margin-right: 0;
  min-width: 0;
}

body[class*="storefront-theme-"] .home-slider .animated-slider .slick-slide,
body[class*="storefront-theme-"] .home-slider .animated-slider .slick-slide > div {
  height: 100%;
  min-height: clamp(280px, 42vw, 520px);
}

body[class*="storefront-theme-"] .home-slider .slider-item.ratio {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-height: clamp(280px, 42vw, 520px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}

body[class*="storefront-theme-"] .home-slider .slider-item.ratio::before {
  display: none !important;
  padding-bottom: 0 !important;
  content: none !important;
}

body[class*="storefront-theme-"] .home-slider .slider-item.ratio > .bg-img {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0;
  object-fit: cover;
  object-position: center center;
  pointer-events: none;
  opacity: 1;
  filter: none;
}

/* Slick fade stacks slides; keep each slide's media visible when active */
body[class*="storefront-theme-"] .home-slider .animated-slider.slick-slider.slick-fade .slick-slide {
  opacity: 0;
  z-index: 1;
  transition: opacity 300ms ease;
}

body[class*="storefront-theme-"] .home-slider .animated-slider.slick-slider.slick-fade .slick-slide.slick-active {
  opacity: 1;
  z-index: 2;
}

body[class*="storefront-theme-"] .home-slider .animated-slider.slick-slider.slick-fade .slider-item.ratio > .bg-img {
  opacity: 1 !important;
  visibility: visible !important;
}

body[class*="storefront-theme-"] .home-slider .slider-item.ratio > .bg-img.lazyloaded,
body[class*="storefront-theme-"] .home-slider .slider-item.ratio > .bg-img.blur-up {
  opacity: 1;
  filter: none;
}

body[class*="storefront-theme-"] .home-slider .slider-item.ratio > .d-flex {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  padding: clamp(16px, 4vw, 40px);
  min-width: 0;
}

body[class*="storefront-theme-"] .home-slider .slider-item.ratio .slider-content {
  position: relative;
  z-index: 2;
}

/* Ratio-slider themes: full-width slider below 1200px */
@media (max-width: 1199.98px) {
  body[class*="storefront-theme-"] .home-slider:not(:has(> .bg-img)) .animated-slider {
    width: 100vw;
    max-width: 100vw;
    margin-inline: calc(50% - 50vw);
  }
}

@media (max-width: 767.98px) {
  body[class*="storefront-theme-"] .home-slider:has(> .bg-img) {
    min-height: clamp(300px, 58svh, 480px);
  }

  /* Height only on list/track/slide; aspect-ratio only on the slide box so the
   * multi-slide track width can't inflate the hero height. */
  body[class*="storefront-theme-"] .home-slider .animated-slider .slick-list,
  body[class*="storefront-theme-"] .home-slider .animated-slider .slick-track,
  body[class*="storefront-theme-"] .home-slider .animated-slider .slick-slide,
  body[class*="storefront-theme-"] .home-slider .animated-slider .slick-slide > div {
    min-height: clamp(260px, 56vw, 400px);
  }

  body[class*="storefront-theme-"] .home-slider .slider-item.ratio {
    min-height: clamp(260px, 56vw, 400px);
    aspect-ratio: 4 / 3;
  }
}

@media (min-width: 992px) {
  body[class*="storefront-theme-"] .home-slider:has(> .bg-img) {
    min-height: clamp(400px, 58svh, 720px);
  }

  body.storefront-theme-fashion .home-slider.home-slider-3 > .bg-img {
    object-position: center 35%;
  }
}

@media (min-width: 1200px) {
  body.storefront-theme-fashion .home-slider.home-slider-3 > .bg-img,
  body.storefront-theme-kids .home-slider.home-slider-5 > .bg-img,
  body.storefront-theme-furniture .home-slider.home-slider-2 > .bg-img {
    object-position: center bottom;
  }

  body.storefront-theme-vegetables .home-slider.home-slider-1 .slider-item.ratio > .bg-img,
  body.storefront-theme-electronics .home-slider.home-slider-4 .slider-item.ratio > .bg-img,
  body.storefront-theme-manti .home-slider.home-slider-6 .slider-item.ratio > .bg-img {
    object-position: center bottom;
  }
}

/* Fashion section padding (content breathing room over backdrop) */
body.storefront-theme-fashion .home-slider.home-slider-3 {
  padding-block: clamp(80px, 11vw, 104px) clamp(24px, 4vw, 32px);
  background-color: var(--storefront-surface-soft, var(--storefront-page-bg));
}

body.storefront-theme-fashion .home-slider.home-slider-3 > .bg-img {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  object-fit: cover !important;
  object-position: center center !important;
}

@media (min-width: 992px) {
  body.storefront-theme-fashion .home-slider.home-slider-3 {
    padding-block: clamp(104px, 14vw, 220px) clamp(220px, 18vw, 260px);
    background-color: transparent;
  }
}
