.ranges {
    --white: #f3f4f4;
    --gray: #7a7a7a;
    --brand-primary: #7c00ff;
    --brand-secondary: #fd5016;
}

.ranges {
    overflow: hidden;
    position: relative;
    margin-top: 2.5rem;
    padding-top: 1rem;
}
.ranges::after {
    content: '';
    background: #1d1f24;
    width: 100%;
    height: 2rem;
    position: absolute;
    bottom: 0;
}

.ranges__ttl {
    text-align: center;
}

/* Centrage des filtres */
.ranges__container.filter {
    text-align: center;
}

.ranges__filters {
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #7c00ff #000;
    display: inline-flex;
    justify-content: center;
}

.ranges__filters::-webkit-scrollbar {
    width: 8px;
}

.ranges__filters::-webkit-scrollbar-thumb {
    background-color: #7c00ff;
}

.ranges__filters::-webkit-scrollbar-track {
    background-color: black;
}

.ranges__filter:last-child::after,
.filter__item:last-child::after {
    display: none;
}

.ranges__grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-auto-rows: minmax(min-content, 1fr);
    gap: 1rem;
    align-items: stretch;
    margin: 2rem 0 2.5rem;
    position: relative;
    padding: 0 1.5rem;
}
.ranges__grid::before, .ranges__grid::after {
    content: '';
    position: absolute;
    background: #1d1f24;
    z-index: 1;
}
.ranges__grid::before {
    width: 1px;
    height: calc(100% + 1rem);
    left: 0.5rem;
}
.ranges__grid::after {
    height: 1px;
    width: calc(100% + 1rem);
    bottom: -1rem;
}
.range {
    position: relative;
    padding: 0 1rem 0 0;
    transition: all 0.5s;
}

.range::before,
.range::after {
    content: "";
    background-color: var(--gray);
    position: absolute;
}
.range::before {
    width: calc(100% + 1rem);
    height: 1px;
    bottom: -1rem;
    left: 0;
}
.range::after {
    width: 1px;
    height: 100vh;
    top: 0;
    left: -1rem;
}
.range img {
    max-width: 100%;
}

.range__img img {
    filter: invert(40%);
}
.range:hover .range__hover {
    opacity: 1;
    visibility: visible;
    z-index: 2;
    transition: all 0.2s;
    width: 102%;
}

.range__hover {
    position: absolute;
    width:0%;
    top: 50%;
    left: 50%;
    transform: translate(-54%,-46%);
    z-index: 10;
    opacity: 0;
    visibility: hidden;
}

.range__hover__container {
    background-color: var(--white);
    border-radius: 15px;
    z-index: 1;
}
.range__hover__container::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    transform: rotate(10deg);
    z-index: -1;
    background: linear-gradient(230deg,var(--brand-secondary),var(--brand-primary)) border-box;
    border-width: 2px;
    border-style: solid;
    border-radius: 15px;
    border-color: transparent;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box,linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) padding-box,linear-gradient(#fff 0 0);
    mask-composite: exclude;
}

@media (min-width: 576px) {
    .ranges__grid {
        grid-template-columns: 1fr 1fr 1fr 1fr;
    }
}
@media (min-width: 768px) {
    .ranges__grid {
        grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    }
}
@media (min-width: 992px) {
    .ranges__grid {
        grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
    }
}

@media (hover: none) and (pointer: coarse) {
  .range__hover,
  .range__hover *,
  .range:hover .range__hover,
  .range:active .range__hover,
  .range:focus .range__hover {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

/* === MOBILE - Quadrillage simple === */
@media (max-width: 575.98px) {
  .ranges__grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0 !important;
    padding: 0 !important;
    margin: 2rem 0 2.5rem;
    position: relative;
  }

  /* Suppression complète des bordures de la grille */
  .ranges__grid::before,
  .ranges__grid::after {
    display: none !important;
  }

  .range {
    aspect-ratio: 1/1;
    position: relative;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Bordures par défaut sur toutes les cellules */
    border-right: 1px solid var(--gray);
    border-bottom: 1px solid var(--gray);
  }

  /* Suppression des anciens pseudo-éléments */
  .range::before,
  .range::after {
    display: none !important;
  }

  /* Classes ajoutées par JavaScript pour gérer les bordures */
  .range.no-border-right {
    border-right: none !important;
  }
  
  .range.no-border-bottom {
    border-bottom: none !important;
  }

  /* Centrage du logo */
  .range__img {
    width: 100%;
    height: 100%;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 15%;
  }
  
  .range__img img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
  }
  
  /* Pour les éléments cachés */
  .range[style*="display: none"] {
    display: none !important;
  }
  
  /* S'assurer que display: block se transforme en flex */
  .range[style*="display: block"] {
    display: flex !important;
  }
  
  /* Masquer le hover */
  .range__hover {
    display: none !important;
  }
  
  /* Dégradé des filtres */
  .ranges__filters {
    position: relative;
    padding-bottom: 4px;
  }
  
  .ranges__filters::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary));
  }

  /* Supprimer le dégradé du conteneur parent s'il existe */
  .ranges__container.filter::after {
    display: none;
  }
  
  /* Appliquer le dégradé sur l'élément qui scroll */
  .ranges__filters {
    position: relative;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary));
    background-size: 100% 2px;
    background-repeat: no-repeat;
    background-position: bottom;
  }
  
  /* Alternative : avec pseudo-élément */
  .ranges__filters::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary));
    pointer-events: none;
  }


}

