/* calling-card.css v2 — Animation demande d'ami style Persona 5 */

#cc-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#cc-overlay.cc--visible {
  pointer-events: auto;
}

.cc-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.2s ease 0.22s;
}

#cc-overlay.cc--visible .cc-backdrop {
  background: rgba(0, 0, 0, 0.82);
}

/* ── Scène 3D ─────────────────────────────────────────── */
.cc-scene {
  perspective: 1400px;
  z-index: 2;
  position: relative;
}

/* ── Carte principale ─────────────────────────────────── */
.cc-card {
  width: 280px;
  height: 400px;
  position: relative;
  transform-style: preserve-3d;
  animation: ccSlideIn 0.26s cubic-bezier(0.08, 0, 0.32, 0) forwards;
  will-change: transform;
}

.cc-card.cc-card--flip {
  animation:
    ccSlideIn 0.38s cubic-bezier(0.08, 0, 0.32, 0) forwards,
    ccThump 0.18s ease-out 0.38s forwards,
    ccFlip 0.65s cubic-bezier(0.45, 0, 0.55, 1) 1.1s forwards;
}

.cc-card-front,
.cc-card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 14px;
  overflow: hidden;
}

.cc-card-front {
  transform: rotateY(0deg);
}
.cc-card-back {
  transform: rotateY(180deg);
}

.cc-card-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cc-card-back {
  background: #0a0a0a;
  border: 2.5px solid #e63946;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 28px 24px;
  text-align: center;
}

/* ── Anneaux d'impact — HORS du contexte 3D de la carte ──
   Positionnés en fixed, centrés sur le viewport (là où la carte arrive)
   Alternance rouge / noir, expansion rapide depuis 0
   ──────────────────────────────────────────────────────── */
.cc-rings {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 1; /* derrière .cc-scene (z-index 2) → anneaux sous la carte */
}

.cc-ring {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  animation: ccRing 0.7s ease-out forwards;
}

/* 6 anneaux alternant rouge/noir, tailles croissantes, délais échelonnés */
.cc-ring:nth-child(1) {
  width: 160px;
  height: 160px;
  border: 13px solid #e63946;
  animation-delay: 0.26s;
}
.cc-ring:nth-child(2) {
  width: 280px;
  height: 280px;
  border: 15px solid #0d0d0d;
  box-shadow: 0 0 0 5px #e63946;
  animation-delay: 0.32s;
}
.cc-ring:nth-child(3) {
  width: 420px;
  height: 420px;
  border: 13px solid #e63946;
  animation-delay: 0.38s;
}
.cc-ring:nth-child(4) {
  width: 580px;
  height: 580px;
  border: 14px solid #0d0d0d;
  box-shadow: 0 0 0 5px #e63946;
  animation-delay: 0.44s;
}
.cc-ring:nth-child(5) {
  width: 760px;
  height: 760px;
  border: 11px solid #e63946;
  animation-delay: 0.5s;
}
.cc-ring:nth-child(6) {
  width: 960px;
  height: 960px;
  border: 9px solid #0d0d0d;
  box-shadow: 0 0 0 4px #e63946;
  animation-delay: 0.56s;
}

@keyframes ccRing {
  0% {
    transform: translate(-50%, -50%) scale(0.04);
    opacity: 1;
  }
  55% {
    opacity: 0.85;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
  }
}

/* ── Flash rouge à l'impact ───────────────────────────── */
.cc-flash {
  position: fixed;
  inset: 0;
  background: #e63946;
  pointer-events: none;
  z-index: 9997;
  opacity: 0;
  animation: ccFlash 0.24s ease-out 0.25s forwards;
}

@keyframes ccFlash {
  0% {
    opacity: 0.6;
  }
  100% {
    opacity: 0;
  }
}

/* ── Avatar ami au verso de la carte ─────────────────── */
.cc-friend-avatar {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  object-fit: contain;
  background: #111;
  border: 2.5px solid #e63946;
  box-shadow: 0 0 14px rgba(230, 57, 70, 0.5);
  flex-shrink: 0;
}

/* ── Texte verso de la carte ─────────────────────────── */
.cc-pseudo {
  font-family: "Persona5", "Oswald", "Arial Black", Arial, sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: #e63946;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0;
  line-height: 1.2;
  word-break: break-word;
  max-width: 210px;
}

.cc-message {
  font-size: 0.88rem;
  color: #f0f0f0;
  margin: 0;
  line-height: 1.5;
}

.cc-sub {
  font-size: 0.72rem;
  color: #888;
  margin: 0;
  font-style: italic;
}

.cc-buttons {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.cc-btn {
  padding: 9px 22px;
  border: none;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: "Persona5", "Oswald", Arial, sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    transform 0.1s,
    background 0.15s;
}
.cc-btn:active {
  transform: scale(0.95);
}

.cc-btn--yes {
  background: #e63946;
  color: #fff;
}
.cc-btn--yes:hover {
  background: #c1121f;
}

.cc-btn--no {
  background: #2a2a2a;
  color: #999;
  border: 1px solid #444;
}
.cc-btn--no:hover {
  background: #3a3a3a;
  color: #fff;
}

/* ── Bouton fermer ────────────────────────────────────── */
.cc-close {
  position: fixed;
  top: 18px;
  right: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  z-index: 10001;
  transition: background 0.15s;
  pointer-events: auto;
  opacity: 0;
  animation: ccFadeIn 0.2s ease 0.55s forwards;
}
.cc-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ── Keyframes principaux ─────────────────────────────── */

/* Slide horizontal brutal depuis la droite */
@keyframes ccSlideIn {
  0% {
    transform: translateX(115vw);
  }
  82% {
    transform: translateX(-16px);
  }
  100% {
    transform: translateX(0);
  }
}

/* Micro-rebond à l'impact */
@keyframes ccThump {
  0% {
    transform: translateX(0) scale(1);
  }
  45% {
    transform: translateX(0) scale(1.05);
  }
  100% {
    transform: translateX(0) scale(1);
  }
}

/* Retournement 3D horizontal */
@keyframes ccFlip {
  from {
    transform: rotateY(0deg);
  }
  to {
    transform: rotateY(180deg);
  }
}

@keyframes ccFadeIn {
  to {
    opacity: 1;
  }
}
