/* ==========================================================================
   XDR PlusOne — Motion System
   Layered approach:
   1. Restraint primitives (per brand spec): fade-up, hover color/shadow only.
   2. Cinematic moments at marquee spots: hero, stat counters, comparison flow,
      section dividers — these provide premium feel without becoming "SaaS hype".
   3. Reduced-motion fallback fully respected.
   ========================================================================== */

/* ---------- Reveal primitives ---------- */
.reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 720ms var(--ease-emphasis), transform 720ms var(--ease-emphasis);
  will-change: opacity, transform;
}
.reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}

.reveal-lg {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 900ms var(--ease-out-expo), transform 900ms var(--ease-out-expo);
  will-change: opacity, transform;
}
.reveal-lg.is-in {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger when parent has [data-stagger] */
[data-stagger] > .reveal,
[data-stagger] > .reveal-lg { transition-delay: calc(var(--i, 0) * 80ms); }

/* ---------- Kinetic line reveal (pretext-inspired, line-by-line) ----------
   We pre-split a heading into per-line wrappers via JS (line-mask), then animate
   each line with an overflow-clip mask + per-line delay. Reads as elegant. */
.line-mask {
  display: block;
  overflow: hidden;
}
.line-mask > .line-inner {
  display: block;
  transform: translateY(110%);
  transition: transform 900ms var(--ease-out-expo);
  will-change: transform;
}
.line-mask.is-in > .line-inner { transform: translateY(0); }
.line-mask:nth-child(2) > .line-inner { transition-delay: 80ms; }
.line-mask:nth-child(3) > .line-inner { transition-delay: 160ms; }
.line-mask:nth-child(4) > .line-inner { transition-delay: 240ms; }
.line-mask:nth-child(5) > .line-inner { transition-delay: 320ms; }
.line-mask:nth-child(6) > .line-inner { transition-delay: 400ms; }

/* ---------- Stat counter — purple glow rises with value ---------- */
.stat-num {
  position: relative;
  display: inline-block;
  background: linear-gradient(180deg, var(--brand-purple) 0%, var(--brand-purple-700) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat-num::after {
  content: "";
  position: absolute;
  inset: -10% -8% 5% -8%;
  background: radial-gradient(60% 60% at 50% 60%, rgba(91,63,191,0.18), transparent 70%);
  z-index: -1;
  opacity: 0;
  transition: opacity 600ms var(--ease-emphasis);
  pointer-events: none;
}
.stat-card.is-in .stat-num::after { opacity: 1; }

/* ---------- Hero parallax/glow layers ---------- */
.hero-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.hero-particles::before,
.hero-particles::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  will-change: transform;
}
.hero-particles::before {
  width: 540px; height: 540px;
  left: -120px; top: -120px;
  background: radial-gradient(circle, rgba(91,63,191,0.65), transparent 65%);
  animation: hero-orb-a 18s ease-in-out infinite alternate;
}
.hero-particles::after {
  width: 600px; height: 600px;
  right: -160px; bottom: -160px;
  background: radial-gradient(circle, rgba(30,58,138,0.7), transparent 65%);
  animation: hero-orb-b 22s ease-in-out infinite alternate;
}
@keyframes hero-orb-a {
  0%   { transform: translate3d(0,0,0) scale(1); }
  100% { transform: translate3d(120px, 80px, 0) scale(1.15); }
}
@keyframes hero-orb-b {
  0%   { transform: translate3d(0,0,0) scale(1); }
  100% { transform: translate3d(-100px,-60px,0) scale(0.92); }
}

/* Hero shimmer line — subtle horizontal sweep across title every ~6s */
.shimmer-text {
  background: linear-gradient(
    100deg,
    rgba(255,255,255,0.85) 30%,
    rgba(255,255,255,1) 45%,
    rgba(183,166,255,1) 50%,
    rgba(255,255,255,1) 55%,
    rgba(255,255,255,0.85) 70%
  );
  background-size: 250% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer-sweep 7s ease-in-out 1.4s infinite;
}
@keyframes shimmer-sweep {
  0%, 18%   { background-position: 100% 0; }
  35%, 100% { background-position: -50% 0; }
}

/* ---------- Hero diagram — flow pulse ---------- */
.flow-row {
  position: relative;
  overflow: hidden;
}
.flow-row::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: linear-gradient(
    100deg,
    transparent 35%,
    rgba(183,166,255,0.18) 50%,
    transparent 65%
  );
  background-size: 220% 100%;
  background-position: 100% 0;
  pointer-events: none;
  animation: flow-sweep 4.5s ease-in-out infinite;
}
.flow-row:nth-child(3)::before { animation-delay: 1.5s; }
.flow-row:nth-child(5)::before { animation-delay: 3s; }
@keyframes flow-sweep {
  0%   { background-position: 100% 0; }
  60%  { background-position: -50% 0; }
  100% { background-position: -50% 0; }
}

.flow-connector {
  position: relative;
  width: 1px;
  height: 32px;
  margin: 0 auto;
  background: rgba(255,255,255,0.18);
  overflow: hidden;
}
.flow-connector::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, var(--brand-purple-light) 50%, transparent 100%);
  animation: flow-pulse 2.4s ease-in-out infinite;
}
.flow-connector:nth-of-type(2)::after { animation-delay: 0.6s; }
@keyframes flow-pulse {
  0%   { transform: translateY(-100%); }
  50%  { transform: translateY(0); }
  100% { transform: translateY(100%); }
}

/* ---------- Card hover (per spec: color/shadow only, no scale) ---------- */
.lift {
  transition: border-color 200ms var(--ease-standard),
              box-shadow   200ms var(--ease-standard),
              background   200ms var(--ease-standard);
}
.lift:hover {
  border-color: var(--brand-purple-100);
  box-shadow: var(--shadow-md);
}

/* ---------- Button shine on primary CTA ---------- */
.btn-shine {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.btn-shine::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 35%,
    rgba(255,255,255,0.45) 50%,
    transparent 65%
  );
  transform: translateX(-120%);
  transition: transform 900ms var(--ease-out-expo);
  pointer-events: none;
}
.btn-shine:hover::after { transform: translateX(120%); }

/* ---------- Scene transitions (hyperframes-inspired) ----------
   Scenes are stacked panels that crossfade as the user scrolls.
   Each .scene-panel sits in a .scene-stage; JS toggles .is-active. */
.scene-stage {
  position: relative;
  isolation: isolate;
}
.scene-panel {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 600ms var(--ease-emphasis),
              transform 600ms var(--ease-emphasis);
}
.scene-panel.is-active {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Marquee logo strip ---------- */
.marquee {
  display: flex;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee-track {
  display: flex;
  gap: 64px;
  flex-shrink: 0;
  animation: marquee 30s linear infinite;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ---------- Comparison row reveal ---------- */
.compare-row {
  opacity: 0;
  transform: translateX(-12px);
  transition: opacity 500ms var(--ease-emphasis), transform 500ms var(--ease-emphasis);
}
.compare-row.is-in {
  opacity: 1;
  transform: translateX(0);
}

/* ---------- Section divider line: hairline that draws in ---------- */
.divider-draw {
  position: relative;
  height: 1px;
  background: var(--color-border);
  overflow: hidden;
}
.divider-draw::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--brand-purple), var(--brand-navy));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1100ms var(--ease-out-expo);
}
.divider-draw.is-in::after { transform: scaleX(1); }

/* ---------- FAQ accordion smooth height ---------- */
.acc-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 320ms var(--ease-emphasis);
}
.acc-body > div { overflow: hidden; }
.acc-item.is-open .acc-body { max-height: 1000px; }
.acc-item.is-open .acc-toggle { transform: rotate(45deg); }
.acc-toggle { transition: transform 280ms var(--ease-emphasis); }

/* ---------- Sticky right-edge CTA ---------- */
.sticky-cta {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%) translateX(0);
  z-index: var(--z-fixed-cta);
  background: var(--brand-purple);
  color: white;
  padding: 18px 14px;
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.18em;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  border-radius: 8px 0 0 8px;
  box-shadow: var(--shadow-cta);
  transition: transform 200ms var(--ease-emphasis), background 200ms;
  cursor: pointer;
  border: none;
}
.sticky-cta:hover {
  background: var(--brand-purple-700);
  transform: translateY(-50%) translateX(-3px);
}

@media (max-width: 768px) {
  .sticky-cta {
    top: auto;
    right: 16px;
    bottom: 16px;
    left: 16px;
    transform: none;
    writing-mode: horizontal-tb;
    text-align: center;
    padding: 16px 20px;
    border-radius: 12px;
    letter-spacing: 0.06em;
  }
  .sticky-cta:hover { transform: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal, .reveal-lg, .compare-row, .line-mask > .line-inner {
    opacity: 1 !important;
    transform: none !important;
  }
  .hero-particles::before, .hero-particles::after,
  .shimmer-text, .flow-row::before, .flow-connector::after,
  .marquee-track {
    animation: none !important;
  }
  .shimmer-text {
    background: white;
    -webkit-text-fill-color: white;
    color: white;
  }
}
