/* ═══════════════════════════════════════════════════════
   anime-scroll.css — Creative overlays & Letter Storm
   PURELY ADDITIVE — no modifications to existing elements.
   ═══════════════════════════════════════════════════════ */

/* ── LETTER STORM SECTION ─────────────────────────────── */
.letter-storm {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 6rem 2rem;
  background: radial-gradient(
    ellipse 80% 60% at 50% 50%,
    rgba(74, 159, 255, 0.04) 0%,
    transparent 70%
  );
}

.letter-storm::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(74, 159, 255, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(200, 80, 60, 0.04) 0%, transparent 40%);
  pointer-events: none;
}

.letter-storm::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 100%;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(74, 159, 255, 0.2) 30%,
    rgba(74, 159, 255, 0.2) 70%,
    transparent 100%
  );
  pointer-events: none;
}

.storm-canvas {
  position: relative;
  width: 100%;
  max-width: 1100px;
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

/* ── STORM PARTICLES ──────────────────────────────────── */
.storm-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.storm-dot {
  position: absolute;
  width: var(--size, 3px);
  height: var(--size, 3px);
  border-radius: 50%;
  background: rgba(74, 159, 255, 0.5);
  opacity: 0;
  box-shadow: 0 0 6px rgba(74, 159, 255, 0.3);
  will-change: transform, opacity;
}

.storm-dot:nth-child(3n) {
  background: rgba(200, 160, 80, 0.5);
  box-shadow: 0 0 6px rgba(200, 160, 80, 0.3);
}

.storm-dot:nth-child(5n) {
  background: rgba(200, 80, 60, 0.4);
  box-shadow: 0 0 6px rgba(200, 80, 60, 0.2);
}

/* ── STORM TEXT ────────────────────────────────────────── */
.storm-text {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  z-index: 3;
}

.storm-line {
  display: flex;
  gap: 0;
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--cream, #f4ecd8);
}

.storm-line--1 {
  font-size: clamp(3rem, 8vw, 7rem);
}

.storm-line--2 {
  font-size: clamp(2.5rem, 7vw, 6rem);
  font-style: italic;
  color: var(--blue, #4a9fff);
}

.storm-line--3 {
  font-size: clamp(3.5rem, 9vw, 8rem);
}

/* ── INDIVIDUAL CHARACTERS ─────────────────────────────── */
.storm-char {
  display: inline-block;
  will-change: transform, opacity;
  transition: color 0.3s ease;
  position: relative;
  transform: translate(var(--jx, 0), var(--jy, 0));
}

.storm-char::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--blue, #4a9fff);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.4s ease;
  opacity: 0.4;
}

.storm-line--3 .storm-char:hover::after {
  transform: scaleX(1);
}

.storm-char:hover {
  color: var(--blue, #4a9fff);
}

/* ── SUBTITLE ──────────────────────────────────────────── */
.storm-subtitle {
  margin-top: 2.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(0.75rem, 1.2vw, 0.9rem);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted, rgba(244, 236, 216, 0.5));
  text-align: center;
  will-change: transform, opacity;
}

/* ── STORM PROGRESS INDICATOR ──────────────────────────── */
.storm-progress {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 40px;
  border: 1px solid rgba(74, 159, 255, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: storm-pulse 2s ease-in-out infinite;
}

.storm-progress::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--blue, #4a9fff);
  border-radius: 50%;
  animation: storm-bounce 2s ease-in-out infinite;
}

@keyframes storm-pulse {
  0%, 100% { opacity: 0.4; transform: translateX(-50%) scale(1); }
  50% { opacity: 0.8; transform: translateX(-50%) scale(1.1); }
}

@keyframes storm-bounce {
  0%, 100% { transform: translateY(-4px); }
  50% { transform: translateY(4px); }
}

/* ═══════════════════════════════════════════════════════
   FIREFLY LAYER — Ambient floating particles overlay
   Fixed position, covers entire viewport, behind content.
   ═══════════════════════════════════════════════════════ */
.firefly-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.firefly {
  position: absolute;
  width: var(--fly-size, 3px);
  height: var(--fly-size, 3px);
  border-radius: 50%;
  background: rgba(74, 159, 255, 0.6);
  box-shadow:
    0 0 4px rgba(74, 159, 255, 0.4),
    0 0 8px rgba(74, 159, 255, 0.2);
  opacity: 0;
  will-change: transform, opacity;
}

.firefly:nth-child(3n) {
  background: rgba(244, 236, 216, 0.5);
  box-shadow:
    0 0 4px rgba(244, 236, 216, 0.3),
    0 0 8px rgba(244, 236, 216, 0.15);
}

.firefly:nth-child(5n) {
  background: rgba(200, 160, 80, 0.5);
  box-shadow:
    0 0 4px rgba(200, 160, 80, 0.3),
    0 0 8px rgba(200, 160, 80, 0.15);
}

.firefly:nth-child(7n) {
  background: rgba(200, 80, 60, 0.4);
  box-shadow:
    0 0 4px rgba(200, 80, 60, 0.3),
    0 0 8px rgba(200, 80, 60, 0.15);
}

/* ═══════════════════════════════════════════════════════
   SCROLL ORB — Glowing sphere tracking scroll progress
   Fixed on the right edge of the viewport.
   ═══════════════════════════════════════════════════════ */
.scroll-orb {
  position: fixed;
  right: 20px;
  top: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, #4a9fff 0%, rgba(74, 159, 255, 0.6) 60%, transparent 100%);
  box-shadow:
    0 0 10px rgba(74, 159, 255, 0.4),
    0 0 20px rgba(74, 159, 255, 0.2);
  z-index: 9998;
  pointer-events: none;
  will-change: transform, box-shadow;
  transition: box-shadow 0.3s ease;
}

.scroll-orb.is-moving {
  width: 12px;
  height: 12px;
}

.scroll-orb-trail {
  position: fixed;
  right: 22px;
  top: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(74, 159, 255, 0.3);
  box-shadow: 0 0 6px rgba(74, 159, 255, 0.2);
  z-index: 9997;
  pointer-events: none;
  will-change: transform, opacity;
  opacity: 0.4;
}

.scroll-orb-trail:nth-child(2) { width: 5px; height: 5px; }
.scroll-orb-trail:nth-child(3) { width: 4px; height: 4px; }
.scroll-orb-trail:nth-child(4) { width: 3px; height: 3px; }
.scroll-orb-trail:nth-child(5) { width: 3px; height: 3px; }

/* ── RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 768px) {
  .letter-storm {
    min-height: 80vh;
    padding: 4rem 1rem;
  }

  .storm-line--1 { font-size: 2.5rem; }
  .storm-line--2 { font-size: 2rem; }
  .storm-line--3 { font-size: 3rem; }

  .storm-subtitle {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
  }

  /* Fireflies + orb hidden on mobile for perf */
  .firefly-layer,
  .scroll-orb,
  .scroll-orb-trail {
    display: none;
  }
}

@media (max-width: 480px) {
  .storm-line--1 { font-size: 2rem; }
  .storm-line--2 { font-size: 1.6rem; }
  .storm-line--3 { font-size: 2.4rem; }
}

/* ── REDUCED MOTION ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .letter-storm { min-height: auto; }
  .storm-char { transform: none !important; opacity: 1 !important; }
  .storm-subtitle { opacity: 1 !important; transform: none !important; }
  .storm-dot { display: none; }
  .storm-progress { display: none; }
  .firefly-layer { display: none; }
  .scroll-orb,
  .scroll-orb-trail { display: none; }
}
