/* Wide gallery (desktop >=481px) */
@media (min-width: 481px) {
  body.js-wide-gallery .hp-hero-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr; /* pas de repeat() pour les minifieurs tatillons */
    gap: 12px;
    position: relative;
    margin-bottom: 16px;
  }
  body.js-wide-gallery .hp-hero-gallery figure {
    margin: 0;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    transition: transform 0.2s ease;
  }
  body.js-wide-gallery .hp-hero-gallery figure:hover {
    transform: scale(1.02);
  }
  body.js-wide-gallery .hp-hero-gallery figure img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  /* 1ere image en grand si >=2 */
  body.js-wide-gallery .hp-hero-gallery figure.is-large {
    grid-column: 1 / span 2;
    grid-row: 1 / span 2;
  }
  /* Miniatures jusqu'a 4 */
  body.js-wide-gallery .hp-hero-gallery figure:nth-child(2) { grid-column: 3; grid-row: 1; }
  body.js-wide-gallery .hp-hero-gallery figure:nth-child(3) { grid-column: 4; grid-row: 1; }
  body.js-wide-gallery .hp-hero-gallery figure:nth-child(4) { grid-column: 3; grid-row: 2; }
  body.js-wide-gallery .hp-hero-gallery figure:nth-child(5) { grid-column: 4; grid-row: 2; }
  /* Cas 1 seule image */
  body.js-wide-gallery .hp-hero-gallery.solo {
    grid-template-columns: 1fr;
  }
  /* Badge +N */
  body.js-wide-gallery .hp-hero-gallery__more {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 10px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: background 0.2s ease;
  }
  body.js-wide-gallery .hp-hero-gallery__more:hover {
    background: rgba(255, 255, 255, 1);
  }
  /* Cacher le slider d'origine (ton sélecteur exact) */
  body.js-wide-gallery .hp-listing__images.content-slider.hp-grid.alignfull {
    display: none !important;
  }
}

/* Coins sans nth-child : on ne fait que gérer les arrondis */
@media (min-width: 481px){
  body.js-wide-gallery .hp-hero-gallery figure       { border-radius: 0; overflow: hidden; }
  body.js-wide-gallery .hp-hero-gallery figure.top-left     { border-top-left-radius: 16px; }
  body.js-wide-gallery .hp-hero-gallery figure.top-right    { border-top-right-radius: 16px; }
  body.js-wide-gallery .hp-hero-gallery figure.bottom-left  { border-bottom-left-radius: 16px; }
  body.js-wide-gallery .hp-hero-gallery figure.bottom-right { border-bottom-right-radius: 16px; }
}

/* Images carrées pour le slider mobile */
@media (max-width: 480px) {
  /* Forcer les images du slider à être carrées */
  .hp-listing__images img,
  .hp-listing__images .slick-slide img,
  .content-slider img {
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: center;
    width: 100%;
    height: auto;
  }
  
  /* Alternative si aspect-ratio n'est pas supporté */
  @supports not (aspect-ratio: 1 / 1) {
    .hp-listing__images img,
    .hp-listing__images .slick-slide img,
    .content-slider img {
      width: 100%;
      height: 0;
      padding-bottom: 100%; /* Ratio 1:1 */
      object-fit: cover;
      object-position: center;
    }
  }
  
  /* Assure-toi que les conteneurs ne limitent pas la hauteur */
  .hp-listing__images .slick-slide,
  .hp-listing__images figure,
  .content-slider .slick-slide,
  .content-slider figure {
    height: auto;
    min-height: 0;
  }
}

/* Mobile : garde le slider natif + badge overlay */
@media (max-width: 480px) {
  .hp-hero-gallery { 
    display: none !important; 
  }
  
  /* Badge mobile avec indicateur slide courant/total - version discrète */
  body.js-mobile-gallery-badge .hp-mobile-gallery-badge {
    position: absolute;
    bottom: -12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 900;
    z-index: 10;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
    pointer-events: none;
    /*transition: opacity 0.3s ease;*/
    line-height: 1;
    min-width: 32px;
    text-align: center;
    opacity: 0.9;
  }
  
  /* Version encore plus compacte */
  body.js-mobile-gallery-badge .hp-mobile-gallery-badge.compact {
    padding: 2px 6px;
    font-size: 11px;
    border-radius: 8px;
    min-width: 28px;
  }
  
  /* Style alternatif plus discret */
  body.js-mobile-gallery-badge .hp-mobile-gallery-badge.minimal {
    background: rgba(255, 255, 255, 0.85);
    color: #333;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }
  
  /* Style avec bordure */
  body.js-mobile-gallery-badge .hp-mobile-gallery-badge.bordered {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.3);
  }
  
  /* Position alternative (coin supérieur droit) */
  body.js-mobile-gallery-badge .hp-mobile-gallery-badge.top-right {
    top: 12px;
    bottom: auto;
    right: 12px;
  }
  
  /* Position alternative (coin supérieur gauche) */
  body.js-mobile-gallery-badge .hp-mobile-gallery-badge.top-left {
    top: 12px;
    bottom: auto;
    right: auto;
    left: 12px;
  }
  
  /* Position alternative (coin inférieur gauche) */
  body.js-mobile-gallery-badge .hp-mobile-gallery-badge.bottom-left {
    bottom: 12px;
    right: auto;
    left: 12px;
  }
  
  /* Version centrée en bas */
  body.js-mobile-gallery-badge .hp-mobile-gallery-badge.bottom-center {
    bottom: 12px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
}
