/* ============================================================
   LENIS SMOOTH SCROLL
   ============================================================ */
html.lenis, html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

/* ============================================================
   WORD SPLIT TEXT ANIMATIONS
   ============================================================ */

/* Each word is clipped vertically — the inner slides up from below */
.split-word {
  display: inline-block;
  overflow: hidden;
  /* Shift clip slightly below baseline to avoid cutting descenders (g, p, y, j) */
  padding-bottom: 0.1em;
  margin-bottom: -0.1em;
  vertical-align: top;
  /* Never let this block eat the whitespace text nodes around it */
  white-space: nowrap;
}

.split-word-inner {
  display: inline-block;
  will-change: transform, opacity;
}

/* Gradient spans inside split-word must keep their styling intact */
.split-word-inner .gradient-text,
.split-word-inner .gradient-text-2 {
  /* Ensure the background-clip still applies after being moved inside inner */
  display: inline;
}

/* [data-split] elements — no visibility tricks.
   GSAP's gsap.set() is called synchronously before first paint. */

/* ============================================================
   PRE-HIDE ANIMATED ELEMENTS (CSS safety net before JS loads)
   Prevents flash of unstyled/visible content when GSAP CDN is slow.
   ============================================================ */

/* card cascade elements — pre-hidden via CSS so they're invisible
   even before GSAP loads from CDN. JS uses gsap.to() to reveal them. */
.card-group > .feature-card,
.card-group > .kb-category-card,
.card-group > .step-item,
.card-group > .pricing-value-card,
.kb-article-grid .kb-article-card,
.feature-full-card {
  opacity: 0;
  transform: translateY(30px);
  will-change: transform, opacity;
}

/* Stack items are managed entirely by GSAP — cancel the pre-hide */
.feature-full-card.card-stack-item {
  opacity: 1;
  transform: none;
}

/* ============================================================
   MARQUEE TICKER
   ============================================================ */
.marquee-section {
  overflow: hidden;
  padding: 14px 0;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  user-select: none;
}

.marquee-track {
  display: flex;
  align-items: center;
  gap: 0;
  width: max-content;
  animation: marquee-scroll 30s linear infinite;
  will-change: transform;
}

.marquee-section:hover .marquee-track {
  animation-play-state: paused;
}

.marquee-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 32px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  font-family: var(--font-body);
}

.marquee-item-icon {
  width: 18px; height: 18px;
  border-radius: 5px;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.marquee-item-icon svg {
  width: 10px; height: 10px;
  color: var(--accent);
}

.marquee-dot {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--text-3);
  opacity: 0.4;
  flex-shrink: 0;
}

@keyframes marquee-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Second marquee row (reverse) */
.marquee-track.reverse {
  animation-direction: reverse;
  animation-duration: 35s;
}

/* ============================================================
   SCROLL STORY (Pinned How It Works)
   ============================================================ */
.scroll-story {
  background: var(--bg);
}

.scroll-story-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px, 6vw, 100px);
  align-items: start;
  min-height: 100vh;
}

.scroll-story-sticky {
  position: sticky;
  top: 80px;
  padding: 80px 0 80px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.scroll-story-label {
  margin-bottom: 32px;
}

.scroll-story-headline {
  margin-bottom: 48px;
}

.story-steps-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}

.story-steps-list::before {
  content: '';
  position: absolute;
  left: 19px;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--border-md);
}

.story-step {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 20px 0;
  transition: opacity 0.5s var(--ease-smooth);
  opacity: 0.3;
  position: relative;
  z-index: 1;
}

.story-step.is-active {
  opacity: 1;
}

.story-step-bullet {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border-md);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.4s, border-color 0.4s, box-shadow 0.4s;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-3);
}

.story-step.is-active .story-step-bullet {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 6px rgba(27, 79, 216, 0.12);
}

.story-step-text h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-1);
}

.story-step-text p {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-3);
}

.scroll-story-scroller {
  padding: 80px 0;
}

.story-panel {
  height: 65vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 0;
}

.story-panel-card {
  width: 100%;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 36px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(40px) scale(0.97);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out), box-shadow 0.3s;
}

.story-panel-card.is-visible {
  opacity: 1;
  transform: none;
  box-shadow: var(--shadow-xl);
}

.story-panel-card-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 16px;
}

.story-panel-card h4 {
  font-size: 1.3rem;
  margin-bottom: 12px;
}

.story-panel-card p {
  font-size: 0.88rem;
  color: var(--text-2);
  line-height: 1.65;
  margin-bottom: 20px;
}

/* ============================================================
   HORIZONTAL SCROLL SHOWCASE
   ============================================================ */

/* Header sits above the pinned section — scrolls normally */
.h-scroll-outer-header {
  background: var(--bg-dark);
  padding: clamp(64px, 9vw, 110px) 0 clamp(40px, 5vw, 60px);
  text-align: center;
}

.h-scroll-intro {
  color: rgba(255, 255, 255, 0.5);
  font-size: 1rem;
  margin-top: 14px;
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}

/* Only the track + progress hint — this is what gets pinned by GSAP */
.h-scroll-section {
  background: var(--bg-dark);
  overflow: hidden;
  position: relative;
  /* Fill the viewport so cards appear centred, not huddled at the top */
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.h-scroll-track {
  display: flex;
  gap: 24px;
  /* Horizontal padding for first/last card breathing room; minimal vertical */
  padding: 12px clamp(20px, 5vw, 80px) 12px;
  width: max-content;
  will-change: transform;
}

.h-scroll-card {
  width: clamp(300px, 33vw, 420px);
  /* Height fills most of the viewport so cards look substantial */
  height: clamp(340px, 60vh, 520px);
  flex-shrink: 0;
  border-radius: var(--radius-xl);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 36px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0;
  transition: background 0.3s, border-color 0.3s;
}

.h-scroll-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(27,79,216,0.08) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
}

.h-scroll-card:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.14);
}

.h-scroll-card:hover::before { opacity: 1; }

.h-scroll-card-num {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  margin-bottom: 20px;
}

.h-scroll-card-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: rgba(27,79,216,0.2);
  border: 1px solid rgba(27,79,216,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.h-scroll-card-icon svg { width: 22px; height: 22px; color: #93C5FD; }

.h-scroll-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
}

.h-scroll-card p {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.65;
  margin-bottom: 0;
}

.h-scroll-card-visual {
  border-radius: var(--radius);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* Flex-grow pushes the visual to consume leftover card height */
  flex: 1;
  margin-top: 20px;
}

.h-scroll-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.05);
  font-size: 0.8rem;
}

.h-scroll-metric-name { color: rgba(255,255,255,0.5); }
.h-scroll-metric-value { color: rgba(255,255,255,0.85); font-weight: 600; }
.h-scroll-metric-badge {
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
}

.hb-green { background: rgba(13,148,136,0.2); color: #6EE7B7; }
.hb-blue  { background: rgba(27,79,216,0.2);  color: #93C5FD; }

.h-scroll-progress-hint {
  position: absolute;
  bottom: clamp(20px, 3vw, 36px);
  left: 0; right: 0;
  color: rgba(255,255,255,0.25);
  font-size: 0.82rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
}

.h-scroll-progress-track {
  width: 120px;
  height: 2px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  position: relative;
}

.h-scroll-progress-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
}

/* ============================================================
   PARALLAX LAYERS
   ============================================================ */
[data-parallax] {
  will-change: transform;
}

/* ============================================================
   SCRUB COUNTER
   ============================================================ */
.scrub-counter {
  display: inline-block;
  will-change: contents;
}

/* ============================================================
   SECTION OVERLAP / ENTER EFFECT
   ============================================================ */
.section-overlap {
  position: relative;
  z-index: 1;
}

/* Section that "pushes up" into view */
.push-up {
  transform-origin: bottom center;
}

/* ============================================================
   GRADIENT REVEAL LINE
   ============================================================ */
.section-rule {
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--border-md) 50%, transparent 100%);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.8s var(--ease-out);
}

.section-rule.is-revealed { transform: scaleX(1); }

/* ============================================================
   HERO SPECIFIC SCROLL STATES
   ============================================================ */
.hero-content-inner {
  will-change: transform, opacity;
}

/* Eyebrow chip animation */
.hero-eyebrow {
  will-change: transform, opacity;
}

/* ============================================================
   NUMBER TICKER
   ============================================================ */
.stat-number .ticker-value {
  display: inline-block;
  will-change: contents;
}

/* ============================================================
   FLOATING FEATURE BADGES (hero decoration)
   ============================================================ */
.float-badge {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-1);
  pointer-events: none;
  z-index: 2;
  white-space: nowrap;
}

.float-badge-icon {
  width: 24px; height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.float-badge-1 {
  /* Floats above the top-left of the mockup */
  top: 12px;
  left: -12px;
  animation: float-badge 7s ease-in-out infinite;
}

.float-badge-2 {
  /* Floats below the bottom-left */
  bottom: 12px;
  left: -12px;
  animation: float-badge 9s ease-in-out infinite reverse;
  animation-delay: -3s;
}

/* ============================================================
   SCROLL HINT ARROW
   ============================================================ */
.scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  z-index: 2;
  animation: scroll-hint-fade 2s ease-in-out infinite;
}

.scroll-hint-line {
  width: 1px;
  height: 32px;
  background: linear-gradient(180deg, var(--accent) 0%, transparent 100%);
  animation: scroll-hint-line 2s ease-in-out infinite;
}

@keyframes scroll-hint-fade {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 1; }
}

@keyframes scroll-hint-line {
  0%   { transform: scaleY(1) translateY(0); opacity: 0; }
  25%  { opacity: 1; }
  75%  { opacity: 1; }
  100% { transform: scaleY(0.3) translateY(100%); opacity: 0; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* ── 900px — tablet ───────────────────────────────────────── */
@media (max-width: 900px) {
  /* Scroll story: drop sticky panel, stack vertically */
  .scroll-story-inner {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .scroll-story-sticky {
    position: static;
    padding: 48px 0 24px;
  }
  .scroll-story-headline { margin-bottom: 24px; }
  .story-panel { height: 40vh; }
  .h-scroll-card { width: clamp(260px, 80vw, 360px); }
}

/* ── 768px — mobile ───────────────────────────────────────── */
@media (max-width: 768px) {
  /* Decorative */
  .float-badge { display: none; }
  .scroll-hint { display: none; }

  /* ── Scroll story ── */
  /* Sticky label and steps list take less vertical space on mobile */
  .scroll-story-sticky { padding: 32px 0 16px; }
  .scroll-story-label  { margin-bottom: 20px; }
  .scroll-story-scroller { padding: 24px 0 40px; }

  .story-panel {
    height: auto;
    min-height: auto;
    padding: 12px 0;
  }

  /* Always show panel cards on mobile — JS triggers are unreliable
     when the sticky panel is removed and touch scroll speed varies */
  .story-panel-card {
    opacity: 1 !important;
    transform: none !important;
    box-shadow: var(--shadow-lg);
  }

  /* Keep active step highlighting, dim the others slightly */
  .story-step { opacity: 0.5; }
  .story-step.is-active { opacity: 1; }

  /* ── Horizontal scroll ── */
  /* Remove fixed viewport height — GSAP pin is disabled on mobile */
  .h-scroll-section {
    height: auto;
    min-height: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
  }
  .h-scroll-section::-webkit-scrollbar { display: none; }

  /* Track flows naturally — no GSAP x-transform */
  .h-scroll-track {
    padding: 16px 20px 32px;
    gap: 16px;
  }

  /* Cards a little narrower for mobile single-hand scroll */
  .h-scroll-card {
    width: clamp(240px, 78vw, 320px);
    height: clamp(280px, 55vh, 400px);
    padding: 24px;
  }

  /* Progress hint not relevant without GSAP pin */
  .h-scroll-progress-hint { display: none; }

  /* ── Marquee ── */
  .marquee-section { padding: 20px 0; }
}
