/* Stellarc — design system + page styles.
   Tokens mirror the game exactly (Palette.swift). */

:root {
  --bg-deep: #050514;        /* Palette.bgBottom */
  --bg-top: #1a0d3d;         /* Palette.bgTop */
  --nebula-violet: #6647f2;  /* Palette.nebulaIndigo */
  --nebula-magenta: #e63d9e; /* Palette.nebulaMagenta */
  --comet: #8cedff;          /* Palette.comet */
  --well: #9e8cff;           /* Palette.well */
  --gold: #ffd973;           /* Palette.mote */
  --text: rgba(255, 255, 255, 0.92);
  --text-dim: rgba(214, 214, 236, 0.62);
  --glass: rgba(255, 255, 255, 0.055);
  --glass-stroke: rgba(255, 255, 255, 0.12);
  --ease: cubic-bezier(0.22, 0.8, 0.3, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; background: var(--bg-deep); }

body {
  margin: 0;
  /* the game's UI face, graceful fallbacks elsewhere */
  font-family: "Avenir Next", Avenir, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg-deep);
  background-image: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-deep) 110vh);
  background-repeat: no-repeat;
  overflow-x: hidden;
}

/* the game's vignette */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background: radial-gradient(120% 95% at 50% 45%, transparent 62%,
    rgba(0, 0, 0, 0.42) 100%);
}

::selection { background: rgba(140, 237, 255, 0.3); }

a { color: var(--comet); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- ambient nebulas ---------- */

.nebulas {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.nebulas::before,
.nebulas::after {
  content: "";
  position: absolute;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.13;
}
.nebulas::before {
  background: radial-gradient(circle, var(--nebula-violet), transparent 65%);
  top: -20vmax;
  left: -18vmax;
  animation: drift-a 26s ease-in-out infinite alternate;
}
.nebulas::after {
  background: radial-gradient(circle, var(--nebula-magenta), transparent 65%);
  bottom: -25vmax;
  right: -20vmax;
  animation: drift-b 32s ease-in-out infinite alternate;
}
@keyframes drift-a { to { transform: translate(6vmax, 4vmax) scale(1.08); } }
@keyframes drift-b { to { transform: translate(-5vmax, -6vmax) scale(1.1); } }

/* ---------- hero ---------- */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

#sky {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  touch-action: none;
}

.hero-content {
  position: relative;
  pointer-events: none; /* the sky underneath is the toy */
  z-index: 2;
}

/* The game's logo, faithfully: white Heavy over a cyan glow copy
   (1.04 scale, 2px down, 35%), floating ±5px, with a light sweep. */
.wordmark {
  position: relative;
  font-size: clamp(3rem, 9vw, 6.5rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  margin: 0;
  color: #fff;
  animation: logo-float 5.2s ease-in-out infinite;
}
.wordmark::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  z-index: -1;
  color: var(--comet);
  opacity: 0.35;
  transform: scale(1.04) translateY(2px);
  filter: blur(5px);
}
.wordmark::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 42%,
    rgba(255, 255, 255, 0.95) 50%, transparent 58%);
  background-size: 280% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: sheen 6s var(--ease) infinite;
}
@keyframes logo-float { 50% { transform: translateY(-5px); } }
@keyframes sheen {
  0%, 70% { background-position: 130% 0; }
  92%, 100% { background-position: -70% 0; }
}

.tagline {
  margin: 14px 0 0;
  color: var(--text-dim);
  font-size: clamp(1rem, 2.4vw, 1.25rem);
  letter-spacing: 0.14em;
}
.tagline b { color: var(--text); font-weight: 600; }

.hero-cta {
  margin-top: 34px;
  pointer-events: auto;
}

.hint {
  position: absolute;
  bottom: clamp(18px, 5vh, 44px);
  left: 0;
  right: 0;
  color: var(--text-dim);
  font-size: 0.92rem;
  letter-spacing: 0.1em;
  animation: hint-pulse 2.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes hint-pulse { 50% { opacity: 0.45; } }

.stardust {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 18px);
  right: 18px;
  z-index: 3;
  pointer-events: none;
}

/* ---------- components ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-stroke);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--gold);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cta {
  display: inline-block;
  padding: 15px 34px;
  border-radius: 999px;
  background: var(--gold);
  color: #2b1d05;
  font-weight: 700;
  letter-spacing: 0.06em;
  box-shadow: 0 0 34px rgba(255, 217, 115, 0.3);
  transition: transform 150ms var(--ease), box-shadow 150ms var(--ease);
}
.cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 44px rgba(255, 217, 115, 0.45);
  text-decoration: none;
}

/* ---------- sections ---------- */

section { padding: clamp(64px, 11vh, 130px) 24px; }

.section-inner { max-width: 1060px; margin: 0 auto; }

.section-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0 0 12px;
}
.section-sub {
  text-align: center;
  color: var(--text-dim);
  margin: 0 auto 54px;
  max-width: 520px;
  line-height: 1.7;
}

.phones {
  display: flex;
  justify-content: center;
  gap: clamp(10px, 3vw, 36px);
  perspective: 1200px;
  flex-wrap: wrap;
}
.phone {
  width: clamp(180px, 24vw, 250px);
  border-radius: 36px;
  border: 1px solid var(--glass-stroke);
  outline: 6px solid rgba(255, 255, 255, 0.04);
  overflow: hidden;
  background: #000;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
  transition: transform 500ms var(--ease);
  animation: float 7s ease-in-out infinite;
}
.phone img { display: block; width: 100%; height: auto; }
.phone:nth-child(2) { animation-delay: -2.3s; }
.phone:nth-child(3) { animation-delay: -4.6s; }
.phone:hover { transform: rotateY(-6deg) rotateX(3deg) translateY(-8px); }
@keyframes float { 50% { transform: translateY(-12px); } }

/* ---------- footer ---------- */

footer {
  padding: 40px 24px 60px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}
footer nav {
  display: flex;
  gap: 26px;
  justify-content: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
footer a { color: var(--text-dim); }
footer a:hover { color: var(--comet); }

/* ---------- scroll reveals ---------- */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 700ms var(--ease), transform 700ms var(--ease);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- privacy subpage ---------- */

.doc {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(40px, 8vh, 90px) 24px 80px;
  line-height: 1.7;
}
.doc h1 { font-size: 1.7rem; letter-spacing: 0.05em; }
.doc h2 { font-size: 1.1rem; margin-top: 2em; letter-spacing: 0.04em; }
.doc .muted { color: var(--text-dim); font-size: 0.9rem; }
.doc ul { color: var(--text-dim); }
.doc p { color: var(--text-dim); }
.doc strong { color: var(--text); }
.back-home {
  display: inline-block;
  margin-bottom: 30px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
}

.doc-header { text-align: center; margin-bottom: 42px; }
.doc-wordmark {
  position: relative;
  display: inline-block;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #fff;
  text-decoration: none;
}
.doc-wordmark::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  z-index: -1;
  color: var(--comet);
  opacity: 0.35;
  transform: scale(1.05) translateY(1px);
  filter: blur(4px);
}
.doc-wordmark:hover { text-decoration: none; }
.doc-tag {
  margin: 6px 0 0;
  color: var(--text-dim);
  letter-spacing: 0.28em;
  font-size: 0.8rem;
  text-transform: lowercase;
}

.doc-card {
  background: rgba(10, 9, 28, 0.55);
  border: 1px solid var(--glass-stroke);
  border-radius: 28px;
  padding: clamp(26px, 5vw, 52px);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}
.doc-card h1 { margin-top: 0; }

/* ambient sky on content pages */
#ambient {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.doc { position: relative; z-index: 1; }

/* ---------- motion accessibility ---------- */

@media (prefers-reduced-motion: reduce) {
  .wordmark { animation: none; }
  .wordmark::after { animation: none; opacity: 0; }
  .nebulas::before, .nebulas::after { animation: none; }
  .phone { animation: none; }
  .hint { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

@media (max-width: 640px) {
  .phones .phone:nth-child(3) { display: none; }
  section { padding: 64px 18px; }
}
