/* =====================================================================
   EASTER EGGS - effets visuels
   ===================================================================== */

/* Apesanteur : les éléments flottent chacun à leur rythme.
   « translate » et « rotate » s'ajoutent aux transform existants sans les écraser. */
html.apesanteur :is(.projet-carte, .groupe, .contact, .puce, .avatar, .section-titre, .bouton, .badge-dispo) {
  animation: apesanteur 3.2s ease-in-out infinite;
}

html.apesanteur :is(.projet, .puce, .contact, .groupe):nth-child(2n) :is(.projet-carte),
html.apesanteur :is(.puce, .contact, .groupe):nth-child(2n) { animation-duration: 4.1s; animation-delay: -1.3s; }
html.apesanteur :is(.projet, .puce, .contact, .groupe):nth-child(3n) :is(.projet-carte),
html.apesanteur :is(.puce, .contact, .groupe):nth-child(3n) { animation-duration: 3.6s; animation-delay: -2.1s; animation-direction: reverse; }

@keyframes apesanteur {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  25% { translate: 6px -12px; rotate: 1.5deg; }
  50% { translate: -4px -20px; rotate: -1deg; }
  75% { translate: -8px -8px; rotate: 1deg; }
}

/* ---------- Miaou : la photo de profil se trémousse ---------- */
.avatar.miaou { animation: miaou 0.9s ease-in-out; }

@keyframes miaou {
  0%, 100% { rotate: 0deg; scale: 1; }
  15% { rotate: -14deg; scale: 1.12; }
  35% { rotate: 12deg; scale: 1.12; }
  55% { rotate: -8deg; scale: 1.06; }
  75% { rotate: 5deg; scale: 1.03; }
}

/* ---------- Retour aux sources : vieux terminal vert ---------- */
html.retro,
html.retro[data-theme="jour"] {
  --fond: #030803;
  --texte: #33ff66;
  --texte-doux: #22bb4a;
  --accent: #33ff66;
  --accent-2: #33ff66;
  --carte: rgba(0, 30, 8, 0.85);
  --carte-survol: rgba(0, 45, 12, 0.9);
  --bordure: rgba(51, 255, 102, 0.3);
  --bordure-forte: rgba(51, 255, 102, 0.6);
  --curseur: #33ff66;
  --police-titre: "Courier New", ui-monospace, monospace;
  --police-texte: "Courier New", ui-monospace, monospace;
  color-scheme: dark;
}

html.retro body { text-shadow: 0 0 6px rgba(51, 255, 102, 0.55); }
html.retro #ciel { opacity: 0; }
html.retro img { filter: grayscale(1) sepia(1) hue-rotate(70deg) saturate(3); }

/* Lignes de balayage d'un vieil écran cathodique */
html.retro body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 900;
  pointer-events: none;
  background: repeating-linear-gradient(transparent 0 2px, rgba(0, 0, 0, 0.3) 2px 3px);
}

/* ---------- Constellation libre : le champ de saisie ---------- */
.constellation { position: relative; }

.constellation-saisie {
  position: absolute;
  left: 50%; top: 50%;
  translate: -50% -50%;
  width: min(360px, 90%);
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--bordure-forte);
  background: color-mix(in srgb, var(--fond) 92%, transparent);
  color: var(--texte);
  font: 600 1.1rem var(--police-titre);
  text-align: center;
  box-shadow: var(--ombre);
  outline: none;
}

.constellation-saisie:focus { border-color: var(--accent); }

/* ---------- Explorateur fidèle : la médaille ---------- */
.medaille-fidele {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--bordure);
  background: var(--carte);
  font-size: 1.1rem;
  animation: medaille 3s ease-in-out infinite;
}

@keyframes medaille {
  0%, 100% { rotate: -8deg; }
  50% { rotate: 8deg; }
}

@media (max-width: 400px) {
  .medaille-fidele { width: 34px; height: 34px; }
}

/* ---------- Thème secret « Aurore boréale » (succès légendaire) ----------
   Vert aurore et bleu glacier à la place de la lavande. Le mode rétro reste prioritaire. */
html.aurore:not(.retro) {
  --accent: #7ee0b5;
  --accent-2: #9ab8ff;
  --bordure: rgba(126, 224, 181, 0.16);
  --bordure-forte: rgba(126, 224, 181, 0.38);
}

html.aurore[data-theme="jour"]:not(.retro) {
  --accent: #2b8a6b;
  --accent-2: #4f6fb8;
  --bordure: rgba(43, 138, 107, 0.2);
  --bordure-forte: rgba(43, 138, 107, 0.45);
}
