/* ============================================================
   AFTER DUSK PRODUCTIONS — Coming Soon
   Retro 80s / vaporwave theme
   ============================================================ */

:root {
  --bg-deep: #07010f;
  --bg-purple: #1b0637;
  --magenta: #ff2bd6;
  --pink: #ff71ce;
  --cyan: #01cdfe;
  --violet: #b967ff;
  --sun-top: #ffd319;
  --sun-mid: #ff901f;
  --sun-low: #ff2975;
  --sun-bot: #f222ff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: #fff;
  font-family: "VT323", "Courier New", monospace;
}

/* ============================================================
   PHASE 1 — LOADER
   ============================================================ */

#loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(64, 8, 90, 0.55), transparent 60%),
    #030008;
  transition: opacity 0.45s ease, visibility 0.45s;
}

#loader.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-frame {
  width: min(92vw, 880px);
  height: min(88vh, 640px);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 43, 214, 0.35);
  box-shadow:
    0 0 24px rgba(255, 43, 214, 0.12) inset,
    0 0 42px rgba(1, 205, 254, 0.08);
  padding: 18px 22px;
}

.loader-header,
.loader-footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: clamp(16px, 2.4vmin, 22px);
  letter-spacing: 0.12em;
}

.loader-brand {
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(1, 205, 254, 0.8), 1px 0 rgba(255, 0, 128, 0.6);
}

.loader-ver { color: rgba(255, 113, 206, 0.7); }

#ascii {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin: 8px 0;
  font-family: "VT323", monospace;
  font-size: clamp(9px, 1.7vmin, 15px);
  line-height: 1.05;
  letter-spacing: 0.14em;
  text-align: center;
  white-space: pre;
  background: linear-gradient(120deg, var(--magenta) 15%, var(--violet) 45%, var(--cyan) 85%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--magenta); /* fallback */
  filter: drop-shadow(0 0 6px rgba(255, 43, 214, 0.55));
  animation: asciiPulse 2.4s ease-in-out infinite;
}

@keyframes asciiPulse {
  0%, 100% { filter: drop-shadow(0 0 5px rgba(255, 43, 214, 0.45)); }
  50%      { filter: drop-shadow(0 0 12px rgba(1, 205, 254, 0.65)); }
}

#bootlog {
  height: 9.5em;
  overflow: hidden;
  font-size: clamp(14px, 2.2vmin, 20px);
  line-height: 1.35;
  color: var(--pink);
  text-shadow:
    0 0 6px rgba(255, 113, 206, 0.7),
    1px 0 rgba(255, 0, 100, 0.45),
    -1px 0 rgba(0, 255, 255, 0.45);
}

#bootlog .ok { color: var(--cyan); }

#bootlog .cursor {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  vertical-align: text-bottom;
  background: var(--cyan);
  animation: blink 0.85s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

#loader-status {
  color: rgba(185, 103, 255, 0.9);
  text-shadow: 0 0 8px rgba(185, 103, 255, 0.6);
}

#percent {
  color: var(--cyan);
  min-width: 4ch;
  text-align: right;
  text-shadow:
    0 0 10px rgba(1, 205, 254, 0.9),
    1px 0 rgba(255, 0, 100, 0.5),
    -1px 0 rgba(0, 255, 255, 0.5);
}

/* ============================================================
   GLITCH FLASH (transition between phases)
   ============================================================ */

#glitch-flash {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0;
}

#glitch-flash.go {
  animation: glitchFlash 0.5s steps(2, end) 1;
}

@keyframes glitchFlash {
  0%   { opacity: 1; background: #fff; }
  15%  { opacity: 1; background: repeating-linear-gradient(0deg, #ff2bd6 0 6px, #000 6px 9px, #01cdfe 9px 14px); transform: translateX(-8px); }
  30%  { opacity: 1; background: #000; transform: translateX(6px); }
  45%  { opacity: 1; background: repeating-linear-gradient(0deg, #01cdfe 0 3px, #000 3px 10px, #ff2bd6 10px 12px); transform: translateX(-4px) scaleY(1.04); }
  60%  { opacity: 0.8; background: #fff; transform: none; }
  100% { opacity: 0; background: #000; }
}

/* ============================================================
   PHASE 2 — MAIN SCENE
   ============================================================ */

#scene {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: hidden;
}

#scene.hidden { display: none; }

.sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 78%, rgba(255, 41, 117, 0.28), transparent 55%),
    linear-gradient(180deg,
      #030008 0%,
      #0e0224 28%,
      #2a0a54 52%,
      #55127a 66%,
      #8b1e6b 74%,
      #1b0637 76%,
      var(--bg-deep) 100%);
}

/* --- stars --- */

#stars { position: absolute; inset: 0 0 30% 0; }

#stars .star {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.7;
  animation: twinkle 3.2s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.15; }
  50%      { opacity: 0.9; }
}

/* --- retro striped sun --- */

.sun {
  position: absolute;
  left: 50%;
  bottom: 24%;
  width: 46vmin;
  height: 46vmin;
  transform: translateX(-50%);
  border-radius: 50%;
  background: linear-gradient(180deg,
    var(--sun-top) 4%,
    var(--sun-mid) 36%,
    var(--sun-low) 68%,
    var(--sun-bot) 96%);
  -webkit-mask-image: linear-gradient(to bottom,
    #000 0 54%,
    transparent 54% 56.5%,
    #000 56.5% 63.5%,
    transparent 63.5% 66.5%,
    #000 66.5% 73%,
    transparent 73% 76.5%,
    #000 76.5% 82%,
    transparent 82% 86%,
    #000 86% 90.5%,
    transparent 90.5% 95%,
    #000 95% 100%);
  mask-image: linear-gradient(to bottom,
    #000 0 54%,
    transparent 54% 56.5%,
    #000 56.5% 63.5%,
    transparent 63.5% 66.5%,
    #000 66.5% 73%,
    transparent 73% 76.5%,
    #000 76.5% 82%,
    transparent 82% 86%,
    #000 86% 90.5%,
    transparent 90.5% 95%,
    #000 95% 100%);
  filter: drop-shadow(0 0 5vmin rgba(255, 41, 117, 0.55));
  animation: sunRise 2.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes sunRise {
  from { transform: translateX(-50%) translateY(24vmin); }
  to   { transform: translateX(-50%) translateY(0); }
}

.horizon-glow {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 23%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--pink) 30%, #fff 50%, var(--pink) 70%, transparent);
  box-shadow: 0 0 24px 6px rgba(255, 113, 206, 0.55);
  opacity: 0.85;
}

/* --- perspective grid floor --- */

.grid-floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 24%;
  overflow: hidden;
  perspective: 240px;
  perspective-origin: 50% 0%;
  background: linear-gradient(180deg, #240b45 0%, var(--bg-deep) 90%);
}

.grid {
  position: absolute;
  left: -60%;
  right: -60%;
  top: 0;
  height: 300%;
  background-image:
    linear-gradient(to right, rgba(255, 43, 214, 0.7) 2px, transparent 2px),
    linear-gradient(to bottom, rgba(255, 43, 214, 0.7) 2px, transparent 2px);
  background-size: 72px 72px;
  transform: rotateX(62deg);
  transform-origin: 50% 0%;
  animation: gridScroll 1.1s linear infinite;
  box-shadow: 0 0 40px rgba(255, 43, 214, 0.25) inset;
}

@keyframes gridScroll {
  from { background-position: 0 0; }
  to   { background-position: 0 72px; }
}

/* --- centered content --- */

.scene-fx {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-bottom: 10vh;
  z-index: 10;
  pointer-events: none; /* let clicks reach pixel cars below */
}

.title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4vmin;
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  font-style: italic;
  line-height: 1;
  transform: skewX(-4deg);
}

.title-line {
  position: relative;
  font-size: clamp(38px, 10.5vmin, 118px);
  letter-spacing: 0.04em;
  animation: riseIn 0.9s 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.title-line.small {
  font-size: clamp(24px, 6.4vmin, 72px);
  letter-spacing: 0.22em;
  animation-delay: 0.65s;
}

/* chrome-gradient lettering with neon underlight */
.chrome {
  background: linear-gradient(180deg,
    #fdfeff 0%,
    #d3ecff 22%,
    #8fc4ea 38%,
    #33355e 49%,
    #17102e 51%,
    #7a3f9e 58%,
    #e78ad4 72%,
    #ffe6f7 86%,
    #fff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #d3ecff; /* fallback */
  filter:
    drop-shadow(0 2px 0 rgba(255, 255, 255, 0.28))
    drop-shadow(0 0 18px rgba(185, 103, 255, 0.45))
    drop-shadow(0 6px 22px rgba(255, 43, 214, 0.35));
}

.coming-soon {
  margin-top: 4.2vmin;
  font-family: "Monoton", cursive;
  font-size: clamp(24px, 5.8vmin, 60px);
  letter-spacing: 0.1em;
  color: #ffd0f0;
  text-shadow:
    0 0 6px rgba(255, 255, 255, 0.85),
    0 0 14px rgba(255, 113, 206, 0.9),
    0 0 32px rgba(255, 43, 214, 0.65),
    0 0 56px rgba(255, 43, 214, 0.35);
  animation:
    riseIn 0.9s 0.85s cubic-bezier(0.22, 1, 0.36, 1) both,
    neonGlow 5s ease-in-out infinite;
}

@keyframes neonGlow {
  0%, 100% {
    text-shadow:
      0 0 6px rgba(255, 255, 255, 0.85),
      0 0 14px rgba(255, 113, 206, 0.9),
      0 0 32px rgba(255, 43, 214, 0.65),
      0 0 56px rgba(255, 43, 214, 0.35);
  }
  50% {
    text-shadow:
      0 0 8px rgba(255, 255, 255, 0.95),
      0 0 20px rgba(255, 113, 206, 1),
      0 0 40px rgba(255, 43, 214, 0.8),
      0 0 72px rgba(255, 43, 214, 0.45);
  }
}

.domain {
  margin-top: 5vmin;
  font-size: clamp(15px, 2.6vmin, 24px);
  letter-spacing: 0.3em;
  color: rgba(1, 205, 254, 0.85);
  text-shadow:
    0 0 10px rgba(1, 205, 254, 0.6),
    1px 0 rgba(255, 0, 100, 0.4),
    -1px 0 rgba(0, 255, 255, 0.4);
  animation: riseIn 0.9s 1.05s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(28px); filter: blur(6px); }
  to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* title lines keep the skew from the parent; riseIn transform is fine on children */

/* ============================================================
   CRT / VHS OVERLAYS
   ============================================================ */

.crt {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.22) 0px,
    rgba(0, 0, 0, 0.22) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: multiply;
}

/* slow-moving VHS roll bar */
.crt::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 12vh;
  background: linear-gradient(180deg,
    transparent,
    rgba(255, 255, 255, 0.035) 40%,
    rgba(255, 255, 255, 0.06) 50%,
    rgba(255, 255, 255, 0.035) 60%,
    transparent);
  animation: rollbar 9s linear infinite;
}

@keyframes rollbar {
  from { top: -14vh; }
  to   { top: 110vh; }
}

.grain {
  position: absolute;
  inset: -60px;
  pointer-events: none;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainJitter 0.6s steps(4) infinite;
}

@keyframes grainJitter {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-18px, 12px); }
  50%  { transform: translate(14px, -20px); }
  75%  { transform: translate(-10px, -8px); }
  100% { transform: translate(0, 0); }
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center,
    transparent 55%,
    rgba(0, 0, 0, 0.35) 88%,
    rgba(0, 0, 0, 0.6) 100%);
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .grid, .grain, .crt::after, .coming-soon, #ascii {
    animation: none !important;
  }
}

/* ============================================================
   SMALL SCREENS
   ============================================================ */

@media (max-width: 560px) {
  .loader-frame { padding: 12px 14px; }
  #bootlog { height: 8em; font-size: 15px; }
  .sun { width: 62vmin; height: 62vmin; bottom: 26%; }
}

/* ============================================================
   PIXEL CLASSICS
   ============================================================ */

.pixel-cars {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6%;
  z-index: 11; /* above .content so cars stay clickable */
  display: flex;
  justify-content: space-between;
  padding: 0 7vw;
  pointer-events: none;
}

.pixel-cars .car {
  width: min(26vmin, 280px);
  height: auto;
  image-rendering: pixelated;
}

.car-left {
  filter:
    drop-shadow(0 0 8px rgba(255, 43, 214, 0.8))
    drop-shadow(0 0 22px rgba(255, 43, 214, 0.35));
  animation:
    riseIn 0.9s 1.2s cubic-bezier(0.22, 1, 0.36, 1) both,
    carRumble 1.1s ease-in-out 2.1s infinite;
}

.car-right {
  filter:
    drop-shadow(0 0 8px rgba(1, 205, 254, 0.8))
    drop-shadow(0 0 22px rgba(1, 205, 254, 0.35));
  animation:
    riseIn 0.9s 1.35s cubic-bezier(0.22, 1, 0.36, 1) both,
    carRumble 1.1s ease-in-out 2.25s infinite;
}

/* rumble period matches gridScroll (1.1s) so the cars read as driving */
@keyframes carRumble {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .car-left,
  .car-right {
    animation: riseIn 0.9s 1.2s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
}

@media (max-width: 560px) {
  .pixel-cars { padding: 0 4vw; bottom: 8%; }
  .pixel-cars .car { width: 34vmin; }
}
