/* ============================================================
   EPHEMERIS · design tokens
   ============================================================ */
:root {
  --void: #05070E;
  --firmament: #0B1224;
  --parchment: #E9E2CF;
  --parchment-dim: rgba(233, 226, 207, 0.62);
  --parchment-faint: rgba(233, 226, 207, 0.34);
  --gold: #C7A55C;
  --gold-dim: rgba(199, 165, 92, 0.5);
  --hairline: rgba(199, 165, 92, 0.22);
  --accent: var(--gold);

  --font-display: 'Italiana', 'Didot', serif;
  --font-body: 'Instrument Sans', 'Helvetica Neue', sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', monospace;

  --pad: clamp(20px, 4vw, 48px);
}

/* ---- reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--void);
  color: var(--parchment);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: var(--gold); color: var(--void); }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 1px solid var(--gold); outline-offset: 4px; }

/* ---- fixed layers ---- */
#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}
.grain {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- header ---- */
.site-head {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 26px var(--pad);
  mix-blend-mode: normal;
}
.wordmark {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.42em;
  color: var(--parchment);
}
.head-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--parchment-faint);
}
.head-nav {
  display: flex;
  gap: 28px;
  align-items: baseline;
}
.survey-tag {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.24em;
  color: var(--gold-dim);
}
.guide-link {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: border-color 0.4s ease;
}
.guide-link:hover { border-color: var(--gold); }

/* ---- constellation nav ---- */
.constellation {
  position: fixed;
  right: clamp(16px, 3vw, 44px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 34px;
  align-items: center;
}
.constellation-line {
  position: absolute;
  top: 6px; bottom: 6px;
  width: 1px;
  background: linear-gradient(to bottom, transparent, rgba(199, 165, 92, 0.38) 15%, rgba(199, 165, 92, 0.38) 85%, transparent);
}
.constellation a {
  position: relative;
  display: flex;
  align-items: center;
  padding: 4px;
}
.constellation .node {
  width: 9px; height: 9px;
  transform: rotate(45deg);
  border: 1px solid rgba(199, 165, 92, 0.85);
  background: var(--void);
  box-shadow: 0 0 8px rgba(199, 165, 92, 0.25);
  transition: background 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}
.constellation .node-label {
  position: absolute;
  right: 26px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.15em;
  color: var(--parchment-faint);
  opacity: 0.45;
  transition: opacity 0.4s ease, color 0.4s ease;
}
.constellation a:hover .node-label { opacity: 1; }
.constellation a.active .node {
  background: var(--active-accent, var(--gold));
  border-color: var(--active-accent, var(--gold));
  box-shadow: 0 0 12px 1px var(--active-accent, var(--gold));
}
.constellation a.active .node-label {
  opacity: 1;
  color: var(--active-accent, var(--gold));
}

/* ---- panels ---- */
main { position: relative; z-index: 2; }
.panel {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  align-items: center;
  padding: 0 var(--pad);
}

/* ---- intro ---- */
.intro { text-align: center; position: relative; }
.intro-inner { justify-self: center; }
.kicker {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 2.2rem;
}
.title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3.4rem, 13vw, 10.5rem);
  letter-spacing: 0.14em;
  line-height: 1;
  text-indent: 0.14em; /* optically recenter tracked caps */
  color: var(--parchment);
}
.sub {
  margin-top: 2.4rem;
  font-size: 1.0625rem;
  color: var(--parchment-dim);
  line-height: 1.85;
  text-shadow: 0 2px 28px rgba(5, 7, 14, 0.9);
}
.scroll-cue {
  position: absolute;
  bottom: 34px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.cue-label {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--parchment-faint);
}
.cue-line {
  width: 1px;
  height: 56px;
  background: linear-gradient(to bottom, var(--gold), transparent);
  transform-origin: top;
  animation: cue 2.6s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes cue {
  0% { transform: scaleY(0); }
  45% { transform: scaleY(1); transform-origin: top; }
  55% { transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ---- world cards ---- */
.world .card {
  position: relative;
  width: min(500px, 100%);
  margin-left: clamp(0px, 6vw, 96px);
  padding: clamp(28px, 4vw, 44px);
  background: linear-gradient(165deg, rgba(11, 18, 36, 0.74), rgba(5, 7, 14, 0.6));
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(233, 226, 207, 0.1);
}
/* star-chart corner ticks */
.card::before, .card::after,
.card .card-head::before, .card .card-head::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border-color: var(--gold-dim);
  border-style: solid;
  border-width: 0;
}
.card::before { top: -1px; left: -1px; border-top-width: 1px; border-left-width: 1px; }
.card::after { top: -1px; right: -1px; border-top-width: 1px; border-right-width: 1px; }
.card .card-head::before { bottom: -1px; left: -1px; border-bottom-width: 1px; border-left-width: 1px; }
.card .card-head::after { bottom: -1px; right: -1px; border-bottom-width: 1px; border-right-width: 1px; }
.card .card-head::before, .card .card-head::after { position: absolute; }
.card-head {
  position: static; /* let its corner pseudo-elements anchor to .card */
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1.6rem;
}
.numeral {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--accent);
  line-height: 1;
}
.designation {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.22em;
  color: var(--parchment-faint);
}
.designation::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 10px;
  transform: rotate(45deg) translateY(-1px);
  background: var(--accent);
}
.world-name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.6rem, 5.4vw, 3.9rem);
  letter-spacing: 0.03em;
  line-height: 1.05;
  color: var(--parchment);
}
.epithet {
  margin-top: 0.7rem;
  font-style: italic;
  font-size: 1.0625rem;
  color: var(--accent);
}
.field-note {
  margin-top: 1.5rem;
  font-size: 0.9375rem;
  line-height: 1.75;
  color: rgba(233, 226, 207, 0.74);
  max-width: 48ch;
}
.data {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 18px;
  margin-top: 1.8rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}
.data dt {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 5px;
}
.data dd {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--parchment);
  white-space: nowrap;
}
.survey-note {
  margin-top: 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  color: var(--accent);
}

/* ---- epilogue ---- */
.epilogue { text-align: center; }
.epilogue-inner { justify-self: center; max-width: 760px; }
.closing-quote {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.9rem, 4.6vw, 3.3rem);
  line-height: 1.25;
  color: var(--parchment);
}
.closing-attr {
  margin-top: 1.6rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--gold-dim);
}
.cta {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-top: 3.2rem;
  padding: 15px 34px;
  border: 1px solid var(--gold);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  transition: background 0.45s ease, color 0.45s ease;
}
.cta:hover { background: var(--gold); color: var(--void); }
.cta-arrow { transition: transform 0.45s ease; }
.cta:hover .cta-arrow { transform: translateX(6px); }
.colophon {
  margin-top: 4.5rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 2;
  color: var(--parchment-faint);
}
.colophon strong { color: var(--parchment-dim); font-weight: 500; }

/* ---- reveal ---- */
.reveal {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 1.1s cubic-bezier(0.19, 1, 0.22, 1),
              transform 1.1s cubic-bezier(0.19, 1, 0.22, 1);
}
.reveal.visible { opacity: 1; transform: none; }

/* ---- responsive ---- */
@media (max-width: 900px) {
  .head-label { display: none; }
  .constellation { gap: 26px; }
  .world { align-items: end; }
  .world .card {
    margin: 0 auto 12vh;
    width: min(500px, calc(100% - 8px));
  }
  .data { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .survey-tag { display: none; }
  .wordmark { letter-spacing: 0.28em; font-size: 0.95rem; }
  .site-head { padding: 20px 18px; }
  .title { font-size: clamp(2.5rem, 10.5vw, 4rem); letter-spacing: 0.1em; }
  .constellation { right: 8px; gap: 22px; }
  .constellation .node-label { display: none; }
  .constellation .node { width: 7px; height: 7px; }
  .world .card { padding-right: 30px; }
}

/* ---- reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cue-line { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
