/* =========================================================================
   MeritX — micro-interactions & ReactBits-style effects
   Loaded AFTER styles.css. transform/opacity only · reduced-motion safe.
   ========================================================================= */

/* ---------- Capability card tilt host (cursor-follow glow removed) ---------- */
.s-wwd-card { position: relative; transition: transform 0.25s cubic-bezier(.22,1,.36,1), border-color 0.25s ease, box-shadow 0.25s ease; transform-style: preserve-3d; }
.s-wwd-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-soft); }

/* ---------- Mock product cards: lift ---------- */
.mock { position: relative; transition: transform 0.3s cubic-bezier(.22,1,.36,1), border-color 0.3s ease, box-shadow 0.3s ease; }
.mock:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow); }

/* ---------- Buttons: magnetic host + sheen + press ---------- */
.btn { position: relative; overflow: hidden; transition: transform 0.18s cubic-bezier(.22,1,.36,1), background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; }
.btn--ghost::after {
  content: ""; position: absolute; top: 0; left: -150%; width: 55%; height: 100%; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.14), transparent);
  transform: skewX(-20deg); transition: left 0.6s ease;
}
.btn--ghost:hover::after { left: 160%; }

/* ---------- Star border (animated gradient ring) ---------- */
@property --mx-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.star-border { position: relative; z-index: 0; }
.star-border::before {
  content: ""; position: absolute; inset: -2px; border-radius: inherit; z-index: -1; pointer-events: none;
  background: conic-gradient(from var(--mx-angle),
              transparent 0deg, var(--accent) 55deg, var(--accent-2) 120deg, transparent 210deg, transparent 360deg);
  animation: mx-spin 4s linear infinite;
}
@keyframes mx-spin { to { --mx-angle: 360deg; } }

/* ---------- Click spark particles ---------- */
.mx-spark {
  position: fixed; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); pointer-events: none; z-index: 9999;
  transform: translate(-50%, -50%); will-change: transform, opacity;
  animation: mx-spark 0.5s cubic-bezier(.22,1,.36,1) forwards;
}
@keyframes mx-spark {
  to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0); opacity: 0; }
}

/* ---------- Heatmap cells ---------- */
.heat { transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease; }
.heat:hover { transform: translateY(-2px) scale(1.04); filter: brightness(1.22); z-index: 2; box-shadow: 0 8px 20px -8px rgba(0,0,0,.6); }

/* ---------- Nav links: animated underline ---------- */
.nav__links a { position: relative; }
.nav__links a::after {
  content: ""; position: absolute; left: 13px; right: 13px; bottom: 5px; height: 2px; border-radius: 2px;
  background: var(--grad); transform: scaleX(0); transform-origin: left; transition: transform 0.25s ease;
}
.nav__links a:hover::after { transform: scaleX(1); }

/* ---------- Table / list rows ---------- */
.mw-row, .own-row { transition: background 0.18s ease; border-radius: 8px; }
.mw-row:hover, .own-row:hover { background: rgba(255,255,255,0.035); }
.scr-table tbody tr { transition: background 0.18s ease; }
.scr-table tbody tr:hover { background: rgba(255,255,255,0.04); }
[data-theme="light"] .mw-row:hover,
[data-theme="light"] .own-row:hover,
[data-theme="light"] .scr-table tbody tr:hover { background: rgba(8,15,30,0.04); }

/* ---------- Chips ---------- */
.chip { transition: transform 0.18s ease, border-color 0.18s ease, color 0.18s ease, background 0.18s ease; cursor: pointer; }
.chip:hover { transform: translateY(-2px); color: var(--text); border-color: color-mix(in srgb, var(--accent) 55%, var(--border-strong)); }

/* ---------- Feature list items ---------- */
/* feat-item hover removed per user — the pointer cards no longer react to hover (no bg
   tint, no padding shift, no icon scale). */

/* ---------- Toggle groups (research tabs / news filters) get real button affordance ---------- */
.s-research__tab, .s-news__chip { cursor: pointer; transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease; }
.s-research__tab:focus-visible, .s-news__chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Hero animated aurora (subtle drifting gradient blobs) ---------- */
.hero__glow::before, .hero__glow::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(58px);
  opacity: 0.5; pointer-events: none; z-index: 0;
}
/* static blobs (no continuous animation = no idle shimmer); they drift only on scroll via JS */
.hero__glow::before {
  width: 46vw; max-width: 560px; aspect-ratio: 1 / 1; left: 8%; top: -14%;
  background: radial-gradient(circle, rgba(63,125,251,0.42), transparent 62%);
}
.hero__glow::after {
  width: 40vw; max-width: 500px; aspect-ratio: 1 / 1; right: 6%; top: -8%;
  background: radial-gradient(circle, rgba(124,69,232,0.36), transparent 62%);
}
@keyframes mx-aurora-a { from { transform: translate(0,0) scale(1); } to { transform: translate(90px,46px) scale(1.18); } }
@keyframes mx-aurora-b { from { transform: translate(0,0) scale(1); } to { transform: translate(-80px,34px) scale(1.12); } }
[data-theme="light"] .hero__glow::before { opacity: 0.4; background: radial-gradient(circle, rgba(63,125,251,0.3), transparent 62%); }
[data-theme="light"] .hero__glow::after  { opacity: 0.4; background: radial-gradient(circle, rgba(124,69,232,0.24), transparent 62%); }

/* ---------- Inline SVG icon alignment (replacing former emoji) ---------- */
.term-nav .ic svg, .footer__col a .ic svg, .s-terminal__wtitle svg, .app-btn .ic svg { vertical-align: -0.18em; }
.feat-item .ic svg, .s-wwd-ic svg { display: block; }
.s-wwd-ic svg { margin: 0 auto; }

/* ---------- Scroll progress bar (sits just under the nav) ---------- */
.scroll-progress {
  position: fixed; top: var(--nav-h); left: 0; right: 0; height: 2px;
  z-index: 1001; pointer-events: none;
}
.scroll-progress span {
  display: block; height: 100%; transform: scaleX(0); transform-origin: left;
  background: var(--grad); box-shadow: 0 0 10px rgba(99, 140, 255, 0.6);
}

/* ---------- Active nav link (lights up as you pass its section) ---------- */
.nav__links a.active { color: var(--text); }
.nav__links a.active::after { transform: scaleX(1); }

/* ---------- Count-up numbers keep a stable width while ticking ---------- */
.hero__trust, .pf-value, .factor .val, .scr-stat .v, .stk-price, .perf .v, .mw-row .vals b {
  font-variant-numeric: tabular-nums;
}

/* ---------- Hero headline word reveal (blur + rise, staggered) ---------- */
.hero h1 .word { display: inline-block;
  animation: mx-word 0.7s cubic-bezier(.22, 1, .36, 1) both; }
.hero h1 em.word-block {
  animation: mx-word 0.75s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes mx-word {
  from { opacity: 0; transform: translateY(0.45em); }
  to   { opacity: 1; transform: none; }
}

/* ---------- First view: heatmap cells stagger in + sparkline draws itself ---------- */
.heat.mx-cell-in { animation: mx-cell 0.45s ease-out both; }
@keyframes mx-cell { from { opacity: 0; transform: scale(0.82); } to { opacity: 1; transform: none; } }
.spark path.line { stroke-dasharray: 1; }
.terminal.is-seen .spark path.line { animation: mx-draw 1.7s cubic-bezier(.5, 0, .2, 1); }
@keyframes mx-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

/* ---------- Directional reveal — plays ONCE on first scroll into view ----------
   Left card → top-left, middle → top, right card → top-right; feature copy/visual from their
   sides. The IntersectionObserver unobserves each element after it reveals, so it never replays
   (no scroll-up re-trigger). The transition is toggled on only WHILE animating (.rev-anim), so
   once settled it never overrides component hover transforms (e.g. card tilt). */
[data-reveal] { opacity: 0; }
[data-reveal="up"]    { transform: translate3d(0, 40px, 0); }
[data-reveal="top"]   { transform: translate3d(0, -40px, 0); }
[data-reveal="left"]  { transform: translate3d(-48px, 0, 0); }
[data-reveal="right"] { transform: translate3d(48px, 0, 0); }
[data-reveal="tl"]    { transform: translate3d(-48px, -36px, 0); }
[data-reveal="tr"]    { transform: translate3d(48px, -36px, 0); }
[data-reveal].rev-anim { transition: opacity 0.9s cubic-bezier(.22, 1, .36, 1), transform 0.9s cubic-bezier(.22, 1, .36, 1); }
[data-reveal].is-in { opacity: 1; transform: translate3d(0, 0, 0); }

/* ---------- Elastic slider: let the over-drag stretch be VISIBLE ----------
   The screener mock had overflow:hidden which clipped the elastic spring so it
   looked dead. Un-clip just this mock (round the bar so the top corners stay clean),
   keeping the full rail length so the elasticity actually shows. */
.s-screener__mock { overflow: visible; }
.s-screener__mock .mock__bar { border-radius: var(--r-lg) var(--r-lg) 0 0; }
/* a touch more spring travel + room so the stretch reads clearly */
.elasticslider__rail { margin-inline: 4px; }

/* ---------- Reduced motion: kill transforms/animations, keep states legible ---------- */
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
  .spotlight::before { transition: none; }
  .star-border::before { animation: none; background: var(--accent); opacity: .5; }
  .shiny { animation: none; }
  .hero__glow::before, .hero__glow::after { animation: none; }
  .btn, .mock, .heat, .chip, .feat-item, .s-wwd-card,
  .nav__links a::after, .feat-item .ic { transition: none !important; }
  .mock:hover, .heat:hover, .chip:hover { transform: none; }
}

/* ---------- Mobile overflow guard ----------
   Mock visuals contain wide data tables/grids whose min-content was forcing the
   grid column (and the whole page) wider than the viewport. Let items shrink, and
   let any still-too-wide mock content scroll inside its own card instead. */
.feat, .feat__copy, .feat__visual { min-width: 0; }
.feat__visual .mock { max-width: 100%; }
.mock__body, .term-card, .card { min-width: 0; }
@media (max-width: 639px) {
  .mock__body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ---------- Touch / no-hover: don't depend on hover, keep tap feedback ---------- */
@media (hover: none) {
  .btn--ghost::after { display: none; }
  .heat:hover, .mock:hover, .chip:hover { transform: none; }
}
