/* ============================================================
   SCROLL-CHARACTER.CSS — Mr. Bean Style Spotlight Companion
   Fixed full-height track where a tech silhouette descends
   within a glowing conical light beam as you scroll.
   ============================================================ */

/* ── Container (Full Viewport Height) ───────────────────────── */
.scroll-character-container {
  position: fixed;
  right: 20px;
  top: 0;
  bottom: 0;
  height: 100vh;
  z-index: 1000;
  width: 80px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── Spotlight Beam (Mr. Bean Style) ────────────────────────── */
.scroll-spotlight {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  top: 0;
  height: 0; /* Dynamic height tracks the character's top value */
  z-index: 1;
  pointer-events: none;
  opacity: 0.12;
  filter: blur(2px);
  transition: opacity 0.5s ease, height 0.1s ease-out;

  /* Dynamic neon cyan conical beam */
  background: linear-gradient(
    to bottom,
    rgba(0, 212, 255, 0.8) 0%,
    rgba(0, 212, 255, 0.4) 40%,
    rgba(0, 212, 255, 0.15) 75%,
    rgba(0, 212, 255, 0.02) 100%
  );
  clip-path: polygon(25% 0%, 75% 0%, 100% 100%, 0% 100%);
}

.scroll-character-container.at-bottom .scroll-spotlight {
  opacity: 0.22;
  filter: blur(3px) drop-shadow(0 0 15px rgba(0, 212, 255, 0.4));
}

/* ── Character Wrapper ─────────────────────────────────────── */
.character-wrapper {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  pointer-events: all;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: top 0.1s ease-out, transform 0.3s ease, opacity 0.5s ease;
}

/* ── Character SVG Silhouette ──────────────────────────────── */
.scroll-character {
  width: 50px;
  height: auto;
  cursor: pointer;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
  transition: transform 0.3s var(--ease-out-expo), filter 0.3s ease;
  transform-origin: center center;
}

.scroll-character:hover {
  transform: scale(1.08) translateY(-2px);
  filter:
    drop-shadow(0 6px 15px rgba(0, 0, 0, 0.7))
    drop-shadow(0 0 15px rgba(0, 212, 255, 0.4));
}

/* Core and Armor Swapping */
.scroll-character--armor {
  display: none !important;
}

/* Flying State */
.scroll-character-container.flying .scroll-character--core {
  display: none !important;
}

.scroll-character-container.flying .scroll-character--armor {
  display: block !important;
  /* Add glowing repulsor eyes and helmet aura */
  filter: drop-shadow(0 0 15px rgba(239, 68, 68, 0.65)) drop-shadow(0 0 25px rgba(245, 158, 11, 0.4));
}

.scroll-character-container.flying .scroll-spotlight {
  opacity: 0.35 !important;
  /* Turn the spotlight into a hot thruster beam (yellow/crimson/white) */
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(245, 158, 11, 0.65) 30%,
    rgba(239, 68, 68, 0.3) 70%,
    transparent 100%
  ) !important;
  filter: blur(4px) drop-shadow(0 0 20px rgba(245, 158, 11, 0.5));
}

/* Let the character wrapper fly up off-screen when flying class is added */
.scroll-character-container.flying .character-wrapper {
  top: -150px !important;
  transform: translateX(-50%) rotate(-5deg) scale(1.1);
  transition: top 1.5s cubic-bezier(0.25, 1, 0.2, 1), transform 0.5s ease, opacity 1s ease;
}

/* ── Click Hint ────────────────────────────────────────────── */
.click-hint {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.5s ease 0.3s;
  text-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}

@keyframes hint-float-left {
  0%, 100% {
    transform: translate(0, -50%);
  }
  50% {
    transform: translate(-5px, -50%);
  }
}

.scroll-character-container.at-bottom .click-hint {
  opacity: 1;
  animation: hint-float-left 3s ease-in-out infinite;
}

/* ── Visual Vertical Rail ──────────────────────────────────── */
.scroll-track {
  position: absolute;
  right: 50%;
  transform: translateX(50%);
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(0, 212, 255, 0.05) 15%,
    rgba(0, 212, 255, 0.05) 85%,
    transparent
  );
  pointer-events: none;
  z-index: 0;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  .scroll-character-container {
    right: 10px;
    width: 60px;
  }

  .scroll-character {
    width: 42px;
  }

  .scroll-spotlight {
    width: 60px;
  }

  .click-hint {
    font-size: 0.6rem;
    bottom: -20px;
  }
}

@media (max-width: 480px) {
  .scroll-character-container {
    right: 6px;
    width: 50px;
  }

  .scroll-character {
    width: 34px;
  }

  .scroll-spotlight {
    width: 50px;
  }

  .click-hint {
    display: none;
  }
  
  .scroll-track {
    display: none;
  }
}

/* Hide on very small screens */
@media (max-width: 360px) {
  .scroll-character-container {
    display: none;
  }
}

/* ── Reduced Motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .scroll-character-container.dropped .character-wrapper {
    transition: none !important;
  }
  .scroll-spotlight {
    transition: none !important;
  }
}
