/* ═══════════════════════════════════════════════
   LOS FELPUDOS — hoja de estilos del misterio
   ═══════════════════════════════════════════════ */

:root {
  --negro: #050307;
  --negro-2: #0c060a;
  --sangre: #a30f0f;
  --sangre-viva: #ff2222;
  --hueso: #d8cfc0;
  --hueso-tenue: #8f867a;
  --morado: #9b4dff;
  --fuente-titulo: 'Pirata One', cursive;
  --fuente-cuerpo: 'IM Fell English', serif;
  --fuente-digital: 'VT323', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--negro);
  color: var(--hueso);
  font-family: var(--fuente-cuerpo);
  overflow-x: hidden;
  min-height: 100vh;
  cursor: crosshair;
}

/* viñeta + scanlines sobre TODO */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 50;
  background:
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(0,0,0,.12) 2px 4px),
    radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,.75) 100%);
}

.oculto { display: none !important; }

/* ═══════════ EL PORTAL ═══════════ */

#portal {
  position: fixed; inset: 0;
  z-index: 100;
  background: radial-gradient(ellipse at center, #12060a 0%, var(--negro) 70%);
  display: flex; align-items: center; justify-content: center;
  text-align: center;
}

.portal-inner { padding: 1rem; }

/* entrada escalonada: el ojo se abre, luego el texto, luego el botón */
.portal-inner > * { opacity: 0; }
#ojo           { animation: ojoAbre 2.2s cubic-bezier(.2, 1.4, .4, 1) .3s both; }
.portal-title  { animation: subeAparece 1.4s ease 1.6s both; }
.portal-sub    { animation: subeAparece 1.4s ease 2.2s both; }
#entrar        { animation: subeAparece 1.4s ease 2.9s both; }
.portal-warn   { animation: subeAparece 1.4s ease 3.5s both; }

@keyframes ojoAbre {
  0% { opacity: 0; transform: scale(.4); filter: blur(6px); }
  60% { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes subeAparece {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }

#ojo {
  width: min(260px, 60vw);
  filter: drop-shadow(0 0 24px rgba(163, 15, 15, .55));
}
#ojo .parpado { fill: none; stroke: var(--sangre); stroke-width: 3; animation: latidoParpado 3.2s ease-in-out infinite; }
#ojo .pupila { fill: #000; animation: pupila 6s ease-in-out infinite; }
#ojo .brillo { fill: rgba(255,255,255,.75); }
/* #ojo-movil lo mueve JS: el ojo sigue al cursor */

@keyframes latidoParpado {
  0%, 100% { stroke-width: 3; }
  50% { stroke-width: 4.5; }
}
@keyframes pupila {
  0%, 40%, 100% { ry: 26; }
  46%, 54% { ry: 2; }
  60% { ry: 26; }
}

.portal-title {
  font-family: var(--fuente-titulo);
  font-size: clamp(2rem, 7vw, 4rem);
  letter-spacing: .35em;
  margin-top: 1.4rem;
  color: var(--sangre-viva);
  text-shadow: 0 0 18px rgba(255, 34, 34, .5);
}
.portal-sub {
  font-style: italic;
  color: var(--hueso-tenue);
  margin-top: .6rem;
  letter-spacing: .12em;
}

#entrar {
  margin-top: 2.4rem;
  font-family: var(--fuente-titulo);
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  letter-spacing: .3em;
  padding: 1rem 2.4rem;
  background: transparent;
  color: var(--hueso);
  border: 1px solid var(--sangre);
  cursor: pointer;
  transition: all .35s ease;
  text-shadow: 0 0 8px rgba(0,0,0,.8);
}
#entrar:hover {
  background: var(--sangre);
  color: #fff;
  box-shadow: 0 0 32px rgba(255, 34, 34, .55), inset 0 0 18px rgba(0,0,0,.4);
  letter-spacing: .42em;
}

.portal-warn {
  margin-top: 1.6rem;
  font-size: .85rem;
  color: var(--hueso-tenue);
  letter-spacing: .1em;
}

/* transición de salida del portal: glitch violento */
#portal.portal-abierto { animation: salidaPortal .9s steps(12) forwards; pointer-events: none; }
@keyframes salidaPortal {
  0%   { opacity: 1; transform: none; filter: none; }
  15%  { transform: translate(-8px, 3px); filter: hue-rotate(90deg) contrast(3); }
  30%  { transform: translate(10px, -6px) scale(1.02); filter: invert(1); }
  45%  { transform: translate(-12px, 0); filter: hue-rotate(-120deg) saturate(8); }
  60%  { opacity: .8; transform: scale(1.06); filter: contrast(6) brightness(2); }
  80%  { opacity: .35; transform: scale(1.1); filter: blur(3px); }
  100% { opacity: 0; transform: scale(1.15); filter: blur(8px); }
}

/* ═══════════ EL SITIO ═══════════ */

#sitio { position: relative; animation: aparecer 1.8s ease both; }

/* niebla que respira detrás de todo */
.niebla {
  position: fixed;
  width: 130vmax; height: 130vmax;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  will-change: transform;
}
.niebla-a {
  top: -60vmax; left: -50vmax;
  background: radial-gradient(circle, rgba(163, 15, 15, .10) 0%, transparent 55%);
  animation: nieblaA 46s ease-in-out infinite alternate;
}
.niebla-b {
  bottom: -70vmax; right: -55vmax;
  background: radial-gradient(circle, rgba(120, 60, 200, .07) 0%, transparent 55%);
  animation: nieblaB 61s ease-in-out infinite alternate;
}
@keyframes nieblaA {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(14vmax, 9vmax) scale(1.25); }
}
@keyframes nieblaB {
  from { transform: translate(0, 0) scale(1.2); }
  to   { transform: translate(-12vmax, -8vmax) scale(.95); }
}

#cenizas {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 1;
}

.hero, .cuenta, .incognitas, footer {
  position: relative; z-index: 2;
  max-width: 900px;
  margin: 0 auto;
  padding: 4.5rem 1.5rem;
  text-align: center;
}

.hero { padding-top: 20vh; padding-bottom: 10vh; }

.hero-sub {
  margin-top: 1.8rem;
  color: var(--hueso-tenue);
  font-size: 1.25rem;
  font-style: italic;
  letter-spacing: .2em;
  animation: flicker 9s linear infinite;
}

/* secciones que se revelan al hacer scroll */
.revelar {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 1.1s ease, transform 1.1s ease;
}
.revelar.visible { opacity: 1; transform: translateY(0); }

/* título glitch */
.glitch {
  font-family: var(--fuente-titulo);
  font-size: clamp(3rem, 12vw, 7.5rem);
  letter-spacing: .08em;
  color: var(--hueso);
  position: relative;
  margin-top: 1rem;
  text-shadow: 0 0 30px rgba(163, 15, 15, .35);
  user-select: none;
}
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  overflow: hidden;
}
.glitch::before {
  color: var(--sangre-viva);
  animation: glitchA 3.1s infinite linear alternate-reverse;
  clip-path: inset(20% 0 40% 0);
  left: 2px;
}
.glitch::after {
  color: var(--morado);
  animation: glitchB 2.3s infinite linear alternate-reverse;
  clip-path: inset(60% 0 10% 0);
  left: -2px;
}
/* ráfaga fuerte disparada por JS cada pocos segundos */
.glitch.burst { animation: burstGlitch .32s steps(6) both; }
@keyframes burstGlitch {
  0%   { transform: none; filter: none; }
  20%  { transform: translate(-9px, 2px) skewX(-6deg); filter: hue-rotate(120deg) saturate(4); }
  40%  { transform: translate(7px, -3px) skewX(8deg); filter: invert(1); }
  60%  { transform: translate(-5px, 1px) scale(1.03); filter: hue-rotate(-90deg) contrast(3); }
  80%  { transform: translate(4px, -1px) skewX(-3deg); filter: saturate(6); }
  100% { transform: none; filter: none; }
}
@keyframes glitchA {
  0% { clip-path: inset(12% 0 78% 0); transform: translateX(-3px); }
  20% { clip-path: inset(80% 0 4% 0); transform: translateX(3px); }
  40% { clip-path: inset(40% 0 46% 0); transform: translateX(-2px); }
  60% { clip-path: inset(64% 0 18% 0); transform: translateX(4px); }
  80% { clip-path: inset(8% 0 82% 0); transform: translateX(-4px); }
  100% { clip-path: inset(50% 0 30% 0); transform: translateX(2px); }
}
@keyframes glitchB {
  0% { clip-path: inset(70% 0 12% 0); transform: translateX(3px); }
  25% { clip-path: inset(10% 0 70% 0); transform: translateX(-3px); }
  50% { clip-path: inset(46% 0 38% 0); transform: translateX(2px); }
  75% { clip-path: inset(26% 0 60% 0); transform: translateX(-4px); }
  100% { clip-path: inset(82% 0 6% 0); transform: translateX(3px); }
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  3% { opacity: .4; } 6% { opacity: 1; }
  42% { opacity: 1; } 44% { opacity: .2; } 46% { opacity: 1; }
  71% { opacity: .6; } 73% { opacity: 1; }
}

.seccion-titulo {
  font-family: var(--fuente-titulo);
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  letter-spacing: .3em;
  color: var(--sangre);
  margin-bottom: 2.2rem;
}

/* ═══ cuenta regresiva ═══ */

#countdown {
  display: flex;
  justify-content: center;
  gap: clamp(.6rem, 3vw, 2rem);
  flex-wrap: wrap;
}
.celda {
  border: 1px solid rgba(163, 15, 15, .45);
  background: rgba(12, 6, 10, .8);
  padding: 1rem 1.2rem .8rem;
  min-width: 96px;
  box-shadow: inset 0 0 24px rgba(0,0,0,.7), 0 0 14px rgba(163,15,15,.12);
  animation: latidoCelda 4s ease-in-out infinite;
}
.celda:nth-child(2) { animation-delay: 1s; }
.celda:nth-child(3) { animation-delay: 2s; }
.celda:nth-child(4) { animation-delay: 3s; }
@keyframes latidoCelda {
  0%, 100% { box-shadow: inset 0 0 24px rgba(0,0,0,.7), 0 0 14px rgba(163,15,15,.12); }
  50% { box-shadow: inset 0 0 24px rgba(0,0,0,.7), 0 0 26px rgba(163,15,15,.3); }
}
.digitos {
  display: block;
  font-family: var(--fuente-digital);
  font-size: clamp(2.6rem, 8vw, 4rem);
  color: var(--sangre-viva);
  text-shadow: 0 0 14px rgba(255, 34, 34, .65);
  line-height: 1;
  min-height: 1em;
}
.digitos.glitcheado { color: var(--morado); text-shadow: 0 0 14px rgba(155, 77, 255, .8); }
.unidad {
  display: block;
  margin-top: .4rem;
  font-size: .75rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--hueso-tenue);
}
.cuenta-nota { margin-top: 1.6rem; font-style: italic; color: var(--hueso-tenue); font-size: .95rem; }

/* ═══ incógnitas ═══ */

.cartas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.4rem;
  text-align: left;
}
.carta {
  position: relative;
  border: 1px solid rgba(155, 77, 255, .35);
  background: linear-gradient(160deg, rgba(20, 8, 26, .85), rgba(5, 3, 7, .95));
  padding: 1.6rem 1.4rem 1.4rem;
  min-height: 170px;
  transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
  cursor: pointer;
  overflow: hidden;
}
/* barrido de luz al pasar el cursor */
.carta::before {
  content: '';
  position: absolute; top: 0; bottom: 0;
  left: -80%;
  width: 60%;
  background: linear-gradient(105deg, transparent, rgba(155, 77, 255, .12), transparent);
  transform: skewX(-18deg);
  transition: left .7s ease;
  pointer-events: none;
}
.carta:hover::before { left: 130%; }
.carta:hover {
  transform: translateY(-6px);
  border-color: var(--morado);
  box-shadow: 0 12px 40px rgba(0,0,0,.8), 0 0 26px rgba(155, 77, 255, .25);
}
.carta-num {
  position: absolute; top: .6rem; right: 1rem;
  font-family: var(--fuente-titulo);
  font-size: 2.4rem;
  color: rgba(155, 77, 255, .25);
}
.carta h3 {
  font-family: var(--fuente-titulo);
  letter-spacing: .2em;
  color: var(--hueso);
  margin-bottom: .9rem;
}
.runas {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--morado);
  letter-spacing: .06em;
  word-break: break-word;
  text-shadow: 0 0 10px rgba(155, 77, 255, .45);
  min-height: 3.5em;
  transition: color .4s ease;
  animation: brilloRunas 3.4s ease-in-out infinite;
}
@keyframes brilloRunas {
  0%, 100% { text-shadow: 0 0 8px rgba(155, 77, 255, .35); }
  50% { text-shadow: 0 0 16px rgba(155, 77, 255, .7); }
}
.carta.descifrada .runas { color: var(--hueso); text-shadow: none; font-style: italic; animation: none; }
.pista { margin-top: 1.8rem; font-style: italic; color: var(--hueso-tenue); font-size: .9rem; }

/* ═══ footer ═══ */

footer { padding-bottom: 6rem; }
.ip {
  font-family: var(--fuente-digital);
  font-size: clamp(1.4rem, 5vw, 2.2rem);
  color: var(--hueso);
  letter-spacing: .1em;
}
.censura { color: var(--sangre); text-shadow: 0 0 12px rgba(163, 15, 15, .8); }
.ip-nota { font-style: italic; color: var(--hueso-tenue); margin-top: .4rem; }
.firma { margin-top: 3.4rem; font-size: .8rem; letter-spacing: .22em; color: var(--hueso-tenue); text-transform: lowercase; }
.susurro {
  margin-top: 1.2rem;
  font-size: .7rem;
  letter-spacing: .5em;
  color: rgba(216, 207, 192, .18);
  text-transform: uppercase;
  animation: flicker 11s linear infinite;
}

/* ═══ apagón: la luz falla ═══ */

#apagon {
  position: fixed; inset: 0;
  z-index: 90;
  background: #000;
  opacity: 0;
  pointer-events: none;
}
#apagon.activo { animation: parpadeoLuz .4s steps(2) both; }
@keyframes parpadeoLuz {
  0% { opacity: 0; }
  20% { opacity: .92; }
  38% { opacity: .1; }
  55% { opacity: .96; }
  100% { opacity: 0; }
}

/* ═══ botón mute ═══ */

#mute {
  position: fixed;
  bottom: 1.4rem; right: 1.4rem;
  z-index: 60;
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1px solid var(--sangre);
  background: rgba(5, 3, 7, .85);
  color: var(--hueso);
  font-size: 1.3rem;
  cursor: pointer;
  transition: all .3s ease;
}
#mute:hover { box-shadow: 0 0 20px rgba(255, 34, 34, .5); transform: scale(1.08); }

/* ═══ secreto (huevo de pascua) ═══ */

#secreto {
  position: fixed; inset: 0;
  z-index: 200;
  background: rgba(3, 0, 2, .96);
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  cursor: pointer;
  animation: aparecer .6s ease both;
}
.secreto-caja { max-width: 520px; padding: 2rem; border: 1px solid var(--sangre); box-shadow: 0 0 60px rgba(163, 15, 15, .35); }
.secreto-titulo {
  font-family: var(--fuente-titulo);
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  letter-spacing: .25em;
  color: var(--sangre-viva);
  margin-bottom: 1.2rem;
  animation: flicker 3s linear infinite;
}
.secreto-caja p { margin: .7rem 0; line-height: 1.7; }
.secreto-pista { color: var(--morado); font-style: italic; }
.secreto-cerrar { margin-top: 1.6rem !important; font-size: .8rem; color: var(--hueso-tenue); letter-spacing: .2em; }

/* flash del ojo (easter egg del título) */
body.mirado::after {
  content: '👁';
  position: fixed; inset: 0;
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
  font-size: 40vmin;
  background: rgba(0, 0, 0, .92);
  animation: flashOjo 1.4s ease forwards;
  pointer-events: none;
}
@keyframes flashOjo {
  0% { opacity: 0; } 15% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; }
}

/* usuarios que piden menos movimiento */
@media (prefers-reduced-motion: reduce) {
  .niebla, .celda, .runas, .glitch::before, .glitch::after { animation: none !important; }
}

@media (max-width: 560px) {
  .celda { min-width: 74px; padding: .8rem .7rem .6rem; }
  .hero { padding-top: 12vh; }
}
