/* ============================================================
   V2 MOTION — Emil Kowalski philosophy applied to Kopa V2
   Layered on top of v2-editorial.css. Load AFTER it.

   Core principles:
   - Taste over flash. Invisible details compound.
   - UI animations under 300ms. ease-out for entries.
   - Custom cubic-bezier curves (not default easings).
   - Buttons feel responsive via :active transform.
   - Scale(0.97) on press — not scale(0).
   - Interruptible via transitions (not keyframes).
   - Respect prefers-reduced-motion.
   - Hover gated behind (hover: hover) and (pointer: fine).
   ============================================================ */

:root {
  /* Custom easing curves (stronger than built-in) */
  --v2-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --v2-ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --v2-ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  /* Standard durations */
  --v2-dur-feedback: 140ms;    /* button press */
  --v2-dur-ui: 220ms;          /* dropdowns, hovers */
  --v2-dur-surface: 320ms;     /* modals, drawers, reveal */
  --v2-dur-marquee: 60s;       /* logo scroll */
}

/* ---- SCROLL-REVEAL — beefed up for visible motion ----
   Larger translate distance (36px), longer duration (650ms), stronger stagger.
   Osh wanted motion you can actually SEE on scroll.
*/
.fade-up {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 650ms var(--v2-ease-out),
              transform 650ms var(--v2-ease-out);
}
.fade-up.visible,
.fade-up.is-in,
.fade-up.in-view {
  opacity: 1;
  transform: translateY(0);
}
/* Stagger — more pronounced, 120ms between items (visible cascade) */
.fade-up.delay-1 { transition-delay: 120ms; }
.fade-up.delay-2 { transition-delay: 240ms; }
.fade-up.delay-3 { transition-delay: 360ms; }
.fade-up.delay-4 { transition-delay: 480ms; }
.fade-up.delay-5 { transition-delay: 600ms; }

/* ---- BUTTON FEEDBACK ---- */
/* Every pressable gets a scale(0.97) on :active — the "listening" feel */
.btn,
.v2-btn,
.pv-tier-cta,
.v2-foundation-demo,
.v2-hero-pill,
.hero-tertiary-link,
button {
  transition: background var(--v2-dur-ui) var(--v2-ease-out),
              color var(--v2-dur-ui) var(--v2-ease-out),
              border-color var(--v2-dur-ui) var(--v2-ease-out),
              transform var(--v2-dur-feedback) var(--v2-ease-out);
}
.btn:active,
.v2-btn:active,
.pv-tier-cta:active,
.v2-foundation-demo:active,
.hero-tertiary-link:active {
  transform: scale(0.97);
}

/* ---- HOVER STATES (gated behind real pointer) — more pronounced lift ---- */
@media (hover: hover) and (pointer: fine) {
  .btn:hover,
  .v2-btn:hover {
    transform: translateY(-3px);
  }
  .pv-tier-cta:hover {
    transform: translateY(-3px);
  }
  .pv-tier-row {
    transition: border-color var(--v2-dur-ui) var(--v2-ease-out),
                transform var(--v2-dur-ui) var(--v2-ease-out),
                box-shadow var(--v2-dur-ui) var(--v2-ease-out);
  }
  .pv-tier-row:hover {
    border-color: rgba(245, 166, 35, 0.5);
    transform: translateY(-4px);
  }
  .v2-petrol-card {
    transition: border-color var(--v2-dur-ui) var(--v2-ease-out),
                background var(--v2-dur-ui) var(--v2-ease-out),
                transform var(--v2-dur-ui) var(--v2-ease-out);
  }
  .v2-petrol-card:hover {
    background: rgba(245, 166, 35, 0.06);
    transform: translateY(-3px);
  }
  .pain-item {
    transition: transform var(--v2-dur-ui) var(--v2-ease-out),
                border-color var(--v2-dur-ui) var(--v2-ease-out);
  }
  .pain-item:hover {
    transform: translateY(-3px);
    border-color: rgba(245, 166, 35, 0.4);
  }
}

/* ---- NAV LINK HOVERS ---- */
.nav-links a,
.nav-login {
  transition: color var(--v2-dur-ui) var(--v2-ease-out);
}

/* ---- SERVICES DROPDOWN REFINEMENT ---- */
.nav-services-menu {
  transform-origin: top center;
  transform: translateX(-50%) scale(0.96) translateY(-4px);
  transition: opacity var(--v2-dur-ui) var(--v2-ease-out),
              transform var(--v2-dur-ui) var(--v2-ease-out),
              visibility var(--v2-dur-ui) var(--v2-ease-out);
}
.nav-services-dropdown:hover .nav-services-menu,
.nav-services-dropdown:focus-within .nav-services-menu {
  transform: translateX(-50%) scale(1) translateY(0);
}
.nav-service-item {
  transition: background var(--v2-dur-ui) var(--v2-ease-out),
              transform var(--v2-dur-ui) var(--v2-ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .nav-service-item:hover {
    transform: translateX(2px);
  }
}

/* ---- FOUNDATION ROW EXPANSION ----
   Browser default <details> expand is instant. We use JS-free CSS to
   fade the body in via animation keyed to [open]. Transitions on <details>
   are tricky; animation on first-open is the cleanest Emil-approved option.
*/
.v2-foundation-row-click {
  transition: background var(--v2-dur-ui) var(--v2-ease-out);
}
.v2-foundation-row-click[open] {
  background: rgba(255, 255, 255, 0.015);
}
.v2-foundation-row-click > summary {
  transition: color var(--v2-dur-ui) var(--v2-ease-out),
              padding var(--v2-dur-ui) var(--v2-ease-out);
}
.v2-foundation-plus {
  transition: transform var(--v2-dur-surface) var(--v2-ease-out),
              background var(--v2-dur-ui) var(--v2-ease-out);
}
.v2-foundation-row-click[open] .v2-foundation-plus {
  transform: rotate(45deg);
  background: rgba(245, 166, 35, 0.12);
}
.v2-foundation-body {
  animation: v2-foundation-expand 360ms var(--v2-ease-out);
}
@keyframes v2-foundation-expand {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.v2-foundation-demo {
  transition: background var(--v2-dur-ui) var(--v2-ease-out),
              color var(--v2-dur-ui) var(--v2-ease-out),
              border-color var(--v2-dur-ui) var(--v2-ease-out),
              transform var(--v2-dur-feedback) var(--v2-ease-out);
}
.v2-foundation-demo i {
  transition: transform var(--v2-dur-ui) var(--v2-ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .v2-foundation-demo:hover i {
    transform: translateX(2px);
  }
}

/* ---- CHAPTER MARK ENTRY — bigger scale, longer duration, more visible ---- */
.v2-chapter-num {
  transition: transform 800ms var(--v2-ease-out),
              color var(--v2-dur-ui) var(--v2-ease-out),
              opacity 800ms var(--v2-ease-out);
  will-change: transform;
  display: inline-block;
}
.fade-up:not(.visible) .v2-chapter-num,
.v2-chapter:not(.visible) .v2-chapter-num {
  transform: scale(0.7);
  opacity: 0.3;
}
.fade-up.visible .v2-chapter-num,
.v2-section.visible .v2-chapter-num,
.v2-chapter.visible .v2-chapter-num {
  transform: scale(1);
  opacity: 1;
}

/* Also animate the chapter label text with a slight slide-in */
.v2-chapter-label {
  transition: transform 600ms var(--v2-ease-out) 150ms,
              opacity 600ms var(--v2-ease-out) 150ms;
  display: inline-block;
}
.fade-up:not(.visible) .v2-chapter-label,
.v2-chapter:not(.visible) .v2-chapter-label {
  transform: translateX(-12px);
  opacity: 0;
}
.fade-up.visible .v2-chapter-label,
.v2-chapter.visible .v2-chapter-label {
  transform: translateX(0);
  opacity: 1;
}

/* ---- VIDEO TESTIMONIAL CARDS ----
   Subtle lift on hover. Reinforces they're interactive.
*/
.vt-card {
  transition: transform var(--v2-dur-ui) var(--v2-ease-out),
              border-color var(--v2-dur-ui) var(--v2-ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .vt-card:hover {
    transform: translateY(-2px);
  }
}

/* ---- LOGO MARQUEE ----
   Already scrolling via CSS keyframes. Pause on hover, respect reduced motion.
*/
.marquee-track {
  animation-duration: var(--v2-dur-marquee);
}
@media (hover: hover) and (pointer: fine) {
  .marquee-viewport:hover .marquee-track {
    animation-play-state: paused;
  }
}

/* ---- STAT NUMBERS COUNT-UP ----
   Numbers already fade in with their row. Add a subtle scale-up on reveal
   to make them feel like they "land".
*/
.stat-number {
  transition: transform 480ms var(--v2-ease-out);
}
.stat-item:not(.visible) .stat-number {
  transform: scale(0.94);
}
.stat-item.visible .stat-number {
  transform: scale(1);
}

/* ---- MOBILE DRAWER (nav) ---- */
.nav-drawer {
  transition: transform var(--v2-dur-surface) var(--v2-ease-drawer),
              opacity var(--v2-dur-surface) var(--v2-ease-drawer);
}

/* ---- MODAL (video demo) ---- */
.demo-modal-overlay {
  transition: opacity var(--v2-dur-surface) var(--v2-ease-out);
}
.demo-modal {
  transform-origin: center;
  transition: transform var(--v2-dur-surface) var(--v2-ease-out),
              opacity var(--v2-dur-surface) var(--v2-ease-out);
}

/* ---- LINK UNDERLINE REFINEMENT ---- */
a {
  transition: color var(--v2-dur-ui) var(--v2-ease-out);
}

/* ---- REDUCED MOTION ----
   Keep opacity transitions (comprehension aid). Kill transform-based motion
   and the marquee animation.
*/
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 180ms !important;
  }
  .fade-up {
    transform: none !important;
    transition: opacity 180ms linear !important;
  }
  .v2-chapter-num,
  .stat-number {
    transform: none !important;
  }
  .marquee-track {
    animation: none !important;
  }
  /* Keep button :active feedback muted but present */
  .btn:active,
  .v2-btn:active,
  .pv-tier-cta:active {
    transform: none !important;
  }
}
