/* ============================================
   DOCTOR TALOS'S TRAVELING SHOW
   Animations — Cyberpunk Glitch & Boot Sequence
   ============================================ */

/* --- Margin Static Noise --- */
.margin-static {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.margin-static.flash {
  opacity: 1;
}

/* --- Boot Sequence Overlay --- */
.boot-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--black);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.4s ease;
}

.boot-overlay.done {
  opacity: 0;
}

.boot-text {
  color: var(--green);
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  text-align: left;
  line-height: 1.8;
  max-width: 500px;
  padding: 2rem;
}

.boot-text .cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  background: var(--green);
  vertical-align: text-bottom;
  animation: blink-cursor 0.8s step-end infinite;
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Scanline effect on boot */
.boot-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 2px,
    rgba(0, 255, 65, 0.03) 2px,
    rgba(0, 255, 65, 0.03) 4px
  );
  pointer-events: none;
}

/* --- Content Reveal --- */
.intro-content {
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.intro-content.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* --- Text Glitch Effect --- */
.glitch {
  animation: glitch-flicker 6s ease-in-out infinite;
}

@keyframes glitch-flicker {
  0%, 95%, 100% {
    opacity: 1;
    text-shadow: none;
    transform: none;
  }
  96% {
    opacity: 0.8;
    text-shadow:
      2px 0 var(--magenta),
      -2px 0 var(--green);
    transform: translateX(2px);
  }
  97% {
    opacity: 1;
    text-shadow: none;
    transform: none;
  }
  98% {
    opacity: 0.6;
    text-shadow:
      -3px 0 var(--magenta),
      3px 0 var(--green);
    transform: translateX(-2px) skewX(1deg);
  }
  99% {
    opacity: 1;
    text-shadow: none;
    transform: none;
  }
}

/* --- Neon Glow for Title --- */
.title-glow {
  text-shadow:
    0 0 10px var(--green-glow),
    0 0 30px var(--green-glow);
  animation: neon-flicker 8s ease-in-out infinite;
}

@keyframes neon-flicker {
  0%, 92%, 100% {
    text-shadow:
      0 0 10px var(--green-glow),
      0 0 30px var(--green-glow);
  }
  93% {
    text-shadow:
      0 0 5px var(--green-glow);
    opacity: 0.9;
  }
  95% {
    text-shadow:
      0 0 20px rgba(0, 255, 65, 0.4),
      0 0 40px rgba(0, 255, 65, 0.2),
      0 0 60px rgba(255, 0, 255, 0.1);
  }
  97% {
    text-shadow:
      0 0 5px var(--green-glow);
    opacity: 0.85;
  }
  98% {
    text-shadow:
      0 0 15px rgba(0, 255, 65, 0.3),
      0 0 40px rgba(0, 255, 65, 0.15);
  }
}

/* --- Neon Flash Effect (replaces teal-flash) --- */
.neon-flash {
  animation: neon-pulse 6s ease-in-out infinite;
}

@keyframes neon-pulse {
  0%, 85%, 100% {
    color: inherit;
  }
  90% {
    color: var(--green);
    text-shadow: 0 0 10px var(--green-glow);
  }
  95% {
    color: inherit;
  }
}

/* --- Fade-in for page elements --- */
.fade-in {
  opacity: 0;
  animation: fade-in-up 0.5s ease forwards;
}

.fade-in:nth-child(2) { animation-delay: 0.1s; }
.fade-in:nth-child(3) { animation-delay: 0.2s; }
.fade-in:nth-child(4) { animation-delay: 0.3s; }
.fade-in:nth-child(5) { animation-delay: 0.4s; }

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Magenta Neon Glow for Works Title --- */
.title-glow-magenta {
  color: var(--magenta);
  text-shadow:
    0 0 10px var(--magenta-glow),
    0 0 30px var(--magenta-glow);
  animation: neon-flicker-magenta 8s ease-in-out infinite;
}

@keyframes neon-flicker-magenta {
  0%, 92%, 100% {
    text-shadow:
      0 0 10px var(--magenta-glow),
      0 0 30px var(--magenta-glow);
  }
  93% {
    text-shadow: 0 0 5px var(--magenta-glow);
    opacity: 0.9;
  }
  95% {
    text-shadow:
      0 0 20px rgba(255, 0, 255, 0.4),
      0 0 40px rgba(255, 0, 255, 0.2),
      0 0 60px rgba(0, 255, 65, 0.1);
  }
  97% {
    text-shadow: 0 0 5px var(--magenta-glow);
    opacity: 0.85;
  }
  98% {
    text-shadow:
      0 0 15px rgba(255, 0, 255, 0.3),
      0 0 40px rgba(255, 0, 255, 0.15);
  }
}

/* --- Screen Dim (for adventure mode) --- */
.screen-dim {
  transition: filter 1s ease;
}

.screen-dim[data-dim="1"] { filter: brightness(0.95); }
.screen-dim[data-dim="2"] { filter: brightness(0.85); }
.screen-dim[data-dim="3"] { filter: brightness(0.7); }
.screen-dim[data-dim="4"] { filter: brightness(0.5); }
.screen-dim[data-dim="5"] { filter: brightness(0.3); }
