/* ===============================
   RESET
   =============================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===============================
   FUENTES
   =============================== */
@font-face {
  font-family: 'HelveticaNowDisplay';
  src: url('static/assets/fonts/HelveticaNowDisplay-ExtBlk.ttf') format('truetype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* ===============================
   BASE
   =============================== */
html, body {
  width: 100%;
  height: 100%;
  background: #181818;
  overflow: hidden;
}

body {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  font-family: 'VT323', monospace;
  color: #fff;
}

/* ===============================
   HEADER / FOOTER
   =============================== */
.header,
.footer {
  height: 30px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.footer {
  font-size: 12px;
  letter-spacing: 0.04em;
}

/* ===============================
   MAIN
   =============================== */
.main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* ===============================
   GLITCH WRAPPER (FIX CRÍTICO)
   Si esto no tiene altura, el flipbook muere.
   =============================== */
#glitch-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
}

/* ===============================
   FLIPBOOK WRAPPER
   =============================== */
#book-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ===============================
   FLIPBOOK (TOP LAYER)
   =============================== */
#flipbook {
  position: relative;
  z-index: 300; /* por encima del CRT (200) */
  transition: transform 0.6s ease;
}

#flipbook .page {
  background: #000;
}

#flipbook .page img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* ===============================
   ZONAS LATERALES (HOVER SEGURO)
   =============================== */
.page-nav {
  position: absolute;
  top: 0;
  height: 100%;
  width: 8%;
  z-index: 50;
  cursor: pointer;
  background: transparent;
}

.page-nav.left { left: 0; }
.page-nav.right { right: 0; }

.page-nav::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.page-nav.left::before {
  background: linear-gradient(to right, rgba(255,255,255,0.12), rgba(255,255,255,0));
}

.page-nav.right::before {
  background: linear-gradient(to left, rgba(255,255,255,0.12), rgba(255,255,255,0));
}

.page-nav:hover::before { opacity: 1; }

@media (max-width: 900px) {
  .page-nav { display: none; }
}

/* ===============================
   UI ESQUINAS
   =============================== */
.corner {
  position: fixed;
  z-index: 100;
  color: #ffffff;
  font-family: 'HelveticaNowDisplay', sans-serif;
}

.corner-tl { top: 24px; left: 24px; }
.corner-tr { top: 24px; right: 24px; text-align: right; }
.corner-bl { bottom: 24px; left: 24px; }
.corner-br { bottom: 24px; right: 24px; text-align: right; }

.corner-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.corner-tr .corner-title,
.corner-br .corner-title {
  justify-content: flex-end;
}

.corner-sub {
  margin-top: 2px;
  font-family: 'VT323', monospace;
  font-size: 14px;
  letter-spacing: 0.08em;
  opacity: 0.9;
}

.square {
  width: 14px;
  height: 14px;
  background: #fff;
  display: inline-block;
}

.corner.link {
  text-decoration: none;
  color: #fff;
}

.corner.link:hover { opacity: 0.75; }

/* BLINK CUADRADOS */
@keyframes squareBlink {
  0%, 45% { opacity: 1; }
  55%, 100% { opacity: 0; }
}

.corner-bl .square,
.corner-br .square {
  animation: squareBlink 1s steps(1) infinite;
}

/* =========================================================
   GLITCH OVERLAY — FULL PACK (GLITCHXploitR vibe)
   UI (100) < GLITCH (200) < FLIPBOOK (300)
   ========================================================= */

#glitch-overlay{
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;

  opacity: 1;
  background: transparent;
  mix-blend-mode: normal;

  /* “Broadcast punch” */
  filter: contrast(1.6) saturate(1.6) brightness(0.5);
  animation:
    gx_flicker 0.9ms steps(1,end) infinite,
    gx_jerkY 60ms steps(1,end) infinite;
}

/* -------------------------------
   LAYER A (CRT texture + scanlines + RGB subpixel mask + noise)
   ------------------------------- */
#glitch-overlay::before{
  content:"";
  position:absolute;
  inset:-80%;
  opacity: 1;

  /* MULTI-LAYER: crt.png + scanlines + rgb-mask + noise */
  background-image:
    /* CRT PNG texture (del CodePen) */
    url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/86186/crt.png"),

    /* Scanlines finas (horizontales) */
    repeating-linear-gradient(
      to bottom,
      rgba(211, 211, 211, 0.799) 0px,
      rgba(0,0,0,0.30) 1px,
      rgba(255,255,255,0.06) 2px,
      rgba(255, 254, 254, 0) 3px
    ),

    /* RGB subpixel mask (vertical stripes) */
    repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.18) 0px,
      rgba(0, 0, 0, 0.18) 1px,
      rgba(0, 0, 0, 0.12) 1px,
      rgba(0, 0, 0, 0.12) 2px,
      rgba(0, 0, 0, 0.18) 2px,
      rgba(0, 0, 0, 0.18) 3px
    ),

    /* “Snow” CSS (grano) */
    repeating-radial-gradient(
      circle at 50% 50%,
      rgba(4, 4, 4, 0.925) 0px,
      rgba(10, 10, 10, 0.945) 1px,
      rgb(7, 7, 7) 2px
    );

  background-repeat: no-repeat, repeat, repeat, repeat;
  background-size: 100% 100%, 100% 4px, 6px 100%, 200px 200px;
  background-position: center, 0 0, 0 0, 0 0;

  /* Un poco de “bleed” */
  filter: blur(1px);

  animation:
    gx_static 120ms steps(2,end) infinite,
    gx_vRoll 1.2s linear infinite;
}

/* -------------------------------
   LAYER B (RGB split + jitter + slices + skew-glitch + vignette)
   ------------------------------- */
#glitch-overlay::after{
  content:"";
  position:absolute;
  inset:0;
  opacity: 0.025;

  /* Vignette fuerte + bloom */
  background:
    radial-gradient(
      ellipse at center,
      rgba(255, 255, 255, 0.872) 0%,
      rgba(255, 255, 255, 0.87) 55%,
      rgba(255, 255, 255, 0.913) 100%
    );

}

/* =========================================================
   ANIMATIONS (MAX)
   ========================================================= */


@keyframes gx_static{
  0%{transform:translate(0,0) scale(1.03)}
  25%{transform:translate(-1.8%, 1.2%) scale(1.03)}
  50%{transform:translate(1.5%, -1.5%) scale(1.03)}
  75%{transform:translate(-1.2%, -1.8%) scale(1.03)}
  100%{transform:translate(0,0) scale(1.03)}
}

@keyframes gx_rgbJitter{
  0%{transform:translate(0,0)}
  20%{transform:translate(-14px, 6px)}
  40%{transform:translate(12px, -6px)}
  60%{transform:translate(-10px, 5px)}
  80%{transform:translate(10px, -5px)}
  100%{transform:translate(0,0)}
}

@keyframes gx_sliceCuts{
  0%{clip-path: inset(82% 0 4% 0)}
  10%{clip-path: inset(12% 0 86% 0)}
  20%{clip-path: inset(58% 0 22% 0)}
  30%{clip-path: inset(0 0 94% 0)}
  40%{clip-path: inset(75% 0 7% 0)}
  50%{clip-path: inset(28% 0 58% 0)}
  60%{clip-path: inset(94% 0 2% 0)}
  70%{clip-path: inset(38% 0 42% 0)}
  80%{clip-path: inset(65% 0 18% 0)}
  90%{clip-path: inset(10% 0 80% 0)}
  100%{clip-path: inset(48% 0 34% 0)}
}

@keyframes gx_vRoll{
  0%{background-position:center, 0 0, 0 0, 0 0}
  100%{background-position:center, 0 240px, 0 0, 0 240px}
}

/* “glitch” tipo CodePen (skew pop) */
@keyframes gx_skewGlitch{
  0%{transform:scale(1) skew(0,0)}
  39%{transform:scale(1) skew(0,0)}
  40%{transform:scale(1.02,1.05) skew(0,0)}
  41%{transform:scale(1,1.25) skew(80deg,0)}
  42%{transform:scale(1,1.25) skew(-50deg,0)}
  43%{transform:scale(1.02,1.05) skew(0,0)}
  44%{transform:scale(1) skew(0,0)}
  100%{transform:scale(1) skew(0,0)}
}

/* micro-jerks tipo “jerk / jerkup” */
@keyframes gx_jerkX{
  50%{transform:translateX(2px)}
  51%{transform:translateX(0)}
}
@keyframes gx_jerkY{
  0%{transform:translateY(2px)}
  100%{transform:translateY(0)}
}

/* =========================================================
   UI RGB SHIFT ONLY (NO BACKGROUND / NO FLIPBOOK)
   ========================================================= */

:root {
  --ui-rgb-opacity: 0.3; /* 0 = off | 1 = máximo */
}

/* control SOLO de la intensidad visual del RGB */
.header,
.footer,
.corner,
#progress-wrapper {
  filter:
    drop-shadow(0 0 rgba(255,0,0,var(--ui-rgb-opacity)))
    drop-shadow(0 0 rgba(0,0,255,var(--ui-rgb-opacity)));

    animation: uiRgbJitter 0.075s steps(1, end) infinite;
}

/* texto RGB con misma intensidad */
.corner-title,
.corner-sub,
.footer,
.header {
  text-shadow:
    7px 0 rgba(255,0,0,var(--ui-rgb-opacity)),
    10px 0 rgba(0,21,255,var(--ui-rgb-opacity));
}


@keyframes uiRgbJitter {
  0%   { transform: translate(0,0); }
  20%  { transform: translate(-0.6px, 0.3px); }
  40%  { transform: translate(0.6px, -0.3px); }
  60%  { transform: translate(-0.3px, 0.3px); }
  80%  { transform: translate(0.3px, -0.3px); }
  100% { transform: translate(0,0); }
}

/* ===============================
   PROGRESS BAR — DEBUG (FORZADO)
   =============================== */
#progress-wrapper{
  position: fixed !important;
  left: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 5px !important;
  z-index: 999999 !important;
  background: rgba(255,255,255,0.25) !important;
  outline: 2px solid rgba(0, 255, 255, 0) !important;
  pointer-events: none !important;
  display: block !important;

  /* IMPORTANTÍSIMO: que nada lo mueva/filtre */
  transform: none !important;
  filter: none !important;
  mix-blend-mode: normal !important;
}

#progress-bar{
  height: 100% !important;
  background: rgba(255,255,255,1) !important;
  display: block !important;

  transform: none !important;
  filter: none !important;
}

/* ===============================
   UI LINKS HOVER COLOR (BOTTOM)
   =============================== */

.corner.link:hover {
  opacity: 1; /* anulamos el fade */
}

.corner-bl:hover,
.corner-bl:hover .corner-title,
.corner-bl:hover .corner-sub,
.corner-br:hover,
.corner-br:hover .corner-title,
.corner-br:hover .corner-sub {
  color: #f7c479; /* <-- cambia aquí el color */
}

.corner-bl:hover .square,
.corner-br:hover .square {
  background: #f7c479; /* cuadradito también */
}

/* ===============================
   INTRO VIDEO OVERLAY
   =============================== */

#intro-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* VIDEO CENTRADO, TAMAÑO CONTROLADO */
#intro-video {
  width: auto;
  max-width: 420px;   /* AJUSTA ESTE VALOR */
  max-height: 240px;  /* O ESTE */
  object-fit: contain;
}

/* ======================================
   TYPEWRITER SAFE MODE (NO RGB JITTER)
   ====================================== */

.corner.typing-safe {
  animation: none !important;
  filter: none !important;
  transform: none !important;
}

.corner.typing-safe .corner-sub {
  text-shadow: none !important;
}

#flipbook-mobile {
  display: none;
}

/* ===== MODO MÓVIL ===== */
@media (max-width: 768px) {

  #flipbook-desktop {
    display: none;
  }

  #flipbook-mobile {
    display: block;
  }

  /* Apagar glitch pesado en móvil */
  #glitch-overlay {
    display: none !important;
  }

  /* UI más limpia */
  .corner,
  #progress-wrapper {
    filter: none !important;
    animation: none !important;
  }
}
/* ===============================
   MOBILE TAP ZONES
   =============================== */

.mobile-nav {
  position: absolute;
  top: 0;
  height: 100%;
  width: 18%;
  z-index: 50;
}

.mobile-nav.left { left: 0; }
.mobile-nav.right { right: 0; }

#flipbook-desktop,
#flipbook-mobile {
  position: relative;
  z-index: 9999;
}

#flipbook-desktop .page img,
#flipbook-mobile .page img {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ===============================
   MOBILE UI SCALE DOWN
   =============================== */
@media (max-width: 768px) {

  /* Posiciones más cerca del borde */
  .corner-tl { top: 12px; left: 12px; }
  .corner-tr { top: 12px; right: 12px; }
  .corner-bl { bottom: 12px; left: 12px; }
  .corner-br { bottom: 12px; right: 12px; }

  /* Títulos más pequeños */
  .corner-title {
    font-size: 12px;
    gap: 6px;
  }

  /* Subtítulos (VT323) más pequeños */
  .corner-sub {
    font-size: 11px;
    letter-spacing: 0.06em;
  }

  /* Cuadraditos más pequeños */
  .square {
    width: 10px;
    height: 10px;
  }
}

/* ===============================
   BACKGROUND MÁS NEGRO SOLO EN MÓVIL
   =============================== */
@media (max-width: 768px) {
  html, body {
    background: #000000;
  }
}

/* ===============================
   FLIPBOOK HINT — SIMPLE Y ROBUSTO
   =============================== */

#book-wrapper {
  position: relative;
}

#flip-hint {
  position: absolute;
  right: 590px;                 /* pegada al borde del libro */
  top: 50%;
  transform: translateY(-50%);
  z-index: 9999;                 /* encima del flipbook */
  font-family: 'VT323', monospace;
  font-size: 100px;
  color: rgba(255,255,255,0.9);
  pointer-events: none;
  animation: flipHintBlink 1.2s steps(1) infinite;
}
#flip-hint svg {
  display: block;
  opacity: 0.9;
}

/* Tamaño flecha DESKTOP */
#flip-hint svg {
  width: 40px;
  height: 40px;
}


/* MÓVIL: misma flecha, mismo sitio visual */
@media (max-width: 768px) {
  #flip-hint {
    font-size: 30px;
    right: 12px;               /* en móvil no la sacamos fuera */
    position: fixed;           /* 🔴 CLAVE para que siempre se vea */
  }
}

/* Parpadeo */
@keyframes flipHintBlink {
  0%, 50% { opacity: 1; }
  60%, 100% { opacity: 0; }
}









