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

:root {
  --pink: #ff2a6d;
  --cyan: #05d9e8;
  --purple: #120458;
  --sun-top: #ff6ec7;
  --sun-bot: #ff2975;
}

html,
body {
  height: 100%;
}

body {
  font-family: "Audiowide", system-ui, sans-serif;
  background: #0d0221;
  color: #fff;
  overflow: hidden;
  display: grid;
  place-items: center;
}

/* Scene */
.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    #0d0221 0%,
    #1a0533 25%,
    #3d1052 45%,
    #7b2d8e 58%,
    #c74b7a 68%,
    #ff6b35 78%,
    #ff9a3c 88%,
    #ffd166 100%
  );
}

.sun {
  position: absolute;
  left: 50%;
  bottom: 38%;
  width: min(28vmin, 220px);
  height: min(28vmin, 220px);
  transform: translateX(-50%);
  border-radius: 50%;
  background: linear-gradient(180deg, var(--sun-top), var(--sun-bot));
  box-shadow: 0 0 60px rgba(255, 41, 117, 0.6);
  animation: sunPulse 4s ease-in-out infinite;
}

.sun::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-linear-gradient(
    180deg,
    transparent 0px,
    transparent 8px,
    rgba(13, 2, 33, 0.55) 8px,
    rgba(13, 2, 33, 0.55) 16px
  );
}

@keyframes sunPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.15); }
}

.mountains {
  position: absolute;
  bottom: 36%;
  left: 0;
  width: 100%;
  height: 14vh;
  filter: drop-shadow(0 0 24px rgba(255, 42, 109, 0.35));
}

.grid-wrap {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 42vh;
  perspective: 280px;
  perspective-origin: 50% 0%;
  overflow: hidden;
}

.grid {
  position: absolute;
  top: 0;
  left: -50%;
  width: 200%;
  height: 200%;
  transform-origin: 50% 0%;
  transform: rotateX(72deg);
  background:
    linear-gradient(180deg, transparent 0%, rgba(255, 42, 109, 0.15) 100%),
    repeating-linear-gradient(
      90deg,
      var(--pink) 0px,
      var(--pink) 2px,
      transparent 2px,
      transparent 80px
    ),
    repeating-linear-gradient(
      0deg,
      var(--pink) 0px,
      var(--pink) 2px,
      transparent 2px,
      transparent 80px
    );
  animation: gridScroll 3s linear infinite;
}

@keyframes gridScroll {
  to { transform: rotateX(72deg) translateY(80px); }
}

.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.12) 0px,
    rgba(0, 0, 0, 0.12) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
}

.vhs {
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: vhsNoise 0.15s steps(3) infinite;
  pointer-events: none;
}

@keyframes vhsNoise {
  to { transform: translate(1%, -1%); }
}

/* Name */
.name {
  position: relative;
  z-index: 1;
  display: flex;
  font-size: clamp(3.5rem, 16vw, 9rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1;
  user-select: none;
  transform: translateY(-8vh);
  animation: nameGlitch 8s steps(1) infinite;
}

.letter {
  display: inline-block;
  color: #fff;
  opacity: 0;
  transform: translateY(0.6em) scaleX(1.35);
  text-shadow:
    0 0 8px #fff,
    0 0 20px var(--pink),
    0 0 40px var(--pink),
    0 0 80px var(--cyan),
    0 0 120px rgba(5, 217, 232, 0.4);
  animation:
    letterIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards,
    neonFlicker 3s ease-in-out infinite;
  animation-delay:
    calc(var(--i) * 0.1s),
    calc(0.6s + var(--i) * 0.08s);
}

@keyframes letterIn {
  to {
    opacity: 1;
    transform: translateY(0) scaleX(1.35);
  }
}

@keyframes neonFlicker {
  0%, 18%, 22%, 55%, 100% {
    text-shadow:
      0 0 8px #fff,
      0 0 20px var(--pink),
      0 0 40px var(--pink),
      0 0 80px var(--cyan);
    opacity: 1;
  }
  20% {
    text-shadow:
      0 0 4px #fff,
      0 0 10px var(--pink);
    opacity: 0.85;
  }
  56% {
    text-shadow:
      0 0 12px #fff,
      0 0 30px var(--cyan),
      0 0 60px var(--cyan),
      0 0 100px var(--pink);
  }
}

@keyframes nameGlitch {
  0%, 94%, 100% { transform: translateY(-8vh); }
  95% { transform: translate(-3px, calc(-8vh - 2px)); }
  96% { transform: translate(3px, -8vh); }
  97% { transform: translate(-2px, calc(-8vh + 1px)); }
}

@media (prefers-reduced-motion: reduce) {
  .sun,
  .grid,
  .vhs,
  .name,
  .letter {
    animation: none !important;
  }

  .letter {
    opacity: 1;
    transform: scaleX(1.35);
  }

  .name {
    transform: translateY(-8vh);
  }
}
