/* ============================================== 
   Landing (updated)
   - White canvas so the All-Seeing Eye stays visible
   - Merged original + new rain/typing/explosion variants
   - Supports BOTH class sets:
       * binary-rain / binary-drop  (older JS)
       * rain-container / raindrop  (your new spec)
       * fall-char + final-drop     (older JS)
       * raindrop-text              (your new spec)
   ============================================== */

/* --- Force white canvas on landing only --- */
html,
body,
.runway,
.YVhW,
.landing-wrap {
  background-color: #6e6d6d0f !important;
}

/* --- Landing wrapper --- */
.landing-wrap {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;

  background: #bbe0003f;
  /* keep white even if theme-dark on body */
  color-scheme: light;

  /* local token fallbacks */
  --text: #111;
  --blue-400: #60a5fa;
  --accent-blue: #2563eb;
  --accent-cyan: #06b6d4;
  --accent-pink: #ff00ff;
  --transition: 0.3s;
  --radius: 8px;
  --shadow: 0 2px 18px rgba(0, 0, 0, .05);

  font-family: 'Courier New', Courier, monospace;
  margin-top: clamp(80px, 12vh, 120px);
  /* room for any sticky header */
}

/* --- Typing area (clean—no border/shadow) --- */
#typing-area {
  position: relative;
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  line-height: 1.3;
  white-space: nowrap;
  text-align: center;
  color: var(--text);
  padding: 0;
}

/* ===============================
   CHAR / TYPING / EXPLOSION
   =============================== */

/* Base character */
.char {
  display: inline-block;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--transition), transform var(--transition);
  margin-right: 0.05em;
  color: var(--text);
  will-change: transform, opacity;
}

.char.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Explosion trigger (older/new JS both supported) */
.exploding .char {
  position: absolute;
  transition: none;
  pointer-events: none;
  /* prefer explode-animation but also define explode-char keyframes */
  animation: explode-animation 3.3s ease-out forwards;
}

/* Keyframes (both names map to same motion) */
@keyframes explode-animation {
  from {
    transform: translate(0, 0) scale(1) rotate(0deg);
    opacity: 1;
  }

  to {
    transform: translate(var(--dx), var(--dy)) scale(0) rotate(var(--rot));
    opacity: 0;
  }
}

@keyframes explode-char {
  from {
    transform: translate(0, 0) scale(1) rotate(0deg);
    opacity: 1;
    color: var(--text);
  }

  to {
    transform: translate(var(--dx), var(--dy)) scale(0) rotate(var(--rot));
    opacity: 0;
    color: var(--blue-400);
  }
}

/* Older JS: falling line + final drop */
.char.fall-char {
  position: absolute;
  transform: translateY(-100vh);
  opacity: 0;
  animation: fall-into-place 1.5s var(--delay, 0s) forwards cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fall-into-place {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.char.fall-char.final-drop {
  animation: final-drop-animation 2.5s var(--final-drop-delay, 0s) forwards cubic-bezier(0.5, 0, 1, 1);
}

@keyframes final-drop-animation {
  from {
    transform: translateY(0);
    opacity: 1;
  }

  to {
    transform: translateY(100vh);
    opacity: 0;
  }
}

/* New spec: raindrop-text (falls into place line by line) */
.char.raindrop-text {
  position: absolute;
  opacity: 0;
  transform: translateY(var(--start-y, -100vh));
  margin: 0;
  transition: none;
  font-size: inherit;
  /* inherit from #typing-area */
}

.char.raindrop-text.visible {
  opacity: 1;
  transform: translateY(0);
  transition: transform 3.3s ease-in var(--delay, 0s), opacity 0.5s var(--delay, 0s);
}

/* ===============================
   PARTICLES (explosion debris)
   =============================== */

#explosion {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
  /* toggled by JS when spawning particles */
}

.particle {
  position: absolute;
  width: 33px;
  height: 33px;
  border-radius: 50%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
  pointer-events: none;
  animation: particle-fly 3.3s ease-out forwards;
}

@keyframes particle-fly {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }

  100% {
    transform: translate(var(--px), var(--py)) scale(0);
    opacity: 0;
  }
}

/* ===============================
   0/1 RAIN BACKGROUNDS
   (support both class sets)
   =============================== */

/* Containers */
.rain-container,
.binary-rain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  /* below .top-img and main content */
  overflow: hidden;
}

/* Drops (new spec) */
.raindrop {
  position: absolute;
  font-family: 'Courier New', Courier, monospace;
  font-size: clamp(0.5rem, 1vw, 1rem);
  opacity: 0.8;
  animation: rain-fall 2s linear infinite;
}

@keyframes rain-fall {
  0% {
    transform: translateY(-100vh);
    opacity: 0.8;
  }

  100% {
    transform: translateY(100vh);
    opacity: 0;
  }
}

/* Drops (older spec) */
.binary-drop {
  position: absolute;
  font-family: 'Courier New', Courier, monospace;
  font-size: 2rem;
  opacity: 0.5;
  animation: binary-fall 10s linear infinite;
}

@keyframes binary-fall {
  from {
    transform: translateY(-100vh);
    opacity: 0.2;
  }

  to {
    transform: translateY(100vh);
    opacity: 0.8;
  }
}

/* All-Seeing Eye placement with veil */
.top-img {
  position: absolute;
  top: clamp(16px, 2vh, 24px);
  left: 50%;
  transform: translateX(-50%) scale(0.33);
  height: 33px;
  width: 33px;
  z-index: 10;
  filter: blur(3px) grayscale(100%) opacity(0.4);
  pointer-events: none;
  transition: filter 0.6s ease, opacity 0.6s ease;
}

.top-img:hover {
  filter: blur(0) grayscale(0) opacity(1);
}

/* ===============================
   Responsive
   =============================== */
@media (max-width: 768px) {
  #typing-area {
    font-size: clamp(1.2rem, 4vw, 1.8rem);
  }

  .landing-wrap {
    margin-top: clamp(64px, 10vh, 96px);
  }

  .binary-drop {
    font-size: clamp(0.4rem, 0.8vw, 0.8rem);
  }
}

/* ===============================
   Reduced Motion Accessibility
   =============================== */
@media (prefers-reduced-motion: reduce) {
  #typing-area {
    animation: none;
  }

  .char,
  .exploding .char,
  .particle,
  .raindrop,
  .binary-drop,
  .char.raindrop-text,
  .char.raindrop-text.visible,
  .char.fall-char,
  .char.fall-char.final-drop {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
    transition: none !important;
  }
}