/**
 * Category Banners - front styles (v2)
 *
 * Three designs are supported, picked per banner via data-clecb-design:
 *   - "bottom" (default): white strip at the bottom with title/text + CTA
 *   - "side":             vertical white panel on left or right
 *                          (data-clecb-side="left|right")
 *   - "hero":             centered title over a darkened image with CTA
 *
 * Themeable via CSS variables on .clecb-banner:
 *   --clecb-overlay-bg, --clecb-radius, --clecb-col-span, --clecb-cols,
 *   --clecb-mobile-bg, --clecb-card-h, --clecb-slot-h
 */

/* ============================================================
   1. WRAPPER (matches a .js-product slot in the products row)
   ============================================================ */

.clecb-banner {
  /* Defaults — overridden inline by JS at runtime */
  --clecb-overlay-bg: rgba(255, 255, 255, 0.95);
  --clecb-radius: 6px;
  --clecb-cols: 1;
  --clecb-col-span: 1;

  box-sizing: border-box;
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.clecb-banner * { box-sizing: border-box; }

/* Grid mode: when the parent is display:grid, span N tracks. */
.clecb-banner[data-clecb-mode="grid"] {
  grid-column: span var(--clecb-col-span, 1);
}

/* Flex / bootstrap mode: width based on cols×span */
.clecb-banner[data-clecb-mode="flex"] {
  flex: 0 0 calc(100% / var(--clecb-cols, 1) * var(--clecb-col-span, 1));
  max-width: calc(100% / var(--clecb-cols, 1) * var(--clecb-col-span, 1));
}

/* ============================================================
   2. TILE (the visible card — mirrors .thumbnail-container)
   ============================================================ */

.clecb-banner-tile {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  flex: 0 0 auto;
  width: 100%;

  text-decoration: none;
  overflow: hidden;
  position: relative;
  border-radius: var(--clecb-radius);
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.clecb-banner-tile:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
}

@media (max-width: 767px) {
  .clecb-banner-tile {
    background-image: var(--clecb-mobile-bg, inherit);
  }
}

/* ============================================================
   3. OVERLAY content (title / text / CTA) — common defaults
   ============================================================ */

.clecb-banner-overlay {
  width: 100%;
  background: var(--clecb-overlay-bg);
  padding: 18px 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 16px;
  row-gap: 4px;
}

.clecb-banner-title {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: left;
  color: #111;
}

.clecb-banner-text {
  grid-column: 1;
  grid-row: 2;
  font-size: 0.85rem;
  color: #444;
  text-align: left;
}

.clecb-banner-text p { margin: 0; }

.clecb-banner-cta {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  justify-self: end;
  display: inline-block;
  padding: 10px 22px;
  background: #111;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 4px;
  white-space: nowrap;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.clecb-banner-cta:hover {
  background: #333;
  transform: translateY(-1px);
}

@media (max-width: 991px) {
  .clecb-banner-overlay {
    grid-template-columns: 1fr;
    text-align: center;
    row-gap: 12px;
    padding: 20px;
  }
  .clecb-banner-title,
  .clecb-banner-text {
    grid-column: 1;
    text-align: center;
  }
  .clecb-banner-title { font-size: 1.2rem; }
  .clecb-banner-cta {
    grid-column: 1;
    grid-row: 3;
    justify-self: stretch;
    width: 100%;
    text-align: center;
  }
}

/* ============================================================
   4. DESIGN "side" — vertical panel on left or right
   ============================================================ */

.clecb-banner[data-clecb-design="side"] .clecb-banner-tile {
  flex-direction: row;
  align-items: stretch;
  justify-content: flex-start;
}

.clecb-banner[data-clecb-design="side"][data-clecb-side="right"] .clecb-banner-tile {
  justify-content: flex-end;
}

.clecb-banner[data-clecb-design="side"] .clecb-banner-overlay {
  width: clamp(220px, 38%, 360px);
  height: 100%;
  grid-template-columns: 1fr;
  align-content: center;
  row-gap: 14px;
  padding: 26px 24px;
}

.clecb-banner[data-clecb-design="side"] .clecb-banner-title {
  grid-column: 1;
  grid-row: 1;
  font-size: 1.55rem;
  line-height: 1.2;
}

.clecb-banner[data-clecb-design="side"] .clecb-banner-text {
  grid-column: 1;
  grid-row: 2;
  font-size: 0.9rem;
  line-height: 1.45;
}

.clecb-banner[data-clecb-design="side"] .clecb-banner-cta {
  grid-column: 1;
  grid-row: 3;
  align-self: start;
  justify-self: start;
  margin-top: 4px;
}

@media (max-width: 767px) {
  /* On mobile the side panel becomes a bottom band to stay legible */
  .clecb-banner[data-clecb-design="side"] .clecb-banner-tile {
    flex-direction: column;
    justify-content: flex-end;
  }
  .clecb-banner[data-clecb-design="side"] .clecb-banner-overlay {
    width: 100%;
    height: auto;
    text-align: center;
    align-content: end;
  }
  .clecb-banner[data-clecb-design="side"] .clecb-banner-title,
  .clecb-banner[data-clecb-design="side"] .clecb-banner-text {
    text-align: center;
  }
  .clecb-banner[data-clecb-design="side"] .clecb-banner-cta {
    justify-self: stretch;
    width: 100%;
    text-align: center;
  }
}

/* ============================================================
   5. DESIGN "hero" — centered title over darkened image
   ============================================================ */

.clecb-banner[data-clecb-design="hero"] .clecb-banner-tile {
  justify-content: center;
  align-items: center;
}

/* Dark gradient veil over the image for legibility */
.clecb-banner[data-clecb-design="hero"] .clecb-banner-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.25) 0%,
    rgba(0, 0, 0, 0.55) 100%
  );
  z-index: 1;
  pointer-events: none;
}

.clecb-banner[data-clecb-design="hero"] .clecb-banner-overlay {
  position: relative;
  z-index: 2;
  background: transparent;
  width: auto;
  max-width: 80%;
  padding: 28px 30px;
  grid-template-columns: 1fr;
  justify-items: center;
  row-gap: 12px;
  text-align: center;
}

.clecb-banner[data-clecb-design="hero"] .clecb-banner-title {
  grid-column: 1;
  grid-row: 1;
  font-size: clamp(1.6rem, 2.4vw, 2.4rem);
  line-height: 1.1;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.clecb-banner[data-clecb-design="hero"] .clecb-banner-text {
  grid-column: 1;
  grid-row: 2;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.92);
  text-align: center;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
  max-width: 60ch;
}

.clecb-banner[data-clecb-design="hero"] .clecb-banner-cta {
  grid-column: 1;
  grid-row: 3;
  align-self: center;
  justify-self: center;
  background: #fff;
  color: #111;
  padding: 12px 28px;
  font-size: 0.85rem;
  margin-top: 6px;
}

.clecb-banner[data-clecb-design="hero"] .clecb-banner-cta:hover {
  background: #f3f3f3;
  color: #000;
}

@media (max-width: 991px) {
  .clecb-banner[data-clecb-design="hero"] .clecb-banner-overlay {
    max-width: 92%;
    padding: 22px 20px;
  }
  .clecb-banner[data-clecb-design="hero"] .clecb-banner-title {
    font-size: clamp(1.25rem, 5vw, 1.7rem);
  }
}
