/* ============================================
   DE PLATFORM - Motion Enhancements v2
   Scroll interactions, counters, tilt, progress,
   sticky CTA, FAQ, social proof, testimonials,
   cursor glow, keyboard nav, page entrance, easter egg
============================================ */

/* ==========================================
   SCROLL PROGRESS BAR
========================================== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--accent-gradient);
  z-index: 9999;
  transition: none;
  pointer-events: none;
  box-shadow: 0 0 8px rgba(92, 182, 249, 0.4);
}

/* ==========================================
   ACTIVE NAV SECTION HIGHLIGHT
========================================== */
.nav__link--section-active {
  color: var(--text-primary) !important;
}

.nav__link--section-active::after {
  width: 100% !important;
  background: var(--accent) !important;
}

/* ==========================================
   WORD REVEAL ANIMATION
========================================== */
.word-reveal .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(18px) rotateX(-20deg);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.word-reveal.revealed .word {
  opacity: 1;
  transform: translateY(0) rotateX(0);
}

.word-reveal .text-gradient .word {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ==========================================
   3D CARD TILT
========================================== */
.tilt-card {
  transform-style: preserve-3d;
  perspective: 800px;
}

.tilt-card > * {
  transform: translateZ(0);
}

/* ==========================================
   HOW IT WORKS - ANIMATED PROGRESS LINE
========================================== */
@media (min-width: 769px) {
  .process--enhanced::before {
    background: linear-gradient(90deg, var(--accent) var(--line-progress, 0%), var(--border-color) var(--line-progress, 0%)) !important;
    transition: none;
  }
}

/* ==========================================
   SCROLL-REVEAL VARIANTS
========================================== */
.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-scale.revealed {
  opacity: 1;
  transform: scale(1);
}

/* ==========================================
   COUNTER DIGIT ROLL EFFECT
========================================== */
.counter-rolling {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
}

.counter-rolling .digit {
  display: inline-block;
  animation: digitRoll 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes digitRoll {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   MAGNETIC BUTTON EFFECT
========================================== */
.btn--magnetic {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.3s ease,
              background 0.15s ease;
}

/* ==========================================
   SECTION SEPARATOR GLOW
========================================== */
.section--glow-enter::after {
  width: 200px !important;
  background: linear-gradient(90deg, transparent, rgba(92, 182, 249, 0.35), transparent) !important;
  transition: width 0.8s ease, opacity 0.8s ease;
}

/* ==========================================
   PRICING CARD FEATURED GLOW
========================================== */
.pricing-card--featured.revealed {
  box-shadow: var(--shadow-card-hover), 0 0 40px rgba(92, 182, 249, 0.08);
}

/* ==========================================
   TRACK CARD GRADIENT BORDER ON HOVER
========================================== */
.track-card--featured:hover {
  border-image: linear-gradient(135deg, var(--accent), rgba(168, 85, 247, 0.5)) 1;
  border-image-slice: 1;
}

/* ==========================================
   FLOATING INDICATOR (scroll down hint)
========================================== */
.scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0;
  animation: scrollHintIn 0.6s ease 1.5s forwards;
  z-index: 2;
}

.scroll-hint__arrow {
  width: 20px;
  height: 20px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollHintIn {
  to { opacity: 1; }
}

@keyframes scrollBounce {
  0%, 100% { transform: rotate(45deg) translate(0, 0); opacity: 0.6; }
  50% { transform: rotate(45deg) translate(4px, 4px); opacity: 1; }
}

.hero.scrolled-past .scroll-hint {
  opacity: 0 !important;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* ==========================================
   SMOOTH NUMBER TRANSITION
========================================== */
.stat-animate {
  transition: color 0.3s ease;
}

.stat-animate.counting {
  color: var(--accent);
}

/* Suffix pop after counter finishes */
.stat-suffix {
  display: inline-block;
  opacity: 0;
  transform: scale(0.5) translateY(4px);
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat-suffix.popped {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* ==========================================
   SUBTLE GRAIN TEXTURE OVERLAY
========================================== */
.grain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.015;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 256px;
}

[data-theme="light"] .grain-overlay {
  opacity: 0.025;
}

/* ==========================================
   1. STICKY CTA BAR
========================================== */
.sticky-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  background: var(--bg-nav-scroll);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  padding: 12px 0;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.sticky-cta.visible {
  transform: translateY(0);
  pointer-events: auto;
}

.sticky-cta__inner {
  max-width: var(--max-width, 1200px);
  margin: 0 auto;
  padding: 0 var(--space-lg, 24px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sticky-cta__text {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.sticky-cta__text strong {
  color: var(--text-primary);
  font-weight: 700;
}

.sticky-cta__actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.sticky-cta__btn {
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md, 8px);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.sticky-cta__btn--primary {
  background: var(--accent);
  color: var(--text-on-accent);
}

.sticky-cta__btn--primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(92, 182, 249, 0.25);
}

.sticky-cta__btn:focus-visible,
.sticky-cta__close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sticky-cta__close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 50%;
  transition: color 0.2s, background 0.2s;
  font-size: 18px;
  flex-shrink: 0;
}

.sticky-cta__close:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

/* ==========================================
   2. FAQ ACCORDION
========================================== */
.faq-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: var(--space-3xl, 64px);
  align-items: start;
}

.faq-intro {
  position: sticky;
  top: calc(var(--nav-height, 60px) + 32px);
}

.faq-intro__title {
  margin-bottom: var(--space-md, 16px);
}

.faq-intro__text {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-xl, 32px);
}

.faq-intro__contact {
  font-size: 14px;
  color: var(--text-muted);
}

.faq-intro__contact a {
  color: var(--accent);
  transition: opacity 0.2s;
}

.faq-intro__contact a:hover {
  opacity: 0.8;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.faq-item {
  border-bottom: 1px solid var(--border-color);
}

.faq-item:first-child {
  border-top: 1px solid var(--border-color);
}

.faq-question {
  width: 100%;
  text-align: left;
  padding: 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  transition: color 0.2s;
}

.faq-question:hover {
  color: var(--accent);
}

.faq-question:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.faq-chevron {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s;
}

.faq-item.open .faq-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  opacity: 0;
}

.faq-item.open .faq-answer {
  opacity: 1;
}

.faq-answer__inner {
  padding: 0 0 20px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ==========================================
   3. SOCIAL PROOF TICKER
========================================== */
.social-proof-ticker {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 800;
  max-width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg, 12px);
  padding: 14px 18px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.social-proof-ticker.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* When sticky CTA is visible, move ticker up */
.sticky-cta.visible ~ .social-proof-ticker {
  bottom: 76px;
}

.social-proof-ticker__content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 18px;
}

.social-proof-ticker__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  color: var(--accent);
  font-weight: 600;
}

.social-proof-ticker__text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.social-proof-ticker__text strong {
  color: var(--text-primary);
  font-weight: 600;
}

.social-proof-ticker__time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.social-proof-ticker__dismiss {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background 0.2s ease;
}

.social-proof-ticker__dismiss:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.social-proof-ticker__dismiss:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ==========================================
   4. BACK TO TOP BUTTON
========================================== */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 800;
  width: 44px;
  height: 44px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease, color 0.2s, background 0.2s, border-color 0.2s;
  pointer-events: none;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* When sticky CTA is visible, move button up */
.sticky-cta.visible ~ .back-to-top {
  bottom: 76px;
}

.back-to-top:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.back-to-top:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.back-to-top svg {
  width: 20px;
  height: 20px;
}

/* ==========================================
   5. TESTIMONIAL CAROUSEL
========================================== */
.testimonial-carousel {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
  min-height: 160px;
}

.testimonial-carousel:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 8px;
  border-radius: 10px;
}

.testimonial-slide {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  text-align: center;
}

.testimonial-slide.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  position: relative;
}

.testimonial-slide__quote {
  font-size: 18px;
  font-style: italic;
  color: var(--text-primary);
  line-height: 1.7;
  margin-bottom: 16px;
  position: relative;
}

.testimonial-slide__quote::before {
  content: '\201C';
  font-size: 48px;
  color: var(--accent);
  opacity: 0.3;
  position: absolute;
  top: -20px;
  left: -10px;
  font-family: Georgia, serif;
  line-height: 1;
}

.testimonial-slide__author {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.testimonial-slide__author strong {
  color: var(--text-secondary);
}

.testimonial-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}

.testimonial-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-color);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.3s, transform 0.3s;
}

.testimonial-dot.active {
  background: var(--accent);
  transform: scale(1.3);
}

.testimonial-dot:hover {
  background: var(--accent);
}

.testimonial-dot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.testimonial-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 0;
  z-index: 2;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.testimonial-nav--prev {
  left: -52px;
}

.testimonial-nav--next {
  right: -52px;
}

.testimonial-nav:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-50%) scale(1.03);
}

.testimonial-nav:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.testimonial-nav__icon {
  width: 18px;
  height: 18px;
  display: block;
}

/* ==========================================
   6. GATE CARD HOVER PREVIEW TOOLTIP
========================================== */
.gate-preview {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  width: 280px;
  background: var(--bg-elevated, rgba(5, 10, 48, 0.95));
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg, 12px);
  padding: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
}

.gate-card:hover .gate-preview {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.gate-card:focus-within .gate-preview {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.gate-preview__chapters {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.gate-preview__desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 10px;
}

.gate-preview__cta {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.gate-preview__cta::after {
  content: '\2192';
  transition: transform 0.2s;
}

.gate-card:hover .gate-preview__cta::after {
  transform: translateX(3px);
}

/* ==========================================
   7. CURSOR GLOW TRAIL
========================================== */
.cursor-glow {
  position: fixed;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(92, 182, 249, 0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s;
  will-change: left, top;
}

[data-theme="light"] .cursor-glow {
  background: radial-gradient(circle, rgba(92, 182, 249, 0.06) 0%, transparent 70%);
}

/* ==========================================
   8. PAGE ENTRANCE TRANSITION
========================================== */
.page-entrance {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  z-index: 99999;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.page-entrance.done {
  opacity: 0;
}

/* ==========================================
   9. KEYBOARD NAV INDICATOR
========================================== */
.section-focus-ring {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: var(--radius-lg, 12px);
}

.keyboard-nav-hint {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full, 9999px);
  padding: 8px 18px;
  font-size: 12px;
  color: var(--text-muted);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 850;
  pointer-events: none;
  white-space: nowrap;
}

.keyboard-nav-hint.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.keyboard-nav-hint kbd {
  display: inline-block;
  padding: 2px 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  font-family: inherit;
  font-size: 11px;
  color: var(--text-secondary);
  margin: 0 2px;
}

/* ==========================================
   10. EASTER EGG — SHOOTING STAR BURST
========================================== */
@keyframes easterEggPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.logo-easter-egg {
  animation: easterEggPulse 0.3s ease;
}

/* ==========================================
   11. DYNAMIC GREETING
========================================== */
.hero__greeting {
  display: block;
  font-size: 14px;
  color: var(--accent);
  font-weight: 500;
  margin-top: 0;
  margin-bottom: 16px;
  opacity: 0;
  transform: translateY(8px);
  animation: greetingIn 0.5s ease 0.8s forwards;
}

@keyframes greetingIn {
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   REDUCED MOTION
========================================== */
@media (prefers-reduced-motion: reduce) {
  .scroll-progress,
  .scroll-hint,
  .grain-overlay,
  .cursor-glow,
  .page-entrance {
    display: none !important;
  }

  .word-reveal .word,
  .reveal-left,
  .reveal-right,
  .reveal-scale {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .counter-rolling .digit {
    animation: none !important;
  }

  .faq-answer {
    transition: none !important;
  }

  .social-proof-ticker,
  .testimonial-slide {
    transition: none !important;
  }

  .sticky-cta {
    transition: none !important;
  }
}

/* ==========================================
   MOBILE ADJUSTMENTS
========================================== */
@media (max-width: 768px) {
  .scroll-hint {
    display: none;
  }

  .scroll-progress {
    height: 2px;
  }

  .sticky-cta__text {
    display: none;
  }

  .sticky-cta__inner {
    justify-content: center;
  }

  .social-proof-ticker {
    left: 12px;
    right: 12px;
    max-width: none;
    bottom: 12px;
  }

  .sticky-cta.visible ~ .social-proof-ticker {
    bottom: 68px;
  }

  .back-to-top {
    bottom: 12px;
    right: 12px;
  }

  .sticky-cta.visible ~ .back-to-top {
    bottom: 68px;
  }

  .faq-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl, 32px);
  }

  .faq-intro {
    position: static;
  }

  .gate-preview {
    display: none;
  }

  .cursor-glow {
    display: none;
  }

  .keyboard-nav-hint {
    display: none;
  }

  .testimonial-nav {
    display: none;
  }
}
