/* ==========================================================================
   CONVERSIA BY DITESA — SCROLL-DRIVEN HERO ANIMATION
   Bi-directional scrub, sticky hero container, GPU-accelerated transforms.
   Built following Emil Kowalski /design principles:
   - Interpolated lerp smoothing
   - Only transforms and opacity animated
   - Accessible prefers-reduced-motion fallback
   ========================================================================== */

:root {
  /* EDITABLE CONFIGURATION TOKENS */
  --scroll-track-length: 140vh;
  --scroll-track-length-mobile: 100vh;
  
  --intro-bg-solid: #0A0E14;
  --intro-accent-primary: #4F7DF3;
  --intro-accent-glow: #60a5fa;
  --intro-accent-check: #4F7DF3;
  --intro-text-command: #f8fafc;
  --intro-text-muted: #94a3b8;
  --intro-ease: cubic-bezier(0.23, 1, 0.32, 1);
}

/* Scroll track that provides the 120–150vh runway */
.hero-scroll-track {
  position: relative;
  width: 100%;
  height: var(--scroll-track-length);
  margin: 0;
  padding: 0;
}

/* The Hero section is sticky inside the track */
.hero-section.is-scroll-hero {
  position: sticky !important;
  top: 0 !important;
  height: 100vh !important;
  min-height: 100vh !important;
  width: 100% !important;
  overflow: hidden !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 10;
}

/* Overlay terminal placed on top of hero content */
.hero-intro-overlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  background-color: var(--intro-bg-solid);
  background-image: 
    radial-gradient(ellipse 70% 60% at 50% 45%, rgba(79, 125, 243, 0.14) 0%, rgba(10, 14, 20, 0.98) 75%),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 36px 36px, 36px 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  pointer-events: auto;
  will-change: opacity;
  touch-action: pan-y;
}

/* Skip Button */
.hero-intro-skip-btn {
  position: absolute;
  top: 5.8rem;
  right: 2rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 0.4rem 0.95rem;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.16s var(--intro-ease), background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  z-index: 30;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.hero-intro-skip-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
  border-color: rgba(79, 125, 243, 0.4);
}

.hero-intro-skip-btn:active {
  transform: scale(0.97);
}

.hero-intro-skip-btn kbd {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.65rem;
  color: #cbd5e1;
}

/* Scroll Hint Indicator at bottom of screen */
.hero-scroll-hint {
  position: absolute;
  bottom: 2.2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  color: var(--intro-text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  z-index: 30;
  cursor: pointer;
  transition: opacity 0.3s ease, transform 0.3s ease;
  user-select: none;
}

.scroll-hint-mouse {
  width: 20px;
  height: 32px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  position: relative;
  display: flex;
  justify-content: center;
}

.scroll-hint-wheel {
  width: 3px;
  height: 6px;
  background: var(--intro-accent-primary);
  border-radius: 2px;
  position: absolute;
  top: 6px;
  animation: scrollWheelBob 1.6s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes scrollWheelBob {
  0% { transform: translateY(0); opacity: 1; }
  60% { transform: translateY(8px); opacity: 0; }
  61% { transform: translateY(0); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* Terminal Window Frame */
.hero-intro-window {
  width: 90%;
  max-width: 580px;
  min-height: 240px;
  background: linear-gradient(180deg, rgba(16, 24, 38, 0.96) 0%, rgba(10, 14, 22, 0.98) 100%);
  border: 1px solid rgba(79, 125, 243, 0.22);
  border-radius: 14px;
  box-shadow: 
    0 30px 80px -20px rgba(0, 0, 0, 0.95),
    0 0 35px -10px rgba(79, 125, 243, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.96);
  opacity: 0;
  will-change: transform, opacity;
  cursor: default;
}

/* Terminal Header */
.hero-intro-header {
  padding: 0.85rem 1.2rem;
  background: rgba(255, 255, 255, 0.025);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.hero-intro-dots {
  display: flex;
  align-items: center;
  gap: 7px;
}

.hero-intro-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  opacity: 0.85;
}

.hero-intro-dot.close { background: #ef4444; }
.hero-intro-dot.minimize { background: #f59e0b; }
.hero-intro-dot.maximize { background: #10b981; }

.hero-intro-title {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--intro-text-muted);
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.hero-intro-title-icon {
  color: var(--intro-accent-primary);
}

.hero-intro-spacer {
  width: 48px;
}

/* Terminal Body (Typewriter Sequence) */
.hero-intro-body {
  padding: 1.4rem 1.6rem 1.8rem;
  font-family: var(--font-mono);
  font-size: clamp(0.85rem, 1.5vw, 0.95rem);
  line-height: 1.8;
  color: var(--intro-text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 170px;
}

.intro-terminal-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  white-space: pre-wrap;
  word-break: break-word;
}

.line-prompt-symbol {
  color: var(--intro-accent-primary);
  font-weight: 700;
  margin-right: 0.4rem;
}

.line-system-symbol {
  color: rgba(148, 163, 184, 0.65);
  font-weight: 600;
  margin-right: 0.4rem;
}

.line-command-text {
  color: var(--intro-text-command);
  font-weight: 600;
}

.line-status-text {
  color: #cbd5e1;
}

.line-check-badge {
  color: var(--intro-accent-primary);
  font-weight: 800;
  margin-left: 0.5rem;
  display: inline;
}

/* Blinking terminal cursor */
.intro-cursor {
  display: inline-block;
  width: 8px;
  height: 16px;
  background-color: var(--intro-accent-primary);
  vertical-align: -2px;
  margin-left: 4px;
  box-shadow: 0 0 6px rgba(79, 125, 243, 0.5);
  animation: introCursorBlink 0.85s infinite;
}

@keyframes introCursorBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* Responsive adjustment for Mobile */
@media (max-width: 768px) {
  .hero-scroll-track {
    height: var(--scroll-track-length-mobile);
  }

  .hero-intro-window {
    width: 92%;
    min-height: 210px;
  }
  
  .hero-intro-body {
    padding: 1.1rem 1rem 1.4rem;
    font-size: 0.82rem;
    line-height: 1.7;
    min-height: 150px;
  }
  
  .hero-intro-skip-btn {
    top: 4.8rem;
    right: 1rem;
    padding: 0.35rem 0.8rem;
  }
}

/* ACCESSIBILITY: prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .hero-scroll-track {
    height: auto !important;
  }
  .hero-section.is-scroll-hero {
    position: relative !important;
    top: auto !important;
    height: auto !important;
  }
  .hero-intro-overlay {
    display: none !important;
  }
  .conversia-hero-logo,
  .hero-badge,
  .hero-dark-box,
  .hero-cta-group {
    opacity: 1 !important;
    transform: none !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
}
