/* ==========================================================
   Colegio Beaumont — Dinamismo del landing
   Patrones inspirados en 21st.dev (Text Cycle, Spotlight,
   Tilt Card, Count Up, Marquee) reimplementados sin React.
   ========================================================== */

/* Barra de progreso de lectura */
.progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 120; pointer-events: none;
  background: linear-gradient(90deg, var(--gold), var(--red)); transform-origin: 0 50%; transform: scaleX(0);
}

/* ---------- Hero ---------- */
/* Rejilla de puntos con ondas (Sonar Grid) sobre la foto */
.hero__sonar { position: absolute; inset: 0; }
/* Versión sobria (decisión 006): altura contenida, foto con color natural y velo azul solo a la izquierda */
.hero { min-height: min(calc(100vh - 120px), 720px); }
.hero__bg img { animation: none; filter: saturate(.85); }
.hero::before { background: linear-gradient(90deg, rgba(10,28,64,.82) 0%, rgba(10,28,64,.6) 35%, rgba(10,28,64,.15) 62%, transparent 80%); }
.hero h1, .hero p, .hero__tag { text-shadow: 0 1px 3px rgba(0,0,0,.35); }
.hero p { color: #fff; font-weight: 500; }
.hero__tag { background: rgba(10,28,64,.55); }
.hero .container { position: relative; }
/* Escudo más pequeño, solo con sombra */
.hero__crest { width: min(230px, 18vw); filter: drop-shadow(0 18px 28px rgba(0,0,0,.4)); }
.hero__sonar { opacity: .5; }
.hero__spot { display: none; }

/* Entrada escalonada */
.hero .container > * { animation: heroIn .9s cubic-bezier(.2,.7,.2,1) both; }
.hero .container > :nth-child(2) { animation-delay: .12s; }
.hero .container > :nth-child(3) { animation-delay: .24s; }
.hero .container > :nth-child(4) { animation-delay: .36s; }
@keyframes heroIn { from { opacity: 0; transform: translateY(28px); filter: blur(6px); } }

/* Frase rotativa (Text Cycle): todas las frases ocupan la misma celda para no mover el layout */
.cycle { display: inline-grid; vertical-align: top; }
.cycle > span { grid-area: 1 / 1; }
.cycle .w { display: inline-block; white-space: nowrap; }
.cycle .ch {
  display: inline-block; opacity: 0; transform: translateY(.45em); filter: blur(8px);
  transition: opacity .45s ease, transform .55s cubic-bezier(.2,.7,.2,1), filter .45s ease;
  transition-delay: calc(var(--i) * 22ms);
}
.cycle .on .ch { opacity: 1; transform: none; filter: none; }
.cycle .out .ch { opacity: 0; transform: translateY(-.45em); filter: blur(8px); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Indicador de scroll */
.hero__scroll {
  position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); width: 26px; height: 42px;
  border: 2px solid rgba(255,255,255,.5); border-radius: 14px;
}
.hero__scroll::after {
  content: ""; position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px;
  border-radius: 2px; background: var(--gold); animation: wheel 1.8s ease-in-out infinite;
}
@keyframes wheel { 0% { opacity: 0; transform: translateY(-4px); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }

/* ---------- Botones: brillo + efecto magnético ---------- */
.btn--red, .btn--white { position: relative; overflow: hidden; }
.btn--red::after, .btn--white::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.45), transparent);
  transform: skewX(-20deg); transition: left .7s ease;
}
.btn--white::after { background: linear-gradient(100deg, transparent, rgba(217,30,38,.15), transparent); }
.btn--red:hover::after, .btn--white:hover::after { left: 130%; }
[data-magnetic] { transition: transform .25s cubic-bezier(.2,.7,.2,1), background .25s, color .25s, box-shadow .25s; }

/* ---------- Stats ---------- */
.stats__grid.in .stat__icon { animation: pop .6s cubic-bezier(.3,1.6,.5,1) both; }
.stats__grid.in .stat:nth-child(2) .stat__icon { animation-delay: .1s; }
.stats__grid.in .stat:nth-child(3) .stat__icon { animation-delay: .2s; }
.stats__grid.in .stat:nth-child(4) .stat__icon { animation-delay: .3s; }
@keyframes pop { from { transform: scale(.3) rotate(-25deg); opacity: 0; } }
.stat { transition: background .3s; }
.stat:hover { background: var(--cream); }
.stat__icon { transition: transform .3s; }
.stat:hover .stat__icon { transform: rotate(-8deg) scale(1.08); }

/* ---------- Marquee de valores ---------- */
.marquee {
  --gap: 48px; padding: 40px 0 0; overflow: hidden; display: flex; gap: var(--gap);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee__track {
  flex: none; display: flex; align-items: center; gap: var(--gap); min-width: 100%; justify-content: space-around;
  animation: marquee 40s linear infinite;
}
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__track span {
  font-family: var(--font-head); font-size: clamp(1.4rem, 2.6vw, 2.1rem); font-weight: 600;
  color: var(--navy); white-space: nowrap;
}
.marquee__track span:nth-of-type(even) { font-style: italic; color: transparent; -webkit-text-stroke: 1.2px var(--blue); }
.marquee__track i { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.marquee__track i:nth-of-type(3n+2) { background: var(--gold); }
.marquee__track i:nth-of-type(3n) { background: var(--blue); }
@keyframes marquee { to { transform: translateX(calc(-100% - var(--gap))); } }

/* ---------- Tarjetas con tilt 3D + spotlight ---------- */
[data-tilt] { will-change: transform; }
[data-tilt]::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0;
  transition: opacity .3s; z-index: 2;
  background: radial-gradient(380px circle at var(--sx, 50%) var(--sy, 50%), rgba(255,255,255,.28), transparent 55%);
}
[data-tilt]:hover::after { opacity: 1; }
.pillar { position: relative; overflow: hidden; }
.pillar[data-tilt]::after { background: radial-gradient(300px circle at var(--sx, 50%) var(--sy, 50%), rgba(227,179,65,.22), transparent 60%); }
.pillar__icon { transition: transform .4s cubic-bezier(.3,1.6,.5,1); }
.pillar:hover .pillar__icon { transform: translateY(-4px) rotate(-6deg); }

/* ---------- Quiénes somos: parallax del collage ---------- */
.collage img { transition: transform .2s linear; }
.collage__badge { animation: bob 5s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px); } }

/* ---------- Galería: entrada escalonada ---------- */
.gallery figure { opacity: 0; transform: scale(.94); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1); }
.gallery.in figure { opacity: 1; transform: none; }
.gallery.in figure:nth-child(2) { transition-delay: .08s; }
.gallery.in figure:nth-child(3) { transition-delay: .16s; }
.gallery.in figure:nth-child(4) { transition-delay: .24s; }
.gallery.in figure:nth-child(5) { transition-delay: .32s; }
.gallery.in figure:nth-child(6) { transition-delay: .4s; }
.gallery figcaption { transition: padding .35s; }
.gallery figure:hover figcaption { padding-bottom: 22px; }

/* ---------- Servicios: subrayado animado ---------- */
.service { position: relative; overflow: hidden; transition: transform .3s, box-shadow .3s; }
.service::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--red);
  transform: scaleX(0); transform-origin: left; transition: transform .4s ease;
}
.service:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.service:hover::after { transform: scaleX(1); }

/* ---------- CTA: formas en movimiento ---------- */
.cta::before {
  content: ""; position: absolute; left: -120px; bottom: -160px; width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(227,179,65,.35), transparent 65%);
  animation: drift 12s ease-in-out infinite alternate;
}
.cta::after { animation: breathe 7s ease-in-out infinite; }
@keyframes drift { to { transform: translate(140px, -60px) scale(1.15); } }
@keyframes breathe { 50% { transform: scale(1.18); opacity: .6; } }
.cta > div:first-child { position: relative; z-index: 1; }

@media (max-width: 880px) { .hero__scroll { display: none; } .hero::before { background: rgba(10,28,64,.6); } }
@media (prefers-reduced-motion: reduce) {
  .cycle .ch, .gallery figure { opacity: 1; transform: none; filter: none; }
  .progress { display: none; }
}
