:root {
  --bg: #b9a8ce;
  --bg-2: #a894c0;
  --paper: #f4eefb;
  --ink: #231433;
  --ink-soft: #3d2b54;
  --muted: #5c4a72;
  --line: rgba(50, 24, 80, 0.16);
  --purple: #5b27a8;
  --purple-deep: #431888;
  --header-h: 4.6rem;
  --font: "Outfit", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --shadow: 0 18px 40px rgba(40, 16, 70, 0.16);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font: 400 1.05rem/1.65 var(--font);
  background:
    radial-gradient(800px 420px at 10% -8%, rgba(255, 230, 255, 0.35), transparent 55%),
    var(--bg);
}

img { max-width: 100%; height: auto; }
a { color: var(--purple-deep); text-underline-offset: 0.18em; }
a:hover { color: var(--purple); }

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 80;
  padding: 0.6rem 0.9rem; background: var(--purple); color: #fff;
}
.skip:focus { top: 1rem; }

.wrap { width: min(1160px, calc(100% - 2rem)); margin-inline: auto; }
.wrap-wide { width: min(1280px, calc(100% - 1.4rem)); margin-inline: auto; }

.kicker {
  display: inline-flex; align-items: center; gap: 0.5rem;
  color: var(--purple-deep); font-size: 0.78rem; letter-spacing: 0.16em;
  text-transform: uppercase; font-weight: 700; margin: 0 0 0.6rem;
}
.kicker::before { content: ""; width: 1.4rem; height: 2px; background: var(--purple); }

h1, h2 {
  font-family: var(--display);
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin: 0 0 0.7rem;
}
h1 { font-size: clamp(2.2rem, 5.4vw, 4.2rem); font-weight: 650; }
h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
.lede { font-size: 1.12rem; color: var(--ink-soft); max-width: 40rem; }
.muted { color: var(--muted); }
.section { padding: 3.8rem 0; }

.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  display: flex; align-items: center;
  background: #efe6f8;
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  width: min(1280px, calc(100% - 1.4rem));
}
.brand { display: flex; align-items: center; text-decoration: none; z-index: 2; }
.brand-full { height: 38px; width: auto; display: none; }
.brand-mark { height: 42px; width: 42px; }
@media (min-width: 720px) {
  .brand-full { display: block; }
  .brand-mark { display: none; }
}

.nav-toggle {
  display: none; min-height: 2.5rem; padding: 0 0.8rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper); color: var(--ink); font: 600 0.9rem var(--font); cursor: pointer;
}
.site-nav { display: flex; align-items: center; gap: 0.15rem; }
.site-nav a,
.nav-group > button {
  appearance: none; border: 0; background: transparent;
  color: var(--ink-soft); font: 550 0.92rem/1 var(--font);
  padding: 0.65rem 0.7rem; border-radius: 999px; text-decoration: none; cursor: pointer;
}
.site-nav a:hover,
.nav-group > button:hover,
.site-nav a.is-current { color: var(--ink); background: rgba(67, 24, 136, 0.1); }
.nav-cta {
  color: #fff !important;
  background: linear-gradient(135deg, #4e1f96, #7a3ad6) !important;
}
.nav-group { position: relative; }
.nav-panel {
  position: absolute; top: calc(100% + 0.4rem); left: 0; min-width: 17rem;
  padding: 0.5rem; border-radius: 1rem; background: #fff;
  border: 1px solid var(--line); box-shadow: var(--shadow); display: none; z-index: 20;
}
.nav-group:hover .nav-panel,
.nav-group:focus-within .nav-panel,
.nav-group.is-open .nav-panel { display: grid; }
.nav-panel a { display: flex; align-items: center; gap: 0.85rem; padding: 0.7rem 0.75rem; border-radius: 0.7rem; }
.nav-panel img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }

@media (max-width: 980px) {
  .nav-toggle { display: inline-flex; align-items: center; }
  .site-nav {
    display: none; position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch;
    padding: 0.8rem 1rem 1.2rem; background: #efe6f8; border-bottom: 1px solid var(--line);
  }
  body.nav-open .site-nav { display: flex; }
  .nav-group > button { width: 100%; text-align: left; }
  .nav-panel { position: static; display: none; box-shadow: none; min-width: 0; }
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3rem; padding: 0.75rem 1.25rem; border-radius: 999px;
  border: 1px solid transparent; font: 650 0.98rem/1 var(--font);
  text-decoration: none; cursor: pointer;
}
.btn-primary { color: #fff; background: linear-gradient(135deg, #4e1f96, #7a3ad6); }
.btn-ghost { color: var(--ink); background: var(--paper); border-color: var(--line); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

.hero { padding: 2.2rem 0 1rem; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(280px, 1.1fr);
  gap: 1.5rem;
  align-items: center;
}
.hero h1 { max-width: 14ch; }

.orrery-box {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 2rem;
  box-shadow: var(--shadow);
  padding: 1rem 1.2rem 1.4rem;
  overflow: hidden;
}
.orrery-tools {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.2rem 0.8rem 0.6rem; color: #000; font-size: 0.85rem;
}
.orrery {
  position: relative;
  width: min(100%, 400px);
  aspect-ratio: 1;
  max-height: 400px;
  margin-inline: auto;
  overflow: hidden;
}
.sun {
  position: absolute; left: 50%; top: 50%;
  width: 13%; aspect-ratio: 1; transform: translate(-50%, -50%);
  z-index: 8; border-radius: 50%;
  box-shadow: 0 0 36px rgba(255, 170, 60, 0.45);
}
.sun img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }

.ring {
  position: absolute; left: 50%; top: 50%;
  border: 1px dashed rgba(67, 24, 136, 0.22);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: spin var(--t) linear infinite;
}
.ring .p {
  position: absolute;
  top: 0; left: 50%;
  width: var(--s); height: var(--s);
  margin-left: calc(var(--s) / -2);
  margin-top: calc(var(--s) / -2);
  animation: unspin var(--t) linear infinite;
  display: block;
}
.ring .p img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  border-radius: 50%;
  filter: drop-shadow(0 8px 14px rgba(40, 20, 70, 0.28));
}
.ring.saturn .p img { border-radius: 0; object-fit: contain; }

.r1 { width: 20%; aspect-ratio: 1; --t: 8s; --s: 10px; }
.r2 { width: 30%; aspect-ratio: 1; --t: 13s; --s: 13px; }
.r3 { width: 40%; aspect-ratio: 1; --t: 18s; --s: 15px; }
.r4 { width: 48%; aspect-ratio: 1; --t: 24s; --s: 12px; }
.r5 { width: 56%; aspect-ratio: 1; --t: 36s; --s: 22px; }
.r6 { width: 64%; aspect-ratio: 1; --t: 48s; --s: 26px; }
.r7 { width: 71%; aspect-ratio: 1; --t: 62s; --s: 14px; }
.r8 { width: 78%; aspect-ratio: 1; --t: 78s; --s: 13px; }

@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes unspin { to { transform: rotate(-360deg); } }
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
body.orbits-paused .ring,
body.orbits-paused .ring .p { animation-play-state: paused; }

.procession {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.9rem;
}
.body-tile {
  background: var(--paper); border: 1px solid var(--line); border-radius: 1.3rem;
  padding: 1.1rem 1rem 1.2rem; text-decoration: none; color: inherit;
}
.body-tile:hover { color: inherit; }
.body-tile img {
  width: 96px; height: 96px; object-fit: cover; border-radius: 50%;
  display: block; margin: 0.2rem auto 0.9rem;
  animation: bob 6s ease-in-out infinite;
}
.body-tile h3 { font-family: var(--display); font-size: 1.3rem; margin: 0 0 0.25rem; }
.body-tile p { margin: 0; color: var(--muted); font-size: 0.95rem; }

.gates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}
.gate {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 1rem;
  align-items: center;
  min-height: 0;
  padding: 1.25rem 1.2rem;
  border-radius: 1.4rem;
  text-decoration: none;
  color: inherit;
  background: var(--paper);
  border: 1px solid var(--line);
  overflow: hidden;
}
.gate:hover { color: inherit; box-shadow: var(--shadow); }
.gate-copy { min-width: 0; position: relative; z-index: 1; }
.gate-copy b {
  display: block;
  font-family: var(--display);
  font-size: 1.45rem;
  margin: 0.3rem 0 0.4rem;
  line-height: 1.15;
}
.gate-copy p { margin: 0; color: var(--ink-soft); }
.gate img {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border-radius: 50%;
  justify-self: end;
  flex-shrink: 0;
}

.guide-top { padding: 2rem 0 0.4rem; }
.starmap, .filters, .catalog { margin-bottom: 1.2rem; }
.starmap {
  background: var(--paper); border: 1px solid var(--line); border-radius: 1.6rem;
  padding: 1.1rem 1.4rem 1.5rem; box-shadow: var(--shadow);
  overflow: hidden;
}
.starmap-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.starmap .orrery { max-height: 400px; }
.belt-links { display: flex; flex-wrap: wrap; gap: 0.55rem; justify-content: center; margin: 0.8rem 0 0; }
.system {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 0.35rem; overflow-x: auto; padding: 0.8rem 0.2rem 0.4rem;
}
.world { flex: 0 0 auto; text-decoration: none; color: inherit; text-align: center; width: var(--w, 64px); }
.world img {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 50%; display: block;
  animation: bob var(--bob, 8s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
.world span { display: block; margin-top: 0.7rem; font-size: 0.78rem; color: var(--ink-soft); font-weight: 550; }
.zone {
  align-self: center; font-size: 0.72rem; color: var(--purple-deep);
  border: 1px dashed rgba(67, 24, 136, 0.35); border-radius: 999px;
  padding: 0.25rem 0.5rem; text-decoration: none; white-space: nowrap;
}

.filters { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.chip, .search {
  border: 1px solid var(--line); background: var(--paper); color: var(--ink-soft);
  border-radius: 999px; min-height: 2.35rem; padding: 0.35rem 0.85rem;
  font: 550 0.88rem/1 var(--font);
}
.chip { cursor: pointer; }
.chip.is-on, .chip:hover { background: rgba(67, 24, 136, 0.12); color: var(--ink); }
.search { min-width: min(100%, 16rem); color: var(--ink); }
.count { color: var(--muted); font-size: 0.9rem; }

.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}
.entry {
  background: var(--paper); border: 1px solid var(--line); border-radius: 1.2rem;
  padding: 1rem; text-decoration: none; color: inherit;
  display: flex; flex-direction: column; min-height: 210px;
}
.entry:hover { color: inherit; }
.entry.is-hidden { display: none; }
.entry-figure { display: grid; place-items: center; min-height: 88px; }
.entry-figure img { width: 78px; height: 78px; object-fit: cover; border-radius: 50%; }
.entry small { color: var(--purple); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }
.entry h3 { font-family: var(--display); font-size: 1.25rem; margin: 0.2rem 0; }
.entry p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.empty-msg { display: none; grid-column: 1 / -1; color: var(--muted); }
.empty-msg.is-on { display: block; }

.sheet, .page-hero { padding: 2rem 0 3rem; }
.crumbs { color: var(--muted); font-size: 0.88rem; margin-bottom: 1rem; }
.crumbs a { color: var(--ink-soft); text-decoration: none; }
.sheet-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.85fr) minmax(0, 1.15fr);
  gap: 2rem; align-items: center;
}
.sheet-visual { display: grid; place-items: center; }
.sheet-visual img {
  width: min(220px, 52vw);
  animation: bob 8s ease-in-out infinite;
  filter: drop-shadow(0 24px 36px rgba(40, 16, 70, 0.2));
}
.tag {
  display: inline-block; padding: 0.2rem 0.55rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--purple); font-size: 0.75rem;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.65rem; margin: 1.2rem 0; }
.stat { padding: 0.8rem; border-radius: 1rem; background: var(--paper); border: 1px solid var(--line); }
.stat b { display: block; }
.stat span { display: block; color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.blocks { display: grid; gap: 0.85rem; margin-top: 1.8rem; }
.blocks-2 { grid-template-columns: 1fr 1fr; }
.block { padding: 1.2rem; border-radius: 1.2rem; background: var(--paper); border: 1px solid var(--line); }
.block h2 { font-size: 1.25rem; }
.block p:last-child { margin-bottom: 0; }
.prose { max-width: 68ch; }
.prose h2 { margin-top: 1.8rem; }
.related { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.related a {
  display: flex; gap: 0.9rem; align-items: center; padding: 0.9rem 1rem;
  background: var(--paper); border: 1px solid var(--line); border-radius: 1rem;
  text-decoration: none; color: inherit;
}
.related img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.related span { display: grid; gap: 0.2rem; min-width: 0; }
.related small { display: block; color: var(--muted); font-size: 0.75rem; }
.related strong { display: block; font-family: var(--display); font-size: 1.05rem; }
.figure-strip {
  margin-top: 1.4rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}
.shot { margin: 0; border-radius: 1rem; overflow: hidden; background: #1a1028; }
.shot img { width: 100%; height: 168px; object-fit: cover; display: block; }
.shot figcaption { padding: 0.75rem 0.9rem 0.9rem; color: #d8cce8; font-size: 0.88rem; }
.credits { width: 100%; border-collapse: collapse; background: var(--paper); border-radius: 1rem; overflow: hidden; }
.credits th, .credits td { text-align: left; padding: 0.85rem 1rem; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
.credits th { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.table-scroll { overflow-x: auto; }

.form { display: grid; gap: 0.75rem; max-width: 34rem; }
.form label { display: grid; gap: 0.3rem; color: var(--ink-soft); font-size: 0.92rem; }
.form input, .form textarea {
  border: 1px solid var(--line); border-radius: 0.85rem; padding: 0.75rem 0.85rem;
  font: 400 1rem/1.4 var(--font); background: #fff; color: var(--ink);
}
.form textarea { min-height: 8.5rem; resize: vertical; }

.site-footer {
  margin-top: 2rem; padding: 2.4rem 0 1.8rem;
  background: #efe6f8; border-top: 1px solid var(--line);
}
.foot-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 1.4rem; }
.site-footer a { color: var(--ink-soft); text-decoration: none; }
.site-footer a:hover { color: var(--purple); }
.site-footer ul { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.site-footer li { margin: 0.35rem 0; }
.legal { margin-top: 1.6rem; color: var(--muted); font-size: 0.88rem; display: flex; gap: 1rem; flex-wrap: wrap; }

[data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
[data-reveal].is-in { opacity: 1; transform: none; }

:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; }

@media (max-width: 980px) {
  .hero-grid, .sheet-layout, .gates, .foot-grid, .related, .blocks-2, .procession { grid-template-columns: 1fr; }
  .gate { grid-template-columns: minmax(0, 1fr) 88px; }
  .gate img { width: 88px; height: 88px; }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr; }
  .orrery { max-height: 320px; }
  .figure-strip { grid-template-columns: 1fr; }
  .shot img { height: 150px; }
}

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