/* ==========================================================================
   intro.css
   Animación de entrada del INICIO ("La huella"): pantalla azul marino con
   círculos concéntricos que se expanden (el patrón de las franjas), el logo
   que se revela y, justo debajo, el nombre completo del instituto. Después la cortina sube y la portada se asienta.
   Se reproduce UNA VEZ por visita. Para apagarla: <html data-intro="off">.
   Comportamiento: js/intro.js · Decisión de mostrarla: script en el <head> de index.html.
   Todo depende de la clase html.intro-on; sin ella (o sin JavaScript) no se ve nada.
   Cronología (s):  0 anillos · .3 logo · 1.1 nombre · 2.6 sale la cortina
   ========================================================================== */

/* El panel nunca se muestra salvo que el script del <head> active .intro-on */
#intro {
  display: none;
}
.intro-on #intro {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 46%, var(--c-ink) 0%, var(--c-navy) 55%, var(--c-noche-2) 100%);
  color: #fff;
  cursor: pointer;
  transition: transform 1.05s cubic-bezier(.76, 0, .24, 1);
  /* Seguro: si el JavaScript fallara, el panel se oculta solo a los 6 s */
  animation: intro-failsafe .01s 6s forwards;
}
.intro-on body {
  overflow: hidden;
  animation: intro-unlock .01s 6s forwards;
}
@keyframes intro-failsafe {
  to {
    visibility: hidden;
    opacity: 0;
  }
}
@keyframes intro-unlock {
  to {
    overflow: visible;
  }
}

/* Salida: la cortina sube y deja ver la portada */
.intro-on.intro-lift #intro {
  transform: translateY(-100%);
}

/* Borde luminoso en la parte baja de la cortina mientras sube (degradado oficial) */
#intro::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--c-ink), var(--c-blue), var(--c-cyan), var(--c-blue), var(--c-ink));
  opacity: 0;
  transition: opacity .3s;
}
.intro-lift #intro::after {
  opacity: 1;
}

/* ---------- Círculos concéntricos (patrón de marca) ---------- */
.intro-rings {
  position: absolute;
  left: 50%;
  top: 46%;
  width: max(150vmax, 1100px);
  height: max(150vmax, 1100px);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.intro-rings circle {
  fill: none;
  stroke: rgba(255, 255, 255, .13);
  stroke-width: 1.6;
  transform-origin: 500px 500px;
  opacity: 0;
  animation: intro-ring 1.5s cubic-bezier(.2, .7, .2, 1) forwards, intro-breathe 4s ease-in-out 1.5s infinite alternate;
}
.intro-rings circle:nth-child(1) { animation-delay: .00s, 1.5s; }
.intro-rings circle:nth-child(2) { animation-delay: .10s, 1.6s; }
.intro-rings circle:nth-child(3) { animation-delay: .20s, 1.7s; }
.intro-rings circle:nth-child(4) { animation-delay: .30s, 1.8s; }
.intro-rings circle:nth-child(5) { animation-delay: .40s, 1.9s; }
.intro-rings circle:nth-child(6) { animation-delay: .50s, 2.0s; }
.intro-rings circle:nth-child(7) { animation-delay: .60s, 2.1s; }
.intro-rings circle:nth-child(8) { animation-delay: .70s, 2.2s; }
/* Los anillos del centro son más brillantes (turquesa) */
.intro-rings circle:nth-child(-n+3) {
  stroke: rgb(var(--c-cyan-rgb) / .28);
}
@keyframes intro-ring {
  from {
    opacity: 0;
    transform: scale(.25);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes intro-breathe {
  to {
    transform: scale(1.035);
  }
}

/* Resplandor turquesa detrás del logo */
.intro-core::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 150%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgb(var(--c-blue-rgb) / .38), transparent 62%);
  opacity: 0;
  animation: intro-fade 1.6s .2s forwards;
  pointer-events: none;
}

/* ---------- Logo y nombre ---------- */
.intro-core {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(80vw, 24rem);
  text-align: center;
}
.intro-logo {
  position: relative;
  width: 100%;
  height: auto;
  /* El logo se revela de izquierda a derecha, como una cortina */
  clip-path: inset(0 100% 0 0);
  transform: scale(.94);
  animation: intro-logo 1.05s cubic-bezier(.7, 0, .2, 1) .3s forwards;
}
@keyframes intro-logo {
  to {
    clip-path: inset(0 0 0 0);
    transform: scale(1);
  }
}

.intro-name {
  /* Pegado al logo: forma un solo bloque con él */
  margin-top: .55rem;
  font: 500 clamp(.72rem, 1.6vw, .9rem) var(--font);
  letter-spacing: .32em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .85);
  opacity: 0;
  transform: translateY(8px);
  animation: intro-up .8s 1.1s forwards;
}
.intro-skip {
  position: absolute;
  bottom: max(1.6rem, env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  text-align: center;
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .5);
  opacity: 0;
  animation: intro-fade .6s 1s forwards;
}
@keyframes intro-fade {
  to {
    opacity: 1;
  }
}
@keyframes intro-up {
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- La portada espera la cortina y luego entra ----------
   Mientras la animación está en pantalla, el texto del slider y la foto quedan en su estado inicial;
   al subir la cortina (.intro-lift) se sueltan y reproducen su entrada normal. */
.intro-on:not(.intro-lift) .slide.active .copy > * {
  opacity: 0;
  transform: translateY(22px);
  transition: none;
}
.slide img {
  transition: transform 2.8s cubic-bezier(.2, .7, .2, 1);
}
.intro-on:not(.intro-lift) .slide.active img {
  transform: scale(1.1);
  transition: none;
}
.nav {
  transition-property: background, box-shadow, padding, transform;
}
.intro-on:not(.intro-lift) .nav {
  transform: translateY(-100%);
}
.intro-on.intro-lift .nav {
  transition-duration: .9s;
  transition-delay: .35s;
}

/* Pantallas pequeñas: el logo un poco más grande respecto al ancho */
@media (max-width: 480px) {
  .intro-core {
    width: 74vw;
  }
}
