/* =========================================================================
 * Tap'Animaux — Exploration sonore pour les 2-4 ans
 *
 * Principes :
 *  - Grille géante 2x4 (8 animaux) — boutons énormes
 *  - Animations expressives au tap (wiggle, scale)
 *  - speechSynthesis pour le son (pas d'asset à charger)
 *  - Couleurs vives variées par animal
 * ========================================================================= */

* { -webkit-tap-highlight-color: transparent; }

.animaux-body {
  background: linear-gradient(180deg, #fef3c7 0%, #fde68a 50%, #fed7aa 100%);
  min-height: 100dvh;
  margin: 0;
  font-family: 'Baloo 2', 'Comic Sans MS', system-ui, sans-serif;
  overflow-x: hidden;
}

.animaux-main {
  /* Sprint UX.PATCH-2 : padding-top calé sur --ik-header-h pour eviter
     que l'emoji du haut soit tronqué par le header IrisKids fixe.
     padding-bottom safe-area pour barre URL Safari iOS. */
  padding: calc(var(--ik-header-h, 52px) + 16px) 14px max(32px, env(safe-area-inset-bottom, 32px));
  max-width: 720px;
  margin: 0 auto;
}

.animaux-hello {
  /* Sprint UX.PATCH-5 : compact pour laisser un max d'espace aux cartes */
  text-align: center;
  margin: 4px 0 8px;
  flex-shrink: 0;
}
.animaux-hello-emoji {
  font-size: clamp(2rem, 7vmin, 3rem);
  line-height: 1;
  animation: animaux-wiggle 1.6s ease-in-out infinite;
}
@keyframes animaux-wiggle {
  0%, 100% { transform: rotate(-6deg); }
  50%      { transform: rotate(6deg); }
}
.animaux-hello-title {
  font-size: clamp(1.1rem, 4vmin, 1.6rem);
  font-weight: 800;
  color: #92400e;
  margin: 4px 0 2px;
}
.animaux-hello-sub {
  font-size: clamp(0.8rem, 2.6vmin, 1rem);
  color: #78350f;
  margin: 0;
  opacity: 0.85;
}

.animaux-grid {
  /* Sprint UX.PATCH-5 : grid qui prend toute la place dispo dans le main
   * flex-column. Plus d'aspect-ratio 1/1 (forçait débordement et scroll
   * inaccessible aux bébés). 2×4 sur portrait, 4×2 sur paysage/desktop. */
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 14px;
  width: 100%;
  max-width: 600px;
  margin: 12px auto;
  flex: 1;
  min-height: 0;
}
@media (min-width: 520px) {
  .animaux-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
  }
}

.animaux-card {
  /* Plus d'aspect-ratio : la cellule grid dicte la taille, on remplit tout */
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 22px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.10);
  transition: transform 0.15s cubic-bezier(.34,1.56,.64,1);
  font-weight: 800;
}
.animaux-card:active { transform: scale(0.92); }

.animaux-card.bouncing { animation: animaux-bounce 0.6s ease-out; }
@keyframes animaux-bounce {
  0%   { transform: scale(1) rotate(0deg); }
  20%  { transform: scale(1.18) rotate(-8deg); }
  40%  { transform: scale(1.05) rotate(6deg); }
  60%  { transform: scale(1.12) rotate(-3deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.animaux-card-emoji {
  /* Sprint UX.PATCH-5 : emoji scalable avec viewport. */
  font-size: clamp(2.5rem, 14vmin, 6rem);
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}
.animaux-card-name {
  font-size: clamp(0.85rem, 3vmin, 1.4rem);
  letter-spacing: 0.02em;
}

/* Palettes vives par animal */
.animaux-card[data-color="0"] { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; }
.animaux-card[data-color="1"] { background: linear-gradient(135deg, #ddd6fe, #c4b5fd); color: #5b21b6; }
.animaux-card[data-color="2"] { background: linear-gradient(135deg, #fbcfe8, #f9a8d4); color: #9d174d; }
.animaux-card[data-color="3"] { background: linear-gradient(135deg, #bfdbfe, #93c5fd); color: #1e40af; }
.animaux-card[data-color="4"] { background: linear-gradient(135deg, #d9f99d, #bef264); color: #3f6212; }
.animaux-card[data-color="5"] { background: linear-gradient(135deg, #fed7aa, #fdba74); color: #9a3412; }
.animaux-card[data-color="6"] { background: linear-gradient(135deg, #a7f3d0, #6ee7b7); color: #047857; }
.animaux-card[data-color="7"] { background: linear-gradient(135deg, #fecaca, #fca5a5); color: #991b1b; }

/* Animation "speaking" — petites ondes autour de la card */
.animaux-card.speaking::before {
  content: '🔊';
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 1.4rem;
  animation: animaux-speak-pulse 0.6s ease-out infinite;
}
@keyframes animaux-speak-pulse {
  0%   { opacity: 0; transform: scale(0.8); }
  50%  { opacity: 1; transform: scale(1.2); }
  100% { opacity: 0; transform: scale(1.4); }
}

.animaux-tip {
  /* Sprint UX.PATCH-5 : compact pour laisser place aux cartes */
  margin: 8px auto 0;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 12px;
  text-align: center;
  font-size: clamp(0.75rem, 2.4vmin, 0.9rem);
  color: #78350f;
  max-width: 380px;
  line-height: 1.3;
  flex-shrink: 0;
}
