/* Cosmos — page-specific layer on top of the shared EZO Labs theme.
 * Palette is lifted from the Cosmos app itself (src/renderer/src/app.css
 * `cosmos-dark` tokens) and its icon artwork. */

:root {
  --cos-violet: #8b6fff;
  --cos-cyan: #80dfff;
  --cos-blue: #588bf9;
  --cos-accent: #7aa2ff;
  --cos-deep: #0b0d12;
}

/* ---------- starfield ---------- */
.starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1.2px 1.2px at 12% 18%, rgba(255,255,255,0.75), transparent 100%),
    radial-gradient(1px 1px at 27% 62%, rgba(255,255,255,0.55), transparent 100%),
    radial-gradient(1.4px 1.4px at 41% 9%,  rgba(198,214,255,0.8), transparent 100%),
    radial-gradient(1px 1px at 55% 41%, rgba(255,255,255,0.42), transparent 100%),
    radial-gradient(1.6px 1.6px at 68% 77%, rgba(175,155,255,0.7), transparent 100%),
    radial-gradient(1px 1px at 79% 26%, rgba(255,255,255,0.5), transparent 100%),
    radial-gradient(1.2px 1.2px at 88% 58%, rgba(139,111,255,0.6), transparent 100%),
    radial-gradient(1px 1px at 6% 84%,  rgba(255,255,255,0.4), transparent 100%),
    radial-gradient(1.3px 1.3px at 34% 92%, rgba(128,223,255,0.45), transparent 100%),
    radial-gradient(1px 1px at 94% 12%, rgba(255,255,255,0.45), transparent 100%);
  opacity: 0.7;
  animation: drift 24s ease-in-out infinite alternate;
  /* Counter-parallax: stars shift opposite the mark for depth. */
  translate: calc(var(--px, 0) * -9px) calc(var(--py, 0) * -7px);
  transition: translate 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}
/* Deep-indigo wash behind everything, matching the app icon's background. */
.starfield::after {
  content: "";
  position: absolute;
  inset: -20%;
  background: radial-gradient(closest-side, rgba(37,26,74,0.55), transparent 70%);
  filter: blur(50px);
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-14px, 10px, 0) scale(1.03); }
}

body > *:not(.starfield) { position: relative; z-index: 1; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- header ---------- */
.nav-min {
  display: flex;
  align-items: center;
  gap: 24px;
}
.nav-min a {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.2s ease;
}
.nav-min a:hover { color: var(--heading); }

/* ---------- single-screen stage ---------- */
.cos-stage {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 64px;
}
.cos-grid {
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  align-items: center;
  gap: clamp(28px, 5vw, 72px);
  width: 100%;
  flex: 1;
  align-content: center;
}

.cos-kicker { color: var(--muted-dim); }

.cos-title {
  font-size: clamp(52px, 9vw, 116px);
  line-height: 0.94;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--heading);
  margin: 18px 0 0;
}
/* Continuously scrolling gradient. The ramp repeats seamlessly (its first and
 * last stops match), so translating one full tile and looping never jumps. */
.cos-title .halo {
  background: linear-gradient(
    96deg,
    #ffffff 0%,
    #cfe0ff 12%,
    var(--cos-blue) 24%,
    var(--cos-cyan) 34%,
    #e6f6ff 44%,
    #ffffff 50%,
    #cfe0ff 62%,
    var(--cos-blue) 74%,
    var(--cos-cyan) 84%,
    #e6f6ff 94%,
    #ffffff 100%
  );
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientscroll 1.4s linear infinite;
}

/* One tile is 50% of background-size here, so 0% -> -50% is a seamless loop. */
@keyframes gradientscroll {
  from { background-position: 0% 50%; }
  to   { background-position: -110% 50%; }
}

.cos-line {
  font-size: clamp(16px, 1.6vw, 19px);
  letter-spacing: -0.01em;
  max-width: 30ch;
  margin: 22px 0 clamp(26px, 3.4vw, 36px);
  /* Same scroll, dimmer, slower and offset so it never marches in lockstep
   * with the wordmark. */
  color: transparent;
  background: linear-gradient(
    96deg,
    #8a90a0 0%,
    #aab4cc 12%,
    #7f9fd8 24%,
    #86bcd4 34%,
    #b7c6da 44%,
    #8a90a0 50%,
    #aab4cc 62%,
    #7f9fd8 74%,
    #86bcd4 84%,
    #b7c6da 94%,
    #8a90a0 100%
  );
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: gradientscroll 2.1s linear infinite;
}

/* ---------- fragment strip ---------- */
.cos-fragments {
  list-style: none;
  margin: 0 0 clamp(28px, 3.8vw, 40px);
  padding: 0;
  max-width: 460px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--muted-dim);
}
.cos-fragments li {
  position: relative;
  padding: 11px 0 11px 0;
  border-top: 1px solid var(--hairline-soft);
  transition: color 0.28s ease, padding-left 0.28s ease;
}
.cos-fragments li:last-child { border-bottom: 1px solid var(--hairline-soft); }

/* Sweep that fills from the left on hover. */
.cos-fragments li::before {
  content: "";
  position: absolute;
  left: 0;
  top: -1px;
  height: 1px;
  width: 0;
  background: linear-gradient(90deg, var(--cos-cyan), transparent);
  transition: width 0.45s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.cos-fragments li:hover {
  color: var(--text);
  padding-left: 14px;
}
.cos-fragments li:hover::before { width: 100%; }

/* ---------- orbiting mark ---------- */
.cos-visual {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
}
.cos-visual svg { width: min(92%, 500px); height: auto; overflow: visible; }
.orbiter {
  width: 100%;
  display: grid;
  place-items: center;
  /* Pointer parallax, driven by parallax.js via --px / --py. */
  transform: translate3d(calc(var(--px, 0) * 16px), calc(var(--py, 0) * 14px), 0);
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.aura {
  transform-box: fill-box;
  transform-origin: center;
  animation: corepulse 7s ease-in-out infinite;
}

/* The satellite swings back and forth along the near arc of the orbit rather
 * than circling: it never passes behind the planet, so no second copy or
 * occlusion handling is needed. `swing` rotates it about the planet centre;
 * `counter` cancels that rotation on the body so it never appears to tumble. */
.sat {
  transform-box: view-box;
  transform-origin: 512px 530px;
  animation: swing 13s ease-in-out infinite alternate;
}
.sat-swing {
  transform-box: view-box;
  transform-origin: 276px 300px;
  animation: counter 13s ease-in-out infinite alternate;
}

/* Slow counter-rotation makes the dashes crawl along the path. */
.orbit-path {
  transform-box: view-box;
  transform-origin: 512px 530px;
  animation: orbitdrift 90s linear infinite;
}
@keyframes orbitdrift {
  from { transform: rotate(0deg); }
  to   { transform: rotate(-360deg); }
}

.spec {
  transform-box: fill-box;
  transform-origin: center;
  animation: twinkle 5s ease-in-out infinite;
}
.spec-b { animation-duration: 7s;   animation-delay: -1.6s; }
.spec-c { animation-duration: 6.2s; animation-delay: -3.1s; }
.spec-d { animation-duration: 8.4s; animation-delay: -4.4s; }
@keyframes twinkle {
  0%, 100% { opacity: 0.18; transform: scale(0.7); }
  50%      { opacity: 0.9;  transform: scale(1.15); }
}
@keyframes corepulse {
  0%, 100% { opacity: 0.6; transform: scale(0.95); }
  50%      { opacity: 1;   transform: scale(1.05); }
}
/* Travels right from the upper-left anchor and back. 96deg keeps it clear of
 * the planet's silhouette at both ends of the sweep. */
@keyframes swing {
  from { transform: rotate(0deg); }
  to   { transform: rotate(96deg); }
}
@keyframes counter {
  from { transform: rotate(0deg); }
  to   { transform: rotate(-96deg); }
}

/* ---------- signup ---------- */
.signal-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 460px;
}
.signal-form input[type="email"] {
  flex: 1 1 240px;
  min-width: 0;
  background: rgba(255, 255, 255, 0.022);
  border: 1px solid var(--hairline);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  padding: 15px 16px;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.signal-form input[type="email"]::placeholder { color: var(--muted-dim); letter-spacing: 0.18em; text-transform: uppercase; }
.signal-form input[type="email"]:hover { border-color: rgba(255, 255, 255, 0.2); }
.signal-form input[type="email"]:focus {
  outline: none;
  border-color: rgba(122, 162, 255, 0.7);
  background: rgba(88, 139, 249, 0.06);
  box-shadow: 0 0 0 3px rgba(88, 139, 249, 0.12);
}
.signal-form button {
  flex: 0 0 auto;
  cursor: pointer;
  background: none;
  font: inherit;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.18s ease;
}
.signal-form button:hover {
  transform: translateY(-1px);
  border-color: rgba(128, 223, 255, 0.6);
  background: rgba(88, 139, 249, 0.1);
}
.signal-form button:active { transform: translateY(0); }
.signal-form button[disabled] { opacity: 0.5; cursor: progress; transform: none; }

/* honeypot — never shown to humans */
.orbit-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.signal-status {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-top: 16px;
  min-height: 16px;
  color: var(--muted-dim);
}
.signal-status.ok { color: var(--cos-cyan); }
.signal-status.err { color: #e06c75; }

/* ---------- footer strip ---------- */
.cos-foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-block: 26px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted-dim);
}
.cos-foot a { transition: color 0.2s ease; }
.cos-foot a:hover { color: var(--text); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .cos-grid { grid-template-columns: 1fr; gap: 4px; }
  .cos-visual { order: -1; max-width: 300px; margin-inline: auto; }
  .cos-stage { padding-top: 76px; }
  .cos-line { max-width: none; }
  .cos-fragments { max-width: none; font-size: 10px; letter-spacing: 0.14em; }
  .cos-fragments li { padding: 9px 0; }
}

/* ---------- entrance ---------- */
.cos-copy > *,
.cos-visual {
  opacity: 0;
  animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
.cos-copy > *:nth-child(1) { animation-delay: 0.05s; }
.cos-copy > *:nth-child(2) { animation-delay: 0.13s; }
.cos-copy > *:nth-child(3) { animation-delay: 0.21s; }
.cos-copy > *:nth-child(4) { animation-delay: 0.29s; }
.cos-copy > *:nth-child(5) { animation-delay: 0.37s; }
.cos-copy > *:nth-child(6) { animation-delay: 0.45s; }
.cos-visual { animation-delay: 0.12s; animation-duration: 1.2s; }

/* The tagline needs BOTH the entrance and its own gradient scroll; the blanket
 * rule above would otherwise replace the scroll with `rise` alone. */
.cos-copy > .cos-line {
  animation:
    rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.21s forwards,
    gradientscroll 2.1s linear 0s infinite;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .starfield { animation: none; transition: none; translate: none; }
  .orbiter { transition: none; transform: none; }
  .aura,
  .sat,
  .sat-swing,
  .orbit-path,
  .spec,
  .cos-title .halo,
  .cos-line { animation: none !important; }
  .spec { opacity: 0.5; }
  /* Gradient text must stay legible once the scroll stops. */
  .cos-title .halo { background-position: 0% 50%; }
  .cos-line { background: none; color: var(--muted); }
  .cos-copy > *,
  .cos-visual { opacity: 1; animation: none; transform: none; }
  .cos-fragments li,
  .signal-form button,
  .signal-form input[type="email"] { transition: none; }
}
