/* =========================================================
   HP bannery: carousel → dlaždice vedle sebe (V1-a v6)
   Soubor: /user/documents/yanabel/hp-tiles.css?v=3
   Šablona: Classic (template-11), všechny 4 země.

   CO DĚLÁ:
     Nativní carousel (Bannery → záložka Carousel) zůstává zdrojem
     dat: každý slide = jedna dlaždice s vlastním obrázkem, odkazem
     a alt textem. CSS z něj udělá statickou mřížku:
       - slidy vedle sebe, počet sloupců = počet slidů
         (2 teď, 4 v příštím měsíci bez úpravy kódu)
       - mezera 12 px, zaoblení 12 px, bílé pozadí (Figma)
       - šipky carouselu skryté, rotace vizuálně vypnutá
       - úzký blok (mobil, tablet se sloupcem kategorií): pod sebe

   PROČ CONTAINER QUERY:
     Homepage má vlevo sloupec kategorií, takže carousel je při
     ~800px okně široký jen ~430px. Řídíme se šířkou bloku, ne okna
     (stejný přístup jako benefit-homepage.css).

   Obrázky dlaždic: export z Figmy 1067 × 882 (2x), na webu
   cca 540 × 446. Rozměr bere Shoptet z nahraného souboru.
   ========================================================= */

.in-index #carousel {
  container-type: inline-size;
  background: #fff;
}

/* .banners-row has -20px margin on both sides but .wide-carousel pads
   only the left one, so the tiles ran 20px past the product grid. */
@media (min-width: 768px) {
  .in-index .banners-row .wide-carousel {
    padding-right: 20px !important;
  }
}

/* Mobile: the row is full-bleed (-10px), tiles keep 12px from the edge */
@media (max-width: 767px) {
  .in-index .banners-row .wide-carousel {
    padding: 0 12px !important;
  }
}

.in-index #carousel .carousel-inner {
  display: grid !important;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  overflow: visible !important;
  /* Shoptet JS sets inline min-height from the old slide ratio */
  min-height: 0 !important;
}

/* Bootstrap 3 slide classes (.active/.next/.prev/.left/.right)
   keep toggling every 5 s, so every state is pinned in place. */
.in-index #carousel .carousel-inner > .item {
  display: block !important;
  position: relative !important;
  top: auto !important;
  left: 0 !important;
  transform: none !important;
  transition: none !important;
  opacity: 1 !important;
  border-radius: 12px;
  overflow: hidden;
}

.in-index #carousel .carousel-inner > .item > a,
.in-index #carousel .carousel-inner > .item img {
  display: block;
  width: 100%;
  height: auto;
}

.in-index #carousel .carousel-inner > .item > a:focus-visible {
  outline: 3px solid #239ceb;
  outline-offset: -3px;
}

.in-index #carousel .carousel-control,
.in-index #carousel .carousel-indicators {
  display: none !important;
}

/* Narrow block: tiles under each other */
@container (max-width: 640px) {
  .in-index #carousel .carousel-inner {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Fallback for browsers without container queries */
@supports not (container-type: inline-size) {
  @media (max-width: 767px) {
    .in-index #carousel .carousel-inner {
      grid-auto-flow: row;
      grid-auto-columns: auto;
      grid-template-columns: minmax(0, 1fr);
    }
  }
}

/* ---------------------------------------------------------
   Benefity duplicitně pod bannery (.br-hp-benefits)
   Kopii vytváří hp-tiles.js. Originál dole na stránce
   (.position--benefitHomepage v .br-fullwidth) zůstává.
   Kopie nemá třídu position--benefitHomepage schválně:
   hodnoceni-a-benefity.js by ji jinak přesunul dolů.
   Pravidla níž odpovídají benefit-homepage.css.
   --------------------------------------------------------- */

.br-hp-benefits {
  container-type: inline-size;
  display: flex !important;
  flex-wrap: wrap !important;
  margin: 12px 0 24px;
  padding: 12px 0;
  border-radius: 12px;
  background-color: #239ceb20;
}

.br-hp-benefits .benefitBanner__item {
  flex: 0 0 25% !important;
  max-width: 25% !important;
  box-sizing: border-box;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 0 !important;
}

.br-hp-benefits .benefitBanner__picture {
  flex: 0 0 auto !important;
  max-width: none !important;
  margin-right: 0 !important;
}

.br-hp-benefits .benefitBanner__img {
  width: 48px !important;
  height: 48px !important;
}

/* Theme pads the text 10px on the right, which pushed the longest USP
   ("Fără riscuri până la 15 ani") onto a second line. */
.br-hp-benefits .benefitBanner__content {
  padding-right: 0 !important;
}

/* 4 in a row: width follows the text length instead of fixed 25 %,
   so the longest USP gets the room it needs. */
@container (min-width: 901px) {
  .br-hp-benefits {
    flex-wrap: nowrap !important;
    justify-content: space-between;
  }

  .br-hp-benefits .benefitBanner__item {
    flex: 1 1 auto !important;
    width: auto !important;
    max-width: none !important;
    padding: 10px 12px;
  }
}

@container (max-width: 900px) {
  .br-hp-benefits .benefitBanner__item {
    flex: 0 0 50% !important;
    max-width: 50% !important;
  }
}

@container (max-width: 430px) {
  .br-hp-benefits .benefitBanner__item {
    flex-direction: column;
    text-align: center;
    gap: 6px;
    padding: 8px 4px;
  }

  .br-hp-benefits .benefitBanner__content {
    padding-right: 0;
  }

  .br-hp-benefits .benefitBanner__data {
    font-size: 12px;
    line-height: 1.3;
  }

  .br-hp-benefits .benefitBanner__img {
    width: 40px !important;
    height: 40px !important;
  }
}
