/*!
 * FairSign Spatial FX Engine v2.0 - Accompanying Stylesheet
 * Zero-dependency 60fps 3D/4D Parallax, Magnetic Halo Cursor, Tactile Ripple,
 * Multi-Card Bento Spotlight Border & Mechanical Odometer Telemetry
 * Designed exclusively for FairSign Forms to PDF (Warm Editorial Ivory & Metallic Ranks)
 */

:root {
  --lux-gold-bright: #f5e6b3;
  --lux-gold-core: #d4af37;
  --lux-gold-deep: #9e7a1c;
  --lux-gold-rgb: 212, 175, 55;
  --lux-sheen-rgb: 255, 248, 224;
  --lux-emerald-core: #1e9e63;
  --lux-emerald-bright: #34d399;
  --lux-emerald-rgb: 52, 211, 153;
  --lux-cursor-bg: rgba(15, 15, 18, 0.84);
  --lux-cursor-border: rgba(212, 175, 55, 0.72);
  --lux-cursor-text: #f7eed2;
  --lux-spring-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Automatic adaptation for FairSign light editorial surfaces or explicit light theme */
[data-lux-surface="ivory"],
[data-fs-skin="free"],
html:not([data-lux-surface="obsidian"]) body.fairsign-light {
  --lux-gold-bright: #e3b778;
  --lux-gold-core: #a5501a;
  --lux-gold-deep: #7c3a10;
  --lux-gold-rgb: 165, 80, 26;
  --lux-sheen-rgb: 255, 250, 240;
  --lux-cursor-bg: rgba(22, 21, 15, 0.9);
  --lux-cursor-border: rgba(212, 175, 55, 0.82);
  --lux-cursor-text: #fcf6ba;
}

/* Female Couture Rose Gold adaptation (FairSign Duchess 18K Rose) */
[data-fs-skin="rose"],
[data-lux-skin="rose"] {
  --lux-gold-bright: #fce4ec;
  --lux-gold-core: #e09f96;
  --lux-gold-deep: #a96860;
  --lux-gold-rgb: 224, 159, 150;
}

/* Platinum Cold Steel adaptation */
[data-fs-skin="platinum"],
[data-lux-skin="platinum"] {
  --lux-gold-bright: #f1f5f9;
  --lux-gold-core: #cbd5e1;
  --lux-gold-deep: #64748b;
  --lux-gold-rgb: 203, 213, 225;
}

/* ==========================================================================
   1. MAGNETIC HALO CURSOR & ±6PX MAGNETIC BUTTON PULL
   ========================================================================== */

.lux-cursor-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2147483640;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.28s var(--lux-spring-ease);
}

.lux-cursor-root.is-visible {
  opacity: 1;
}

@media (hover: none), (pointer: coarse), (prefers-reduced-motion: reduce) {
  .lux-cursor-root {
    display: none !important;
  }
}

.lux-cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  margin-top: -3px;
  border-radius: 999px;
  background: var(--lux-gold-bright);
  box-shadow: 0 0 10px rgba(var(--lux-gold-rgb), 0.85);
  will-change: transform, opacity;
  transition: opacity 0.2s var(--lux-spring-ease), transform 0.15s var(--lux-spring-ease);
}

.lux-cursor-halo {
  position: fixed;
  top: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--lux-cursor-border);
  background: radial-gradient(
    circle at 50% 50%,
    rgba(var(--lux-gold-rgb), 0.16),
    rgba(var(--lux-gold-rgb), 0.03) 72%
  );
  box-shadow:
    0 0 20px rgba(var(--lux-gold-rgb), 0.22),
    inset 0 0 8px rgba(var(--lux-gold-rgb), 0.18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transform: translate3d(-100px, -100px, 0) translate(-50%, -50%) scale(1);
  will-change: transform, width, height, padding, background-color, border-color;
  transition:
    min-width 0.34s var(--lux-spring-ease),
    height 0.34s var(--lux-spring-ease),
    padding 0.34s var(--lux-spring-ease),
    background 0.28s var(--lux-spring-ease),
    border-color 0.28s var(--lux-spring-ease),
    box-shadow 0.28s var(--lux-spring-ease);
}

.lux-cursor-status-dot {
  width: 0;
  height: 6px;
  border-radius: 999px;
  background: var(--lux-gold-bright);
  opacity: 0;
  transform: scale(0.4);
  transition:
    width 0.26s var(--lux-spring-ease),
    opacity 0.24s var(--lux-spring-ease),
    transform 0.26s var(--lux-spring-ease),
    background-color 0.24s ease;
}

.lux-cursor-label {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--lux-cursor-text);
  transform: translateY(0.5px);
  transition:
    max-width 0.36s var(--lux-spring-ease),
    opacity 0.22s var(--lux-spring-ease);
}

/* Pill expansion states: 3D TILT / INSPECT / LIVE DATA / MAGNET */
.lux-cursor-root.is-pill .lux-cursor-dot {
  opacity: 0;
}

.lux-cursor-root.is-pill .lux-cursor-halo {
  height: 32px;
  min-width: 96px;
  padding: 0 13px;
  background: var(--lux-cursor-bg);
  border-color: rgba(var(--lux-gold-rgb), 0.92);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.38),
    0 0 18px rgba(var(--lux-gold-rgb), 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.lux-cursor-root.is-pill .lux-cursor-status-dot {
  width: 6px;
  opacity: 1;
  transform: scale(1);
}

.lux-cursor-root.is-pill .lux-cursor-label {
  max-width: 150px;
  opacity: 1;
}

.lux-cursor-root[data-mode="live"] .lux-cursor-status-dot {
  background: var(--lux-emerald-bright);
  box-shadow: 0 0 8px rgba(var(--lux-emerald-rgb), 0.9);
  animation: luxLiveDotPulse 1.4s ease-in-out infinite;
}

.lux-cursor-root[data-mode="magnet"]:not(.is-pill) .lux-cursor-halo {
  min-width: 46px;
  height: 46px;
  border-color: rgba(var(--lux-gold-rgb), 0.95);
  background: radial-gradient(
    circle at 50% 50%,
    rgba(var(--lux-gold-rgb), 0.24),
    rgba(var(--lux-gold-rgb), 0.04) 72%
  );
}

.lux-cursor-root.is-down .lux-cursor-halo {
  box-shadow:
    0 0 26px rgba(var(--lux-gold-rgb), 0.58),
    inset 0 0 12px rgba(var(--lux-gold-rgb), 0.35);
}

@keyframes luxLiveDotPulse {
  0%, 100% { transform: scale(0.9); opacity: 0.78; }
  50% { transform: scale(1.25); opacity: 1; }
}

/* Magnetic Pull Elements (±6px max displacement + Spring Press compatibility) */
[data-lux-magnet],
.lux-magnet-bound {
  --lux-mag-x: 0px;
  --lux-mag-y: 0px;
  --lux-press-scale: 1;
  translate: var(--lux-mag-x) var(--lux-mag-y);
  scale: var(--lux-press-scale);
  transition: scale 0.42s var(--lux-spring-ease);
  will-change: translate, scale;
}

/* ==========================================================================
   2. TACTILE DOUBLE-RING PRECIOUS METAL RIPPLE & SPRING PRESS
   ========================================================================== */

.lux-tactile-bound {
  position: relative;
  --lux-press-scale: 1;
  scale: var(--lux-press-scale);
  transition: scale 0.44s var(--lux-spring-ease);
}

.lux-tactile-bound.is-lux-pressing {
  --lux-press-scale: 0.972;
  transition: scale 0.11s cubic-bezier(0.32, 0, 0.67, 0);
}

.lux-tactile-bound.is-lux-springing {
  animation: luxSpringBounce 0.52s var(--lux-spring-ease);
}

@keyframes luxSpringBounce {
  0% { scale: 0.972; }
  48% { scale: 1.016; }
  100% { scale: 1; }
}

/* Dedicated ripple plane preserves 3D Z-depth overflow on parent while clipping ripples cleanly */
.lux-ripple-plane {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  z-index: 3;
  transform: translateZ(0.5px);
}

.lux-ripple-wave {
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0);
  will-change: transform, opacity;
}

.lux-ripple-wave.is-outer {
  background: radial-gradient(
    circle,
    rgba(var(--lux-gold-rgb), 0.04) 0%,
    rgba(var(--lux-gold-rgb), 0.28) 54%,
    rgba(255, 248, 220, 0.52) 72%,
    transparent 76%
  );
  animation: luxRippleOuter 0.72s var(--lux-spring-ease) forwards;
}

.lux-ripple-wave.is-inner {
  border: 1.35px solid rgba(255, 246, 208, 0.78);
  box-shadow: 0 0 14px rgba(var(--lux-gold-rgb), 0.52);
  animation: luxRippleInner 0.78s 0.065s var(--lux-spring-ease) forwards;
}

@keyframes luxRippleOuter {
  0% {
    transform: translate(-50%, -50%) scale(0.06);
    opacity: 0.95;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
  }
}

@keyframes luxRippleInner {
  0% {
    transform: translate(-50%, -50%) scale(0.02);
    opacity: 0.92;
  }
  100% {
    transform: translate(-50%, -50%) scale(0.76);
    opacity: 0;
  }
}

/* ==========================================================================
   3. TRUE 3D TILT + 4D SPECULAR SHEEN + Z-DEPTH FLOATING LAYER (45PX)
   ========================================================================== */

[data-lux-3d],
.lux-3d-bound {
  --lux-rx: 0deg;
  --lux-ry: 0deg;
  --lux-lift: 1;
  --lux-sheen-angle: 135deg;
  --lux-sheen-x: 50%;
  --lux-sheen-y: 50%;
  --lux-sheen-alpha: 0;
  --lux-shadow-x: 0px;
  --lux-shadow-y: 18px;
  position: relative;
  transform-style: preserve-3d;
  transform: perspective(1000px) rotateX(var(--lux-rx)) rotateY(var(--lux-ry)) scale3d(var(--lux-lift), var(--lux-lift), 1);
  box-shadow:
    var(--lux-shadow-x) var(--lux-shadow-y) 38px -10px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(var(--lux-gold-rgb), 0.22);
  will-change: transform, box-shadow;
  transition: box-shadow 0.35s var(--lux-spring-ease);
}

[data-lux-3d].is-lux-3d-active,
.lux-3d-bound.is-lux-3d-active {
  box-shadow:
    var(--lux-shadow-x) var(--lux-shadow-y) 48px -8px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(var(--lux-gold-rgb), 0.52),
    0 0 28px -6px rgba(var(--lux-gold-rgb), 0.22);
}

/* Clipped inner media plane so rounded corners stay crisp while Z-badges float outside */
.lux-3d-clip {
  position: relative;
  border-radius: inherit;
  overflow: hidden;
  transform: translateZ(0);
}

/* 4D Dynamic Anisotropic Specular Sheen Layer */
.lux-4d-sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  z-index: 4;
  opacity: var(--lux-sheen-alpha, 0);
  transition: opacity 0.32s var(--lux-spring-ease);
  background:
    radial-gradient(
      340px circle at var(--lux-sheen-x) var(--lux-sheen-y),
      rgba(var(--lux-sheen-rgb), 0.32) 0%,
      rgba(var(--lux-gold-rgb), 0.14) 34%,
      transparent 70%
    ),
    linear-gradient(
      var(--lux-sheen-angle),
      transparent 18%,
      rgba(var(--lux-gold-rgb), 0.08) 38%,
      rgba(var(--lux-sheen-rgb), 0.42) 49.5%,
      rgba(var(--lux-gold-rgb), 0.18) 53%,
      transparent 74%
    );
  mix-blend-mode: soft-light;
}

/* Subtle crisp edge glint */
.lux-4d-sheen::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    var(--lux-sheen-angle),
    transparent 20%,
    rgba(255, 250, 226, 0.82) 50%,
    transparent 80%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
}

/* Z-Depth Floating Foreground Crest / Badge (Default translateZ(45px)) */
[data-lux-z] {
  --lux-z-dist: 45px;
  --lux-z-px: 0px;
  --lux-z-py: 0px;
  transform-style: preserve-3d;
  transform: translate3d(var(--lux-z-px), var(--lux-z-py), var(--lux-z-dist));
  filter: drop-shadow(calc(var(--lux-shadow-x, 0px) * 0.45) 12px 16px rgba(0, 0, 0, 0.42));
  will-change: transform, filter;
  z-index: 8;
}

/* ==========================================================================
   4. CURSOR-TRACKING SPOTLIGHT BENTO BORDER (MULTI-CARD PROXIMITY SYNC)
   ========================================================================== */

[data-lux-bento-card],
.lux-bento-bound {
  --lux-spot-x: -999px;
  --lux-spot-y: -999px;
  --lux-spot-alpha: 0;
  position: relative;
}

/* Crisp 1.25px Golden Spotlight Border via Dual-Mask Composite */
[data-lux-bento-card]::before,
.lux-bento-bound::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.35px;
  pointer-events: none;
  z-index: 5;
  opacity: var(--lux-spot-alpha, 0);
  transition: opacity 0.24s ease;
  background: radial-gradient(
    290px circle at var(--lux-spot-x) var(--lux-spot-y),
    rgba(252, 240, 188, 0.98) 0%,
    rgba(var(--lux-gold-rgb), 0.72) 28%,
    rgba(var(--lux-gold-rgb), 0.18) 56%,
    transparent 76%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
}

/* Ambient surface glow synced with neighboring cards */
.lux-bento-surface-glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
  opacity: var(--lux-spot-alpha, 0);
  transition: opacity 0.25s ease;
  background: radial-gradient(
    360px circle at var(--lux-spot-x) var(--lux-spot-y),
    rgba(var(--lux-gold-rgb), 0.085) 0%,
    rgba(var(--lux-gold-rgb), 0.025) 45%,
    transparent 75%
  );
}

/* ==========================================================================
   5. ODOMETER ROLL COUNTER, TELEMETRY BAR PULSE & VERIFICATION GREEN SEAL
   ========================================================================== */

.lux-odo {
  display: inline-flex;
  align-items: baseline;
  font-variant-numeric: tabular-nums;
  line-height: 1.08;
  vertical-align: baseline;
}

.lux-odo-static {
  display: inline-block;
  white-space: pre;
}

.lux-odo-col {
  position: relative;
  display: inline-block;
  height: 1.08em;
  overflow: hidden;
  vertical-align: bottom;
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    #000 13%,
    #000 87%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    #000 13%,
    #000 87%,
    transparent 100%
  );
}

.lux-odo-ribbon {
  display: flex;
  flex-direction: column;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

.lux-odo-digit {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 1.08em;
  line-height: 1.08em;
  user-select: none;
}

/* KPI Card Pulse Flash on Click / Telemetry Update */
.is-lux-kpi-pulsing {
  animation: luxKpiCardPulse 0.62s var(--lux-spring-ease);
}

@keyframes luxKpiCardPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(var(--lux-gold-rgb), 0.55);
  }
  45% {
    box-shadow:
      0 0 0 5px rgba(var(--lux-gold-rgb), 0.14),
      0 0 24px rgba(var(--lux-emerald-rgb), 0.22);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(var(--lux-gold-rgb), 0);
  }
}

/* Telemetry Bar Click Energy Pulse */
[data-lux-telem-bar],
[data-tc-bar] {
  position: relative;
  transition:
    height 0.54s var(--lux-spring-ease),
    transform 0.36s var(--lux-spring-ease),
    filter 0.28s ease;
}

.is-lux-bar-pulsing {
  animation: luxBarShockwave 0.58s var(--lux-spring-ease);
  filter: brightness(1.22) drop-shadow(0 0 12px rgba(var(--lux-gold-rgb), 0.65));
}

@keyframes luxBarShockwave {
  0% { transform: scaleY(0.92) scaleX(0.96); }
  45% { transform: scaleY(1.06) scaleX(1.05); }
  100% { transform: scaleY(1) scaleX(1); }
}

/* Verification Green Seal Stamp & Sheen Bounce */
[data-lux-verify-seal],
[data-tqv-stamp] {
  position: relative;
  overflow: hidden;
  transform-origin: center center;
  will-change: transform, box-shadow;
}

[data-lux-verify-seal]::after,
[data-tqv-stamp]::after {
  content: "";
  position: absolute;
  top: -20%;
  bottom: -20%;
  width: 48%;
  left: -65%;
  pointer-events: none;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(167, 243, 208, 0.45) 50%,
    transparent 100%
  );
  transform: skewX(-18deg);
}

.is-lux-seal-bouncing {
  animation: luxVerifySealBounce 0.64s var(--lux-spring-ease);
}

.is-lux-seal-bouncing::after {
  animation: luxVerifySealSweep 0.68s var(--lux-spring-ease);
}

@keyframes luxVerifySealBounce {
  0% {
    transform: scale(0.84) rotate(-2.8deg);
    box-shadow: 0 0 0 0 rgba(var(--lux-emerald-rgb), 0.68);
  }
  42% {
    transform: scale(1.075) rotate(1.1deg);
    box-shadow:
      0 0 0 7px rgba(var(--lux-emerald-rgb), 0.16),
      0 8px 24px rgba(16, 185, 129, 0.34);
  }
  72% {
    transform: scale(0.985) rotate(-0.3deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    box-shadow: 0 0 0 0 rgba(var(--lux-emerald-rgb), 0);
  }
}

@keyframes luxVerifySealSweep {
  0% { left: -65%; }
  100% { left: 135%; }
}

/* Reduced motion graceful fallback */
@media (prefers-reduced-motion: reduce) {
  [data-lux-3d],
  .lux-3d-bound {
    transform: none !important;
  }
  [data-lux-z] {
    transform: none !important;
  }
  .lux-tactile-bound,
  [data-lux-magnet],
  .lux-magnet-bound {
    translate: none !important;
    scale: 1 !important;
    animation: none !important;
  }
}

/* Simple Clean Mode ([data-ui-mode="simple"] / [data-fs-mode="simple"]) Full FX Mute */
html[data-ui-mode="simple"] .lux-cursor-root,
html[data-fs-mode="simple"] .lux-cursor-root,
html[data-ui-mode="simple"] .lux-4d-sheen,
html[data-fs-mode="simple"] .lux-4d-sheen,
html[data-ui-mode="simple"] .lux-bento-surface-glow,
html[data-fs-mode="simple"] .lux-bento-surface-glow,
html[data-ui-mode="simple"] .lux-bento-bound::before,
html[data-fs-mode="simple"] .lux-bento-bound::before,
html[data-ui-mode="simple"] .lux-ripple-plane,
html[data-fs-mode="simple"] .lux-ripple-plane,
html[data-ui-mode="simple"] [data-lux-verify-seal]::after,
html[data-fs-mode="simple"] [data-lux-verify-seal]::after,
html[data-ui-mode="simple"] [data-tqv-stamp]::after,
html[data-fs-mode="simple"] [data-tqv-stamp]::after {
  display: none !important;
  opacity: 0 !important;
}

html[data-ui-mode="simple"] [data-lux-3d],
html[data-fs-mode="simple"] [data-lux-3d],
html[data-ui-mode="simple"] .lux-3d-bound,
html[data-fs-mode="simple"] .lux-3d-bound,
html[data-ui-mode="simple"] [data-lux-z],
html[data-fs-mode="simple"] [data-lux-z] {
  transform: none !important;
}

html[data-ui-mode="simple"] .lux-tactile-bound,
html[data-fs-mode="simple"] .lux-tactile-bound,
html[data-ui-mode="simple"] [data-lux-magnet],
html[data-fs-mode="simple"] [data-lux-magnet],
html[data-ui-mode="simple"] .lux-magnet-bound,
html[data-fs-mode="simple"] .lux-magnet-bound,
html[data-ui-mode="simple"] .is-lux-kpi-pulsing,
html[data-fs-mode="simple"] .is-lux-kpi-pulsing,
html[data-ui-mode="simple"] .is-lux-bar-pulsing,
html[data-fs-mode="simple"] .is-lux-bar-pulsing,
html[data-ui-mode="simple"] .is-lux-seal-bouncing,
html[data-fs-mode="simple"] .is-lux-seal-bouncing {
  translate: none !important;
  scale: 1 !important;
  animation: none !important;
  filter: none !important;
}
