:root {
  --bg-deep: #07040f;
  --bg-mid: #140a2e;
  --purple: #7c4dff;
  --purple-bright: #a87bff;
  --cyan: #36e0ff;
  --gold: #ffcf6b;
  --text: #f3eefe;
  --text-dim: #b9aee0;
  --max-width: 1100px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  /* Fallback background gradient sits behind the canvas in case it is hidden. */
  background:
    radial-gradient(120% 90% at 50% 10%, #1c1040 0%, var(--bg-mid) 40%, var(--bg-deep) 100%);
}

/* ---------- 3D scene canvas ---------- */
#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* ---------- CSS-only fallback hero ---------- */
.fallback-hero {
  position: fixed;
  inset: 0;
  z-index: 0;
  /* hidden by default; the [hidden] guard below beats this when not active */
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  overflow: hidden;
}

/* Only show the fallback once main.js removes the `hidden` attribute.
   (A bare `display` on .fallback-hero would otherwise override the
   `hidden` attribute and keep the static wizard permanently visible.) */
.fallback-hero:not([hidden]) {
  display: flex;
}

.fallback-hero::before {
  /* magical glow behind the wizard */
  content: "";
  position: absolute;
  width: min(70vw, 540px);
  height: min(70vw, 540px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 77, 255, 0.55) 0%, rgba(54, 224, 255, 0.18) 45%, transparent 70%);
  filter: blur(10px);
  animation: pulse 6s ease-in-out infinite;
}

.fallback-wizard {
  position: relative;
  width: min(48vw, 360px);
  height: auto;
  filter: drop-shadow(0 30px 40px rgba(0, 0, 0, 0.55));
  animation: levitate 5s ease-in-out infinite;
}

@keyframes levitate {
  0%,
  100% {
    transform: translateY(-12px) rotate(-1.5deg);
  }
  50% {
    transform: translateY(14px) rotate(1.5deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.92);
    opacity: 0.75;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

/* ---------- Foreground overlay ---------- */
.overlay {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  /* subtle scrim improves text legibility over the bright scene center */
  background:
    radial-gradient(140% 120% at 50% 120%, rgba(7, 4, 15, 0.85) 0%, transparent 55%),
    linear-gradient(to bottom, rgba(7, 4, 15, 0.45) 0%, transparent 25%, transparent 60%, rgba(7, 4, 15, 0.6) 100%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.brand__mark {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--purple-bright), var(--cyan));
  box-shadow: 0 0 14px rgba(124, 77, 255, 0.8);
  transform: rotate(45deg);
}

.brand__name {
  font-size: clamp(1rem, 2.2vw, 1.2rem);
}

.brand__llc {
  color: var(--text-dim);
  font-weight: 400;
}

.hero {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 1.4rem;
  max-width: 680px;
  margin: 0 auto;
  /* reserve the upper area for the floating wizard, center the text below it */
  padding-top: clamp(8rem, 30vh, 19rem);
  padding-bottom: clamp(2rem, 6vh, 5rem);
}

.hero__title {
  font-size: clamp(2.6rem, 8vw, 5.5rem);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
  background: linear-gradient(120deg, #ffffff 0%, var(--purple-bright) 55%, var(--cyan) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(124, 77, 255, 0.25);
}

.hero__subtitle {
  font-size: clamp(1rem, 2.4vw, 1.25rem);
  line-height: 1.6;
  color: var(--text-dim);
  /* never wider than its container, so it can't overflow on small screens */
  max-width: min(42ch, 100%);
  margin: 0 auto;
}

/* ---------- CTA button ---------- */
.cta {
  position: relative;
  align-self: center;
  display: inline-flex;
  align-items: center;
  padding: 0.95rem 2.1rem;
  border-radius: 999px;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  color: #1a0b2e;
  background: linear-gradient(120deg, var(--purple-bright), var(--cyan));
  box-shadow:
    0 10px 30px rgba(124, 77, 255, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta:hover,
.cta:focus-visible {
  transform: translateY(-2px);
  box-shadow:
    0 16px 40px rgba(124, 77, 255, 0.6),
    inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  outline: none;
}

.cta__glow {
  position: absolute;
  inset: -40%;
  z-index: -1;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(255, 255, 255, 0.7) 60deg, transparent 120deg);
  animation: spin 4s linear infinite;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.cta:hover .cta__glow,
.cta:focus-visible .cta__glow {
  opacity: 0.55;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Footer ---------- */
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ---------- FPS metric (debug only) ---------- */
.fps {
  position: fixed;
  z-index: 5;
  top: 0.9rem;
  right: 0.9rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: rgba(7, 4, 15, 0.55);
  border: 1px solid rgba(124, 77, 255, 0.35);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  backdrop-filter: blur(6px);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

/* ---------- Motion / responsiveness ---------- */
@media (prefers-reduced-motion: reduce) {
  .fallback-wizard,
  .fallback-hero::before,
  .cta__glow {
    animation: none;
  }
}

@media (max-width: 600px) {
  .overlay {
    padding: 1.1rem;
  }
  .hero {
    padding-top: clamp(3.5rem, 17vh, 8rem);
    padding-bottom: 1.5rem;
    gap: 1.1rem;
  }
  .hero__title {
    font-size: clamp(2.2rem, 9vw, 3rem);
  }
  .hero__subtitle {
    font-size: 1rem;
    max-width: 100%;
  }
  .footer {
    text-align: center;
  }
}
