/* ============================================================
   Emerald Edge — Premium Interaction Layer
   Cursor-reactive, physics-driven motion craft.
   Pairs with premium.js. GPU-only (transform/opacity), and
   fully disabled under prefers-reduced-motion.
   ============================================================ */

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

/* ---------- 1. Scroll progress rail ---------- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--emerald), var(--cyan));
  box-shadow: 0 0 12px var(--glow-color), 0 0 4px var(--cyan-glow);
  z-index: 1100;
  pointer-events: none;
  will-change: transform;
}

/* ---------- 2. Header condense on scroll ---------- */
.header {
  transition: padding 0.4s var(--ease-out-expo),
              background 0.4s ease,
              border-color 0.4s ease,
              box-shadow 0.4s ease;
}
.header.is-scrolled {
  background: rgba(6, 10, 15, 0.92);
  border-bottom-color: rgba(34, 229, 127, 0.22);
  box-shadow: 0 8px 40px -12px rgba(0, 0, 0, 0.6);
}
.header.is-scrolled .nav {
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

/* ---------- 3. Scroll reveal ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s var(--ease-out-expo),
              transform 0.8s var(--ease-out-expo);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: transform, opacity;
}
[data-reveal="left"]  { transform: translateX(-36px); }
[data-reveal="right"] { transform: translateX(36px); }
[data-reveal="scale"] { transform: scale(0.94); }
[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- 4. Spotlight glow (cursor-following) ---------- */
.spotlight {
  position: relative;
  isolation: isolate;
}
.spotlight::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(
    220px circle at var(--mx, 50%) var(--my, 50%),
    rgba(34, 229, 127, 0.55),
    rgba(28, 183, 232, 0.18) 40%,
    transparent 70%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
  z-index: 1;
}
.spotlight::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    240px circle at var(--mx, 50%) var(--my, 50%),
    rgba(34, 229, 127, 0.10),
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
  z-index: 0;
}
.spotlight.is-hot::before,
.spotlight.is-hot::after { opacity: 1; }

/* keep card's own content above the glow layers */
.spotlight > * { position: relative; z-index: 2; }

/* ---------- 5. Magnetic / tilt transforms ---------- */
/* Magnetic motion is driven entirely by JS lerp (both directions) — no CSS
   transition here, or it would fight the per-frame transform and feel mushy. */
.magnetic { will-change: transform; }
.tilt-3d {
  transform-style: preserve-3d;
  transition: transform 0.18s var(--ease-out-expo); /* short: smooths jitter without lag */
  will-change: transform;
}

/* ---------- 6. Hero parallax targets ---------- */
.hero-visual { will-change: transform; }

/* ---------- 7. Animated count-up safety ---------- */
.stat-number[data-count] { font-variant-numeric: tabular-nums; }

/* ============================================================
   Respect user motion preferences — turn it all off cleanly.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .scroll-progress { display: none; }
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .spotlight::before, .spotlight::after { display: none; }
  .magnetic, .tilt-3d { transform: none !important; transition: none !important; }
  .hero-aurora { animation: none !important; }
}

/* ============================================================
   8. Hero aurora — animated, pointer-reactive gradient mesh
   ============================================================ */
.hero-aurora {
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 140%;
  z-index: 0;
  pointer-events: none;
  filter: blur(60px) saturate(120%);
  opacity: 0.9;
  background:
    radial-gradient(38% 50% at calc(28% + var(--ax, 0px)) calc(32% + var(--ay, 0px)),
      rgba(34, 229, 127, 0.34), transparent 70%),
    radial-gradient(34% 46% at calc(72% - var(--ax, 0px)) calc(40% + var(--ay, 0px)),
      rgba(28, 183, 232, 0.28), transparent 70%),
    radial-gradient(40% 48% at calc(54% + var(--ax, 0px)) calc(78% - var(--ay, 0px)),
      rgba(15, 175, 106, 0.22), transparent 72%);
  transition: --ax 0.6s ease, --ay 0.6s ease;
  animation: aurora-drift 18s ease-in-out infinite;
  will-change: transform;
}
@keyframes aurora-drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33%      { transform: translate3d(2%, -2%, 0) scale(1.06); }
  66%      { transform: translate3d(-2%, 1%, 0) scale(1.03); }
}
/* keep hero content above the aurora */
.hero .hero-container { position: relative; z-index: 1; }

/* ============================================================
   9. Interactive Visibility Check widget
   ============================================================ */
.vischeck-section { position: relative; }
.vischeck-frame {
  max-width: 980px;
  margin: 2.5rem auto 0;
  background: linear-gradient(180deg, rgba(12, 18, 24, 0.96), rgba(7, 11, 16, 0.96));
  border: 1px solid rgba(34, 229, 127, 0.18);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 40px 120px -40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255,255,255,0.02) inset;
}
.vischeck-body { padding: clamp(1.4rem, 4vw, 2.6rem); }

/* --- form --- */
.vischeck-form { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1.2rem; }
.vc-field { display: flex; flex-direction: column; gap: 0.4rem; }
.vc-field:nth-child(3) { grid-column: 1 / -1; }
.vc-field label {
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em;
  text-transform: uppercase; color: var(--gray-text);
}
.vc-field input, .vc-field select {
  width: 100%;
  padding: 0.85rem 1rem;
  background: rgba(3, 6, 8, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 11px;
  color: var(--light-text);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.vc-field select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 1rem center;
}
.vc-field input:focus, .vc-field select:focus {
  outline: none;
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px rgba(34, 229, 127, 0.15);
  background: rgba(3, 6, 8, 0.95);
}
.vc-field input.vc-invalid { border-color: #f87171; box-shadow: 0 0 0 3px rgba(248,113,113,0.14); }
.vischeck-form .vc-submit { grid-column: 1 / -1; margin-top: 0.3rem; }
.vc-disclaimer {
  grid-column: 1 / -1; margin: 0.2rem 0 0;
  font-size: 0.8rem; line-height: 1.5; color: var(--gray-text);
}

/* --- scanning --- */
.vischeck-scan { animation: vc-fade 0.4s ease both; }
.vc-scan-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 1.2rem; color: var(--light-text); }
.vc-scan-title span { color: var(--emerald); }
.vc-scan-list { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }
.vc-scan-row {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.8rem 1rem; border-radius: 11px;
  background: rgba(3, 6, 8, 0.6); border: 1px solid var(--border-color);
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease, border-color 0.4s ease;
}
.vc-scan-row.vc-show { opacity: 1; transform: none; }
.vc-scan-spinner {
  width: 16px; height: 16px; flex-shrink: 0; border-radius: 50%;
  border: 2px solid rgba(34, 229, 127, 0.25); border-top-color: var(--emerald);
  animation: vc-spin 0.7s linear infinite;
}
.vc-scan-row.vc-done .vc-scan-spinner { animation: none; border: none; }
.vc-scan-name { flex: 1; font-weight: 500; }
.vc-scan-state { font-size: 0.82rem; color: var(--gray-text); }
.vc-scan-row.vc-done { border-color: rgba(34, 229, 127, 0.22); }
.vc-scan-check { color: var(--emerald); display: none; }
.vc-scan-row.vc-done .vc-scan-check { display: block; }
@keyframes vc-spin { to { transform: rotate(360deg); } }
@keyframes vc-fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* --- result --- */
.vischeck-result { animation: vc-fade 0.5s ease both; }
.vc-result-top { display: flex; align-items: center; gap: clamp(1.2rem, 4vw, 2.4rem); flex-wrap: wrap; }
.vc-gauge { position: relative; width: 150px; height: 150px; flex-shrink: 0; }
.vc-gauge-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.vc-gauge-track { fill: none; stroke: rgba(255,255,255,0.07); stroke-width: 9; }
.vc-gauge-fill {
  fill: none; stroke: var(--emerald); stroke-width: 9;
  stroke-linecap: round; stroke-dasharray: 327; stroke-dashoffset: 327;
  transition: stroke-dashoffset 1.4s var(--ease-out-expo), stroke 0.6s ease;
  filter: drop-shadow(0 0 6px rgba(34,229,127,0.5));
}
.vc-gauge-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.vc-gauge-num { font-size: 2.6rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.vc-gauge-denom { font-size: 0.85rem; color: var(--gray-text); margin-top: 2px; }
.vc-result-summary { flex: 1; min-width: 220px; }
.vc-result-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-text); }
.vc-result-headline { font-size: clamp(1.3rem, 3vw, 1.7rem); margin: 0.3rem 0 0.5rem; line-height: 1.2; }
.vc-result-sub { color: var(--gray-text); font-size: 0.98rem; line-height: 1.5; }
.vc-result-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem; margin-top: 1.8rem; }
.vc-block-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-text); margin-bottom: 0.8rem; }
.vc-platform-list, .vc-finding-list { list-style: none; display: flex; flex-direction: column; gap: 0.55rem; }
.vc-platform-list li {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.85rem; border-radius: 9px;
  background: rgba(3, 6, 8, 0.5); border: 1px solid var(--border-color);
  font-size: 0.92rem;
}
.vc-plat-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.vc-plat-dot--none { background: #f87171; box-shadow: 0 0 8px rgba(248,113,113,0.5); }
.vc-plat-dot--weak { background: #fbbf24; box-shadow: 0 0 8px rgba(251,191,36,0.5); }
.vc-plat-dot--ok   { background: var(--emerald); box-shadow: 0 0 8px rgba(34,229,127,0.5); }
.vc-plat-name { flex: 1; }
.vc-plat-state { font-size: 0.8rem; color: var(--gray-text); }
.vc-finding-list li {
  position: relative; padding: 0.6rem 0.85rem 0.6rem 2rem;
  border-radius: 9px; background: rgba(3, 6, 8, 0.5);
  border: 1px solid var(--border-color); font-size: 0.92rem; line-height: 1.45;
}
.vc-finding-list li::before {
  content: "!"; position: absolute; left: 0.7rem; top: 0.6rem;
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(251,191,36,0.15); color: #fbbf24;
  font-size: 0.72rem; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.vc-result-cta {
  margin-top: 1.9rem; padding-top: 1.6rem; border-top: 1px solid var(--border-color);
  text-align: center;
}
.vc-result-ctatext { font-size: 1.05rem; margin-bottom: 1.1rem; }
.vc-cta-row { display: flex; gap: 0.9rem; justify-content: center; flex-wrap: wrap; }

@media (max-width: 768px) {
  .vischeck-form { grid-template-columns: 1fr; }
  .vc-field:nth-child(3) { grid-column: 1; }
  .vc-result-cols { grid-template-columns: 1fr; gap: 1.3rem; }
  .vc-result-top { justify-content: center; text-align: center; }
}

/* ============================================================
   10. Scroll-pinned transformation story
   ============================================================ */
.story-section { position: relative; }
.story-track {
  position: relative;
  height: 460vh;            /* tall scroll runway: 4 beats + lead-out */
}
.story-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.story-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 3rem;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
}

/* --- sticky visual stage --- */
.story-stage { display: flex; justify-content: center; }
.story-phone {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, rgba(12, 18, 24, 0.98), rgba(7, 11, 16, 0.98));
  border: 1px solid rgba(34, 229, 127, 0.2);
  border-radius: 22px;
  padding: 1.3rem;
  box-shadow: 0 50px 130px -40px rgba(0, 0, 0, 0.85), 0 0 60px -20px var(--glow-color);
}
.story-phone-bar { display: flex; align-items: center; gap: 0.55rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border-color); margin-bottom: 1.1rem; }
.story-phone-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 10px var(--emerald); }
.story-phone-title { font-size: 0.82rem; color: var(--gray-text); font-weight: 600; letter-spacing: 0.03em; }
.story-chat { display: flex; flex-direction: column; gap: 0.7rem; margin-bottom: 1.4rem; }
.story-q {
  align-self: flex-end; max-width: 85%;
  background: rgba(28, 183, 232, 0.14); border: 1px solid rgba(28, 183, 232, 0.25);
  color: var(--light-text); padding: 0.7rem 0.9rem; border-radius: 14px 14px 4px 14px;
  font-size: 0.92rem;
}
.story-a {
  align-self: flex-start; max-width: 92%; min-height: 3.2em;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border-color);
  color: var(--light-text); padding: 0.8rem 1rem; border-radius: 14px 14px 14px 4px;
  font-size: 0.95rem; line-height: 1.5;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.story-a.is-swapping { opacity: 0; transform: translateY(6px); }
.story-a strong { color: var(--emerald); }

.story-meter { background: rgba(3, 6, 8, 0.5); border: 1px solid var(--border-color); border-radius: 14px; padding: 1rem 1.1rem; }
.story-meter-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.story-meter-label { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-text); }
.story-meter-status {
  font-size: 0.74rem; font-weight: 700; padding: 0.2rem 0.6rem; border-radius: 999px;
  background: rgba(248, 113, 113, 0.15); color: #f87171;
  transition: background 0.4s ease, color 0.4s ease;
}
.story-meter-scorerow { display: flex; align-items: baseline; gap: 0.3rem; margin-bottom: 0.6rem; }
.story-meter-num { font-size: 2.6rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: var(--light-text); }
.story-meter-denom { font-size: 0.95rem; color: var(--gray-text); }
.story-meter-track { height: 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.story-meter-fill {
  height: 100%; width: 8%; border-radius: 999px;
  background: linear-gradient(90deg, #f87171, #fbbf24);
  transition: width 0.25s linear, background 0.5s ease;
}
/* status / fill color ramp by stage */
.story-phone[data-stage="2"] .story-meter-status { background: rgba(251, 191, 36, 0.16); color: #fbbf24; }
.story-phone[data-stage="2"] .story-meter-fill { background: linear-gradient(90deg, #fbbf24, var(--emerald)); }
.story-phone[data-stage="3"] .story-meter-status { background: rgba(34, 229, 127, 0.16); color: var(--emerald); }
.story-phone[data-stage="3"] .story-meter-fill { background: linear-gradient(90deg, var(--emerald), var(--cyan)); }

/* --- scroll-advancing copy --- */
.story-copy { position: relative; min-height: 16rem; }
.story-beat {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center;
  opacity: 0; transform: translateY(24px); pointer-events: none;
  transition: opacity 0.5s var(--ease-out-expo), transform 0.5s var(--ease-out-expo);
}
.story-beat.is-active { opacity: 1; transform: none; pointer-events: auto; }
.story-eyebrow {
  display: inline-block; align-self: flex-start;
  font-size: 0.76rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--emerald); margin-bottom: 0.9rem;
  padding: 0.3rem 0.8rem; border: 1px solid rgba(34, 229, 127, 0.3); border-radius: 999px;
}
.story-title { font-size: clamp(1.8rem, 4vw, 2.9rem); line-height: 1.1; margin-bottom: 1rem; }
.story-text { font-size: clamp(1rem, 1.5vw, 1.18rem); color: var(--gray-text); line-height: 1.6; max-width: 30rem; }
.story-text strong { color: var(--light-text); }

/* --- progress rail --- */
.story-rail { position: absolute; right: 2rem; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 0.8rem; }
.story-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); transition: all 0.4s ease; }
.story-dot.is-active { background: var(--emerald); box-shadow: 0 0 12px var(--glow-color); transform: scale(1.4); }

.story-scrollhint {
  position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%);
  font-size: 0.8rem; color: var(--gray-text); letter-spacing: 0.04em;
  animation: story-hint 2.2s ease-in-out infinite;
}
@keyframes story-hint { 0%,100% { opacity: 0.4; } 50% { opacity: 0.9; } }
.story-track.is-engaged .story-scrollhint { opacity: 0; transition: opacity 0.4s ease; }

@media (max-width: 900px) {
  /* extra bottom padding clears the fixed mobile CTA bar; the centered
     block then sits a touch higher so no copy hides behind it */
  .story-inner { grid-template-columns: 1fr; gap: 1.1rem; padding: 3rem 1.4rem 7rem; }
  .story-stage { order: -1; }
  .story-phone { max-width: 320px; padding: 0.9rem; }
  .story-q, .story-a { font-size: 0.88rem; }
  .story-a { min-height: 2.8em; }
  .story-meter { padding: 0.8rem 0.9rem; }
  .story-meter-num { font-size: 1.9rem; }
  .story-copy { min-height: 9.5rem; text-align: center; }
  .story-title { font-size: 1.55rem; margin-bottom: 0.7rem; }
  .story-text { font-size: 0.96rem; }
  .story-beat { align-items: center; }
  .story-eyebrow, .story-beat { align-self: center; }
  .story-eyebrow { margin-bottom: 0.6rem; }
  .story-rail { right: 0.7rem; }
  .story-scrollhint { display: none; }
}

/* --- static, accessible fallback --- */
@media (prefers-reduced-motion: reduce) {
  .story-track { height: auto; }
  .story-sticky { position: static; height: auto; overflow: visible; padding: 4rem 0; }
  .story-copy { min-height: 0; }
  .story-beat { position: static; opacity: 1; transform: none; pointer-events: auto; margin-bottom: 2rem; }
  .story-rail, .story-scrollhint { display: none; }
}
