/* Discover — carrousel coverflow 3D.

   Isolé de discover-page.css : c'est la zone la plus risquée du portage hors
   React, et la seule qui manipule une scène 3D.

   ── Le principe ──────────────────────────────────────────────────────────
   Les 7 valeurs qui placent une carte (translateX, translateZ, rotateY, scale,
   opacity, largeur, z-index) ne dépendent QUE de sa position dans la fenêtre
   (-2…+2) et du breakpoint — jamais de la donnée. Elles sont donc figées ici en
   5 règles `[data-off]`, et le JS n'écrit qu'un seul attribut par cran.

   ── Déviation assumée ────────────────────────────────────────────────────
   L'implémentation React clait ses cartes par `id + "-" + off` : les 5 nœuds
   étaient démontés/remontés à chaque cran, si bien que la `transition` déclarée
   ne s'exécutait JAMAIS — le carrousel sautait. Le portage recycle les nœuds,
   ce qui rend l'animation réelle : c'est l'intention manifeste du CSS d'origine.
   Pour revenir au comportement précédent, retirer la ligne `transition` de
   `.zd-cf-slot`. */

/* ─── La scène ──────────────────────────────────────────────────────── */

.zd-cf-scene {
  position: relative;
  height: 560px;
  width: 100%;
  max-width: 100%;
  perspective: 1600px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: grab;
  user-select: none;
}
.zd-cf-scene:focus-visible {
  outline: 2px solid rgba(167, 139, 245, 0.8);
  outline-offset: -4px;
}
/* Pendant un glissement, le curseur doit suivre le geste. */
.zd-cf-scene.is-dragging {
  cursor: grabbing;
}

/* Halo violet diffus derrière les cartes. */
.zd-cf-glow {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.4) 0%, transparent 65%);
  filter: blur(60px);
  pointer-events: none;
}

/* ─── Les 5 emplacements ────────────────────────────────────────────── */

.zd-cf-slot {
  position: absolute;
  left: 50%;
  transform-origin: center center;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s;
}

/* Le slot qui boucle d'un bord à l'autre de la fenêtre est repositionné sans
   animation, le temps d'une frame : sans cela il traverserait toute la scène. */
.zd-cf-slot.is-teleporting {
  transition: none;
}

.zd-cf-slot[data-off="0"] {
  width: 320px;
  margin-left: -160px;
  transform: translateX(0) translateZ(0) rotateY(0deg) scale(1);
  opacity: 1;
  z-index: 10;
}
.zd-cf-slot[data-off="-1"] {
  width: 280px;
  margin-left: -140px;
  transform: translateX(-230px) translateZ(-240px) rotateY(32deg) scale(0.78);
  opacity: 0.78;
  z-index: 9;
}
.zd-cf-slot[data-off="1"] {
  width: 280px;
  margin-left: -140px;
  transform: translateX(230px) translateZ(-240px) rotateY(-32deg) scale(0.78);
  opacity: 0.78;
  z-index: 9;
}
.zd-cf-slot[data-off="-2"] {
  width: 280px;
  margin-left: -140px;
  transform: translateX(-360px) translateZ(-300px) rotateY(64deg) scale(0.6);
  opacity: 0.45;
  z-index: 8;
}
.zd-cf-slot[data-off="2"] {
  width: 280px;
  margin-left: -140px;
  transform: translateX(360px) translateZ(-300px) rotateY(-64deg) scale(0.6);
  opacity: 0.45;
  z-index: 8;
}

/* ─── La carte ──────────────────────────────────────────────────────── */

.zd-cf-card-shell {
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.zd-cf-cover {
  height: 200px;
  background: var(--zd-grad, #1c1635);
  position: relative;
  overflow: hidden;
}
.zd-cf-slot[data-off="0"] .zd-cf-cover {
  height: 260px;
}
.zd-cf-cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Repli en initiales géantes : toujours dans le flux, révélé quand l'image
   manque ou échoue (classe posée par un listener `error` en capture). */
.zd-cf-initials {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}
.zd-cf-cover.has-image .zd-cf-initials {
  opacity: 0;
}
.zd-cf-cover.has-image.is-failed .zd-cf-initials {
  opacity: 0.85;
}
.zd-cf-cover.is-failed .zd-cf-cover-img {
  display: none;
}
.zd-cf-initials span {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 900;
  font-size: 130px;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: -6px;
  filter: blur(0.4px);
  text-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  line-height: 1;
}
.zd-cf-slot[data-off="0"] .zd-cf-initials span {
  font-size: 170px;
}

/* Bandeau haut : pastille de présence (optionnelle) + badge d'univers. */
.zd-cf-toprow {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
}
.zd-cf-toprow.has-presence {
  justify-content: space-between;
}

.zd-badge-presence {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 100px;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  font-family: "DM Sans", sans-serif;
  font-weight: 600;
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.zd-badge-presence.is-online {
  color: #86efac;
}
.zd-badge-presence-dot {
  width: 6px;
  height: 6px;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.5);
}
.zd-badge-presence.is-online .zd-badge-presence-dot {
  background: #22c55e;
}

/* La couleur d'univers est pilotée par la donnée : seule valeur restée inline. */
.zd-badge-univ {
  padding: 5px 10px;
  border-radius: 100px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  white-space: nowrap;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 10px;
  color: var(--zd-univ, #a78bf5);
  border: 1px solid var(--zd-univ-soft, rgba(167, 139, 245, 0.33));
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.zd-badge-drop {
  position: absolute;
  bottom: 14px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 10px;
  white-space: nowrap;
  background: rgba(249, 115, 22, 0.95);
  box-shadow: 0 6px 18px rgba(249, 115, 22, 0.4);
}
.zd-badge-drop span {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 800;
  font-size: 10.5px;
  color: #fff;
  letter-spacing: 0.3px;
}

/* Corps de la carte. */
.zd-cf-body {
  padding: 18px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #1c1635;
  flex: 1;
}
.zd-cf-slot[data-off="0"] .zd-cf-body {
  padding: 22px 22px 24px;
  gap: 14px;
}

.zd-cf-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 800;
  font-size: 19px;
  color: #fff;
  letter-spacing: -0.6px;
  line-height: 1.1;
}
.zd-cf-slot[data-off="0"] .zd-cf-name {
  font-size: 24px;
}
.zd-cf-name-inner {
  display: inline-flex;
  align-items: center;
}
.zd-cf-host {
  font-family: "DM Sans", sans-serif;
  font-weight: 500;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 3px;
}
.zd-cf-slot[data-off="0"] .zd-cf-host {
  font-size: 13.5px;
}

.zd-cf-reach {
  display: flex;
  align-items: center;
  gap: 10px;
}
.zd-cf-reach-value {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 800;
  font-size: 17px;
  color: #fff;
}
.zd-cf-slot[data-off="0"] .zd-cf-reach-value {
  font-size: 20px;
}
.zd-cf-reach-label {
  font-family: "DM Sans", sans-serif;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.5);
}

.zd-cf-faces {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.zd-cf-cta {
  margin-top: 6px;
  padding: 13px 18px;
  border-radius: 12px;
  background: #6d28d9;
  border: none;
  cursor: pointer;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(109, 40, 217, 0.45);
  transition: transform 0.15s, box-shadow 0.15s;
}
/* Le survol était écrit à la main en JS (`e.currentTarget.style…`) ; en CSS on
   gagne `:focus-visible` au passage. */
.zd-cf-cta:hover,
.zd-cf-cta:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(109, 40, 217, 0.55);
}

/* ─── Flèches et pastilles ──────────────────────────────────────────── */

.zd-cf-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  transition: background 0.15s, transform 0.15s;
}
.zd-cf-nav:hover,
.zd-cf-nav:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(-50%) scale(1.05);
}
.zd-cf-nav--prev {
  left: 24px;
}
.zd-cf-nav--next {
  right: 24px;
}

.zd-cf-dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: min(96vw, 520px);
  z-index: 30;
}
.zd-cf-dot {
  width: 7px;
  height: 7px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  padding: 0;
  background: rgba(255, 255, 255, 0.3);
  transition: all 0.25s;
}
.zd-cf-dot.is-active {
  width: 22px;
  background: #fff;
}
.zd-cf-dot:focus-visible {
  outline: 2px solid rgba(167, 139, 245, 0.9);
  outline-offset: 2px;
}

/* Annonce du cran courant pour les lecteurs d'écran (visuellement masquée). */
.zd-cf-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ─── Mobile ────────────────────────────────────────────────────────── */
/* ⚠️ Le hook React comparait `innerWidth <= 768` : la borne est 768, pas 767. */

@media (max-width: 768px) {
  .zd-cf-scene {
    height: 420px;
  }
  .zd-cf-glow {
    width: min(600px, 180vw);
    height: min(600px, 180vw);
  }
  .zd-cf-slot[data-off="0"] {
    width: 240px;
    margin-left: -120px;
  }
  .zd-cf-slot[data-off="-1"],
  .zd-cf-slot[data-off="1"],
  .zd-cf-slot[data-off="-2"],
  .zd-cf-slot[data-off="2"] {
    width: 200px;
    margin-left: -100px;
  }
  .zd-cf-slot[data-off="-1"] {
    transform: translateX(-160px) translateZ(-240px) rotateY(32deg) scale(0.78);
  }
  .zd-cf-slot[data-off="1"] {
    transform: translateX(160px) translateZ(-240px) rotateY(-32deg) scale(0.78);
  }
  .zd-cf-slot[data-off="-2"] {
    transform: translateX(-240px) translateZ(-300px) rotateY(64deg) scale(0.6);
  }
  .zd-cf-slot[data-off="2"] {
    transform: translateX(240px) translateZ(-300px) rotateY(-64deg) scale(0.6);
  }
  .zd-cf-cover {
    height: 140px;
  }
  .zd-cf-slot[data-off="0"] .zd-cf-cover {
    height: 180px;
  }
  .zd-cf-initials span {
    font-size: 80px;
  }
  .zd-cf-slot[data-off="0"] .zd-cf-initials span {
    font-size: 110px;
  }
  /* Les flèches ne sont pas rendues sous 768px (parité avec `!isMobile`). */
  .zd-cf-nav {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .zd-cf-slot {
    transition: none;
  }
}
