/* =====================================================================
   ax-polish.css  —  Reddenda marketing-site expressive effects module
   Light-locked. Compositor-only (transform + opacity). No blur on large
   areas. No layout/paint animation. Self-contained; opt-in via classes
   and data-attributes. Pairs with ax-polish.js (defer-loaded).

   Accent tokens:  teal #0FB5A6 · cyan #00E5FF (LOW alpha only)
   Surfaces:       white #FFFFFF · faint #F7F9FB
   Ink:            #0A0B0C · body #191D21 · hairline #EAEBEC

   Public surface:
     [data-ax-lamp]      lit-from-above section header (signature beat)
     [data-ax-spotlight] cursor-following radial glow on a container
     .ax-cta-btn /
       [data-ax-border]  animated conic moving-border on primary CTAs
     [data-ax-card]      mouse-follow spotlight + sheen sweep + glow edge
     [data-ax-tilt]      perspective tilt (hero card)
     [data-ax-reveal]    shimmer/wipe reveal for a headline word
   ===================================================================== */

/* ---- registered custom props (graceful static fallback if unsupported) */
@property --ax-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

:root {
  --ax-teal: 15, 181, 166;   /* #0FB5A6 */
  --ax-cyan: 0, 229, 255;    /* #00E5FF */
  --ax-ink: #0A0B0C;
  --ax-hair: #EAEBEC;
  --ax-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* =====================================================================
   1) LAMP  —  [data-ax-lamp]  (the signature dramatic beat)
   Pure gradients + transform. "Lit from above" on white. No filter:blur.
   ===================================================================== */
[data-ax-lamp] {
  position: relative;
  overflow: clip;
  isolation: isolate;
  background: #FFFFFF;
}
[data-ax-lamp].ax-lamp--faint { background: #F7F9FB; }

/* keep real content above all glow layers */
[data-ax-lamp] > * { position: relative; z-index: 3; }

/* shared decorative layers — non-interactive, never shift layout */
[data-ax-lamp]::before,
[data-ax-lamp]::after,
[data-ax-lamp] > .ax-lamp-line,
[data-ax-lamp] > .ax-lamp-cones {
  pointer-events: none;
}

/* (c) broad faint top-glow behind everything */
[data-ax-lamp]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(72% 82% at 50% -8%,
      rgba(var(--ax-cyan), 0.22) 0%,
      rgba(var(--ax-teal), 0.12) 30%,
      rgba(var(--ax-teal), 0.04) 50%,
      transparent 66%);
  opacity: 0;
  transition: opacity 0.7s var(--ax-ease);
}

/* (a) the bright accent LINE at top-center + soft radial halo (no blur) */
[data-ax-lamp]::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 2;
  width: min(620px, 78%);
  height: 3px;
  border-radius: 3px;
  transform: translateX(-50%) scaleX(0.55);
  transform-origin: top center;
  opacity: 0;
  background:
    linear-gradient(90deg,
      transparent 0%,
      rgba(var(--ax-teal), 0.9) 24%,
      rgba(var(--ax-cyan), 1) 50%,
      rgba(var(--ax-teal), 0.9) 76%,
      transparent 100%);
  /* luminous glowing line — real bloom (blur permitted in ultimate mode), cheap on one tiny element */
  box-shadow:
    0 0 14px 1px rgba(var(--ax-cyan), 0.85),
    0 0 42px 6px rgba(var(--ax-cyan), 0.45),
    0 0 90px 16px rgba(var(--ax-teal), 0.30);
  transition:
    transform 0.8s var(--ax-ease),
    opacity 0.8s var(--ax-ease);
}

/* halo bloom around the line (separate so it can spread without box-shadow) */
[data-ax-lamp] > .ax-lamp-line {
  position: absolute;
  top: -64px;
  left: 50%;
  z-index: 1;
  width: min(880px, 96%);
  height: 210px;
  transform: translateX(-50%) scaleX(0.55);
  transform-origin: top center;
  opacity: 0;
  /* hot bright core fading out — soft blur for a real luminous bloom */
  background:
    radial-gradient(46% 58% at 50% 42%,
      rgba(var(--ax-cyan), 0.42) 0%,
      rgba(var(--ax-cyan), 0.22) 22%,
      rgba(var(--ax-teal), 0.12) 46%,
      transparent 74%);
  filter: blur(6px);
  transition:
    transform 0.8s var(--ax-ease),
    opacity 0.8s var(--ax-ease);
}

/* (b) two mirrored conic "cones" fanning down-outward from the line */
[data-ax-lamp] > .ax-lamp-cones {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 460px;
  z-index: 0;
}
[data-ax-lamp] > .ax-lamp-cones::before,
[data-ax-lamp] > .ax-lamp-cones::after {
  content: "";
  position: absolute;
  top: 0;
  width: 52%;
  height: 100%;
  opacity: 0;
  transform: scaleX(0.55);
  transition:
    transform 0.85s var(--ax-ease),
    opacity 0.85s var(--ax-ease);
  /* soft edge dissolve so the cone never shows a hard boundary */
  -webkit-mask-image:
    radial-gradient(120% 100% at 50% 0%, #000 0%, transparent 70%);
  mask-image:
    radial-gradient(120% 100% at 50% 0%, #000 0%, transparent 70%);
}
[data-ax-lamp] > .ax-lamp-cones::before {
  left: 0;
  transform-origin: top right;
  background:
    conic-gradient(from 196deg at 100% 0%,
      transparent 0%,
      rgba(var(--ax-cyan), 0.30) 6%,
      rgba(var(--ax-teal), 0.20) 13%,
      rgba(var(--ax-teal), 0.06) 22%,
      transparent 32%);
}
[data-ax-lamp] > .ax-lamp-cones::after {
  right: 0;
  transform-origin: top left;
  background:
    conic-gradient(from 132deg at 0% 0%,
      transparent 0%,
      rgba(var(--ax-cyan), 0.30) 6%,
      rgba(var(--ax-teal), 0.20) 13%,
      rgba(var(--ax-teal), 0.06) 22%,
      transparent 32%);
}

/* heading lift — target a marked element, else any heading inside */
[data-ax-lamp] .ax-lamp-heading,
[data-ax-lamp] :is(h1, h2, h3) {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.8s var(--ax-ease) 0.08s,
    transform 0.8s var(--ax-ease) 0.08s;
  /* fail-safe (2026-07-07): if the IO never lands .is-lit (slow device, JS hiccup,
     headless render), the heading must still appear. Pure CSS, fires at 2.2s. */
  animation: axLampFailsafe 0.8s var(--ax-ease) 2.2s forwards;
}
@keyframes axLampFailsafe { to { opacity: 1; transform: none; } }

/* lit state (added by IO when in view) */
[data-ax-lamp].is-lit::before { opacity: 1; }
[data-ax-lamp].is-lit::after {
  opacity: 1;
  transform: translateX(-50%) scaleX(1);
}
[data-ax-lamp].is-lit > .ax-lamp-line {
  opacity: 1;
  transform: translateX(-50%) scaleX(1);
}
[data-ax-lamp].is-lit > .ax-lamp-cones::before,
[data-ax-lamp].is-lit > .ax-lamp-cones::after {
  opacity: 1;
  transform: scaleX(1);
}
[data-ax-lamp].is-lit .ax-lamp-heading,
[data-ax-lamp].is-lit :is(h1, h2, h3) {
  opacity: 1;
  transform: translateY(0);
}

/* =====================================================================
   2) SPOTLIGHT  —  [data-ax-spotlight]
   Cursor-following radial glow. --mx/--my set by JS in a coalesced rAF.
   Static centered glow as the touch / no-pointer default.
   ===================================================================== */
[data-ax-spotlight] {
  position: relative;
  isolation: isolate;
}
[data-ax-spotlight]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: inherit;
  /* static centered default (also the touch fallback) */
  background:
    radial-gradient(38% 46% at 50% 30%,
      rgba(var(--ax-cyan), 0.08) 0%,
      rgba(var(--ax-teal), 0.05) 40%,
      transparent 72%);
  opacity: 0.85;
  transition: opacity 0.4s var(--ax-ease);
}
[data-ax-spotlight] > * { position: relative; z-index: 1; }

/* active pointer-tracked glow (JS adds .ax-tracking + sets --mx/--my) */
@media (hover: hover) and (pointer: fine) {
  [data-ax-spotlight].ax-tracking::before {
    background:
      radial-gradient(360px 360px at var(--mx, 50%) var(--my, 30%),
        rgba(var(--ax-cyan), 0.12) 0%,
        rgba(var(--ax-teal), 0.07) 38%,
        transparent 70%);
    opacity: 1;
  }
}

/* =====================================================================
   3) MOVING BORDER  —  .ax-cta-btn / [data-ax-border]
   Additive conic ring via ::before (masked). No layout shift. IO-paused.
   ===================================================================== */
.ax-cta-btn,
[data-ax-border] {
  position: relative;
  isolation: isolate;
  z-index: 0;
}
.ax-cta-btn::before,
[data-ax-border]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  padding: 1.5px;            /* ring thickness */
  border-radius: inherit;
  /* static fallback ring (used when @property/animation unavailable) */
  background:
    linear-gradient(120deg,
      rgba(var(--ax-teal), 0.65),
      rgba(var(--ax-cyan), 0.9),
      rgba(var(--ax-teal), 0.65));
  /* show only the ring: composite the fill out of the center */
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0.9;
  pointer-events: none;
}

/* animated conic ring where @property is supported */
@supports (background: conic-gradient(from var(--ax-angle), red, red)) {
  .ax-cta-btn::before,
  [data-ax-border]::before {
    background:
      conic-gradient(from var(--ax-angle),
        rgba(var(--ax-teal), 0.0) 0%,
        rgba(var(--ax-teal), 0.55) 16%,
        rgba(var(--ax-cyan), 1) 30%,
        rgba(var(--ax-teal), 0.55) 44%,
        rgba(var(--ax-teal), 0.0) 60%,
        rgba(var(--ax-teal), 0.0) 100%);
    animation: ax-spin 3.4s linear infinite;
    animation-play-state: paused;   /* JS/IO resumes only while on-screen */
  }
  /* a faint full ring underneath so the button always reads as bordered */
  .ax-cta-btn::after,
  [data-ax-border]::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    padding: 1.5px;
    border-radius: inherit;
    background:
      linear-gradient(120deg,
        rgba(var(--ax-teal), 0.30),
        rgba(var(--ax-cyan), 0.40));
    -webkit-mask:
      linear-gradient(#000 0 0) content-box,
      linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask:
      linear-gradient(#000 0 0) content-box,
      linear-gradient(#000 0 0);
    mask-composite: exclude;
    pointer-events: none;
  }
  /* IO marks visible elements; only those spin */
  .ax-cta-btn.ax-spin-on::before,
  [data-ax-border].ax-spin-on::before {
    animation-play-state: running;
  }
}

@keyframes ax-spin {
  to { --ax-angle: 360deg; }
}

/* =====================================================================
   4) CARD  —  [data-ax-card]
   ::before mouse-follow spotlight (opacity 0->1 on hover, --mx/--my rAF)
   ::after one-shot diagonal sheen sweep on hover (transform only)
   hairline accent-glow border on hover
   ===================================================================== */
[data-ax-card] {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transition: box-shadow 0.4s var(--ax-ease);
}
[data-ax-card] > * { position: relative; z-index: 2; }

/* spotlight overlay */
[data-ax-card]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.35s var(--ax-ease);
  background:
    radial-gradient(220px 220px at var(--mx, 50%) var(--my, 50%),
      rgba(var(--ax-cyan), 0.14) 0%,
      rgba(var(--ax-teal), 0.07) 40%,
      transparent 70%);
}

/* sheen / glare sweep — thin diagonal highlight, parked off to the left */
[data-ax-card]::after {
  content: "";
  position: absolute;
  top: -60%;
  left: -60%;
  z-index: 1;
  width: 55%;
  height: 220%;
  pointer-events: none;
  transform: translateX(-220%) rotate(18deg);
  background:
    linear-gradient(90deg,
      transparent 0%,
      rgba(var(--ax-cyan), 0.0) 10%,
      rgba(255, 255, 255, 0.55) 48%,
      rgba(var(--ax-cyan), 0.18) 60%,
      transparent 100%);
  opacity: 0;
}

@media (hover: hover) and (pointer: fine) {
  [data-ax-card].ax-hot::before { opacity: 1; }
  [data-ax-card].ax-hot {
    box-shadow:
      0 1px 0 rgba(var(--ax-teal), 0.25) inset,
      0 0 0 1px rgba(var(--ax-teal), 0.28),
      0 18px 40px -22px rgba(var(--ax-teal), 0.35);
  }
  /* sweep runs once when JS adds .ax-sweep */
  [data-ax-card].ax-sweep::after {
    opacity: 1;
    transform: translateX(360%) rotate(18deg);
    transition:
      transform 0.85s var(--ax-ease),
      opacity 0.85s linear;
  }
}

/* =====================================================================
   5) TILT  —  [data-ax-tilt]  (hero RateScore card)
   Perspective set on the element; JS writes rotateX/rotateY transform.
   ===================================================================== */
[data-ax-tilt] {
  transform: perspective(900px) rotateX(0deg) rotateY(0deg);
  transform-style: preserve-3d;
  transition: transform 0.5s var(--ax-ease);
}
@media (hover: hover) and (pointer: fine) {
  /* while tracking, JS sets the transform directly and shortens transition
     via the .ax-tilting class for a springy, responsive feel */
  [data-ax-tilt].ax-tilting {
    transition: transform 0.12s ease-out;
  }
}

/* =====================================================================
   6) REVEAL  —  [data-ax-reveal]  (headline word shimmer/wipe)
   ===================================================================== */
[data-ax-reveal] {
  display: inline-block;
  position: relative;
  opacity: 0;
  transform: translateY(0.18em);
  transition:
    opacity 0.6s var(--ax-ease),
    transform 0.6s var(--ax-ease);
}
[data-ax-reveal].is-revealed {
  opacity: 1;
  transform: translateY(0);
}
/* a single shimmer pass driven by background-position (paint-light, text-clipped) */
[data-ax-reveal].ax-shimmer.is-revealed {
  background-image:
    linear-gradient(110deg,
      currentColor 0%,
      currentColor 38%,
      rgba(var(--ax-cyan), 1) 50%,
      currentColor 62%,
      currentColor 100%);
  background-size: 220% 100%;
  background-position: 120% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: ax-shimmer 1.1s var(--ax-ease) 0.2s 1 forwards;
}
@keyframes ax-shimmer {
  to { background-position: -40% 0; }
}

/* =====================================================================
   NO-SCRIPT FALLBACK  —  .is-lit is added by ax-polish.js. If scripting
   is disabled the JS never runs, so render the lamp + its heading in the
   final lit state (CSS-only, no animation) so no content stays hidden.
   ===================================================================== */
@media (scripting: none) {
  [data-ax-lamp]::before { opacity: 1; transition: none; }
  [data-ax-lamp]::after {
    opacity: 1; transform: translateX(-50%) scaleX(1); transition: none;
  }
  [data-ax-lamp] > .ax-lamp-line {
    opacity: 1; transform: translateX(-50%) scaleX(1); transition: none;
  }
  [data-ax-lamp] > .ax-lamp-cones::before,
  [data-ax-lamp] > .ax-lamp-cones::after {
    opacity: 1; transform: scaleX(1); transition: none;
  }
  [data-ax-lamp] .ax-lamp-heading,
  [data-ax-lamp] :is(h1, h2, h3) {
    opacity: 1; transform: none; transition: none;
  }
  [data-ax-reveal] { opacity: 1; transform: none; transition: none; }
}

/* =====================================================================
   REDUCED MOTION  —  render everything in its final, fully-lit state.
   No spins, no sweeps, no tilt, no pointer tracking.
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  [data-ax-lamp]::before,
  [data-ax-lamp].is-lit::before { opacity: 1; transition: none; }
  [data-ax-lamp]::after,
  [data-ax-lamp].is-lit::after {
    opacity: 1; transform: translateX(-50%) scaleX(1); transition: none;
  }
  [data-ax-lamp] > .ax-lamp-line,
  [data-ax-lamp].is-lit > .ax-lamp-line {
    opacity: 1; transform: translateX(-50%) scaleX(1); transition: none;
  }
  [data-ax-lamp] > .ax-lamp-cones::before,
  [data-ax-lamp] > .ax-lamp-cones::after,
  [data-ax-lamp].is-lit > .ax-lamp-cones::before,
  [data-ax-lamp].is-lit > .ax-lamp-cones::after {
    opacity: 1; transform: scaleX(1); transition: none;
  }
  [data-ax-lamp] .ax-lamp-heading,
  [data-ax-lamp] :is(h1, h2, h3) {
    opacity: 1; transform: none; transition: none;
  }

  .ax-cta-btn::before,
  [data-ax-border]::before { animation: none !important; }

  [data-ax-card]::after { display: none; }

  [data-ax-tilt],
  [data-ax-tilt].ax-tilting { transform: none; transition: none; }

  [data-ax-reveal] { opacity: 1; transform: none; transition: none; }
  [data-ax-reveal].ax-shimmer.is-revealed {
    animation: none;
    -webkit-text-fill-color: currentColor;
    background: none;
  }
}
