/* ============================================================
   mobile-magic.css — Premium mobile animations & visual effects
   Only active on screens <= 768px
   ============================================================ */

/* ============================================================
   1. ANIMATED AURORA BACKGROUND
   ============================================================ */
@media (max-width: 768px) {

  /* Re-enable a lighter ambient bg on mobile.
     Use position:absolute on a tall wrapper instead of position:fixed
     to avoid iOS Safari scroll-trapping (fixed full-screen elements
     can intercept first-touch scroll events). */
  .bg-ambient {
    display: block !important;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    min-height: 100vh;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
  }
  .bg-ambient::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
      radial-gradient(ellipse at 20% 50%, rgba(124,92,252,0.06) 0%, transparent 50%),
      radial-gradient(ellipse at 80% 20%, rgba(52,199,89,0.04) 0%, transparent 50%),
      radial-gradient(ellipse at 50% 80%, rgba(100,180,255,0.05) 0%, transparent 50%);
    animation: auroraShift 20s ease-in-out infinite alternate;
    will-change: transform;
  }
  @keyframes auroraShift {
    0%   { transform: translate(0, 0) rotate(0deg); }
    33%  { transform: translate(5%, -3%) rotate(2deg); }
    66%  { transform: translate(-3%, 5%) rotate(-1deg); }
    100% { transform: translate(2%, -2%) rotate(1deg); }
  }

  .scroll-progress {
    display: none !important;
  }

  /* ============================================================
     3. HERO SECTION ENHANCEMENTS
     ============================================================ */

  /* Re-enable hero glow on mobile (lighter) */
  .hero-glow {
    display: block !important;
    width: 400px;
    height: 300px;
    top: 5%;
    left: 10%;
    opacity: 0;
    animation: heroGlowFade 2s ease 0.5s forwards;
  }
  @keyframes heroGlowFade {
    to { opacity: 0.7; }
  }

  /* Badge shimmer */
  .hero-badge {
    position: relative;
    overflow: hidden;
  }
  .hero-badge::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
      90deg,
      transparent,
      rgba(255,255,255,0.08),
      transparent
    );
    animation: badgeShimmer 3s ease-in-out 1.5s infinite;
  }
  @keyframes badgeShimmer {
    0%   { left: -100%; }
    100% { left: 200%; }
  }

  /* Hero heading — reveal word by word */
  .hero h1 .word {
    display: inline-block;
    opacity: 0;
    transform: translateY(30px) rotateX(40deg);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .hero h1 .word.revealed {
    opacity: 1;
    transform: translateY(0) rotateX(0deg);
  }

  /* Typewriter cursor for hero sub */
  .hero-sub.typing::after {
    content: '|';
    display: inline;
    color: rgba(124,92,252,0.7);
    animation: typeCursor 0.7s step-end infinite;
    font-weight: 300;
  }
  @keyframes typeCursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
  }

  /* Kill ALL effects on download button on mobile */
  .btn-primary,
  .hero-cta-group .btn-primary {
    -webkit-tap-highlight-color: transparent !important;
    outline: none !important;
    box-shadow: none !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }
  .btn-primary::before,
  .btn-primary::after,
  .hero-cta-group .btn-primary::before,
  .hero-cta-group .btn-primary::after {
    display: none !important;
    content: none !important;
  }
  .btn-primary:hover,
  .btn-primary:focus,
  .btn-primary:focus-visible,
  .btn-primary:active {
    outline: none !important;
    box-shadow: none !important;
    transform: none !important;
  }

  /* ============================================================
     4. FLOATING PARTICLES
     ============================================================ */
  .mobile-particles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    min-height: 100vh;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
  }
  .mobile-particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    animation: particleFloat linear infinite;
  }
  .mobile-particle:nth-child(1) { left: 10%; animation-duration: 18s; animation-delay: 0s; width: 3px; height: 3px; }
  .mobile-particle:nth-child(2) { left: 25%; animation-duration: 22s; animation-delay: -4s; }
  .mobile-particle:nth-child(3) { left: 40%; animation-duration: 16s; animation-delay: -8s; width: 2.5px; height: 2.5px; }
  .mobile-particle:nth-child(4) { left: 55%; animation-duration: 20s; animation-delay: -2s; }
  .mobile-particle:nth-child(5) { left: 70%; animation-duration: 24s; animation-delay: -6s; width: 3px; height: 3px; }
  .mobile-particle:nth-child(6) { left: 85%; animation-duration: 19s; animation-delay: -10s; }
  .mobile-particle:nth-child(7) { left: 15%; animation-duration: 21s; animation-delay: -12s; width: 2px; height: 2px; }
  .mobile-particle:nth-child(8) { left: 60%; animation-duration: 17s; animation-delay: -3s; }
  @keyframes particleFloat {
    0%   { bottom: -10px; opacity: 0; transform: translateX(0); }
    10%  { opacity: 0.6; }
    90%  { opacity: 0.6; }
    100% { bottom: 110vh; opacity: 0; transform: translateX(40px); }
  }

  /* ============================================================
     5. FEATURE SECTIONS — ADVANCED REVEALS
     ============================================================ */

  /* Section label — slide in from left with line */
  .section-label {
    position: relative;
    overflow: hidden;
  }
  .feature-text .section-label.revealed::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, rgba(124,92,252,0.5), transparent);
    animation: labelLine 0.8s ease forwards;
  }
  @keyframes labelLine {
    from { transform: translateX(-100%); }
    to   { transform: translateX(0); }
  }

  /* Feature headings — clip reveal (negative bottom to preserve descenders) */
  .feature-text h2.clip-reveal {
    clip-path: inset(-10px 100% -10px 0);
    transition: clip-path 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .feature-text h2.clip-reveal.revealed {
    clip-path: inset(-10px 0% -10px 0);
  }

  /* Feature descriptions — fade up with blur */
  .feature-text p.blur-reveal {
    opacity: 0;
    transform: translateY(16px);
    filter: blur(6px);
    transition: opacity 0.7s ease, transform 0.7s ease, filter 0.7s ease;
  }
  .feature-text p.blur-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }

  /* Feature mockups — fade up */
  .feature-mockup.tilt-enter {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .feature-row.reverse .feature-mockup.tilt-enter {
    transform: translateY(30px);
  }
  .feature-mockup.tilt-enter.revealed {
    opacity: 1;
    transform: translateY(0);
  }

  /* Feature panel divider — animated gradient line */
  .feature-panel {
    position: relative;
  }
  .feature-panel::after {
    content: '';
    display: block;
    width: 60%;
    max-width: 200px;
    height: 1px;
    margin: 0 auto;
    background: linear-gradient(
      90deg,
      transparent,
      rgba(255,255,255,0.08),
      transparent
    );
    opacity: 0;
    transition: opacity 0.6s ease;
  }
  .feature-panel.seen::after {
    opacity: 1;
  }

  /* ============================================================
     6. WORKS-WITH CARDS — STAGGERED POP-IN
     ============================================================ */
  .works-card.pop-in {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  .works-card.pop-in.revealed {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  /* Active touch feedback for cards */
  .works-card:active {
    transform: scale(0.96) !important;
    transition-duration: 0.1s !important;
  }

  /* Card icon gentle float */
  .works-card.revealed .works-card-icon {
    animation: iconFloat 3s ease-in-out infinite;
    animation-delay: var(--float-delay, 0s);
  }
  @keyframes iconFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-3px); }
  }

  /* Animated border glow on hover/tap */
  .works-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(
      135deg,
      rgba(124,92,252,0.15),
      rgba(52,199,89,0.15),
      rgba(100,180,255,0.15)
    );
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: var(--radius-lg);
  }
  .works-card {
    position: relative;
    overflow: visible;
  }

  /* ============================================================
     7. PRICING — DRAMATIC REVEAL
     ============================================================ */

  /* Pricing cards — spring entrance */
  .pricing-card.spring-in {
    opacity: 0;
    transform: translateY(40px) scale(0.92);
    transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  .pricing-card.spring-in.revealed {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  /* Featured card — animated gradient border */
  .pricing-card.featured {
    position: relative;
    overflow: visible;
  }
  .pricing-card.featured::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: var(--radius-xl);
    background: linear-gradient(
      var(--border-angle, 0deg),
      rgba(124,92,252,0.3),
      rgba(52,199,89,0.2),
      rgba(100,180,255,0.3),
      rgba(124,92,252,0.3)
    );
    z-index: -1;
    animation: borderRotate 6s linear infinite;
  }
  @keyframes borderRotate {
    to { --border-angle: 360deg; }
  }
  /* Fallback for browsers without @property */
  @supports not (background: paint(something)) {
    .pricing-card.featured::before {
      background: linear-gradient(135deg, rgba(124,92,252,0.2), rgba(52,199,89,0.15), rgba(100,180,255,0.2));
      animation: borderShimmer 3s ease-in-out infinite alternate;
    }
    @keyframes borderShimmer {
      0%   { opacity: 0.5; }
      100% { opacity: 1; }
    }
  }

  /* ============================================================
     8. FINAL CTA — DRAMATIC ENTRANCE
     ============================================================ */

  .final-cta {
    position: relative;
    overflow: hidden;
  }
  .final-cta::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(124,92,252,0.08), transparent 70%);
    animation: ctaGlow 4s ease-in-out infinite;
    pointer-events: none;
  }
  @keyframes ctaGlow {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50%      { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
  }

  /* Override the base opacity:0 from footer.css for mobile —
     the individual .line spans handle their own opacity */
  .final-cta h2.split-reveal {
    opacity: 1 !important;
    transform: none !important;
  }

  .final-cta h2.split-reveal .line {
    display: block;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .final-cta h2.split-reveal .line.revealed {
    opacity: 1;
    transform: translateY(0);
  }

  /* ============================================================
     9. DEMO SECTION — MOBILE PHONE FRAME
     ============================================================ */

  /* Scan line — disabled */

  /* Kill scroll/touch interaction on inner mockup overlays only */
  .overlay-content-area,
  .study-content-area,
  .study-overlay,
  .quick-prompt-overlay,
  .mini-overlay,
  .presto-overlay,
  .demo-overlay,
  .demo-overlay .overlay-content-area {
    overflow: hidden !important;
    max-height: none !important;
    -webkit-overflow-scrolling: auto !important;
    touch-action: none !important;
    pointer-events: none !important;
  }

  /* Feature mockup containers must allow scroll-through on mobile.
     touch-action: manipulation allows scroll + pinch but blocks
     double-tap-zoom and long-press, which is what we want. */
  .feature-mockup {
    overflow: hidden !important;
    pointer-events: none !important;
    touch-action: manipulation !important;
  }

  /* Demo overlay entrance — slide in from right */
  .demo-overlay.slide-up {
    opacity: 0;
    transform: translateX(100px);
    transition: opacity 0.7s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .demo-overlay.slide-up.revealed {
    opacity: 1;
    transform: translateX(0);
  }

  /* ============================================================
     10. NAV ENHANCEMENTS
     ============================================================ */

  /* Mobile menu items — staggered entrance */
  .nav-mobile-menu.open a {
    animation: menuItemIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  .nav-mobile-menu.open a:nth-child(1) { animation-delay: 0.1s; }
  .nav-mobile-menu.open a:nth-child(2) { animation-delay: 0.2s; }
  .nav-mobile-menu.open a:nth-child(3) { animation-delay: 0.3s; }
  @keyframes menuItemIn {
    from {
      opacity: 0;
      transform: translateY(20px) scale(0.95);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }

  /* ============================================================
     11. SMOOTH SECTION SPACING
     ============================================================ */

  /* Tighter, more flowing sections on mobile */
  .features-section {
    padding-top: 20px;
  }

  .feature-row {
    padding-top: 48px;
    padding-bottom: 48px;
  }

  /* Center all feature mockups and their overlays */
  .feature-mockup {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    overflow: hidden;
  }
  .feature-mockup > *:not(.macbook-corner) {
    margin: 0 auto !important;
    max-width: calc(100vw - 40px) !important;
    flex-shrink: 0;
  }

  /* ============================================================
     12. STUDY OVERLAY MOCKUP ENHANCEMENTS
     ============================================================ */

  /* Subtle glow behind mockup overlays */
  .study-overlay,
  .quick-prompt-overlay,
  .mini-overlay {
    position: relative;
  }
  .study-overlay::after,
  .quick-prompt-overlay::after,
  .mini-overlay::after {
    content: '';
    position: absolute;
    inset: -20px;
    background: radial-gradient(ellipse, rgba(124,92,252,0.06), transparent 70%);
    z-index: -1;
    border-radius: 50%;
    filter: blur(20px);
    opacity: 0;
    transition: opacity 0.6s ease;
  }
  .feature-mockup.tilt-enter.revealed .study-overlay::after,
  .feature-mockup.tilt-enter.revealed .quick-prompt-overlay::after,
  .feature-mockup.tilt-enter.revealed .mini-overlay::after {
    opacity: 1;
  }

  /* ============================================================
     13. FOOTER ENTRANCE
     ============================================================ */
  .footer {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s ease, transform 0.6s ease;
  }
  .footer.revealed {
    opacity: 1;
    transform: translateY(0);
  }

  /* ============================================================
     14. PERFORMANCE: Reduce motion for those who prefer it
     ============================================================ */
  @media (prefers-reduced-motion: reduce) {
    .bg-ambient::before,
    .mobile-particle,
    .hero-badge::after,
    .hero-sub.typing::after,
    .hero-cta-group .btn-primary::before,
    .final-cta::before,
    .pricing-card.featured::before,
    .scroll-progress {
      animation: none !important;
    }
    .hero h1 .word,
    .feature-text h2.clip-reveal,
    .feature-text p.blur-reveal,
    .feature-mockup.tilt-enter,
    .works-card.pop-in,
    .pricing-card.spring-in,
    .demo-overlay.slide-up,
    .final-cta h2.split-reveal .line,
    .footer {
      opacity: 1 !important;
      transform: none !important;
      clip-path: none !important;
      filter: none !important;
    }
  }

} /* end @media (max-width: 768px) */
