/* ════════════════════════════════════════════════════════
   Pixl Realm coming-soon page. Colors from tokens.css; the one extra is
   G.H.O.S.T.'s own cyan (its eye), which is the G.H.O.S.T. half of the blend.
   Motion: transform and opacity only. The intro plays once; after it the Ghost
   floats and now and then opens its shell or glitches. Everything stops with
   the Pause button, with the motion switch off, or under reduced motion, and
   the page reads in full with no script.
   ════════════════════════════════════════════════════════ */
:root {
  --cs-cyan: #5fd3e8;
  --cs-sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --cs-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --g: clamp(150px, 30vmin, 260px);            /* the Ghost's size */
}
:root[data-look="bw"] { --cs-cyan: var(--brand-white); }
html { background: var(--color-bg); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--color-bg); color: var(--color-text-primary);
  font-family: var(--cs-sans); font-size: var(--size-large); line-height: 1.6;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
*, *::before, *::after { box-sizing: border-box; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--cs-cyan); outline-offset: 3px; }

.cs {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: var(--space-8) var(--space-4) var(--space-6); position: relative; z-index: 1;
}

/* ── The R icon, above the Ghost ───────────────────────── */
.cs-mark { margin: 0 0 var(--space-4); display: flex; justify-content: center; line-height: 1; }
.cs-mark .pixl-logo { --logo-h: clamp(3.5rem, 11vmin, 5.5rem); }

/* ── The stage ─────────────────────────────────────────── */
.cs-stage {
  position: relative; width: min(100%, calc(var(--g) * 2.4)); height: calc(var(--g) * 1.4);
  display: grid; place-items: center; margin-bottom: var(--space-6);
}
.cs-bob { position: relative; width: var(--g); height: var(--g); z-index: 2; }
/* The pixel canvas is larger than the Ghost, so pixels can fly in from around it. */
.cs-pixels { position: absolute; left: 50%; top: 50%; width: min(calc(100vw - 2 * var(--space-4)), calc(var(--g) * 2.4)); height: calc(var(--g) * 1.4); transform: translate(-50%, -50%); image-rendering: pixelated; }
.cs-shell { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0 1.4rem color-mix(in srgb, var(--cs-cyan) 40%, transparent)); }
/* With the script, the pixels are the Ghost; the drawing only flickers through in a glitch. */
.cs-js .cs-shell { opacity: 0; }
.cs-js .cs-shell.is-flash { opacity: 0.9; }

/* Pixel rings: square, like the logo's pixels; they pulse out from the Ghost. */
.cs-ring {
  position: absolute; left: 50%; top: 50%; width: calc(var(--g) * 0.8); height: calc(var(--g) * 0.8);
  margin: calc(var(--g) * -0.4) 0 0 calc(var(--g) * -0.4);
  border: 2px solid var(--color-accent); opacity: 0; z-index: 1;
}
.cs-ring:nth-child(2) { border-color: var(--cs-cyan); }
.cs-beam {
  position: absolute; left: 0; right: 0; top: 0; height: 2px; z-index: 3;
  background: linear-gradient(90deg, transparent, var(--cs-cyan), transparent);
  opacity: 0; pointer-events: none;
}

/* ── The words ─────────────────────────────────────────── */
.cs-logo { margin: 0; display: flex; justify-content: center; line-height: 1; }
.cs-logo .pixl-logo { --logo-h: clamp(1.75rem, 6vw, 3rem); }   /* the Wordmark, 8.3 wide to 1 tall */
.cs-status {
  margin: var(--space-6) 0 0; display: inline-flex; align-items: center; gap: var(--space-2);
  font-family: var(--font-mono); font-size: var(--size-small); letter-spacing: 0.08em; text-transform: uppercase;
}
.cs-status-k { color: var(--color-text-muted); }
.cs-status-sep { color: var(--color-accent); }
.cs-type { color: var(--cs-cyan); }
.cs-cursor { display: inline-block; width: 0.6em; height: 1.1em; background: var(--cs-cyan); }
.cs-lede { max-width: 30rem; margin: var(--space-4) auto 0; color: var(--color-text-secondary); font-size: var(--size-large); }

/* The G.H.O.S.T. card: a pixel-edged pane with a block shadow. */
.cs-ghost-card {
  margin-top: var(--space-8); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-4);
  width: min(100%, 26rem); padding: var(--space-4); text-align: left; text-decoration: none; color: var(--color-text-primary);
  background: var(--color-surface); border: 2px solid var(--color-glass-border-hover);
  box-shadow: var(--pixel) var(--pixel) 0 var(--pixel-shadow);
  transition: transform .18s var(--cs-ease), border-color .18s ease;
}
.cs-ghost-card:hover { transform: translate(-2px, -2px); border-color: var(--cs-cyan); }
.cs-ghost-card:active { transform: translate(2px, 2px); }
.cs-ghost-ico { display: grid; place-items: center; width: 44px; height: 44px; color: var(--cs-cyan); border: 2px solid currentColor; }
.cs-ghost-ico svg { width: 26px; height: 26px; }
.cs-ghost-text { display: grid; gap: 2px; min-width: 0; }
.cs-ghost-k { font-family: var(--font-mono); font-size: var(--size-label); letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-text-muted); }
.cs-ghost-name { font-family: 'Press Start 2P', var(--font-mono); font-size: var(--size-body); line-height: 1.6; }
.cs-ghost-d { font-size: var(--size-body); color: var(--color-text-secondary); line-height: 1.4; }
.cs-ghost-go { font-family: var(--font-mono); font-size: var(--size-small); text-transform: uppercase; letter-spacing: 0.08em; color: var(--cs-cyan); }

.cs-foot { position: relative; z-index: 1; text-align: center; padding: var(--space-6) var(--space-4) var(--space-8); color: var(--color-text-muted); font-size: var(--size-small); }
.cs-foot p { margin: var(--space-2) auto 0; max-width: 40rem; }
.cs-motion {
  min-height: 44px; padding: 0 var(--space-4); font: inherit; font-family: var(--font-mono); font-size: var(--size-small);
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-secondary);
  background: transparent; border: 1px solid var(--color-border-light); cursor: pointer;
}
.cs-motion:hover { color: var(--color-text-primary); border-color: var(--color-text-secondary); }
.cs-motion:active { transform: translateY(1px); }

@media (max-width: 480px) {
  .cs { padding-top: var(--space-6); }
  .cs-ghost-card { grid-template-columns: auto minmax(0, 1fr); }
  .cs-ghost-go { display: none; }
}

/* ── Motion: only at full motion (the script adds .cs-play) ─ */
/* Intro: the pixels assemble (canvas), the beam scans, then the words build in turn. */
.cs-play .cs-beam { animation: cs-scan .9s var(--cs-ease) 1.5s 1 both; }
.cs-idle .cs-ring { animation: cs-ring 3.2s steps(10) 1.9s infinite; }
.cs-idle .cs-ring:nth-child(2) { animation-delay: 2.97s; }
.cs-idle .cs-ring:nth-child(3) { animation-delay: 4.03s; }
.cs-idle .cs-bob { animation: cs-bob 6s ease-in-out 2.2s infinite; }
/* The R icon builds first, in its two inks (the frame, then the pixel and leg). Then the words build
   the same way: "PIXL" drops in, then "REALM", in hard steps like the pixels above. */
.cs-play .cs-mark .pixl-logo::before { animation: cs-pop .4s steps(4) .15s both; }
.cs-play .cs-mark .pixl-logo::after { animation: cs-pop .4s steps(4) .5s both; }
.cs-play .cs-logo .pixl-logo::before { animation: cs-pop .4s steps(4) 1.8s both; }
.cs-play .cs-logo .pixl-logo::after { animation: cs-pop .4s steps(4) 2.15s both; }
.cs-play .cs-status { animation: cs-fade .3s ease 2.6s both; }
.cs-idle .cs-cursor { animation: cs-blink 1s steps(1) 2.6s infinite; }
.cs-play .cs-lede { animation: cs-up .5s var(--cs-ease) 3.2s both; }
.cs-play .cs-ghost-card { animation: cs-up .5s var(--cs-ease) 3.5s backwards; }
@keyframes cs-scan { 0% { opacity: 0; transform: translateY(0); } 15% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; transform: translateY(calc(var(--g) * 1.4)); } }
@keyframes cs-ring { 0% { opacity: 0.7; transform: scale(0.7); } 100% { opacity: 0; transform: scale(1.9); } }
@keyframes cs-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes cs-pop { 0% { opacity: 0; transform: translateY(-14%) scale(1.08); } 100% { opacity: 1; transform: none; } }
@keyframes cs-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cs-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes cs-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

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