/* ============================================================
   Prizew — 3D Professional Redesign
   Hero 3D · Holographic Cards · Generation Animation
   ============================================================ */

/* ===== KEYFRAMES ===== */
@keyframes float3d {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(3deg); }
}
@keyframes holographic {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes glitch {
  0%, 100% { transform: translate(0); filter: none; }
  20% { transform: translate(-2px, 2px); filter: hue-rotate(20deg); }
  40% { transform: translate(2px, -2px); filter: none; }
  60% { transform: translate(-1px, -1px); filter: hue-rotate(-15deg); }
  80% { transform: translate(1px, 1px); filter: none; }
}
@keyframes spinGlow {
  to { transform: rotate(360deg); filter: drop-shadow(0 0 10px currentColor); }
}
@keyframes typewriter {
  from { width: 0; }
  to { width: 100%; }
}
@keyframes checkDraw {
  to { stroke-dashoffset: 0; }
}
@keyframes particleRise {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translateY(-10vh) scale(1.5); opacity: 0; }
}
@keyframes pulse3d {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(74,222,128,0.25); }
  50% { transform: scale(1.02); box-shadow: 0 0 45px rgba(74,222,128,0.5); }
}
@keyframes shimmerSweep {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes modalBounce {
  0% { transform: scale(0.8) translateY(30px); opacity: 0; }
  60% { transform: scale(1.05) translateY(-6px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(74,222,128,0); }
}
@keyframes priceShimmer {
  0% { background-position: -100% 0; }
  100% { background-position: 200% 0; }
}
@keyframes lockUnlock {
  0%, 60% { transform: rotateY(0) translateY(0); }
  70% { transform: rotateY(-25deg) translateY(-2px); }
  80% { transform: rotateY(15deg) translateY(-4px); }
  90% { transform: rotateY(-8deg) translateY(-2px); }
  100% { transform: rotateY(0) translateY(0); }
}
@keyframes noiseShift {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-2%, -3%); }
  30% { transform: translate(3%, -2%); }
  50% { transform: translate(-3%, 3%); }
  70% { transform: translate(2%, 3%); }
  90% { transform: translate(-2%, 2%); }
}

/* ===== HERO SECTION ===== */
.hero-3d-stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
  perspective: 1400px;
  overflow: hidden;
  z-index: 1;
}
.hero-float-card {
  position: absolute;
  width: 190px;
  aspect-ratio: 1.586/1;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 11px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    inset 0 -1px 0 rgba(0,0,0,0.35),
    0 24px 55px -18px rgba(0,0,0,0.85);
  animation: float3d var(--float-dur, 7s) ease-in-out infinite;
  animation-delay: var(--float-delay, 0s);
  will-change: transform;
}
.hero-float-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(115deg, rgba(255,255,255,0.32), transparent 38%, transparent 62%, rgba(255,255,255,0.16));
  opacity: 0.75;
}
.holo-text {
  background: linear-gradient(
    120deg,
    #ffffff 0%, #a7f3d0 18%, #67e8f9 34%,
    #c4b5fd 52%, #f9a8d4 68%, #fcd34d 84%, #ffffff 100%
  );
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: holographic 6s linear infinite;
  filter: drop-shadow(0 4px 22px rgba(103,232,249,0.28));
}

/* Mouse-follow particles */
.particle-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}
.spark-particle {
  position: absolute;
  width: var(--size, 3px);
  height: var(--size, 3px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(167,243,208,0.95), transparent 70%);
  box-shadow: 0 0 8px rgba(103,232,249,0.65);
  transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.9s ease;
  will-change: transform;
}

/* Glass nav glow */
.nav-glass-glow {
  position: relative;
}
.nav-glass-glow::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  padding: 1px;
  background: linear-gradient(135deg, rgba(103,232,249,0.5), transparent 35%, transparent 65%, rgba(196,181,253,0.45));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
}

/* Scroll reveal */
.scroll-reveal {
  opacity: 0;
  transform: translateY(48px) rotateX(14deg) scale(0.96);
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  transform-origin: top center;
}
.scroll-reveal.revealed {
  opacity: 1;
  transform: none;
}

/* ===== PROFESSIONAL 3D CARDS ===== */
#cards .grid > div {
  perspective: 1200px;
}
#cards .grid button.card-pro {
  position: relative;
  display: block;
  width: 100%;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
  cursor: pointer;
}
#cards .grid button.card-pro .card-body {
  position: relative;
  aspect-ratio: 1.586/1;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.16);
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.3),
    inset 0 -2px 6px rgba(0,0,0,0.35),
    0 22px 50px -18px rgba(0,0,0,0.9);
  transform-style: preserve-3d;
  transition: box-shadow 0.35s ease, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Brushed metal + noise texture */
.card-pro .card-noise {
  position: absolute;
  inset: -60%;
  opacity: 0.07;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  animation: noiseShift 1.4s steps(5) infinite;
}
/* Brushed metal lines */
.card-pro .card-brush {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.12;
  background: repeating-linear-gradient(
    98deg,
    rgba(255,255,255,0.06) 0 1px,
    transparent 1px 4px
  );
}

/* Dynamic shine follows cursor */
.card-pro .card-shine {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 50%),
    rgba(255,255,255,0.28),
    transparent 42%
  );
}
.card-pro:hover .card-shine { opacity: 1; }

/* Holographic rainbow overlay */
.card-pro .card-holo {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
  background: linear-gradient(
    125deg,
    transparent 20%,
    rgba(255,119,225,0.22) 38%,
    rgba(103,232,249,0.26) 50%,
    rgba(196,181,253,0.22) 62%,
    transparent 80%
  );
  background-size: 250% 250%;
  mix-blend-mode: screen;
}
.card-pro:hover .card-holo {
  opacity: 1;
  animation: holographic 3s linear infinite;
}

/* Brand-colored outer glow */
.card-pro::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 19px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.35s ease;
  background:
    radial-gradient(60% 90% at 50% 110%, var(--glow-color, rgba(74,222,128,0.5)), transparent 70%);
  filter: blur(14px);
}
.card-pro:hover::before { opacity: 1; }

/* Floating ground shadow */
.card-pro .card-groundshadow {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -16px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.55), transparent 70%);
  filter: blur(6px);
  transition: transform 0.4s ease, opacity 0.4s ease;
  pointer-events: none;
}
.card-pro:hover .card-groundshadow {
  transform: scaleX(1.08) translateY(4px);
  opacity: 0.75;
}

/* Micro-animations */
.card-pro .region-badge {
  animation: badgePulse 2.6s ease-in-out infinite;
}
.card-pro .price-tag {
  background: linear-gradient(100deg, #fff 40%, rgba(255,255,255,0.55) 50%, #fff 60%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: priceShimmer 3.2s linear infinite;
}
.card-pro:hover .region-badge { animation-duration: 1.1s; }

/* Flip on click */
.card-pro.flipped .card-body {
  transform: rotateY(180deg);
}
.card-pro .card-back {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: rotateY(180deg);
  background: linear-gradient(150deg, #101018, #17172a);
  border: 1px solid rgba(255,255,255,0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: #fff;
}
.card-pro .card-back .back-code {
  font-family: ui-monospace, monospace;
  letter-spacing: 2px;
  color: #4ade80;
  text-shadow: 0 0 14px rgba(74,222,128,0.55);
}
@media (prefers-reduced-motion: reduce) {
  .hero-float-card, .spark-particle, .card-pro .card-noise,
  .card-pro .holo, .card-pro .price-tag, .card-pro .region-badge {
    animation: none !important;
  }
  .scroll-reveal { opacity: 1; transform: none; transition: none; }
}

/* ===== GENERATION MODAL (4 phases) ===== */
.gen-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4,4,8,0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
.gen-overlay.active { opacity: 1; visibility: visible; }

.gen-modal {
  position: relative;
  width: 100%;
  max-width: 430px;
  border-radius: 22px;
  padding: 36px 30px 30px;
  text-align: center;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(74,222,128,0.09), transparent 55%),
    linear-gradient(155deg, rgba(21,21,29,0.99), rgba(11,11,16,0.99));
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow:
    0 50px 100px -20px rgba(0,0,0,0.9),
    0 0 70px rgba(74,222,128,0.06),
    inset 0 1px 0 rgba(255,255,255,0.08);
  transform: scale(0.86) translateY(34px);
  opacity: 0;
}
.gen-overlay.active .gen-modal {
  animation: modalBounce 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Rotating aura ring behind modal */
.gen-modal .gen-aura {
  position: absolute;
  top: -55%;
  left: -55%;
  width: 210%;
  height: 210%;
  pointer-events: none;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(103,232,249,0.05) 60deg, transparent 130deg, rgba(74,222,128,0.06) 230deg, transparent 310deg);
  animation: spinGlow 7s linear infinite;
}

.gen-inner { position: relative; z-index: 2; }

/* Phase 2 — dual-ring spinner with lock */
.gen-rings {
  position: relative;
  width: 92px;
  height: 92px;
  margin: 0 auto 20px;
}
.gen-rings .ring {
  position: absolute;
  border-radius: 50%;
}
.gen-rings .ring-outer {
  inset: 0;
  border: 3px solid transparent;
  border-top-color: #4ade80;
  border-right-color: rgba(74,222,128,0.35);
  animation: spinGlow 1.05s linear infinite;
  color: #4ade80;
}
.gen-rings .ring-inner {
  inset: 13px;
  border: 3px solid transparent;
  border-bottom-color: #67e8f9;
  border-left-color: rgba(103,232,249,0.35);
  animation: spinGlow 1.6s linear infinite reverse;
  color: #67e8f9;
}
.gen-rings .ring-core {
  inset: 27px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a7f3d0;
  animation: lockUnlock 2.2s ease-in-out infinite;
}
.gen-rings.done .ring-outer,
.gen-rings.done .ring-inner { animation-play-state: paused; opacity: 0; transition: opacity 0.3s; }

/* Success check circle */
.gen-check {
  width: 88px;
  height: 88px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4ade80, #16a34a);
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 44px rgba(74,222,128,0.5), inset 0 2px 0 rgba(255,255,255,0.35);
  animation: pulse3d 2s ease-in-out infinite;
}
.gen-check.show { display: flex; }
.gen-check svg polyline {
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: checkDraw 0.55s cubic-bezier(0.65, 0, 0.35, 1) 0.15s forwards;
}

/* Code display */
.gen-codebox {
  position: relative;
  margin: 18px 0 6px;
  padding: 16px 14px;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 12px;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(74,222,128,0.22);
  box-shadow: inset 0 0 24px rgba(0,0,0,0.5);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 19px;
  letter-spacing: 3px;
  color: #4ade80;
  text-shadow: 0 0 14px rgba(74,222,128,0.6);
}
.gen-codebox.ready {
  color: #fff;
  border-color: rgba(255,255,255,0.28);
  text-shadow: 0 0 18px rgba(255,255,255,0.55);
  transition: filter 0.3s ease;
}
.gen-codebox.blurred {
  filter: blur(7px);
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}
.gen-codebox.blurred .caret { opacity: 0; }
.gen-lockbadge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 2px 0 4px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(74,222,128,0.08);
  border: 1px solid rgba(74,222,128,0.25);
  color: rgba(255,255,255,0.75);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.gen-lockbadge.show { opacity: 1; transform: none; }
.gen-lockbadge svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: #4ade80;
}
.gen-codebox .ch { display: inline-block; }
.gen-codebox .ch.glitch { animation: glitch 0.18s steps(2) 1; }
.gen-codebox .caret {
  width: 2px;
  height: 22px;
  background: currentColor;
  margin-left: 3px;
  animation: blinkCaret 0.75s step-end infinite;
}
@keyframes blinkCaret { 50% { opacity: 0; } }

/* Progress bar */
.gen-progress {
  height: 6px;
  margin: 20px 0 10px;
  border-radius: 99px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}
.gen-progress .bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4ade80, #67e8f9 55%, #c4b5fd);
  box-shadow: 0 0 14px rgba(103,232,249,0.5);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}
.gen-progress .bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.5) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: shimmerSweep 1.4s linear infinite;
}

/* Status line */
.gen-status {
  min-height: 20px;
  font-family: ui-monospace, monospace;
  font-size: 12.5px;
  letter-spacing: 0.4px;
  color: rgba(255,255,255,0.55);
}
.gen-status b { color: #a7f3d0; font-weight: 600; }
.gen-status.done { color: #fff; }

/* Rising particles inside modal */
.gen-motes {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.gen-mote {
  position: absolute;
  bottom: -8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(134,239,172,0.95), transparent 70%);
  box-shadow: 0 0 8px rgba(74,222,128,0.7);
  animation: particleRise var(--dur, 2.4s) linear infinite;
  animation-delay: var(--delay, 0s);
}
