/* ==========================================================================
   Bloop — Grille des box (shortcode [bloop_boxes])
   ========================================================================== */

.bl-boxes-wrap {
  --bl-box-bg: var(--main-light);
  --bl-box-ink: var(--main-dark);
  --bl-box-radius: 22px;
  --bl-box-media-h: 350px;
  --bl-box-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --bl-box-gap: clamp(16px, 2vw, 28px);
}

.bl-boxes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--bl-box-gap);
}

/* Carte
   ========================================================================== */

.bl-boxes .bl-box-item {
  position: relative;
  display: flex;
  min-width: 0;
}

.bl-boxes .bl-box {
  flex: 1 1 auto;
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  padding-top: var(--bl-box-media-h); /* réserve la place de l'image */
  background: var(--main-light-contrast);
  border-radius: var(--bl-box-radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--bl-box-ink);
}

.bl-boxes .bl-box:focus-visible {
  outline: 3px solid var(--bl-box-ink);
  outline-offset: 4px;
}

/* Images
   ========================================================================== */

.bl-boxes .bl-box__media {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--bl-box-media-h);
  overflow: hidden;
  transition: height 0.45s var(--bl-box-ease);
}

/* Dégradé sombre en bas pour lire le titre au survol */
.bl-boxes .bl-box__media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.35) 30%, rgba(0, 0, 0, 0) 55%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.bl-boxes .bl-box__media img.bl-box__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  opacity: 0;
  transition:
    opacity 0.15s ease,
    transform 0.2s var(--bl-box-ease);
}

.bl-boxes .bl-box__media img.bl-box__img.is-active {
  opacity: 1;
}

/* Titre
   ========================================================================== */

.bl-boxes .bl-box__title {
  position: relative;
  z-index: 2;
  margin: 0;
  padding: 20px;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--bl-box-ink) !important;
  transition: color 0.3s ease;
  font-family: "Modeco - Regular" !important;
}

/* Survol (PC) ou aperçu ouvert via l'œil (mobile) :
   l'image prend toute la carte, titre en blanc sur dégradé
   ========================================================================== */

.bl-boxes .bl-box.is-open .bl-box__media {
  height: 100%;
}

.bl-boxes .bl-box.is-open .bl-box__media::after {
  opacity: 1;
}

.bl-boxes .bl-box.is-open .bl-box__title {
  color: #fff !important;
}

.bl-boxes .bl-box--zoom.is-open .bl-box__img {
  transform: scale(1.07);
}

@media (hover: hover) {
  .bl-boxes .bl-box:hover .bl-box__media,
  .bl-boxes .bl-box:focus-visible .bl-box__media {
    height: 100%;
  }

  .bl-boxes .bl-box:hover .bl-box__media::after,
  .bl-boxes .bl-box:focus-visible .bl-box__media::after {
    opacity: 1;
  }

  .bl-boxes .bl-box:hover .bl-box__title,
  .bl-boxes .bl-box:focus-visible .bl-box__title {
    color: #fff !important;
  }

  /* Pas d'images hover → zoom simple en plus */
  .bl-boxes .bl-box--zoom:hover .bl-box__img,
  .bl-boxes .bl-box--zoom:focus-visible .bl-box__img {
    transform: scale(1.07);
  }
}

/* Bouton œil (écrans tactiles uniquement)
   Œil → croix une fois l'aperçu ouvert. !important pour passer devant les styles de bouton de Divi.
   ========================================================================== */

.bl-boxes .bl-box__eye {
  display: none !important;
}

@media (hover: none) {
  .bl-boxes .bl-box-item .bl-box__eye {
    position: absolute !important;
    top: 12px;
    right: 12px;
    z-index: 3;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px !important;
    height: 40px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.18) !important;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #fff !important;
    box-shadow: none !important;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition:
      background 0.25s ease,
      transform 0.2s ease;
  }

  .bl-boxes .bl-box-item .bl-box__eye:active {
    transform: scale(0.92);
  }

  .bl-boxes .bl-box-item .bl-box__eye svg {
    pointer-events: none;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
  }

  /* Fermé : œil visible, croix masquée */
  .bl-boxes .bl-box-item .bl-box__eye .bl-box__eye-on {
    display: block !important;
  }

  .bl-boxes .bl-box-item .bl-box__eye .bl-box__eye-off {
    display: none !important;
  }

  /* Ouvert : croix visible, œil masqué */
  .bl-boxes .bl-box-item.is-open .bl-box__eye .bl-box__eye-on {
    display: none !important;
  }

  .bl-boxes .bl-box-item.is-open .bl-box__eye .bl-box__eye-off {
    display: block !important;
  }
}

/* Pastilles (mobile uniquement)
   ========================================================================== */

.bl-boxes__dots {
  display: none;
}

/* le plus populaire */
.bl-box-item:has(.bl-box--box-personnalisee)::before {
  content: "";
  position: absolute;
  top: 0;
  left: -15px;
  z-index: 4;
  height: 65px;
  width: 65px;
  background: url(/wp-content/uploads/2026/10/pastille-bloop-2.svg);
  background-size: contain !important;
  background-repeat: no-repeat !important;
  transform-origin: center;
  animation: infinite_rotation linear 8s infinite;
  pointer-events: none;
}

.bl-box-item:has(.bl-box--box-personnalisee)::after {
  content: "Le plus populaire";
  text-align: center;
  position: absolute;
  top: 17px;
  left: -8px;
  z-index: 5;
  font-size: 11px;
  max-width: 50px;
  line-height: 1.2;
  color: var(--main-dark);
  transform-origin: center;
  transform: rotate(-15deg);
  pointer-events: none;
}

/* Responsive : scroll horizontal
   ========================================================================== */

@media (max-width: 980px) {
  .bl-boxes-wrap {
    --bl-box-media-h: 300px;
    --bl-box-gap: 16px;
    --bl-boxes-bleed: 25px; /* place pour les badges qui dépassent des cartes */
  }

  .bl-boxes {
    display: flex;
    gap: var(--bl-box-gap);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;

    /* À gauche : coupé juste avant la ligne Divi, avec une marge de --bl-boxes-bleed
		   pour laisser dépasser les pastilles/badges posés sur les cartes.
		   À droite : déborde jusqu'au bord de l'écran pour montrer la carte suivante. */
    box-sizing: border-box;
    width: calc(50% + 50vw + var(--bl-boxes-bleed));
    max-width: none;
    margin-left: calc(-1 * var(--bl-boxes-bleed));
    margin-top: calc(-1 * var(--bl-boxes-bleed));
    padding-left: var(--bl-boxes-bleed);
    padding-top: var(--bl-boxes-bleed);
    padding-right: calc(50vw - 50%);
  }

  .bl-boxes::-webkit-scrollbar {
    display: none;
  }

  .bl-boxes .bl-box-item {
    flex: 0 0 78%;
    max-width: 340px;
    scroll-snap-align: start;
  }

  .bl-boxes__dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
  }

  .bl-boxes__dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--bl-box-ink);
    opacity: 0.25;
    cursor: pointer;
    transition:
      opacity 0.3s ease,
      transform 0.3s ease;
  }

  .bl-boxes__dot.is-on {
    opacity: 1;
    transform: scale(1.3);
  }
}

/* Accessibilité : animations réduites
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .bl-boxes .bl-box__media,
  .bl-boxes .bl-box__media::after,
  .bl-boxes .bl-box__img,
  .bl-boxes .bl-box__title {
    transition: none !important;
  }

  .bl-boxes .bl-box--zoom:hover .bl-box__img {
    transform: none !important;
  }
}




