/* ══════════════════════════════════════════
   AVO POLISH — Animations + Responsive
   Include AFTER design-system.css
   ══════════════════════════════════════════ */

/* ── SCROLL ANIMATION CLASSES ─────────── */
.avo-fade-up {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.avo-fade-up.avo-visible {
  opacity: 1;
  transform: translateY(0);
}

.avo-fade-in {
  opacity: 0;
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.avo-fade-in.avo-visible {
  opacity: 1;
}

.avo-scale-in {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.avo-scale-in.avo-visible {
  opacity: 1;
  transform: scale(1);
}

/* ── SLIDE FROM LEFT/RIGHT ───────────── */
.avo-slide-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.avo-slide-left.avo-visible {
  opacity: 1;
  transform: translateX(0);
}

.avo-slide-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.avo-slide-right.avo-visible {
  opacity: 1;
  transform: translateX(0);
}

/* ── HERO ENTRANCE (staggered sequence) ─ */
@keyframes avoHeroEnter {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.avo-hero-enter {
  opacity: 0;
  animation: avoHeroEnter 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.avo-hero-enter:nth-child(1) { animation-delay: 0ms; }
.avo-hero-enter:nth-child(2) { animation-delay: 80ms; }
.avo-hero-enter:nth-child(3) { animation-delay: 160ms; }
.avo-hero-enter:nth-child(4) { animation-delay: 240ms; }
.avo-hero-enter:nth-child(5) { animation-delay: 320ms; }
.avo-hero-enter:nth-child(6) { animation-delay: 400ms; }

/* ── PAGE TRANSITION ─────────────────── */
body {
  opacity: 1;
  transition: opacity 0.12s ease;
}
body.page-transitioning {
  opacity: 0;
}

/* scroll-behavior: smooth removed — causes slow/fast/slow jank on trackpads */

/* ── SMOOTH HOVER TRANSITIONS ─────────── */
.card, .card-dark, .testimonial-card, .industry-pill {
  transition: box-shadow 0.3s cubic-bezier(0.22, 1, 0.36, 1), transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.card:hover, .card-dark:hover, .testimonial-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.08);
}
.industry-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

/* ── NAV SCROLL EFFECT ──────────────────── */
.nav {
  transition: background-color 0.3s ease, backdrop-filter 0.3s ease, box-shadow 0.3s ease;
}
.nav.scrolled {
  background-color: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* ── LINK UNDERLINE ANIMATION ───────────── */
.nav-links a, .footer-links a {
  position: relative;
  transition: color 0.2s ease;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-green-primary, #2D7A4F);
  transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.nav-links a:hover::after {
  width: 100%;
}

/* ── FOCUS VISIBLE RING ─────────────────── */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--color-green-primary, #2D7A4F);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── SMOOTH IMAGE/ICON HOVER ────────────── */
.feature-icon, .step-number, .stat-icon {
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.feature-icon:hover, .step-number:hover {
  transform: scale(1.08);
}

/* ── HAMBURGER ANIMATION ──────────────── */
.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
}
.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ── MOBILE NAV SLIDE ─────────────────── */
.mobile-nav {
  transform: translateY(-10px);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.mobile-nav.open {
  display: flex;
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ══════════════════════════════════════════
   RESPONSIVE — 4 Breakpoints
   1024px (tablet landscape)
   768px  (tablet portrait)
   428px  (large phone)
   375px  (small phone)
   ══════════════════════════════════════════ */

/* ── TABLET LANDSCAPE (1024px) ────────── */
@media (max-width: 1024px) {
  :root {
    --text-hero: 56px;
    --text-6xl: 52px;
    --text-5xl: 44px;
  }

  .container, .container-md { max-width: 100%; padding: 0 32px; }
  .nav { padding: 0 24px; }
  .nav-links { gap: 20px; }
  .nav-links a { font-size: 13px; }

  .grid-4 { grid-template-columns: repeat(2, 1fr); }

  .hero-split {
    gap: 40px;
  }

  /* Pricing cards */
  .pricing-cards, [class*="pricing-grid"] {
    gap: 16px;
  }

  .section { padding: 72px 0; }
}

/* ── TABLET PORTRAIT (768px) ─────────── */
@media (max-width: 768px) {
  /* Before/after comparison stack */
  .ba-grid { grid-template-columns: 1fr !important; }
  .ba-grid > div:first-child { border-radius: 16px 16px 0 0; }
  .ba-grid > div:last-child { border-radius: 0 0 16px 16px; }

  :root {
    --text-hero: 44px;
    --text-6xl: 40px;
    --text-5xl: 36px;
    --text-4xl: 32px;
    --text-3xl: 26px;
  }

  .container, .container-sm, .container-md { padding: 0 20px; }
  .nav { padding: 0 16px; height: 56px; }
  .nav-logo { font-size: 20px; }
  .nav-logo-o { width: 20px; height: 20px; font-size: 12px; }
  .nav-links { display: none; }
  .nav-actions .btn { height: 38px; padding: 0 16px; font-size: 13px; }
  .hamburger { display: flex; }

  .hero-split {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 0 20px;
  }
  .hero { padding: 80px 0 60px; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; gap: 16px; }

  .section { padding: 56px 0; }
  .section-sm { padding: 40px 0; }

  .stat-num { font-size: 40px; }

  .footer-top { flex-direction: column; gap: 24px; align-items: center; text-align: center; }
  .footer-links { flex-wrap: wrap; justify-content: center; gap: 16px; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }

  .btn-lg { height: 48px; padding: 0 24px; font-size: 15px; }

  /* iPhone mockup scales down */
  .iphone-shell { width: 260px; border-radius: 38px; padding: 12px; }
  .iphone-screen { border-radius: 28px; min-height: 400px; }
  .iphone-mockup { order: -1; } /* Put phone above text on mobile */

  /* Testimonials stack */
  .testimonial-card { padding: 20px 20px 20px 24px; }

  /* Process/timeline stack */
  .timeline, [class*="timeline"] { gap: 20px; }

  /* Tables scroll horizontally */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* 2-col grids that should stay 2-col on tablet */
  .grid-2-keep { grid-template-columns: repeat(2, 1fr); }
}

/* ── LARGE PHONE (428px) ─────────────── */
@media (max-width: 428px) {
  :root {
    --text-hero: 36px;
    --text-6xl: 34px;
    --text-5xl: 30px;
    --text-4xl: 28px;
    --text-3xl: 24px;
    --text-2xl: 20px;
  }

  .container, .container-sm, .container-md { padding: 0 16px; }
  .nav { padding: 0 12px; }

  .hero { padding: 64px 0 48px; }
  .hero-btns { flex-direction: column; }
  .hero-btns .btn { width: 100%; }
  .hero-meta { flex-direction: column; gap: 8px; }

  .section { padding: 48px 0; }
  .section-sm { padding: 32px 0; }

  .card { padding: 24px; }
  .card-dark { padding: 24px; }
  .stat-num { font-size: 36px; }

  .btn { height: 42px; padding: 0 18px; font-size: 14px; }
  .btn-lg { height: 46px; padding: 0 20px; }

  .iphone-shell { width: 240px; }

  /* Full-width CTAs */
  .cta-section .btn, .hero-btns .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ── SMALL PHONE (375px) ─────────────── */
@media (max-width: 375px) {
  :root {
    --text-hero: 32px;
    --text-6xl: 30px;
    --text-5xl: 28px;
    --text-4xl: 26px;
  }

  .container, .container-sm, .container-md { padding: 0 14px; }

  .hero { padding: 56px 0 40px; }

  .card { padding: 20px; }
  .card-dark { padding: 20px; }
  .stat-num { font-size: 32px; }

  .section { padding: 40px 0; }

  .iphone-shell { width: 220px; }
}

/* ── CAPACITY BAR RESPONSIVE ─────────── */
@media (max-width: 768px) {
  [style*="capacity"] { font-size: 12px !important; }
}
@media (max-width: 428px) {
  [style*="capacity"] {
    flex-wrap: wrap !important;
    font-size: 11px !important;
    padding: 8px 12px !important;
  }
}

/* ── CTA SECTION RESPONSIVE ──────────── */
@media (max-width: 768px) {
  .cta-section { padding: 80px 0 !important; }
  .cta-section h2 { font-size: clamp(28px, 6vw, 48px) !important; }
  .cta-section p { font-size: 16px !important; }
}
@media (max-width: 428px) {
  .cta-section { padding: 56px 0 !important; }
  .cta-note { font-size: 11px !important; }
}

/* ── PREFERS REDUCED MOTION ──────────── */
@media (prefers-reduced-motion: reduce) {
  .avo-fade-up, .avo-fade-in, .avo-scale-in {
    transition: none;
    opacity: 1;
    transform: none;
  }
  .avo-hero-enter {
    animation: none;
    opacity: 1;
  }
  body {
    animation: none;
    opacity: 1;
  }
}
