/* ========================================
   Flowix - Apple-style Scroll Experience
   Layered on top of style.css. Additive only.
   ======================================== */

:root {
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html {
  /* Smooth, but the browser default is "auto" which is instant.
     style.css already sets 'smooth' but we make it explicit. */
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal],
  [data-reveal-words] .word,
  [data-parallax],
  [data-scroll-progress] { transition: none !important; transform: none !important; opacity: 1 !important; }
}

/* ========================================
   GENERIC REVEAL SYSTEM (data-reveal="...")
   ======================================== */
[data-reveal] {
  opacity: 0;
  transform: translate3d(0, 40px, 0);
  transition:
    opacity 0.9s var(--ease-out-expo),
    transform 1s var(--ease-out-expo);
  will-change: opacity, transform;
}
[data-reveal="up"]    { transform: translate3d(0, 60px, 0); }
[data-reveal="down"]  { transform: translate3d(0, -40px, 0); }
[data-reveal="left"]  { transform: translate3d(-60px, 0, 0); }
[data-reveal="right"] { transform: translate3d(60px, 0, 0); }
[data-reveal="scale"] { transform: scale(0.86); }
[data-reveal="blur"]  { filter: blur(14px); transform: translate3d(0, 30px, 0); }
[data-reveal="rotate"]{ transform: translate3d(0, 80px, 0) rotate(-3deg); }

[data-reveal].is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
  filter: blur(0);
}

[data-reveal-delay="1"] { transition-delay: 0.08s; }
[data-reveal-delay="2"] { transition-delay: 0.16s; }
[data-reveal-delay="3"] { transition-delay: 0.24s; }
[data-reveal-delay="4"] { transition-delay: 0.32s; }
[data-reveal-delay="5"] { transition-delay: 0.4s; }
[data-reveal-delay="6"] { transition-delay: 0.48s; }

/* ========================================
   WORD-BY-WORD REVEAL (data-reveal-words)
   ======================================== */
[data-reveal-words] .word {
  display: inline-block;
  opacity: 0;
  transform: translate3d(0, 0.6em, 0);
  transition:
    opacity 0.8s var(--ease-out-expo),
    transform 0.9s var(--ease-out-expo);
  will-change: opacity, transform;
}
[data-reveal-words].is-visible .word {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}
/* Stagger up to 16 words */
[data-reveal-words].is-visible .word:nth-child(1)  { transition-delay: 0.00s; }
[data-reveal-words].is-visible .word:nth-child(2)  { transition-delay: 0.05s; }
[data-reveal-words].is-visible .word:nth-child(3)  { transition-delay: 0.10s; }
[data-reveal-words].is-visible .word:nth-child(4)  { transition-delay: 0.15s; }
[data-reveal-words].is-visible .word:nth-child(5)  { transition-delay: 0.20s; }
[data-reveal-words].is-visible .word:nth-child(6)  { transition-delay: 0.25s; }
[data-reveal-words].is-visible .word:nth-child(7)  { transition-delay: 0.30s; }
[data-reveal-words].is-visible .word:nth-child(8)  { transition-delay: 0.35s; }
[data-reveal-words].is-visible .word:nth-child(9)  { transition-delay: 0.40s; }
[data-reveal-words].is-visible .word:nth-child(10) { transition-delay: 0.45s; }
[data-reveal-words].is-visible .word:nth-child(11) { transition-delay: 0.50s; }
[data-reveal-words].is-visible .word:nth-child(12) { transition-delay: 0.55s; }
[data-reveal-words].is-visible .word:nth-child(13) { transition-delay: 0.60s; }
[data-reveal-words].is-visible .word:nth-child(14) { transition-delay: 0.65s; }
[data-reveal-words].is-visible .word:nth-child(15) { transition-delay: 0.70s; }
[data-reveal-words].is-visible .word:nth-child(16) { transition-delay: 0.75s; }

/* ========================================
   SCROLL-DRIVEN VARIABLES
   JS sets --progress (0..1) on elements with [data-scroll-progress]
   ======================================== */
[data-scroll-progress] {
  --progress: 0;
}

/* Parallax: shifts element relative to scroll progress */
[data-parallax] {
  --speed: 0.2;
  --offset: calc(var(--progress, 0) * var(--speed) * 200px);
  transform: translate3d(0, calc(var(--offset) * -1), 0);
  will-change: transform;
}

/* Fixed-bg orb parallax: uses global --scroll-y, wraps existing float animation. */
.orb-parallax {
  --orb-speed: 0.2;
  will-change: transform;
}
@media (prefers-reduced-motion: no-preference) {
  .hero-orb-1.orb-parallax { animation: orbFloat1Parallax 12s ease-in-out infinite; }
  .hero-orb-2.orb-parallax { animation: orbFloat2Parallax 15s ease-in-out infinite; }
  .hero-orb-3.orb-parallax { animation: orbFloat3Parallax 10s ease-in-out infinite; }
}
/* The float keyframes already include translate; we layer a scroll-driven
   offset by setting a CSS var consumed in the keyframes' translate. */
@keyframes orbFloat1Parallax {
  0%, 100% { transform: translate3d(0, calc(var(--scroll-y, 0px) * var(--orb-speed) * -1), 0) scale(1); }
  33%      { transform: translate3d(-40px, calc(30px + var(--scroll-y, 0px) * var(--orb-speed) * -1), 0) scale(1.1); }
  66%      { transform: translate3d(20px, calc(-20px + var(--scroll-y, 0px) * var(--orb-speed) * -1), 0) scale(0.95); }
}
@keyframes orbFloat2Parallax {
  0%, 100% { transform: translate3d(0, calc(var(--scroll-y, 0px) * var(--orb-speed) * -1), 0) scale(1); }
  33%      { transform: translate3d(30px, calc(-40px + var(--scroll-y, 0px) * var(--orb-speed) * -1), 0) scale(1.05); }
  66%      { transform: translate3d(-20px, calc(20px + var(--scroll-y, 0px) * var(--orb-speed) * -1), 0) scale(1.1); }
}
@keyframes orbFloat3Parallax {
  0%, 100% { transform: translate3d(0, calc(var(--scroll-y, 0px) * var(--orb-speed) * -1), 0) scale(1); }
  50%      { transform: translate3d(-60px, calc(30px + var(--scroll-y, 0px) * var(--orb-speed) * -1), 0) scale(1.15); }
}

/* ========================================
   HERO: APPLE-STYLE REFRESH
   ======================================== */
.hero {
  padding-top: calc(var(--nav-height) + 40px) !important;
  padding-bottom: 80px !important;
}

.hero h1 {
  font-size: clamp(2rem, 4.6vw, 4rem) !important;
  line-height: 1.1 !important;
  letter-spacing: -0.03em !important;
  font-weight: 700 !important;
  margin-bottom: 24px !important;
}

.hero p {
  font-size: clamp(1.05rem, 1.25vw, 1.2rem) !important;
  line-height: 1.55 !important;
  max-width: 560px !important;
  margin-bottom: 32px !important;
  color: var(--text-light);
}

.hero-badge {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.hero-badge::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.18) 50%, transparent 100%);
  transform: translateX(-100%);
  animation: badgeShine 4s ease-in-out infinite;
  z-index: -1;
}
@keyframes badgeShine {
  0%, 60%, 100% { transform: translateX(-100%); }
  80% { transform: translateX(100%); }
}

/* Hero mockup: floats with subtle parallax + tilt */
.hero-mockup {
  perspective: 1400px;
}
.hero-mockup .mockup-card {
  transform-style: preserve-3d;
  animation: mockupFloat 8s ease-in-out infinite;
  will-change: transform;
}
@keyframes mockupFloat {
  0%, 100% { transform: perspective(1400px) rotateY(-6deg) rotateX(2deg) translate3d(0, 0, 0); }
  50%      { transform: perspective(1400px) rotateY(-6deg) rotateX(2deg) translate3d(0, -14px, 0); }
}

/* ========================================
   BIG STATEMENT (scroll-masked text)
   Used for hero-style declarative sections.
   ======================================== */
.statement-section {
  position: relative;
  padding: 180px 0;
  z-index: 1;
}
.statement {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  font-size: clamp(2rem, 5.4vw, 4.8rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-align: center;
}
.statement .word {
  display: inline-block;
  color: rgba(255, 255, 255, 0.12);
  transition: color 0.4s ease;
  margin: 0 0.18em 0.1em 0;
}
.statement .word.is-active {
  color: var(--text-white);
}
.statement .word.is-highlight {
  background: linear-gradient(135deg, var(--orange-start), var(--orange-end));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ========================================
   PINNED STORY SECTION
   Sticky visual on one side, scrolling chapters on the other.
   ======================================== */
.story {
  position: relative;
  padding: 80px 0;
  z-index: 1;
}
.story-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: start;
}
.story-sticky {
  position: sticky;
  top: 15vh;
  height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.story-visual {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.story-visual-card {
  position: absolute;
  width: 100%;
  max-width: 460px;
  padding: 32px;
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(34, 34, 64, 0.85) 0%, rgba(15, 15, 26, 0.95) 100%);
  border: 1px solid rgba(255, 106, 18, 0.18);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  opacity: 0;
  transform: translate3d(0, 20px, 0) scale(0.96);
  transition:
    opacity 0.7s var(--ease-out-expo),
    transform 0.8s var(--ease-out-expo);
  pointer-events: none;
}
.story-visual-card.is-active {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  pointer-events: auto;
}
.story-visual-card h4 {
  font-size: 1.15rem;
  margin-bottom: 8px;
  color: var(--orange-start);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.story-visual-card .big-stat {
  font-size: clamp(3rem, 5vw, 4.5rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--orange-start), var(--orange-end));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  margin-bottom: 12px;
  letter-spacing: -0.04em;
}
.story-visual-card p {
  color: var(--text-light);
  font-size: 0.98rem;
  line-height: 1.6;
}
.story-chapters {
  display: flex;
  flex-direction: column;
  gap: 30vh;
  padding: 20vh 0;
}
.story-chapter {
  min-height: 40vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.story-chapter-label {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 50px;
  background: rgba(255, 106, 18, 0.08);
  border: 1px solid rgba(255, 106, 18, 0.18);
  color: var(--orange-start);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 18px;
  align-self: flex-start;
}
.story-chapter h3 {
  font-size: clamp(1.8rem, 3.4vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 18px;
}
.story-chapter p {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-light);
  max-width: 480px;
}

@media (max-width: 900px) {
  .story-inner {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .story-sticky {
    position: relative;
    top: 0;
    height: 360px;
  }
  .story-chapters {
    padding: 0;
    gap: 80px;
  }
  .story-chapter { min-height: auto; }
}

/* ========================================
   MARQUEE (logo / integrations strip)
   ======================================== */
.marquee {
  overflow: hidden;
  position: relative;
  padding: 28px 0;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track {
  display: flex;
  gap: 60px;
  width: max-content;
  animation: marqueeScroll 35s linear infinite;
  align-items: center;
}
.marquee-item {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.marquee-item svg,
.marquee-item img {
  width: 22px;
  height: 22px;
  opacity: 0.8;
}
@keyframes marqueeScroll {
  to { transform: translate3d(-50%, 0, 0); }
}

/* ========================================
   SECTION HEADER REFRESH (bigger, airier)
   ======================================== */
.section-header h2 {
  font-size: clamp(2.2rem, 4.6vw, 3.6rem) !important;
  letter-spacing: -0.025em !important;
  line-height: 1.08 !important;
  margin-bottom: 24px !important;
}
.section-header p {
  font-size: 1.12rem !important;
  max-width: 680px !important;
  line-height: 1.65 !important;
}

/* Slightly more breathing room between major sections */
section.how-it-works,
section.before-after,
section.products,
section.results-section,
section.integrations-section,
section.testimonials,
section.faq,
section.cta-section,
section.roi-calculator {
  padding-top: 130px;
  padding-bottom: 130px;
}
@media (max-width: 768px) {
  section.how-it-works,
  section.before-after,
  section.products,
  section.results-section,
  section.integrations-section,
  section.testimonials,
  section.faq,
  section.cta-section,
  section.roi-calculator {
    padding-top: 80px;
    padding-bottom: 80px;
  }
  .statement-section { padding: 100px 0; }
}

/* ========================================
   UPGRADE EXISTING .fade-in TO APPLE-STYLE
   Makes every legacy section reveal smoothly
   with the same easing/timing as data-reveal.
   ======================================== */
.fade-in {
  opacity: 0 !important;
  transform: translate3d(0, 50px, 0) !important;
  transition:
    opacity 0.9s var(--ease-out-expo),
    transform 1s var(--ease-out-expo) !important;
  will-change: opacity, transform;
}
.fade-in.visible {
  opacity: 1 !important;
  transform: translate3d(0, 0, 0) !important;
}

/* Stagger: support up to 12 children with smoother easing */
.fade-in-stagger.visible > * {
  opacity: 0;
  transform: translate3d(0, 30px, 0);
  animation: appleStaggerIn 0.9s var(--ease-out-expo) forwards;
}
.fade-in-stagger.visible > *:nth-child(1)  { animation-delay: 0.00s; }
.fade-in-stagger.visible > *:nth-child(2)  { animation-delay: 0.08s; }
.fade-in-stagger.visible > *:nth-child(3)  { animation-delay: 0.14s; }
.fade-in-stagger.visible > *:nth-child(4)  { animation-delay: 0.20s; }
.fade-in-stagger.visible > *:nth-child(5)  { animation-delay: 0.26s; }
.fade-in-stagger.visible > *:nth-child(6)  { animation-delay: 0.32s; }
.fade-in-stagger.visible > *:nth-child(7)  { animation-delay: 0.38s; }
.fade-in-stagger.visible > *:nth-child(8)  { animation-delay: 0.44s; }
.fade-in-stagger.visible > *:nth-child(9)  { animation-delay: 0.50s; }
.fade-in-stagger.visible > *:nth-child(10) { animation-delay: 0.56s; }
.fade-in-stagger.visible > *:nth-child(11) { animation-delay: 0.62s; }
.fade-in-stagger.visible > *:nth-child(12) { animation-delay: 0.68s; }
@keyframes appleStaggerIn {
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* ========================================
   CARD HOVER LIFT (gentle Apple-style)
   ======================================== */
.product-card,
.step-card,
.value-card,
.compare-card {
  transition:
    transform 0.5s var(--ease-out-expo),
    box-shadow 0.5s var(--ease-out-expo),
    border-color 0.5s var(--ease-out-expo) !important;
}
.product-card:hover,
.step-card:hover,
.value-card:hover {
  transform: translate3d(0, -6px, 0) !important;
}

/* ========================================
   SCROLL HINT (subtle, hero bottom)
   ======================================== */
.scroll-hint {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.7;
  pointer-events: none;
  z-index: 2;
}
.scroll-hint-line {
  width: 1px;
  height: 50px;
  background: linear-gradient(to bottom, transparent, var(--orange-start));
  position: relative;
  overflow: hidden;
}
.scroll-hint-line::after {
  content: "";
  position: absolute;
  top: -50%;
  left: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.9));
  animation: scrollHintDrop 2.4s ease-in-out infinite;
}
@keyframes scrollHintDrop {
  0%   { top: -50%; }
  60%  { top: 100%; }
  100% { top: 100%; }
}
@media (max-width: 768px) {
  .scroll-hint { display: none; }
}
