/* ==========================================================================
   Color Image Swatches — Hummingbird PS9
   ========================================================================== */

/* ── Liste de swatches couleur ──────────────────────────────────────────── */
.cis-swatches-list {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  list-style: none;
  margin: .625rem 0 0;
  padding: 0;
}

/* ── Un swatch ──────────────────────────────────────────────────────────── */
.cis-swatch {
  position: relative;
  cursor: pointer;
  /* taille totale = inner (40px) + ring (4px extérieur) */
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Visuel principal : cercle avec image */
.cis-swatch__inner {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #e9ecef; /* placeholder gris si image lente à charger */
  transition: transform .18s ease, box-shadow .18s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
  position: relative;
  z-index: 1;
}

/* Anneau de sélection — cercle extérieur */
.cis-swatch__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: border-color .18s ease;
  z-index: 2;
  pointer-events: none;
}

/* ── Hover ───────────────────────────────────────────────────────────────── */
.cis-swatch:hover:not(.is-disabled) .cis-swatch__inner {
  transform: scale(1.1);
  box-shadow: 0 3px 10px rgba(0,0,0,.22);
}

/* ── Sélectionné ─────────────────────────────────────────────────────────── */
.cis-swatch.is-selected .cis-swatch__inner {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0,0,0,.28);
}

.cis-swatch.is-selected .cis-swatch__ring {
  border-color: #1a1a1a;
}

/* ── Désactivé / rupture de stock ────────────────────────────────────────── */
.cis-swatch.is-disabled {
  cursor: not-allowed;
}

.cis-swatch.is-disabled .cis-swatch__inner {
  opacity: .35;
}

/* Barre diagonale rouge sur les swatches indisponibles */
.cis-swatch.is-disabled .cis-swatch__inner::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    transparent 42%,
    rgba(210, 30, 30, .65) 42%,
    rgba(210, 30, 30, .65) 58%,
    transparent 58%
  );
}

/* ── Tooltip natif (title) — on s'appuie sur l'attribut HTML title ───────── */
/* Pas besoin de CSS custom, le navigateur l'affiche nativement. */

/* ── Label groupe avec nom de la valeur sélectionnée ────────────────────── */
.product-variants__label {
  display: flex;
  align-items: baseline;
  gap: .4rem;
  margin-bottom: .25rem;
}

.product-variants__label .label {
  font-weight: 600;
  font-size: .875rem;
}

.js-cis-selected-name {
  font-size: .875rem;
  color: #495057;
}

.js-cis-selected-name::before {
  content: ': ';
}

/* ── Boutons radio texte (tailles, etc.) ─────────────────────────────────── */
.cis-radio-list {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem;
  list-style: none;
  margin: .625rem 0 0;
  padding: 0;
}

.cis-radio-item label {
  display: inline-flex;
  align-items: center;
  padding: .3rem .75rem;
  border: 1.5px solid #ced4da;
  border-radius: 4px;
  font-size: .875rem;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.cis-radio-item input:checked + label {
  border-color: #1a1a1a;
  background: #1a1a1a;
  color: #fff;
}

.cis-radio-item.is-disabled label {
  opacity: .4;
  cursor: not-allowed;
  text-decoration: line-through;
}

/* ── Animation d'entrée ──────────────────────────────────────────────────── */
@keyframes cisSwatchIn {
  from { opacity: 0; transform: scale(.8); }
  to   { opacity: 1; transform: scale(1); }
}

.cis-swatches-list .cis-swatch {
  animation: cisSwatchIn .22s ease both;
}

.cis-swatches-list .cis-swatch:nth-child(1) { animation-delay: .03s; }
.cis-swatches-list .cis-swatch:nth-child(2) { animation-delay: .06s; }
.cis-swatches-list .cis-swatch:nth-child(3) { animation-delay: .09s; }
.cis-swatches-list .cis-swatch:nth-child(4) { animation-delay: .12s; }
.cis-swatches-list .cis-swatch:nth-child(5) { animation-delay: .15s; }
.cis-swatches-list .cis-swatch:nth-child(n+6) { animation-delay: .18s; }

/* ── Focus clavier accessible ────────────────────────────────────────────── */
.cis-swatch:focus-visible .cis-swatch__ring {
  border-color: #005fcc;
  outline: 2px solid #005fcc;
  outline-offset: 2px;
}

/* ==========================================================================
   Hummingbird — intégration swatches image dans les classes natives
   ========================================================================== */

/* Swatch image : même taille que le .color natif d'Hummingbird */
.input-color__input,
.cis-swatch-label .cis-swatch {
  display: block;
  width: var(--cis-swatch-size, 3rem);
  height: var(--cis-swatch-size, 3rem);
  border-radius: 50%;
  border: 2px solid transparent;
  outline: 2px solid transparent;
  outline-offset: 2px;
  background-size: cover;
  background-position: center;
  transition: outline-color .15s ease, transform .15s ease;
  cursor: pointer;
}

/* Sélectionné */
.input-color__label--active .cis-swatch,
.input-color__input:checked ~ .cis-swatch-label .cis-swatch {
  outline-color: #1a1a1a;
  transform: scale(1.08);
}

/* Hover */
.cis-swatch-label:hover .cis-swatch {
  outline-color: #888;
  transform: scale(1.05);
}
