/* ==========================================================================
   hero.css — Portada: isotipo + logotipo
   Los cuatro puntos caen y rebotan en su lugar (una sola vez). Después,
   main.js (heroShapes) cambia de figura un punto a la vez, al azar, entre 6
   figuras (círculo, cuadrado, triángulo, rombo, pentágono, hexágono); así
   siempre hay figuras libres y los 4 puntos se ven distintos. Aquí solo
   viven las figuras y la transición entre ellas.
   Entrada: la pantalla empieza en blanco, caen los puntos y luego aparece
   ALGOLOCAL poco a poco (sólido, sin más animación), abajo, justo arriba de
   "Desliza". La línea de "Desliza" baja con una gota que cambia de color.
   Caída y figuras usan propiedades distintas (translate / rotate, scale,
   border-radius, clip-path) para no pisarse.
   ========================================================================== */

.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
}

/* Isotipo de la portada: un poco más grande que el base */
.hero .dots {
  --dot-size: var(--hero-dot-size);
  --dot-gap: var(--hero-dot-gap);
}

/* Logotipo abajo, justo arriba de "Desliza" (los puntos quedan en el centro exacto) */
.hero__brand {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: var(--hero-brand-bottom);
}

/* Entrada: la pantalla empieza en blanco y caen los puntos. Cuando tocan
   piso, ALGOLOCAL aparece con un difuminado suave y lento (3 s), en negro.
   Después, la descripción con el mismo difuminado. */
.hero__brand .brand__name {
  animation: brand-in var(--brand-in-dur) var(--brand-in-start) ease-in-out both;
}

.hero__brand .brand__tagline {
  animation: brand-in var(--brand-in-dur) var(--tagline-in-start) ease-in-out both;
}

/* El botón "Menú" aparece con el mismo difuminado y al mismo tiempo que
   ALGOLOCAL (hero.css solo se carga en el inicio) */
.menu-toggle {
  /* "backwards": al terminar suelta la opacidad, para que el botón pueda
     desvanecerse al bajar la página (.is-away en menu.css) */
  animation: brand-in var(--brand-in-dur) var(--brand-in-start) ease-in-out backwards;
}

@keyframes brand-in {
  from { opacity: 0; }
  to { opacity: 1; }
}



/* --- Caída --- */
/* Todas las figuras usan 6 puntos en el mismo orden para que clip-path
   pueda transformarse suave de una a otra */
.dots--shapes .dots__dot {
  clip-path: polygon(0 0, 100% 0, 100% 50%, 100% 100%, 0 100%, 0 50%);
  transition:
    border-radius var(--shape-dur) var(--ease-out),
    clip-path var(--shape-dur) var(--ease-out),
    rotate var(--shape-dur) var(--ease-out),
    scale var(--shape-dur) var(--ease-out);
  animation: dot-fall var(--fall-dur) var(--fall-delay) both;
}

.dots--shapes .dots__dot:nth-child(1) { --fall-delay: 0s; }
.dots--shapes .dots__dot:nth-child(2) { --fall-delay: 0.15s; }
.dots--shapes .dots__dot:nth-child(4) { --fall-delay: 0.30s; }
.dots--shapes .dots__dot:nth-child(3) { --fall-delay: 0.45s; }

/* Cae desde arriba de la pantalla y da dos rebotes cortos */
@keyframes dot-fall {
  0%   { translate: 0 -55vh; opacity: 0; animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  10%  { opacity: 1; }
  55%  { translate: 0 0;      animation-timing-function: cubic-bezier(0, 0.55, 0.45, 1); }
  72%  { translate: 0 -12px;  animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  86%  { translate: 0 0;      animation-timing-function: cubic-bezier(0, 0.55, 0.45, 1); }
  93%  { translate: 0 -3px;   animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  100% { translate: 0 0;      opacity: 1; }
}

/* --- Figuras (las pone main.js con data-shape) --- */
.dots--shapes .dots__dot[data-shape="square"] {
  border-radius: 0;
  scale: 0.9;
}

.dots--shapes .dots__dot[data-shape="triangle"] {
  border-radius: 0;
  clip-path: polygon(50% 4%, 50% 4%, 75% 48%, 100% 92%, 0 92%, 25% 48%);
  scale: 1.1;
}

.dots--shapes .dots__dot[data-shape="diamond"] {
  border-radius: 0;
  rotate: 45deg;
  scale: 0.8;
}

.dots--shapes .dots__dot[data-shape="pentagon"] {
  border-radius: 0;
  clip-path: polygon(50% 2%, 50% 2%, 100% 38%, 81% 95%, 19% 95%, 0 38%);
  scale: 1.1;
}

.dots--shapes .dots__dot[data-shape="hexagon"] {
  border-radius: 0;
  clip-path: polygon(25% 7%, 75% 7%, 100% 50%, 75% 93%, 25% 93%, 0 50%);
  scale: 1.05;
}

/* --- Invitación a bajar --- */
.hero__cue {
  position: absolute;
  left: 50%;
  bottom: 28px;
  translate: -50% 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: var(--target-min);
  padding: 8px;
  font-size: var(--fs-label);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-muted);
  animation: cue-in 0.8s var(--cue-start) both;
}

.hero__cue-line {
  position: relative;
  width: 1px;
  height: 40px;
  overflow: hidden;
  background: var(--color-line);
}

.hero__cue-line::after {
  content: "";
  position: absolute;
  left: 0;
  top: -16px;
  width: 1px;
  height: 16px;
  background: var(--brand-red);
  animation:
    cue-drip var(--cue-drip) cubic-bezier(0.6, 0, 0.4, 1) infinite,
    cue-colors calc(var(--cue-drip) * 4) step-end infinite;
}

@keyframes cue-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Cada gota cambia de color: rojo → verde → azul → amarillo */
@keyframes cue-colors {
  0%   { background: var(--brand-red); }
  25%  { background: var(--brand-green); }
  50%  { background: var(--brand-blue); }
  75%  { background: var(--brand-yellow); }
}

@keyframes cue-drip {
  to { top: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .dots--shapes .dots__dot,
  .hero__brand .brand__name,
  .hero__brand .brand__tagline,
  .menu-toggle,
  .hero__cue,
  .hero__cue-line::after {
    animation: none;
  }
}
