/**
 * exovault — hero3d-v2.css
 * 3D floating trading-card planes for the front-page hero.
 * Uses existing design tokens from assets/css/exovault.css.
 */

/* ---------- container ---------- */
.hero3d {
  position: relative;
  perspective: 1100px;
  perspective-origin: 50% 40%;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 16 / 10;
  margin-inline: auto;
  overflow: visible;
  contain: layout paint style;
}

.hero3d__stage {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  will-change: transform;
}

/* ambient glows */
.hero3d__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.45;
  pointer-events: none;
}
.hero3d__glow--gold {
  width: 55%;
  aspect-ratio: 1;
  left: -8%;
  top: -12%;
  background: radial-gradient(circle, var(--ev-gold, #c9a227) 0%, transparent 70%);
  animation: hero3d-pulse 7s ease-in-out infinite alternate;
}
.hero3d__glow--violet {
  width: 62%;
  aspect-ratio: 1;
  right: -10%;
  bottom: -14%;
  background: radial-gradient(circle, var(--ev-violet, #c9a9f0) 0%, transparent 70%);
  animation: hero3d-pulse 9s ease-in-out infinite alternate-reverse;
}

/* ---------- card layers ---------- */
.hero3d__layer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-style: preserve-3d;
  will-change: transform;
}

.hero3d__card {
  position: relative;
  width: clamp(140px, 26vw, 230px);
  aspect-ratio: 5 / 7;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--ev-gold-hi, #ffe9a8) 45%, transparent);
  background:
    linear-gradient(160deg,
      rgba(201, 162, 39, 0.14) 0%,
      rgba(26, 11, 46, 0.85) 45%,
      rgba(59, 29, 94, 0.9) 100%),
    var(--ev-space, #1a0b2e);
  box-shadow:
    0 24px 48px -12px rgba(0, 0, 0, 0.65),
    0 0 32px -8px color-mix(in srgb, var(--ev-gold, #c9a227) 35%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--ev-gold-hi, #ffe9a8) 30%, transparent);
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* sheen sweep */
.hero3d__card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    115deg,
    transparent 30%,
    color-mix(in srgb, var(--ev-gold-hi, #ffe9a8) 22%, transparent) 47%,
    transparent 62%
  );
  background-size: 250% 100%;
  animation: hero3d-sheen 6s ease-in-out infinite;
}

/* per-card poses */
.hero3d__layer--back {
  z-index: 1;
  transform: translate(-58%, -54%) rotateY(28deg) rotateX(8deg) rotateZ(-6deg);
}
.hero3d__layer--mid {
  z-index: 2;
  transform: translate(-42%, -38%) rotateY(-20deg) rotateX(6deg) rotateZ(4deg);
}
.hero3d__layer--front {
  z-index: 3;
  transform: translate(-50%, -46%) rotateY(10deg) rotateX(-4deg);
}
.hero3d__layer--front .hero3d__card {
  box-shadow:
    0 32px 64px -14px rgba(0, 0, 0, 0.75),
    0 0 44px -6px color-mix(in srgb, var(--ev-violet, #c9a9f0) 45%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--ev-gold-hi, #ffe9a8) 35%, transparent);
}

/* idle float (composited, GPU-friendly) */
.hero3d__layer--back  .hero3d__card { animation: hero3d-float 8s ease-in-out infinite; }
.hero3d__layer--mid   .hero3d__card { animation: hero3d-float 6.5s ease-in-out infinite -2s; }
.hero3d__layer--front .hero3d__card { animation: hero3d-float 7.5s ease-in-out infinite -4s; }

@keyframes hero3d-float {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -12px; }
}
@keyframes hero3d-pulse {
  from { opacity: 0.3; transform: scale(1); }
  to   { opacity: 0.55; transform: scale(1.12); }
}
@keyframes hero3d-sheen {
  0%, 60%, 100% { background-position: 130% 0; }
  30%           { background-position: -30% 0; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .hero3d__glow,
  .hero3d__card,
  .hero3d__card::after {
    animation: none !important;
  }
}
.hero3d--reduced .hero3d__glow,
.hero3d--reduced .hero3d__card,
.hero3d--reduced .hero3d__card::after {
  animation: none !important;
}

/* ---------- STARFIX: interactive starfield canvas behind the hero ---------- */
.ev-starfield {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none; /* mouse parallax is tracked on window, canvas stays click-through */
  display: block;
}
.ev-hero__rays { z-index: 0; } /* rays + starfield share the backdrop layer */

/* ---------- STARFIX: fold rebalance — cap the card stage height ---------- */
.hero3d {
  max-height: 40vh; /* desktop: cards peek below the copy, never push CTAs down */
}

/* ---------- small screens ---------- */
@media (max-width: 600px) {
  .hero3d {
    aspect-ratio: auto;   /* STARFIX: let the vh cap rule, not the ratio */
    max-width: 300px;
    max-height: 34vh;     /* STARFIX: tighter cap so H1 + CTAs clear the fold */
  }
  /* STARFIX: shrink cards so three planes fit inside the capped stage */
  .hero3d__card { width: clamp(96px, 26vw, 140px); }
  .hero3d__layer--back  { transform: translate(-58%, -50%) rotateY(28deg) rotateX(8deg) rotateZ(-6deg) scale(0.85); }
  .hero3d__layer--mid   { transform: translate(-42%, -36%) rotateY(-20deg) rotateX(6deg) rotateZ(4deg) scale(0.9); }
  .hero3d__layer--front { transform: translate(-50%, -44%) rotateY(10deg) rotateX(-4deg) scale(0.95); }
}
