/* ============================================================
   H2V Gallery Pro v1.1.0 — Styles
   ============================================================ */

/* ---------- Grille shortcode -------------------------------- */
.h2v-gallery-grid {
  display: grid;
  gap: 8px;
  width: 100%;
  grid-template-columns: repeat(var(--h2v-cols, 3), 1fr);
}
.h2v-gallery-grid[data-columns="1"] { --h2v-cols: 1; }
.h2v-gallery-grid[data-columns="2"] { --h2v-cols: 2; }
.h2v-gallery-grid[data-columns="3"] { --h2v-cols: 3; }
.h2v-gallery-grid[data-columns="4"] { --h2v-cols: 4; }
.h2v-gallery-grid[data-columns="5"] { --h2v-cols: 5; }
.h2v-gallery-grid[data-columns="6"] { --h2v-cols: 6; }

.h2v-gallery-item {
  overflow: hidden;
  border-radius: 4px;
  background: #111;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  position: relative;
}
.h2v-gallery-item a {
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
}
.h2v-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  transition: transform 0.35s ease, opacity 0.35s ease;
}
.h2v-gallery-item:hover img {
  transform: scale(1.04);
  opacity: 0.92;
}

/* ---------- Protection globale images ----------------------- */
img[draggable="false"] {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Shield invisible positionné sur les images */
.h2v-img-shield {
  position: absolute;
  inset: 0;
  z-index: 2;
  -webkit-touch-callout: none;
  user-select: none;
}

/* Filigrane inline (sur les galeries/sliders hors lightbox) */
.h2v-inline-wm {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
}

/* ---------- Lightbox overlay -------------------------------- */
#h2v-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(0, 0, 0, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#h2v-lightbox.h2v-open {
  opacity: 1;
  visibility: visible;
}

/* ---------- Contenu ----------------------------------------- */
.h2v-lb-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 60px 80px;
  box-sizing: border-box;
}

#h2v-lb-canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 3px;
  box-shadow: 0 8px 60px rgba(0,0,0,0.7);
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
#h2v-lb-canvas.h2v-loaded {
  opacity: 1;
  transform: scale(1);
}

/* ---------- Boutons nav ------------------------------------- */
.h2v-lb-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 22px;
  transition: background 0.2s, transform 0.2s;
  z-index: 10;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 0;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.h2v-lb-btn:hover  { background: rgba(255,255,255,0.22); transform: translateY(-50%) scale(1.1); }
.h2v-lb-btn:active { transform: translateY(-50%) scale(0.95); }
#h2v-lb-prev { left: 16px; }
#h2v-lb-next { right: 16px; }

/* ---------- Fermer ------------------------------------------ */
#h2v-lb-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  transition: background 0.2s;
  z-index: 10;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 0;
  outline: none;
}
#h2v-lb-close:hover { background: rgba(220,50,50,0.55); }

/* ---------- Compteur & légende ------------------------------ */
#h2v-lb-counter {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.55);
  font-family: -apple-system,'Helvetica Neue',sans-serif;
  font-size: 13px;
  letter-spacing: 0.08em;
  pointer-events: none;
  user-select: none;
}
#h2v-lb-caption {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.75);
  font-family: -apple-system,'Helvetica Neue',sans-serif;
  font-size: 14px;
  text-align: center;
  max-width: 70%;
  pointer-events: none;
  user-select: none;
}

/* ---------- Spinner ----------------------------------------- */
.h2v-lb-spinner {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: rgba(255,255,255,0.8);
  border-radius: 50%;
  animation: h2v-spin 0.7s linear infinite;
}
@keyframes h2v-spin { to { transform: rotate(360deg); } }

/* ---------- Shield média (vidéo) ---------------------------- */
.h2v-media-shield {
  position: absolute;
  inset: 0;
  z-index: 5;
  -webkit-touch-callout: none;
  user-select: none;
}

/* Assure que les wrappers vidéo/audio sont positionnés */
.elementor-widget-video,
.elementor-widget-sound-cloud,
.wp-video,
.wp-audio-shortcode {
  position: relative;
}

/* Désactive le menu contextuel natif sur vidéo */
video, audio {
  -webkit-touch-callout: none;
}

/* Elementor carousel slides */
.elementor-image-carousel .swiper-slide,
/* MetaSlider slides */
.metaslider .slide,
.ml-slider .slide,
.nivoSlider,
.flexslider .slides li,
.rslides li,
/* Elementor gallery item */
.elementor-gallery-item,
.e-gallery-item {
  position: relative;
}

/* ---------- Responsive -------------------------------------- */
@media (max-width: 768px) {
  .h2v-gallery-grid[data-columns="4"],
  .h2v-gallery-grid[data-columns="5"],
  .h2v-gallery-grid[data-columns="6"] { --h2v-cols: 2; }
  .h2v-lb-btn { width: 40px; height: 40px; font-size: 18px; }
  .h2v-lb-inner { padding: 50px 56px; }
  #h2v-lb-prev { left: 6px; }
  #h2v-lb-next { right: 6px; }
}
@media (max-width: 480px) {
  .h2v-gallery-grid[data-columns="3"],
  .h2v-gallery-grid[data-columns="4"],
  .h2v-gallery-grid[data-columns="5"],
  .h2v-gallery-grid[data-columns="6"] { --h2v-cols: 2; }
}
