/* Shared Unbehav site chrome — home, beta, legal pages */

:root {
  color-scheme: dark;
  --bg: #0a0a0c;
  --fg: #eceff5;
  --body: #c9c9d2;
  --muted: #8f8f99;
  --faint: #5a5a63;
  --line: rgba(255, 255, 255, 0.08);
  --surface: rgba(22, 22, 26, 0.72);
  --accent: #b9aef2;
  --accent-soft: rgba(185, 174, 242, 0.14);
  --accent-glow: rgba(185, 174, 242, 0.22);
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: Outfit, system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% -10%, rgba(185, 174, 242, 0.11), transparent 55%),
    radial-gradient(ellipse 45% 35% at 80% 70%, rgba(159, 196, 234, 0.05), transparent 60%),
    radial-gradient(ellipse 40% 30% at 15% 80%, rgba(159, 216, 201, 0.04), transparent 55%);
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 120px 40px rgba(8, 8, 10, 0.55);
}

.page {
  position: relative;
  z-index: 1;
  width: min(100%, 40rem);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  min-height: 100dvh;
}

/* Shell: on mobile the page is a normal full-width column (no moon).
   Desktop layout kicks in at 960px. */
.shell > .page {
  min-height: 100dvh;
  width: min(100%, 40rem);
}

@media (min-width: 640px) {
  .page { padding: 3.5rem 1.5rem 5rem; gap: 3rem; }
}

@media (min-width: 960px) {
  .shell > .page {
    min-height: 100dvh;
  }
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #d3d3db;
  text-decoration: none;
}

.brand:hover { color: #fff; }

.top-link {
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
}

.top-link:hover { color: var(--accent); }

.eyebrow {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.site-footer {
  margin-top: auto;
  padding-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-size: 0.875rem;
}

.site-footer a {
  color: var(--faint);
  text-decoration: none;
}

.site-footer a:hover { color: var(--accent); }

/* Prose pages (privacy, terms, legal, contact) */
.prose-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.prose-header h1 {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-wrap: balance;
}

.prose-header .lede {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--muted);
  text-wrap: pretty;
  max-width: 40ch;
}

.prose {
  display: flex;
  flex-direction: column;
  gap: 0;
  color: var(--body);
  font-size: 1rem;
  line-height: 1.65;
}

.prose h2 {
  margin: 2rem 0 0.65rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.01em;
}

.prose h2:first-child { margin-top: 0; }

.prose p {
  margin: 0 0 0.85rem;
  text-wrap: pretty;
}

.prose ul {
  margin: 0 0 0.85rem;
  padding-inline-start: 1.15em;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.prose li { text-wrap: pretty; }

.prose a { color: var(--accent); text-decoration: none; }
.prose a:hover { color: #cfc7f7; }

.prose strong { color: var(--fg); font-weight: 500; }

.prose .meta {
  margin: 1.5rem 0 0;
  font-size: 0.875rem;
  color: var(--faint);
}

.prose .meta a { color: var(--muted); }
.prose .meta a:hover { color: var(--accent); }

/* ── Moon stage (desktop only) — decorative, non-interactive ────────── */

.shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Hidden on mobile — layout matches the pre-moon pages */
.moon-stage {
  display: none;
}

@media (min-width: 960px) {
  .shell {
    flex-direction: row;
    align-items: stretch;
  }

  .shell > .page {
    flex: 1 1 48%;
    max-width: 40rem;
    margin: 0;
    margin-inline-start: max(1.5rem, calc((100% - 40rem - min(32vw, 22rem)) / 2));
  }

  .shell > .moon-stage {
    display: flex;
    flex: 1 1 42%;
    position: sticky;
    top: 0;
    align-self: stretch;
    align-items: center;
    justify-content: center;
    height: 100dvh;
    min-height: 100dvh;
    margin: 0;
    padding-inline-end: clamp(1rem, 3vw, 2.5rem);
    pointer-events: none;
  }

  .moon-wrap {
    position: relative;
    width: min(28vw, 20rem);
    height: min(28vw, 20rem);
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    filter: drop-shadow(0 24px 50px rgba(0, 0, 0, 0.55));
  }
}

@media (min-width: 1280px) {
  .moon-wrap {
    width: min(26vw, 22rem);
    height: min(26vw, 22rem);
  }
}

.moon-wrap canvas,
.moon-wrap .moon-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
}

.moon-wrap .moon-fallback {
  background-size: cover;
  background-position: center;
  box-shadow:
    inset -18px -14px 40px rgba(0, 0, 0, 0.45),
    inset 10px 8px 24px rgba(255, 255, 255, 0.08);
}

.moon-wrap::before {
  content: "";
  position: absolute;
  inset: -14%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(185, 174, 242, 0.14), transparent 62%);
  pointer-events: none;
  z-index: -1;
}

/* ── Home + beta marketing content (shared so soft-nav keeps styles) ── */

.hero {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-top: 1.25rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 5.5vw, 2.85rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-wrap: balance;
  max-width: 18ch;
}

.page-home .hero h1 { max-width: 14ch; }

.hero .lede {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.55;
  color: var(--muted);
  text-wrap: pretty;
  max-width: 34ch;
}

.hero .lede em {
  font-style: normal;
  color: #cfc7f7;
}

.cta-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1.25rem 1.35rem;
  border-radius: 1.125rem;
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  max-width: 22rem;
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 3rem;
  padding: 0 1.35rem;
  border-radius: 0.75rem;
  background: var(--accent);
  color: #121216;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
}

.cta:hover { background: #cfc7f7; }
.cta:active { transform: scale(0.98); }

.cta-note {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--faint);
  text-wrap: pretty;
}

.join {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  padding: 1.25rem;
  border-radius: 1.125rem;
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

@media (min-width: 640px) {
  .join { padding: 1.35rem 1.4rem; }
}

.join-note {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--faint);
  text-wrap: pretty;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

/* Side-by-side only on comfortable widths — not phone landscape / small tablets */
@media (min-width: 640px) {
  .form-row {
    flex-direction: row;
    align-items: stretch;
  }
}

.field {
  display: block;
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 3.25rem;
  height: 3.25rem;
  padding: 0 1rem;
  border: 0;
  border-radius: 0.75rem;
  background: rgba(10, 10, 12, 0.65);
  color: var(--fg);
  /* 16px minimum avoids iOS zoom / tiny-looking inputs */
  font-family: inherit;
  font-size: 16px;
  line-height: 1.25;
  outline: 1px solid rgba(255, 255, 255, 0.08);
  outline-offset: 0;
  -webkit-appearance: none;
  appearance: none;
}

.field::placeholder { color: #6b6b74; }

.field:focus {
  outline: 2px solid rgba(185, 174, 242, 0.55);
  outline-offset: -1px;
}

.submit {
  display: block;
  width: 100%;
  min-height: 3.25rem;
  height: 3.25rem;
  padding: 0 1.25rem;
  border: 0;
  border-radius: 0.75rem;
  background: var(--accent);
  color: #121216;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  -webkit-appearance: none;
  appearance: none;
}

.submit:hover { background: #cfc7f7; }
.submit:active { transform: scale(0.98); }
.submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

@media (min-width: 640px) {
  .submit {
    width: auto;
    min-width: 9rem;
    flex: 0 0 auto;
  }
}

.status {
  margin: 0;
  min-height: 1.25rem;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--muted);
}

.status[data-kind="ok"] { color: #9fd8c9; }
.status[data-kind="err"] { color: #eba8bc; }

.join.is-done {
  align-items: flex-start;
  gap: 0.5rem;
  background: linear-gradient(180deg, var(--accent-soft), transparent 140%), var(--surface);
}

.done-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--fg);
}

.done-body {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--muted);
  text-wrap: pretty;
}

.features {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.features-kicker {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.feature-list {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--line);
}

.feature {
  margin: 0;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1.5rem 1fr;
  gap: 0.85rem 1rem;
  align-items: start;
}

.feature-mark {
  width: 0.4rem;
  height: 0.4rem;
  margin-top: 0.55rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.feature dt {
  grid-column: 2;
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  color: var(--fg);
}

.feature dd {
  grid-column: 2;
  margin: 0.2rem 0 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--muted);
  text-wrap: pretty;
  max-width: 42ch;
}

.page-home,
.page-beta {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.page-home .site-footer,
.page-beta .site-footer {
  margin-top: auto;
}

@media (min-width: 960px) {
  .page-home {
    gap: 2.75rem;
    justify-content: center;
    padding-block: 3.5rem;
  }
  .page-home .hero { padding-top: 0; }

  .page-beta {
    gap: 2.5rem;
    padding-block: 3rem;
  }
  .page-beta .hero { padding-top: 0.5rem; }
}

/* Soft page enter — only on full load, not soft-nav swaps */
@media (prefers-reduced-motion: no-preference) {
  body:not(.shell-soft) .page-home .hero,
  body:not(.shell-soft) .page-home .cta-block,
  body:not(.shell-soft) .page-beta .hero,
  body:not(.shell-soft) .page-beta .join,
  body:not(.shell-soft) .page-beta .features {
    animation: rise 0.7s cubic-bezier(0.05, 0.7, 0.1, 1) both;
  }
  body:not(.shell-soft) .page-home .cta-block,
  body:not(.shell-soft) .page-beta .join { animation-delay: 0.08s; }
  body:not(.shell-soft) .page-beta .features { animation-delay: 0.14s; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* Soft-nav content swap fade */
@media (prefers-reduced-motion: no-preference) {
  .page.is-swapping {
    opacity: 0.001;
  }
  .page {
    transition: opacity 0.18s ease;
  }
}
