/* ChromaGrid Styles for WordPress - Optimisé pour responsive */

.chroma-grid {
  position: relative;
  width: 100%;
  height: auto;
  display: grid;
  /* Utilise auto-fit pour maximiser le nombre de cartes par ligne */
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  grid-auto-rows: auto;
  justify-content: center;
  gap: 0.75rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  box-sizing: border-box;

  --x: 50%;
  --y: 50%;
  --r: 220px;
}

/* Suppression des media queries spécifiques car auto-fit gère tout */
@media (max-width: 480px) {
  .chroma-grid {
    gap: 0.75rem;
    padding: 1rem;
    /* Pour les très petits écrans, on peut réduire légèrement la taille min */
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}

@media (max-width: 320px) {
  .chroma-grid {
    /* Pour les écrans très étroits */
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.5rem;
    padding: 0.5rem;
  }
}

.chroma-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: auto;
  min-height: 400px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid #333;
  transition: border-color 0.3s ease;
  background: var(--card-gradient);

  --mouse-x: 50%;
  --mouse-y: 50%;
  --spotlight-color: rgba(255, 255, 255, 0.3);
}

.chroma-card:hover {
  border-color: var(--card-border);
}

.chroma-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mouse-x) var(--mouse-y),
      var(--spotlight-color),
      transparent 70%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 2;
}

.chroma-card:hover::before {
  opacity: 1;
}

.chroma-img-wrapper {
  position: relative;
  z-index: 1;
  flex: 1;
  padding: 10px;
  box-sizing: border-box;
  background: transparent;
  transition: background 0.3s ease;
}

.chroma-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

.chroma-info {
  position: relative;
  z-index: 1;
  padding: 0.25rem 1rem 0.75rem 1rem;
  color: #fff;
  font-family: system-ui, sans-serif;
  display: grid;
  grid-template-columns: 1fr auto;
  row-gap: 0;
  column-gap: 0.75rem;
}

.chroma-info .name {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  color: #fff;
}

.chroma-info .role {
  color: #ddd;
  margin: 0;
  font-size: 0.9rem;
}

.chroma-info .handle {
  color: #ddd;
  font-size: 0.85rem;
  justify-self: end;
}

.chroma-info .location {
  color: #ddd;
  font-size: 0.85rem;
  grid-column: 1 / -1;
}

.chroma-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  backdrop-filter: grayscale(1) brightness(0.78);
  -webkit-backdrop-filter: grayscale(1) brightness(0.78);
  background: rgba(0, 0, 0, 0.001);

  mask-image: radial-gradient(circle var(--r) at var(--x) var(--y),
      transparent 0%,
      transparent 15%,
      rgba(0, 0, 0, 0.10) 30%,
      rgba(0, 0, 0, 0.22) 45%,
      rgba(0, 0, 0, 0.35) 60%,
      rgba(0, 0, 0, 0.50) 75%,
      rgba(0, 0, 0, 0.68) 88%,
      white 100%);
  -webkit-mask-image: radial-gradient(circle var(--r) at var(--x) var(--y),
      transparent 0%,
      transparent 15%,
      rgba(0, 0, 0, 0.10) 30%,
      rgba(0, 0, 0, 0.22) 45%,
      rgba(0, 0, 0, 0.35) 60%,
      rgba(0, 0, 0, 0.50) 75%,
      rgba(0, 0, 0, 0.68) 88%,
      white 100%);
}

.chroma-fade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  backdrop-filter: grayscale(1) brightness(0.78);
  -webkit-backdrop-filter: grayscale(1) brightness(0.78);
  background: rgba(0, 0, 0, 0.001);

  mask-image: radial-gradient(circle var(--r) at var(--x) var(--y),
      white 0%,
      white 15%,
      rgba(255, 255, 255, 0.90) 30%,
      rgba(255, 255, 255, 0.78) 45%,
      rgba(255, 255, 255, 0.65) 60%,
      rgba(255, 255, 255, 0.50) 75%,
      rgba(255, 255, 255, 0.32) 88%,
      transparent 100%);
  -webkit-mask-image: radial-gradient(circle var(--r) at var(--x) var(--y),
      white 0%,
      white 15%,
      rgba(255, 255, 255, 0.90) 30%,
      rgba(255, 255, 255, 0.78) 45%,
      rgba(255, 255, 255, 0.65) 60%,
      rgba(255, 255, 255, 0.50) 75%,
      rgba(255, 255, 255, 0.32) 88%,
      transparent 100%);

  opacity: 1;
  transition: opacity 0.25s ease;
}

/* FIX: S'assurer que toutes les cartes sont traitées équitablement */
.chroma-card {
  /* Forcer le rendu en couleur par défaut */
  filter: none !important;
}

.chroma-card img {
  /* S'assurer que les images ne sont jamais en noir et blanc par défaut */
  filter: none !important;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.chroma-grid * {
  filter: inherit;
}

.chroma-fade,
.chroma-overlay {
  background-size: 100% 100%;
  background-position: center;
  will-change: opacity;
  transform: translateZ(0);
}

.chroma-section {
  padding: 4rem 0;
  background: var(--dark-bg, #1a1a1a);
  min-height: 1000px;
}

.chroma-section h2 {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 3rem;
  color: var(--main-color, #00d4ff);
}

.chroma-section p {
  text-align: center;
  font-size: 1.2rem;
  color: var(--text-light, #ccc);
  margin-bottom: 2rem;
}

@media (max-width: 768px) {
  .chroma-section {
    padding: 2rem 0;
  }
  
  .chroma-section h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
  }
  
  .chroma-grid {
    padding: 0.5rem;
  }
}