/* Noumen Games — one page. Mobile first; values come from tokens.css. */

*, *::before, *::after { box-sizing: border-box; }

html {
  color-scheme: dark;
  background: var(--surface);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; }

a { color: var(--accent); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--text); }

:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ---------- Sky: CSS nebula (proposal D) + WebGL stars ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 78% 22%, rgba(122, 92, 255, 0.16), rgba(11, 11, 18, 0) 36%),
    radial-gradient(circle at 10% 100%, rgba(27, 31, 58, 0.9), rgba(11, 11, 18, 0) 45%),
    var(--midnight);
}

/* Static stars, shown until (or unless) the WebGL sky is running */
.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 8% 18%, var(--pale-cyan) 0 1.5px, transparent 2px),
    radial-gradient(circle at 31% 9%, var(--pale-cyan) 0 1px, transparent 1.5px),
    radial-gradient(circle at 46% 30%, var(--pale-cyan) 0 2px, rgba(183, 242, 255, 0.25) 3px, transparent 8px),
    radial-gradient(circle at 58% 12%, var(--pale-cyan) 0 1px, transparent 1.5px),
    radial-gradient(circle at 92% 46%, var(--pale-cyan) 0 1.5px, transparent 2px),
    radial-gradient(circle at 66% 58%, var(--pale-cyan) 0 1px, transparent 1.5px),
    radial-gradient(circle at 20% 40%, var(--pale-cyan) 0 1px, transparent 1.5px),
    radial-gradient(circle at 84% 82%, var(--ink) 0 1px, transparent 1.5px),
    radial-gradient(circle at 14% 72%, var(--ink) 0 1px, transparent 1.5px);
  transition: opacity 1s ease;
}
.has-sky .backdrop::after { opacity: 0; }

.sky {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  display: block;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.has-sky .sky { opacity: 1; }

/* ---------- Page ---------- */

.page {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: var(--space-5) var(--gutter) 0;
  overflow-x: clip;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.site-header__logo { display: block; }
.site-header__logo img { display: block; width: auto; height: 20px; }

.eyebrow,
.label {
  margin: 0;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: var(--tracking-ui);
  text-transform: uppercase;
}
.eyebrow { color: var(--warm); }
.label { color: var(--text-muted); }

/* ---------- Hero ---------- */

.hero {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  padding: var(--space-6) 0 var(--space-8);
  text-align: center;
}

.hero__copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(26px, 8vw, 64px);
  line-height: 0.95;
  font-weight: 300;
  letter-spacing: var(--tracking-display);
  text-transform: uppercase;
  color: var(--text);
}

.hero__lead {
  margin: 0;
  max-width: 520px;
  font-size: 16px;
  line-height: 26px;
  color: var(--text-muted);
}

/* ---------- Deck ---------- */

.deck {
  position: relative;
  width: min(100%, 760px);
  height: clamp(250px, 64vw, 300px);
}

/* Violet light behind the cards (proposal C) */
.deck::before {
  content: "";
  position: absolute;
  inset: -20% 0;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(122, 92, 255, 0.16), rgba(122, 92, 255, 0));
  pointer-events: none;
}

.deck__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: pan-y;
  opacity: 0;
  transition: opacity .8s ease;
}
.has-cards .deck__canvas { opacity: 1; }

.deck__fallback {
  --card-w: clamp(104px, 28vw, 180px);
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity .6s ease, visibility .6s;
}
.has-cards .deck__fallback { opacity: 0; visibility: hidden; }

/* CSS card back (Design System CardBack), used when WebGL is not available */
.cardback {
  position: relative;
  flex: 0 0 auto;
  width: var(--card-w);
  aspect-ratio: 63 / 88;
  padding: calc(var(--card-w) * 0.055);
  border: 1px solid var(--line);
  border-radius: calc(var(--card-w) * 0.078);
  background:
    radial-gradient(circle at 65% 25%, rgba(122, 92, 255, 0.35), rgba(122, 92, 255, 0) 25%),
    radial-gradient(circle at 25% 75%, rgba(255, 178, 140, 0.20), rgba(255, 178, 140, 0) 28%),
    linear-gradient(180deg, #11172B, #080A10 72%);
}
.cardback--left { transform: rotate(-12deg) translate(22%, 4%); }
.cardback--right { transform: rotate(12deg) translate(-22%, 4%); }
.cardback--center { z-index: 1; width: calc(var(--card-w) * 1.09); transform: translateY(-6%); box-shadow: var(--glow); }

.cardback__frame {
  position: relative;
  height: 100%;
  display: grid;
  place-items: center;
  border: 1px solid rgba(199, 182, 255, 0.45);
  border-radius: calc(var(--card-w) * 0.044);
}
.cardback__orbit {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 64%;
  aspect-ratio: 1;
  border: 3px solid rgba(199, 182, 255, 0.72);
  border-radius: 50%;
  box-shadow: var(--glow-strong);
  transform: translate(-50%, -50%);
}
.cardback__mark { position: relative; display: block; width: 33%; height: auto; }

/* ---------- Newsletter ---------- */

.signup {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  text-align: left;
}

.signup__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.input {
  flex: 1 1 220px;
  min-width: 0;
  height: 48px;
  padding: 0 var(--space-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: var(--surface-raised);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
}
.input::placeholder { color: var(--text-muted); opacity: 1; }
.input:disabled { cursor: not-allowed; opacity: .7; }

.ng-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  flex: 1 0 auto;
  min-height: 48px;
  padding: 0 var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: box-shadow .2s ease, opacity .2s ease;
}
.ng-btn--primary { background: var(--action); color: var(--on-action); }
.ng-btn--primary:hover { box-shadow: var(--glow); }
.ng-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.signup__note {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  font-size: 14px;
  line-height: 22px;
  color: var(--text-muted);
}

/* Sign-up states, set by main.js on the form: idle | pending | success | invalid | error */
.signup[data-state="idle"] .signup__note .star { display: none; }
.signup[data-state="success"] .signup__note { color: var(--text); }
.signup[data-state="invalid"] .signup__note,
.signup[data-state="error"] .signup__note { color: var(--warm); }
.signup[data-state="invalid"] .input { border-color: var(--warm); }
.signup__note { min-height: 22px; }

.signup__consent {
  margin: 0;
  font-size: 13px;
  line-height: 20px;
  color: var(--text-muted);
  text-align: center;
  text-wrap: pretty;
}
.signup__consent a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 4px;
}
.signup__consent a:hover { text-decoration-color: currentColor; }

/* ---------- Legal page (privacy-policy.html) ---------- */

.legal {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: var(--space-8) 0 var(--space-9);
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.7;
}
.legal h1 {
  margin: 0 0 var(--space-3);
  font-family: var(--font-display);
  font-size: clamp(28px, 6vw, 48px);
  line-height: 1.05;
  font-weight: 300;
  letter-spacing: var(--tracking-display);
  text-transform: uppercase;
  color: var(--text);
}
.legal h2 {
  margin: var(--space-7) 0 var(--space-3);
  font-size: 13px;
  line-height: 20px;
  font-weight: 600;
  letter-spacing: var(--tracking-ui);
  text-transform: uppercase;
  color: var(--text);
}
.legal p, .legal ul { margin: var(--space-3) 0; }
.legal ul { padding-left: 1.25em; }
.legal li + li { margin-top: var(--space-2); }
.legal strong { color: var(--text); font-weight: 600; }
.legal a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; overflow-wrap: anywhere; }
.legal a:hover { text-decoration-color: currentColor; }
.legal__meta { color: var(--text-muted); }
.site-footer--compact { padding-top: var(--space-5); }
.site-footer--compact .site-footer__bottom { margin-top: 0; padding-top: 0; border-top: 0; }
.legal footer { margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid var(--line); }

.star {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  background: var(--warm);
  clip-path: polygon(50% 0, 57% 42%, 100% 50%, 57% 58%, 50% 100%, 43% 58%, 0 50%, 43% 42%);
}

/* ---------- Footer ---------- */

.site-footer {
  padding: var(--space-7) var(--gutter) var(--space-6);
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(11, 11, 18, 0.4), rgba(11, 11, 18, 0.9));
  font-size: 14px;
  line-height: 22px;
}

.site-footer__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

.site-footer__brand { display: flex; flex-direction: column; gap: var(--space-4); }
.site-footer__brand p { margin: 0; color: var(--text-muted); }
.site-footer__symbol { display: block; width: 40px; height: auto; }

.site-footer__col { display: flex; flex-direction: column; gap: var(--space-3); }
.site-footer__col[hidden] { display: none; }

.site-footer__title {
  margin: 0;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: var(--tracking-ui);
  text-transform: uppercase;
  color: var(--text-muted);
}

.site-footer__list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-style: normal;
  color: var(--text);
}
.site-footer__list > * { display: block; }
.site-footer__list .is-strong { font-weight: 600; }
.site-footer__list .is-placeholder { color: var(--text-muted); }

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ---------- Larger screens ---------- */

@media (min-width: 600px) {
  .page { padding-top: var(--space-7); }
  .site-header__logo img { height: 24px; }
  .hero { gap: var(--space-7); padding: var(--space-8) 0 var(--space-9); }
  .hero__copy { gap: var(--space-5); }
  .hero__lead { font-size: 18px; line-height: 30px; }
  .deck { height: clamp(300px, 40vw, 380px); }
  .ng-btn { flex: 0 0 auto; }
  .site-footer__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 960px) {
  .site-footer__grid { grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: var(--space-7); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
