/* =========================================================
   GRID · cinema-fx.css
   Shared cinematic treatments — used across all pages.
   Layered on top of effects.css (does not replace it).
   Brand v1.1 compliant (Heebo + Space Grotesk, single-family)
   ========================================================= */

/* ─── 1. Premium Depth Card (mouse-tracked spotlight) ─── */
.cfx-depth-card {
  position: relative;
  isolation: isolate;
  transition: transform .35s cubic-bezier(.2, .7, .3, 1),
              border-color .35s ease;
}
.cfx-depth-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    520px circle at var(--mx, 50%) var(--my, 50%),
    rgba(59, 131, 247, 0.22),
    transparent 45%
  );
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
  z-index: 0;
}
.cfx-depth-card:hover {
  transform: translateY(-4px);
  border-color: rgba(59, 131, 247, 0.4) !important;
}
.cfx-depth-card:hover::before { opacity: 1; }
.cfx-depth-card > * { position: relative; z-index: 1; }

/* ─── 2. Image clip-path reveal ─── */
.cfx-image-reveal {
  clip-path: inset(0 0 100% 0);
  will-change: clip-path;
}
.cfx-image-reveal.in-view {
  clip-path: inset(0 0 0 0);
  transition: clip-path 1.2s cubic-bezier(.2, .8, .2, 1);
}

/* ─── 3. Animated section divider (draws from center) ─── */
.cfx-divider {
  height: 1px;
  width: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(59, 131, 247, 0.35) 50%,
    transparent 100%
  );
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 1.1s cubic-bezier(.2, .8, .2, 1);
}
.cfx-divider.in-view { transform: scaleX(1); }
.cfx-divider.cfx-divider-lg { height: 2px; }

/* ─── 4. Breathing radial glow (ambient background) ─── */
.cfx-breath-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    circle at center,
    rgba(59, 131, 247, 0.10),
    transparent 65%
  );
  animation: cfx-breath 5.5s ease-in-out infinite;
  will-change: transform, opacity;
}
@keyframes cfx-breath {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.08); }
}

/* ─── 5. Animated grid lines (premium backdrop) ─── */
.cfx-grid-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(59, 131, 247, 0.10) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(59, 131, 247, 0.10) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse at center, black 25%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 25%, transparent 75%);
}
.cfx-grid-lines.cfx-grid-lines-tight { background-size: 40px 40px; }

/* ─── 6. Mega number background (scroll parallax) ─── */
.cfx-mega-number {
  position: absolute;
  font-family: 'Space Grotesk', 'Heebo', sans-serif;
  font-weight: 700;
  font-size: clamp(140px, 26vw, 360px);
  line-height: 0.85;
  letter-spacing: -0.05em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(59, 131, 247, 0.14);
  pointer-events: none;
  z-index: 0;
  user-select: none;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}

/* ─── 7. Word reveal (used with data-cfx-words + JS split) ─── */
.cfx-word-line {
  overflow: hidden;
  display: inline-block;
  vertical-align: top;
}
.cfx-word {
  display: inline-block;
  will-change: transform, opacity;
  transform-origin: 50% 100%;
}

/* ─── 8. Glow-pulse CTA (replaces flat buttons in cinematic moments) ─── */
.cfx-glow-cta {
  position: relative;
  overflow: visible;
}
.cfx-glow-cta::before {
  content: '';
  position: absolute;
  inset: -6px;
  background: radial-gradient(circle, rgba(59, 131, 247, 0.45), transparent 70%);
  filter: blur(20px);
  z-index: -1;
  opacity: 0.7;
  animation: cfx-cta-pulse 3.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes cfx-cta-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.95); }
  50%      { opacity: 1;    transform: scale(1.08); }
}

/* ─── 8c. Magnetic CTA shell ───
   Used as the outer wrapper around any CTA that is BOTH (a) being
   driven by a GSAP reveal timeline that writes to the CTA's transform,
   AND (b) mouse-magnetic. Putting cfx-magnetic on this shell keeps the
   mouse-driven translate on a separate element from the scroll-driven
   reveal transform, so they no longer fight on every mousemove. */
.cta-magnet {
  display: inline-block;
  will-change: transform;
}

/* ─── 9. Icon halo (used inside depth-cards on hover) ─── */
.cfx-icon-halo {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cfx-icon-halo::after {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 131, 247, 0.32), transparent 70%);
  filter: blur(10px);
  z-index: -1;
  opacity: 0;
  transition: opacity .35s ease, transform .45s cubic-bezier(.2, .8, .2, 1);
}
.cfx-depth-card:hover .cfx-icon-halo::after,
.cfx-icon-halo:hover::after {
  opacity: 1;
  transform: scale(1.2);
}

/* ─── 10. Floating fragment accents (decorative motion bits) ─── */
.cfx-fragment-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.cfx-fragment {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(59, 131, 247, 0.5);
  border-radius: 50%;
  filter: blur(0.5px);
  will-change: transform;
  animation: cfx-float 8s ease-in-out infinite;
}
.cfx-fragment-line {
  width: 24px;
  height: 1px;
  border-radius: 0;
  background: rgba(111, 168, 255, 0.4);
}
@keyframes cfx-float {
  0%, 100% { transform: translate3d(0, 0, 0); opacity: 0.3; }
  50%      { transform: translate3d(0, -20px, 0); opacity: 1; }
}

/* ─── 11. Lift hover (cards) ─── */
.cfx-lift {
  transition: transform .4s cubic-bezier(.2, .8, .2, 1),
              box-shadow .4s ease;
}
.cfx-lift:hover {
  transform: translateY(-6px);
  box-shadow: 0 30px 60px -22px rgba(59, 131, 247, 0.30);
}

/* ─── 12. Chapter tag (premium kicker / eyebrow) ─── */
.cfx-chapter-tag {
  font-family: 'Space Grotesk', 'Heebo', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #3b83f7;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  direction: ltr;
}
.cfx-chapter-tag::before {
  content: '';
  display: inline-block;
  width: 28px;
  height: 1px;
  background: currentColor;
  flex-shrink: 0;
}

/* ─── 13. Scroll-anchored grow (used for footer wordmark, etc.) ─── */
.cfx-wordmark {
  display: inline-block;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  letter-spacing: -0.05em;
  /* Uses CSS variables so it adapts to v6 light mode (--fg = graphite)
     while production dark pages get the hardcoded fallback. */
  background: linear-gradient(180deg, var(--fg, #F5F7F8) 0%, var(--fg-faded, rgba(245, 247, 248, 0.4)) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  will-change: transform, opacity;
  direction: ltr;
}

/* ─── 14. Diagonal slash transition (between sections) ─── */
.cfx-section-edge {
  position: relative;
  height: 1px;
  margin-top: -1px;
  background: transparent;
  overflow: visible;
}
.cfx-section-edge::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(59,131,247,0.4) 50%, transparent 100%);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 1.2s cubic-bezier(.2, .8, .2, 1);
}
.cfx-section-edge.in-view::after { transform: scaleX(1); }

/* ─── 15. Mobile simplifications ─── */
@media (max-width: 767px) {
  .cfx-depth-card::before { display: none; }
  .cfx-depth-card:hover { transform: none; }
  .cfx-breath-glow { animation-duration: 8s; }
  .cfx-glow-cta::before { animation-duration: 5s; }
  .cfx-mega-number { font-size: clamp(100px, 28vw, 160px); }
  .cfx-fragment-field { display: none; }
}

/* ─── 16. Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  .cfx-image-reveal { clip-path: inset(0 0 0 0); transition: none; }
  .cfx-divider, .cfx-section-edge::after { transform: scaleX(1); transition: none; }
  .cfx-breath-glow,
  .cfx-glow-cta::before,
  .cfx-fragment { animation: none; }
  .cfx-depth-card { transition: none; }
  .cfx-depth-card::before { opacity: 0; }
}
