/* Tarjeta giratoria sobrepuesta en la portada (2026-12-01, a pedido del usuario) — ver evento-flotante.js.
   Esquina inferior derecha, a la izquierda de los botones flotantes (.fab-stack); a la izquierda de la página chocaba
   con el selector de vista y, más arriba, tapaba los puntos del carrusel. Queda por debajo de los modales y del aviso de cookies. Gira en 3D mostrando el afiche y su reverso con los datos; detrás
   rota un halo dorado. Con prefers-reduced-motion queda quieta, mostrando el afiche. */
.evento-flotante {
  --ef-ancho: 150px;
  --ef-dorado: #f5c451;
  --ef-dorado-osc: #b8860b;
  position: fixed; right: 6.25rem; bottom: 1.5rem; z-index: 190;
  width: var(--ef-ancho); aspect-ratio: 3 / 4;
  animation: ef-entrada 1.1s cubic-bezier(.2, .9, .25, 1.15) both;
}
.evento-flotante.is-saliendo { animation: ef-salida 0.45s ease-in forwards; }

.evento-flotante__enlace {
  position: relative; display: block; width: 100%; height: 100%;
  perspective: 900px; text-decoration: none; border-radius: 12px;
  animation: ef-flotar 4.5s ease-in-out 1.1s infinite;
}
.evento-flotante__enlace:focus-visible { outline: 3px solid var(--funprotec-orange); outline-offset: 6px; }

/* Halo dorado giratorio detrás de la tarjeta. */
.evento-flotante__halo {
  position: absolute; inset: -9px; border-radius: 18px; z-index: 0;
  background: conic-gradient(from 0deg, var(--ef-dorado), transparent 22%, var(--ef-dorado-osc) 40%,
    transparent 60%, #fff6d5 78%, var(--ef-dorado));
  filter: blur(6px); opacity: 0.9;
  animation: ef-halo 4s linear infinite;
}

.evento-flotante__giro {
  position: relative; z-index: 1; display: block; width: 100%; height: 100%;
  transform-style: preserve-3d;
  animation: ef-giro 9s ease-in-out 1.6s infinite;
}
.evento-flotante__enlace:hover .evento-flotante__giro,
.evento-flotante__enlace:focus-visible .evento-flotante__giro,
.evento-flotante__enlace:hover,
.evento-flotante__enlace:focus-visible,
.evento-flotante__enlace:hover .evento-flotante__halo { animation-play-state: paused; }

.evento-flotante__cara {
  position: absolute; inset: 0; border-radius: 12px; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: 2px solid var(--ef-dorado);
  box-shadow: 0 14px 30px rgba(5, 15, 35, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.evento-flotante__cara--frente img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* Destello que barre el afiche. */
.evento-flotante__cara--frente::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.55) 48%, transparent 60%);
  transform: translateX(-120%);
  animation: ef-brillo 4.5s ease-in-out 2s infinite;
}
.evento-flotante__cara--reverso {
  transform: rotateY(180deg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.3rem;
  padding: 0.6rem; text-align: center; color: #fff;
  background:
    radial-gradient(circle at 50% 0%, rgba(245, 196, 81, 0.45), transparent 60%),
    linear-gradient(160deg, #1b4a8a, #0a1e38);
}
.evento-flotante__icono { font-size: 2rem; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4)); }
.evento-flotante__titulo {
  font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: 1rem; line-height: 1.15;
  color: var(--ef-dorado); text-transform: uppercase; letter-spacing: 0.02em;
}
.evento-flotante__dato { font-size: 0.72rem; line-height: 1.25; }
.evento-flotante__dato:first-letter { text-transform: uppercase; }
.evento-flotante__ver { font-size: 0.72rem; font-weight: 700; text-decoration: underline; }

/* Cinta con la cuenta regresiva, colgada del borde superior. */
.evento-flotante__cinta {
  position: absolute; z-index: 2; top: -12px; left: 50%; transform: translateX(-50%);
  white-space: nowrap; padding: 0.2rem 0.65rem; border-radius: 999px;
  background: linear-gradient(90deg, var(--ef-dorado-osc), var(--ef-dorado), var(--ef-dorado-osc));
  color: #0a1e38; font-weight: 800; font-size: 0.72rem; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.evento-flotante__cerrar {
  position: absolute; z-index: 3; top: -14px; left: -14px;
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--ef-dorado);
  background: #0a1e38; color: #fff; font-size: 1.1rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}
.evento-flotante__cerrar:hover { background: #1b4a8a; }
.evento-flotante__cerrar:focus-visible { outline: 3px solid var(--funprotec-orange); outline-offset: 2px; }

/* Confeti que cae una sola vez al aparecer la tarjeta. */
.evento-flotante__confeti { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.evento-flotante__confeti i {
  position: absolute; top: -10px; width: 7px; height: 11px; border-radius: 2px; opacity: 0;
  background: var(--ef-dorado);
  animation: ef-confeti 1.8s ease-out 0.7s forwards;
}
.evento-flotante__confeti i:nth-child(3n) { background: #fff; }
.evento-flotante__confeti i:nth-child(3n+1) { background: #3b82f6; }
.evento-flotante__confeti i:nth-child(1)  { left: 4%;  --ef-x: -40px; --ef-r: 320deg; }
.evento-flotante__confeti i:nth-child(2)  { left: 14%; --ef-x: -18px; --ef-r: -260deg; animation-delay: .8s; }
.evento-flotante__confeti i:nth-child(3)  { left: 24%; --ef-x: -30px; --ef-r: 400deg; animation-delay: .75s; }
.evento-flotante__confeti i:nth-child(4)  { left: 33%; --ef-x: 10px;  --ef-r: -300deg; animation-delay: .9s; }
.evento-flotante__confeti i:nth-child(5)  { left: 42%; --ef-x: -12px; --ef-r: 280deg; }
.evento-flotante__confeti i:nth-child(6)  { left: 50%; --ef-x: 22px;  --ef-r: -360deg; animation-delay: .85s; }
.evento-flotante__confeti i:nth-child(7)  { left: 58%; --ef-x: -8px;  --ef-r: 340deg; animation-delay: .95s; }
.evento-flotante__confeti i:nth-child(8)  { left: 66%; --ef-x: 30px;  --ef-r: -280deg; }
.evento-flotante__confeti i:nth-child(9)  { left: 74%; --ef-x: 16px;  --ef-r: 420deg; animation-delay: .8s; }
.evento-flotante__confeti i:nth-child(10) { left: 82%; --ef-x: 38px;  --ef-r: -320deg; animation-delay: .9s; }
.evento-flotante__confeti i:nth-child(11) { left: 90%; --ef-x: 26px;  --ef-r: 300deg; animation-delay: .75s; }
.evento-flotante__confeti i:nth-child(12) { left: 96%; --ef-x: 48px;  --ef-r: -400deg; animation-delay: 1s; }

@keyframes ef-entrada {
  0%   { opacity: 0; transform: translateY(60px) rotate(-14deg) scale(0.6); }
  60%  { opacity: 1; transform: translateY(-8px) rotate(4deg) scale(1.04); }
  100% { opacity: 1; transform: none; }
}
@keyframes ef-salida { to { opacity: 0; transform: translateY(40px) scale(0.7) rotate(-8deg); } }
@keyframes ef-flotar { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes ef-halo { to { transform: rotate(360deg); } }
/* Afiche visible ~4 s, gira, reverso ~3 s, vuelve. */
@keyframes ef-giro {
  0%, 40%   { transform: rotateY(0deg); }
  50%, 83%  { transform: rotateY(180deg); }
  93%, 100% { transform: rotateY(360deg); }
}
@keyframes ef-brillo { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
@keyframes ef-confeti {
  0%   { opacity: 1; transform: translate(0, 0) rotate(0deg); }
  100% { opacity: 0; transform: translate(var(--ef-x), 220px) rotate(var(--ef-r)); }
}

@media (max-width: 699px) {
  .evento-flotante { --ef-ancho: 92px; right: 5.25rem; bottom: 1.1rem; }
  .evento-flotante__cerrar { top: -12px; left: -12px; width: 28px; height: 28px; }
  .evento-flotante__icono { font-size: 1.4rem; }
  .evento-flotante__titulo { font-size: 0.72rem; }
  .evento-flotante__dato { font-size: 0.6rem; }
  .evento-flotante__ver { display: none; } /* toda la tarjeta ya es el enlace */
  .evento-flotante__cinta { font-size: 0.62rem; }
  .evento-flotante__cara--reverso { gap: 0.15rem; padding: 0.35rem; }
}

/* Sin animaciones si el usuario lo pidió en su sistema: tarjeta quieta con el afiche. */
@media (prefers-reduced-motion: reduce) {
  .evento-flotante, .evento-flotante.is-saliendo, .evento-flotante__enlace, .evento-flotante__halo,
  .evento-flotante__giro, .evento-flotante__cara--frente::after, .evento-flotante__confeti i { animation: none; }
  .evento-flotante__confeti { display: none; }
}
/* La tarjeta no debe tapar el popup de noticias ni el formulario de preinscripción. */
body.modal-open .evento-flotante { display: none; }
