/*
  VAQ Digital Cosmic Maintenance
  Root files only. Cloudflare Pages static build.
*/

:root {
  color-scheme: dark;
  --bg: #08030f;
  --ink: #fff8ff;
  --muted: #c9b8d9;
  --soft: #8f7ca4;
  --purple: #a978ff;
  --purple-2: #d89cff;
  --pink: #ff85cf;
  --amber: #ffcf7a;
  --cyan: #9ae8ff;
  --progress: 100%;
  --header-h: 52px;
  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  height: 100dvh;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(circle at 17% 11%, rgba(169, 120, 255, 0.26), transparent 21rem),
    radial-gradient(circle at 86% 17%, rgba(255, 133, 207, 0.16), transparent 21rem),
    radial-gradient(circle at 58% 118%, rgba(86, 45, 139, 0.52), transparent 29rem),
    linear-gradient(180deg, #13061f 0%, #08030f 55%, #040108 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.055;
  background-image:
    linear-gradient(rgba(255,255,255,0.8) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.8) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(circle at 50% 8%, black, transparent 66%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.10;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.9) 0 1px, transparent 1.5px);
  background-size: 120px 120px;
  transform: translate3d(0, 0, 0);
}

#starfield,
.space-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

#starfield {
  width: 100%;
  height: 100%;
}

.galaxy {
  position: absolute;
  border-radius: 999px;
  filter: blur(34px);
  opacity: 0.55;
  transform: translate3d(0, 0, 0);
}

.galaxy-a {
  width: 54vw;
  height: 20vh;
  left: -10vw;
  bottom: 7vh;
  background: linear-gradient(90deg, transparent, rgba(169,120,255,0.22), rgba(255,133,207,0.11), transparent);
  transform: rotate(-10deg);
  animation: galaxyDrift 18s ease-in-out infinite alternate;
}

.galaxy-b {
  width: 42vw;
  height: 18vh;
  right: -8vw;
  top: 14vh;
  background: linear-gradient(90deg, transparent, rgba(216,156,255,0.18), rgba(154,232,255,0.07), transparent);
  transform: rotate(16deg);
  animation: galaxyDriftB 22s ease-in-out infinite alternate;
}

.meteor {
  position: absolute;
  width: 150px;
  height: 1px;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.95), transparent);
  transform: rotate(-28deg);
}

.meteor::after {
  content: "";
  position: absolute;
  right: 0;
  top: -2px;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 0 18px rgba(216,156,255,0.95);
}

.meteor-a {
  top: 11vh;
  left: 86vw;
  animation: meteor 7s 0.9s linear infinite;
}

.meteor-b {
  top: 27vh;
  left: 94vw;
  animation: meteor 9s 3.4s linear infinite;
}

.meteor-c {
  top: 5vh;
  left: 64vw;
  animation: meteor 11s 5.5s linear infinite;
}

a,
button {
  font: inherit;
}

button {
  cursor: pointer;
}

.stage {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 34px));
  height: 100dvh;
  margin: 0 auto;
  padding: clamp(12px, 2.2vh, 22px) 0;
  display: grid;
  grid-template-rows: var(--header-h) minmax(0, 1fr);
  gap: clamp(8px, 1.6vh, 16px);
}

.topbar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #16051f;
  background: linear-gradient(135deg, var(--purple-2), var(--pink));
  font-weight: 900;
  letter-spacing: -0.08em;
  box-shadow: 0 12px 32px rgba(169,120,255,0.22);
}

.brand-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  font-size: 0.98rem;
  letter-spacing: -0.02em;
}

.brand-copy span {
  max-width: 44vw;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(246, 231, 255, 0.14);
  border-radius: 13px;
  color: var(--muted);
  background: rgba(255,255,255,0.035);
  backdrop-filter: blur(14px);
  font-size: 0.9rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 0 0 6px rgba(255, 207, 122, 0.13);
  animation: pulse 1.8s ease-in-out infinite;
}

.hero {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(280px, 0.72fr);
  align-items: center;
  gap: clamp(18px, 6vw, 72px);
  padding: 0 clamp(8px, 4vw, 52px);
}

.copy {
  min-width: 0;
  transform: translateY(-0.8vh);
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--purple-2);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  font-weight: 850;
}

h1 {
  max-width: 9ch;
  margin: 0;
  font-size: clamp(3rem, min(7.2vw, 9.2vh), 5.65rem);
  line-height: 0.92;
  letter-spacing: -0.075em;
  font-weight: 900;
  text-wrap: balance;
}

.lead {
  max-width: 460px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: clamp(0.98rem, 1.28vw, 1.1rem);
  line-height: 1.62;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 25px;
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 14px;
  padding: 0 18px;
  text-decoration: none;
  font-weight: 850;
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1), filter 180ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(1px) scale(0.985);
}

.primary {
  color: #16051f;
  background: linear-gradient(135deg, var(--purple-2), var(--pink));
}

.support-link {
  color: var(--muted);
  font-weight: 760;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.22);
  transition: color 180ms ease, border-color 180ms ease;
}

.support-link:hover {
  color: var(--ink);
  border-color: rgba(255,255,255,0.46);
}

.retry {
  width: min(100%, 430px);
  margin-top: 24px;
  display: grid;
  gap: 9px;
}

.retry-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  color: var(--soft);
  font-size: 0.9rem;
}

.retry-row strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.progress {
  height: 6px;
  border-radius: 8px;
  background: rgba(255,255,255,0.075);
  overflow: hidden;
}

.progress span {
  display: block;
  width: var(--progress);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--purple), var(--purple-2), var(--pink));
  box-shadow: 0 0 24px rgba(216,156,255,0.42);
  transition: width 420ms linear;
}

.planet-wrap {
  position: relative;
  width: min(38vw, 400px);
  aspect-ratio: 1;
  justify-self: center;
  display: grid;
  place-items: center;
  isolation: isolate;
  transform: translateY(-1vh);
}

.planet-wrap::before {
  content: "";
  position: absolute;
  inset: 7%;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(169,120,255,0.22), transparent 64%);
  filter: blur(9px);
}

.planet {
  position: relative;
  z-index: 4;
  width: 31%;
  aspect-ratio: 1;
  border-radius: 999px;
  background:
    radial-gradient(circle at 34% 30%, #fff7ff 0 5%, #d9b5ff 14%, var(--purple) 44%, #45196d 78%);
  box-shadow:
    inset -22px -26px 44px rgba(0,0,0,0.32),
    0 0 62px rgba(169,120,255,0.46);
  animation: planetFloat 5s ease-in-out infinite;
}

.planet-shine {
  position: absolute;
  width: 28%;
  height: 28%;
  left: 24%;
  top: 20%;
  border-radius: 999px;
  background: rgba(255,255,255,0.62);
  filter: blur(4px);
}

.planet-ring {
  position: absolute;
  z-index: 5;
  width: 44%;
  height: 14%;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.34);
  transform: rotate(-17deg);
  box-shadow: 0 0 24px rgba(216,156,255,0.22);
}

.orbit {
  position: absolute;
  border: 1px solid rgba(216,156,255,0.16);
  border-radius: 999px;
}

.orbit span {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 16px rgba(255,255,255,0.85);
}

.orbit-1 {
  width: 54%;
  height: 54%;
  animation: spin 8s linear infinite;
}

.orbit-1 span {
  left: 12%;
  top: 16%;
  background: var(--pink);
}

.orbit-2 {
  width: 72%;
  height: 72%;
  animation: spin 13s linear infinite reverse;
}

.orbit-2 span {
  right: 16%;
  top: 22%;
  background: var(--cyan);
}

.orbit-3 {
  width: 90%;
  height: 90%;
  animation: spin 18s linear infinite;
}

.orbit-3 span {
  left: 18%;
  bottom: 19%;
  background: var(--purple-2);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.16); opacity: 0.72; }
}

@keyframes galaxyDrift {
  from { transform: translate3d(0, 0, 0) rotate(-10deg); }
  to { transform: translate3d(4vw, -1vh, 0) rotate(-8deg); }
}

@keyframes galaxyDriftB {
  from { transform: translate3d(0, 0, 0) rotate(16deg); }
  to { transform: translate3d(-3vw, 2vh, 0) rotate(18deg); }
}

@keyframes meteor {
  0%, 68% { opacity: 0; transform: translate3d(0, 0, 0) rotate(-28deg); }
  71% { opacity: 1; }
  80% { opacity: 0; transform: translate3d(-520px, 282px, 0) rotate(-28deg); }
  100% { opacity: 0; transform: translate3d(-520px, 282px, 0) rotate(-28deg); }
}

@keyframes planetFloat {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -8px, 0); }
}

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

@media (max-width: 860px) {
  .stage {
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }

  body {
    height: auto;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .hero {
    grid-template-columns: 1fr;
    align-content: center;
    padding: 18px 4px 0;
  }

  .copy {
    transform: none;
  }

  .planet-wrap {
    order: -1;
    width: min(74vw, 290px);
    transform: none;
  }

  h1 {
    max-width: 100%;
  }
}

@media (max-width: 620px) {
  .stage {
    width: min(100% - 22px, 100%);
    padding-top: 12px;
    padding-bottom: 18px;
  }

  .topbar {
    height: auto;
    min-height: var(--header-h);
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand-copy span {
    max-width: 38vw;
  }

  .status {
    padding-inline: 10px;
  }

  .status span:last-child {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  h1 {
    font-size: clamp(2.75rem, 14.5vw, 4.2rem);
    letter-spacing: -0.062em;
  }

  .lead {
    max-width: 100%;
  }

  .retry {
    width: 100%;
  }
}

@media (max-height: 760px) and (min-width: 861px) {
  :root {
    --header-h: 48px;
  }

  .stage {
    padding-top: 12px;
    padding-bottom: 12px;
    gap: 8px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .topbar {
    height: var(--header-h);
  }

  h1 {
    font-size: clamp(3rem, min(6.4vw, 8.4vh), 5rem);
  }

  .lead {
    margin-top: 16px;
  }

  .actions {
    margin-top: 20px;
  }

  .retry {
    margin-top: 18px;
  }

  .planet-wrap {
    width: min(34vw, 340px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
