:root {
  --bg: #090c16;
  --bg-soft: #11192b;
  --panel: rgba(20, 29, 48, 0.72);
  --panel-strong: rgba(28, 40, 66, 0.9);
  --text: #edf4ff;
  --muted: #aeb9cd;
  --line: rgba(224, 237, 255, 0.18);
  --moon: #f1efd4;
  --silver: #c6d5ff;
  --blue: #78b9ff;
  --amber: #f7bf77;
  --green: #8ee0c2;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 22% 8%, rgba(120, 185, 255, 0.3), transparent 34rem),
    radial-gradient(circle at 82% 18%, rgba(142, 224, 194, 0.18), transparent 30rem),
    linear-gradient(180deg, #060912 0%, #0c1324 48%, #111626 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 76%);
}

img, svg { max-width: 100%; display: block; }

a { color: inherit; }

.skip-link {
  position: fixed;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: var(--moon);
  color: #172033;
  transition: top 0.2s ease;
}

.skip-link:focus { top: 1rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(1120px, calc(100% - 2rem));
  margin: 1rem auto 0;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(7, 12, 24, 0.72);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  font-weight: 760;
  letter-spacing: 0.01em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(241, 239, 212, 0.18), rgba(120, 185, 255, 0.08));
  border: 1px solid var(--line);
}

.brand-mark svg { width: 1.45rem; fill: var(--moon); }

.nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav a,
.menu-button,
.button,
.top-button,
.phase-button {
  border: 0;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.nav a {
  padding: 0.65rem 0.85rem;
  border-radius: 999px;
  color: var(--muted);
  transition: background 0.18s ease, color 0.18s ease;
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.menu-button {
  display: none;
  padding: 0.65rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

main {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: clamp(2rem, 7vw, 5rem);
  align-items: center;
  min-height: clamp(650px, 86vh, 860px);
  padding: clamp(4rem, 9vw, 7rem) 0;
}

.stars {
  position: absolute;
  inset: 4rem -10vw auto auto;
  width: 32rem;
  height: 32rem;
  opacity: 0.75;
  background:
    radial-gradient(circle, rgba(255,255,255,0.95) 0 1px, transparent 1.4px) 4% 12% / 78px 78px,
    radial-gradient(circle, rgba(255,255,255,0.62) 0 1px, transparent 1.6px) 2% 4% / 124px 124px;
  mask-image: radial-gradient(circle, black, transparent 70%);
}

.eyebrow,
.section-kicker {
  margin: 0 0 0.8rem;
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p { margin-top: 0; }

h1 {
  max-width: 13ch;
  margin-bottom: 1.2rem;
  font-size: clamp(3.6rem, 8vw, 7.2rem);
  line-height: 0.86;
  letter-spacing: -0.08em;
}

.hero-text {
  max-width: 42rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 1.8rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.1rem;
  padding: 0.85rem 1.15rem;
  border-radius: 999px;
  font-weight: 750;
}

.button.primary {
  color: #101522;
  background: linear-gradient(135deg, var(--moon), var(--green));
  box-shadow: 0 18px 46px rgba(142, 224, 194, 0.18);
}

.button.ghost {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.hero-art {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 2.5rem;
  background:
    radial-gradient(circle at 50% 20%, rgba(241, 239, 212, 0.14), transparent 20rem),
    rgba(15, 23, 41, 0.66);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-art::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 70px rgba(120, 185, 255, 0.13);
  pointer-events: none;
}

.panel,
.cards,
.phase-section,
.observe {
  margin-bottom: 1rem;
}

.panel {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  padding: clamp(1.5rem, 4vw, 3rem);
  border: 1px solid var(--line);
  border-radius: 2rem;
  background: var(--panel);
  box-shadow: var(--shadow);
}

h2 {
  margin-bottom: 1rem;
  font-size: clamp(2rem, 4.8vw, 4rem);
  line-height: 0.96;
  letter-spacing: -0.055em;
}

.panel p,
.creature-card p,
.phase-section p,
.observe p,
.site-footer p {
  color: var(--muted);
  line-height: 1.75;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  padding: clamp(1rem, 3vw, 1.4rem);
  border: 1px solid var(--line);
  border-radius: 2rem;
  background: rgba(255, 255, 255, 0.035);
}

.section-heading {
  grid-column: 1 / -1;
  max-width: 760px;
  padding: 1rem 0.4rem;
}

.section-heading.centered {
  margin: 0 auto;
  text-align: center;
}

.creature-card,
.signal-card,
.phase-console {
  border: 1px solid var(--line);
  border-radius: 1.6rem;
  background: var(--panel-strong);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.24);
}

.creature-card {
  min-height: 250px;
  padding: 1.4rem;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.creature-card:hover { transform: translateY(-4px); border-color: rgba(241, 239, 212, 0.35); }

.creature-card.featured {
  background:
    radial-gradient(circle at 80% 10%, rgba(241, 239, 212, 0.14), transparent 12rem),
    var(--panel-strong);
}

.card-icon {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 1.4rem;
  border-radius: 1.1rem;
  background: rgba(241, 239, 212, 0.12);
  color: var(--moon);
  font-size: 1.6rem;
}

.creature-card h3 {
  margin-bottom: 0.8rem;
  font-size: 1.35rem;
}

.phase-section {
  padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 3vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: 2rem;
  background:
    linear-gradient(180deg, rgba(120, 185, 255, 0.09), rgba(241, 239, 212, 0.05)),
    rgba(10, 17, 32, 0.76);
  box-shadow: var(--shadow);
}

.phase-console {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.5rem;
  align-items: center;
  max-width: 880px;
  margin: 1.6rem auto 0;
  padding: 1rem;
}

.phase-visual {
  min-height: 260px;
  display: grid;
  place-items: center;
  border-radius: 1.2rem;
  background: rgba(255, 255, 255, 0.045);
}

.phase-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-self: end;
}

.phase-button {
  padding: 0.78rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-weight: 760;
}

.phase-button.active,
.phase-button:hover {
  color: #111827;
  background: var(--moon);
}

.phase-note {
  grid-column: 2;
  margin: -0.5rem 0 0;
  padding: 1rem;
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.05);
}

.observe {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.45fr);
  gap: 1rem;
  align-items: stretch;
}

.observe-copy,
.signal-card {
  padding: clamp(1.5rem, 4vw, 3rem);
  border: 1px solid var(--line);
  border-radius: 2rem;
  background: var(--panel);
}

.signal-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.signal-dot {
  width: 0.9rem;
  height: 0.9rem;
  margin-bottom: 1.3rem;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(142, 224, 194, 0.6);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  50% { box-shadow: 0 0 0 0.8rem rgba(142, 224, 194, 0); }
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.site-footer p { margin: 0; }

.top-button {
  flex: 0 0 auto;
  padding: 0.8rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

body.phase-blue {
  --moon: #d9ecff;
  --green: #93d8ff;
  --panel-strong: rgba(21, 38, 66, 0.92);
}

body.phase-amber {
  --moon: #ffe0a8;
  --green: #ffc690;
  --panel-strong: rgba(50, 38, 29, 0.92);
}

@media (max-width: 860px) {
  .site-header { border-radius: 1.4rem; align-items: flex-start; }
  .menu-button { display: inline-flex; }
  .nav {
    display: none;
    position: absolute;
    left: 0.8rem;
    right: 0.8rem;
    top: calc(100% + 0.45rem);
    flex-direction: column;
    align-items: stretch;
    padding: 0.6rem;
    border: 1px solid var(--line);
    border-radius: 1.2rem;
    background: rgba(7, 12, 24, 0.94);
  }
  .nav.open { display: flex; }
  .hero { grid-template-columns: 1fr; min-height: auto; padding: 4rem 0 2rem; }
  h1 { max-width: 11ch; }
  .panel,
  .observe,
  .phase-console { grid-template-columns: 1fr; }
  .phase-note { grid-column: auto; }
  .cards { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  main,
  .site-header,
  .site-footer { width: min(100% - 1rem, 1120px); }
  .brand span:last-child { max-width: 9.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  h1 { font-size: clamp(3.1rem, 18vw, 4.8rem); }
  .hero-actions { flex-direction: column; }
  .button { width: 100%; }
  .site-footer { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
