/* Universe Atlas: full-screen, monochrome, mission-control styling. */

:root {
  --bg: #000;
  --bg-raised: #0b0b0d;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-strong: rgba(8, 8, 10, 0.94);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.3);
  --text: #fff;
  --muted: rgba(255, 255, 255, 0.74);
  --faint: rgba(255, 255, 255, 0.5);
  --live: #ff4d4d;
  --radius: 2px;
  --gutter: clamp(1.25rem, 5vw, 5rem);
  --shell: min(1320px, calc(100% - 2 * var(--gutter)));
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sans: "Barlow", "Helvetica Neue", Arial, sans-serif;
  --condensed: "Barlow Condensed", "Barlow", Arial, sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 60;
  padding: 0.7rem 1.1rem;
  background: var(--text);
  color: #000;
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
}

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

.shell {
  width: var(--shell);
  margin: 0 auto;
}

/* ---------- Type ---------- */

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  line-height: 0.95;
}

h1 {
  font-size: clamp(2.8rem, 7vw, 5.6rem);
}

h2 {
  font-size: clamp(2rem, 4.4vw, 3.6rem);
}

h3 {
  font-size: clamp(1.5rem, 2.4vw, 2.1rem);
}

.kicker {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1rem;
  color: var(--text);
  font-family: var(--condensed);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.meta-line {
  margin: 0 0 0.7rem;
  color: var(--faint);
  font-family: var(--condensed);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.meta-line:empty {
  display: none;
}

.lead {
  max-width: 34ch;
  margin: 1.2rem 0 2rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.4vw, 1.25rem);
}

.live-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live);
  animation: live-pulse 1.8s ease-out infinite;
}

/* Plain-language line under a section heading: what this is, what to do. */
.section-lead {
  max-width: 52ch;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.2vw, 1.12rem);
  line-height: 1.5;
}

/* ---------- Buttons ---------- */

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.95rem 1.6rem;
  overflow: hidden;
  isolation: isolate;
  border: 1.5px solid var(--text);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 320ms var(--ease);
}

/* White fill rises from the bottom on hover. */
.button::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--text);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 320ms var(--ease);
}

.button:hover,
.button:focus-visible {
  color: #000;
}

.button:hover::before,
.button:focus-visible::before {
  transform: scaleY(1);
}

.button-arrow {
  width: 7px;
  height: 7px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 320ms var(--ease);
}

.button:hover .button-arrow {
  transform: translateX(3px) rotate(45deg);
}

.button--small {
  padding: 0.75rem 1.1rem;
}

.button[disabled] {
  opacity: 0.5;
  cursor: progress;
}

.button[disabled]::before {
  transform: scaleY(0);
}

/* ---------- Header ---------- */

.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: clamp(1.5rem, 3vw, 3rem);
  padding: 1.4rem var(--gutter);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.6), transparent);
  transition: background 300ms var(--ease), padding 300ms var(--ease);
}

.site-nav.is-scrolled {
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
  background: rgba(0, 0, 0, 0.92);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  flex: none;
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-decoration: none;
  text-transform: uppercase;
}

.brand-mark {
  width: 24px;
  height: 24px;
}

.brand-mark circle {
  fill: var(--text);
}

.brand-mark ellipse {
  fill: none;
  stroke: var(--text);
  stroke-width: 1.5;
}

.nav-links {
  display: flex;
  gap: clamp(1rem, 2.2vw, 2rem);
}

.nav-links a {
  position: relative;
  padding: 0.3rem 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1.5px;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 300ms var(--ease);
}

.nav-links a:hover::after {
  transform: scaleX(1);
}

.nav-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin-left: auto;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.35);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-transform: uppercase;
  transition: border-color 220ms ease;
}

.nav-chip:hover {
  border-color: var(--text);
}

.nav-chip__value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

/* ---------- Full-screen panels (hero + spotlight) ---------- */

.hero,
.spotlight {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 100svh;
  padding: 7rem var(--gutter) clamp(5rem, 13vh, 9rem);
  overflow: hidden;
  isolation: isolate;
}

.panel-copy {
  position: relative;
  max-width: 600px;
  animation: rise-in 1s var(--ease) both;
}

.hero .panel-copy {
  max-width: 860px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--bg);
}

.hero-backdrop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 1.6s var(--ease), transform 8s var(--ease);
}

.hero-backdrop img.is-loaded {
  opacity: 0.7;
  transform: scale(1);
}

/* Strong shade on the text side: the live feed sometimes shows NASA's
   loss-of-signal card, and the headline must stay readable over it. */
.hero-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 32%, rgba(0, 0, 0, 0.15) 62%, rgba(0, 0, 0, 0) 80%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0) 45%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 20%);
}

/* Live video */

.hero-video {
  position: absolute;
  inset: 0;
  overflow: hidden;
  container-type: size;
  opacity: 0;
  transition: opacity 1.6s var(--ease);
}

.hero.is-live .hero-video {
  opacity: 1;
}

/* Cover the hero with a 16:9 player at any aspect ratio. The slight zoom
   pushes the player chrome at the edges out of view; clicks pass through. */
.hero-video iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: max(100cqw, 177.78cqh);
  height: max(100cqh, 56.25cqw);
  border: 0;
  transform: translate(-50%, -50%) scale(1.12);
  pointer-events: none;
}

.hero:not(.is-live) .kicker .live-dot {
  background: var(--faint);
  animation: none;
}

.hero-controls {
  position: absolute;
  right: var(--gutter);
  bottom: clamp(1.4rem, 4vh, 2.4rem);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.hero-credit {
  max-width: 34ch;
  margin: 0 0.5rem 0 0;
  color: var(--faint);
  font-family: var(--condensed);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-align: right;
  text-transform: uppercase;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.95rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.4);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: border-color 220ms ease, background 220ms ease;
}

.icon-button[hidden] {
  display: none;
}

.icon-button:hover {
  border-color: var(--text);
  background: rgba(0, 0, 0, 0.6);
}

.icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button .icon-speaker {
  fill: currentColor;
  stroke: none;
}

.icon-button[aria-pressed="true"] .icon-mute,
.icon-button[aria-pressed="false"] .icon-waves {
  display: none;
}

.hero:fullscreen {
  min-height: 100vh;
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 1.6rem;
  width: 14px;
  height: 14px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateX(-50%) rotate(45deg);
  animation: cue 2.2s ease-in-out infinite;
}

/* Spotlight */

.featured-media {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--bg-raised);
}

.featured-media img,
.featured-media iframe,
.featured-media .media-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.featured-media img,
.featured-media iframe {
  object-fit: cover;
  border: 0;
}

.featured-media img {
  animation: fade-in 1.2s var(--ease) both;
}

.featured-media::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.35) 45%, rgba(0, 0, 0, 0) 75%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 40%),
    linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0) 14%);
}

.media-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.loader {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--text);
  animation: spin 1s linear infinite;
}

.featured-copy h2 {
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.featured-copy .clamp-copy {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  max-width: 52ch;
  overflow: hidden;
  margin: 1.2rem 0 2rem;
  color: var(--muted);
}

.key-details {
  margin-top: 2rem;
  max-width: 440px;
}

.key-details summary {
  cursor: pointer;
  color: var(--faint);
  font-family: var(--condensed);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  list-style: none;
}

.key-details summary::-webkit-details-marker {
  display: none;
}

.key-details summary::before {
  content: "+";
  display: inline-block;
  width: 1.1rem;
}

.key-details[open] summary::before {
  content: "\2212";
}

.key-form {
  margin-top: 0.9rem;
}

.key-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
}

.key-row input {
  min-width: 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.55);
}

.key-row input::placeholder {
  color: var(--faint);
}

.helper-copy {
  margin: 0.7rem 0 0;
  color: var(--faint);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ---------- Sections ---------- */

.iss-section,
.gallery-section {
  padding: clamp(6rem, 12vw, 10rem) 0;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
  margin-bottom: 2.4rem;
}

/* ---------- ISS tracker ---------- */

.iss-updated {
  margin: 0;
  color: var(--faint);
  font-family: var(--condensed);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

/* ESA's widget renders at most 625px wide (16:9-ish); showing it at its
   native size keeps the map pixel-sharp and avoids white page edges. */
.iss-layout {
  display: grid;
  grid-template-columns: minmax(0, 625px) minmax(280px, 1fr);
  gap: clamp(2rem, 4vw, 4rem);
  align-items: start;
}

.iss-map {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 625px;
  aspect-ratio: 625 / 352;
  border-radius: var(--radius);
  background: #000;
}

/* Always render the widget at its native size, then shrink it to fit
   (set by JS). Downscaling stays sharp; it is never enlarged. */
.iss-map iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 625px;
  height: 352px;
  border: 0;
  transform: scale(var(--iss-scale, 1));
  transform-origin: 0 0;
}

/* Background reload: the fresh copy loads invisibly behind the current map. */
.iss-map iframe.is-preloading {
  visibility: hidden;
  pointer-events: none;
}

.iss-telemetry {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--line);
}

.telemetry-card {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  padding: 1.4rem 0 1.3rem;
  border-bottom: 1px solid var(--line);
}

.telemetry-card:nth-child(odd) {
  padding-right: 1rem;
}

.telemetry-card dt {
  color: var(--faint);
  font-family: var(--condensed);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.telemetry-card dd {
  margin: 0 0 0.3rem;
  font-size: clamp(1.5rem, 2.4vw, 2.1rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.iss-credit {
  margin: 1.4rem 0 0;
  color: var(--faint);
  font-size: 0.82rem;
}

.iss-credit a {
  color: var(--muted);
  text-underline-offset: 3px;
}

/* ---------- Solar system map ---------- */

.map-section {
  position: relative;
}

.canvas-frame {
  position: relative;
  height: 100svh;
  min-height: 720px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 170, 70, 0.12) 0%, transparent 22%),
    #000;
}

#starfield,
.canvas-glow,
.solar-reference,
.map-overlay {
  position: absolute;
  inset: 0;
}

#starfield {
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
}

.canvas-glow {
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(circle at var(--sun-x, 50%) var(--sun-y, 50%), rgba(255, 186, 95, 0.16), transparent 18%);
}

.solar-reference {
  z-index: 3;
  pointer-events: none;
  --sun-x: 50%;
  --sun-y: 50%;
}

.sun-anchor {
  position: absolute;
  left: var(--sun-x);
  top: var(--sun-y);
  width: calc(clamp(44px, 4.6vw, 72px) * var(--zoom, 1));
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
}

.sun-corona,
.sun-core {
  position: absolute;
}

.sun-corona {
  inset: -70%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 240, 200, 0.6) 0%,
    rgba(255, 170, 70, 0.22) 36%,
    rgba(255, 170, 70, 0) 72%
  );
  filter: blur(14px);
  animation: solar-pulse 8s ease-in-out infinite;
}

/* Photosphere: limb darkening (the disk dims and reddens towards its edge,
   as the real Sun does) plus a fine, slowly turning granulation texture. */
.sun-core {
  inset: 0;
  overflow: hidden;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    #fffdf2 0%,
    #fff1c4 28%,
    #ffd57a 55%,
    #ffad3b 76%,
    #f07b18 90%,
    #b9480a 100%
  );
  box-shadow:
    0 0 18px rgba(255, 200, 110, 0.75),
    0 0 46px rgba(255, 160, 60, 0.45),
    0 0 110px rgba(255, 140, 40, 0.25);
}

.sun-core::before {
  content: "";
  position: absolute;
  inset: -20%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.55' numOctaves='3' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0.55 0 0 0 0 0.3 0 0 0 0 0.05 0 0 0 1.6 -0.55'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23g)'/%3E%3C/svg%3E");
  background-size: 40% 40%;
  mix-blend-mode: multiply;
  opacity: 0.55;
  animation: sun-turn 160s linear infinite;
}

/* Re-apply limb darkening above the texture so the edge stays soft. */
.sun-core::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, transparent 58%, rgba(170, 60, 5, 0.45) 92%, rgba(120, 35, 0, 0.7) 100%);
}

@keyframes sun-turn {
  to {
    transform: rotate(360deg);
  }
}

.map-overlay {
  z-index: 4;
}

.map-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
  padding: 7rem var(--gutter) 0;
  pointer-events: none;
}

.map-top > * {
  pointer-events: auto;
}

.map-top {
  transition: opacity 500ms var(--ease), transform 500ms var(--ease);
}

.canvas-frame.is-zoomed .map-top {
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
}

.canvas-frame.is-zoomed .map-top > * {
  pointer-events: none;
}

.canvas-frame.is-zoomed .map-node--deep-space {
  opacity: 0;
  pointer-events: none;
}

.map-node--deep-space {
  transition: opacity 400ms ease;
}

.map-back {
  position: absolute;
  top: 7rem;
  left: var(--gutter);
  z-index: 6;
  background: rgba(0, 0, 0, 0.45);
  animation: fade-in 500ms var(--ease) both;
}

.map-back[hidden] {
  display: none;
}

.button-arrow--back {
  transform: rotate(-135deg);
}

.button:hover .button-arrow--back {
  transform: translateX(-3px) rotate(-135deg);
}

.map-overlay {
  cursor: default;
}

.canvas-frame.is-zoomed .map-overlay {
  cursor: zoom-out;
}

.map-node {
  cursor: zoom-in;
}

.canvas-frame.is-zoomed .map-node.is-active {
  cursor: default;
}

/* Facts for the selected body. */
.hud-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.6rem;
  margin: 1rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.hud-facts:empty {
  display: none;
}

.hud-facts dt {
  color: var(--faint);
  font-family: var(--condensed);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hud-facts dd {
  margin: 0.1rem 0 0;
  font-size: 0.98rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.map-node {
  position: absolute;
  z-index: 2;
  border: 0;
  padding: 0;
  background: none;
  color: var(--text);
  transform: translate(-50%, -50%);
}

.map-node:hover,
.map-node.is-active,
.map-node:focus-visible {
  z-index: 4;
}

.map-node__body,
.map-node__label {
  display: block;
}

.map-node__body {
  position: relative;
  width: calc(var(--planet-size) * var(--zoom, 1));
  height: calc(var(--planet-size) * var(--zoom, 1));
  border-radius: 50%;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(255, 255, 255, 0.92) 0%,
    var(--planet-color) 36%,
    rgba(7, 12, 25, 0.94) 100%
  );
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 0 22px var(--planet-glow);
  scale: var(--depth-scale, 1);
  transition: transform 260ms var(--ease), box-shadow 260ms var(--ease);
}

.map-node--deep-space .map-node__body {
  width: calc(var(--planet-size) * 0.9);
  height: calc(var(--planet-size) * 0.9);
  transition: opacity 400ms ease;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.96) 0%,
    var(--planet-color) 30%,
    rgba(11, 17, 34, 0.08) 68%,
    transparent 74%
  );
  box-shadow:
    0 0 20px var(--planet-glow),
    0 0 44px var(--planet-glow);
}

.map-node--deep-space .map-node__body::after {
  content: "";
  position: absolute;
  inset: -85%;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.18);
}

/* Planets and the Moon: a cropped NASA photo of each body. */
/* Sized 106% so the photos' dark edge fringe falls outside the circle. */
.map-node--textured .map-node__body {
  background: var(--texture) center / 106% no-repeat, var(--planet-color);
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.06),
    0 0 calc(var(--planet-size) * var(--zoom, 1) * 0.45) var(--atmo, rgba(0, 0, 0, 0));
}

/* Large on screen (zoomed in): switch to the 480px photo, layered over the
   small one so there is never a blank frame while it loads. */
.map-node--textured.is-detailed .map-node__body {
  background:
    var(--texture-hi) center / 106% no-repeat,
    var(--texture) center / 106% no-repeat,
    var(--planet-color);
}

.map-node--ringed.is-detailed .map-node__body {
  background:
    var(--texture-hi) center / contain no-repeat,
    var(--texture) center / contain no-repeat;
}

/* Sunlight: bright on the side facing the Sun (--lx/--ly, set every frame),
   falling into night on the far side, so each planet shows its phase. */
.map-node--textured .map-node__body::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(
    circle at var(--lx, 35%) var(--ly, 35%),
    rgba(255, 250, 235, 0.16) 0%,
    rgba(0, 0, 0, 0) 34%,
    rgba(0, 0, 0, 0.5) 58%,
    rgba(0, 0, 0, 0.9) 82%
  );
}

/* Saturn keeps its photographed rings (a transparent PNG). */
.map-node--ringed .map-node__body {
  width: calc(var(--planet-size) * var(--zoom, 1) * 2.37);
  border-radius: 0;
  background: var(--texture) center / contain no-repeat;
  box-shadow: none;
}

.map-node--ringed .map-node__body::after {
  display: none;
}

.map-node__label {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--label-width);
  max-width: calc(100vw - 3rem);
  padding: 0.45rem 0.65rem;
  border-left: 1.5px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.55);
  text-align: left;
  transform: translate(var(--label-x), var(--label-y));
  pointer-events: none;
  /* When planets pass each other a label changes side; glide, don't jump. */
  transition:
    transform 600ms var(--ease),
    border-color 220ms ease,
    background 220ms ease;
}

.map-node.is-label-hidden .map-node__label {
  visibility: hidden;
}

.map-node__label strong,
.map-node__label small {
  display: block;
}

.map-node__label strong {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.1;
  text-transform: uppercase;
}

.map-node__label small {
  margin-top: 0.15rem;
  color: var(--faint);
  font-family: var(--condensed);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  line-height: 1.15;
  text-transform: uppercase;
}

.map-node__order {
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.map-node.is-active .map-node__order,
.map-node:hover .map-node__order {
  color: var(--text);
}

.map-node:hover .map-node__body,
.map-node.is-active .map-node__body,
.map-node:focus-visible .map-node__body {
  transform: scale(1.15);
  box-shadow:
    0 0 0 8px rgba(255, 255, 255, 0.08),
    0 0 34px var(--planet-glow);
}

.map-node--textured:hover .map-node__body,
.map-node--textured.is-active .map-node__body,
.map-node--textured:focus-visible .map-node__body {
  box-shadow:
    0 0 0 1.5px rgba(255, 255, 255, 0.55),
    0 0 0 7px rgba(255, 255, 255, 0.07),
    0 0 calc(var(--planet-size) * var(--zoom, 1) * 0.6) var(--atmo, rgba(255, 255, 255, 0.12));
}

/* Zoomed in: no hover ring or scale-up on the planet you are looking at. */
.canvas-frame.is-zoomed .map-node--textured.is-active .map-node__body {
  transform: none;
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.06),
    0 0 calc(var(--planet-size) * var(--zoom, 1) * 0.35) var(--atmo, rgba(0, 0, 0, 0));
}

.map-node--ringed:hover .map-node__body,
.map-node--ringed.is-active .map-node__body,
.map-node--ringed:focus-visible .map-node__body {
  box-shadow: none;
}

.map-node:hover .map-node__label,
.map-node.is-active .map-node__label,
.map-node:focus-visible .map-node__label {
  border-left-color: var(--text);
  background: rgba(0, 0, 0, 0.8);
}

.map-node:focus-visible {
  outline: none;
}

.map-hud {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: clamp(1.4rem, 4vh, 2.4rem);
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-end;
  pointer-events: none;
}

.map-hud > div:first-child {
  max-width: 460px;
  padding: 1.2rem 1.4rem;
  border-left: 2px solid var(--text);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  pointer-events: auto;
}

.map-hud .kicker {
  margin-bottom: 0.4rem;
  color: var(--faint);
}

.map-hud p:not(.kicker) {
  margin: 0.5rem 0 0;
  color: var(--muted);
}

.hud-status {
  display: grid;
  gap: 0.4rem;
  justify-items: end;
  flex: none;
}

.hud-status .map-legend {
  color: rgba(255, 255, 255, 0.36);
}

.hud-status span {
  color: var(--faint);
  font-family: var(--condensed);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Destination rail */

.destination-rail {
  display: flex;
  gap: 0.4rem;
  padding: 1.2rem var(--gutter);
  overflow-x: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.destination-rail::-webkit-scrollbar {
  display: none;
}

.rail-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex: none;
  padding: 0.55rem 0.9rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 200ms ease, border-color 200ms ease;
}

.rail-chip::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chip-color);
}

.rail-order {
  color: rgba(255, 255, 255, 0.36);
  font-variant-numeric: tabular-nums;
}

.rail-chip[aria-pressed="true"] .rail-order {
  color: var(--faint);
}

.rail-chip:hover {
  color: var(--text);
}

.rail-chip[aria-pressed="true"] {
  color: var(--text);
  border-color: var(--line-strong);
}

.rail-divider {
  flex: none;
  width: 1px;
  margin: 0.4rem 0.5rem;
  background: var(--line-strong);
}

/* ---------- Gallery ---------- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: 220px;
  grid-auto-flow: dense;
  gap: 6px;
}

.gallery-card {
  position: relative;
  grid-column: span 4;
  grid-row: span 2;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--bg-raised);
  animation: rise-in 700ms var(--ease) both;
}

/* Editorial rhythm per 12 images: feature + tall, three, two wide, three, two wide */
.gallery-card:nth-child(12n + 1) {
  grid-column: span 8;
  grid-row: span 3;
}

.gallery-card:nth-child(12n + 2) {
  grid-row: span 3;
}

.gallery-card:nth-child(12n + 6),
.gallery-card:nth-child(12n + 7),
.gallery-card:nth-child(12n + 11),
.gallery-card:nth-child(12n + 12) {
  grid-column: span 6;
}

.gallery-card button {
  all: unset;
  position: absolute;
  inset: 0;
  cursor: pointer;
}

.gallery-card button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: -4px;
}

.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.1s var(--ease);
}

.gallery-card::after {
  content: "";
  position: absolute;
  inset: 45% 0 0;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.9));
  pointer-events: none;
}

.gallery-card:hover img {
  transform: scale(1.05);
}

.gallery-copy {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 1;
  padding: 1.2rem 1.3rem;
  pointer-events: none;
}

.gallery-copy .meta-line {
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
}

.gallery-copy h3 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 1.15rem;
  line-height: 1.1;
}

.gallery-card:nth-child(12n + 1) .gallery-copy h3 {
  font-size: clamp(1.4rem, 2.4vw, 2rem);
}

.gallery-empty {
  grid-column: 1 / -1;
  grid-row: span 1;
  display: grid;
  place-items: center;
  padding: 2rem;
  text-align: center;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
}

.gallery-skeleton {
  grid-column: span 4;
  grid-row: span 2;
  background: linear-gradient(100deg, var(--bg-raised) 30%, #17171b 50%, var(--bg-raised) 70%);
  background-size: 300% 100%;
  animation: shimmer 1.6s linear infinite;
}

.gallery-more {
  display: flex;
  justify-content: center;
  margin-top: 2.4rem;
}

/* ---------- Dialog ---------- */

.image-dialog {
  width: min(1240px, calc(100% - 1.5rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--text);
}

.image-dialog[open] {
  animation: dialog-in 420ms var(--ease) both;
}

.image-dialog::backdrop {
  background: rgba(0, 0, 0, 0.9);
}

.dialog-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 3;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.6);
}

.dialog-close:hover {
  border-color: var(--text);
}

.dialog-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
  max-height: calc(100vh - 2rem);
}

.dialog-media {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 360px;
  background: #000;
}

.dialog-media img {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 2rem);
  object-fit: contain;
}

.dialog-nav {
  position: absolute;
  top: 50%;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.55);
  transform: translateY(-50%);
  transition: border-color 200ms ease, background 200ms ease;
}

.dialog-nav:hover {
  border-color: var(--text);
  background: rgba(0, 0, 0, 0.85);
}

.dialog-nav[disabled] {
  opacity: 0.3;
  cursor: default;
}

.dialog-nav--prev {
  left: 1rem;
}

.dialog-nav--next {
  right: 1rem;
}

.dialog-copy {
  padding: 2.6rem 2rem 2rem;
  overflow-y: auto;
}

.dialog-copy h3 {
  margin: 0 0 1rem;
}

.dialog-copy p:not(.kicker):not(.meta-line) {
  margin: 0 0 1.8rem;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 3rem 0 3.5rem;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.85rem;
}

.site-footer .shell {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.footer-brand {
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.site-footer p {
  margin: 0;
  max-width: 70ch;
}

.site-footer a {
  color: var(--muted);
  text-underline-offset: 3px;
}

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

/* ---------- Motion ---------- */

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes live-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.6);
  }

  100% {
    box-shadow: 0 0 0 9px rgba(255, 77, 77, 0);
  }
}

@keyframes cue {
  0%,
  100% {
    opacity: 0.35;
    transform: translate(-50%, 0) rotate(45deg);
  }

  50% {
    opacity: 1;
    transform: translate(-50%, 6px) rotate(45deg);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }

  to {
    background-position: -100% 0;
  }
}

@keyframes solar-pulse {
  0%,
  100% {
    transform: scale(0.96);
    opacity: 0.85;
  }

  50% {
    transform: scale(1.04);
    opacity: 1;
  }
}

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

  html {
    scroll-behavior: auto;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .nav-links {
    display: none;
  }
}

@media (max-width: 1024px) {
  .iss-layout,
  .dialog-layout {
    grid-template-columns: 1fr;
  }

  .iss-telemetry {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dialog-layout {
    overflow-y: auto;
  }

  .dialog-media img {
    max-height: 60vh;
  }

  .gallery-card,
  .gallery-card:nth-child(n) {
    grid-column: span 6;
    grid-row: span 2;
  }

  .gallery-card:nth-child(12n + 1) {
    grid-column: span 12;
  }

  .gallery-skeleton {
    grid-column: span 6;
  }

  .map-hud {
    flex-direction: column;
    align-items: flex-start;
  }

  .hud-status {
    justify-items: start;
  }
}

@media (max-width: 720px) {
  .site-nav {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .brand {
    font-size: 0.9rem;
    letter-spacing: 0.16em;
  }

  .nav-chip__value {
    display: none;
  }

  .hero,
  .spotlight {
    padding-bottom: 6.5rem;
  }

  .hero-credit {
    display: none;
  }

  .hero-controls {
    left: var(--gutter);
    right: auto;
  }

  .icon-button {
    padding: 0.65rem;
  }

  .icon-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .scroll-cue {
    display: none;
  }

  .section-heading,
  .map-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .iss-telemetry {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 260px;
  }

  .gallery-card,
  .gallery-card:nth-child(n),
  .gallery-skeleton {
    grid-column: auto;
    grid-row: span 1;
  }

  .canvas-frame {
    min-height: 780px;
  }

  .map-top {
    padding-top: 5.5rem;
  }

  .map-top .button {
    display: none;
  }

  .map-back {
    top: 5.5rem;
  }

  .hud-facts {
    gap: 0.6rem 1.1rem;
  }

  .hud-facts dd {
    font-size: 0.88rem;
  }

  .map-node__label {
    max-width: min(150px, 46vw);
    padding: 0.35rem 0.5rem;
  }

  .map-node:not(.is-active) .map-node__label {
    padding: 0.2rem 0.4rem;
    background: rgba(0, 0, 0, 0.45);
  }

  .map-node:not(.is-active) .map-node__label small,
  .map-node:not(.is-active) .map-node__order ~ .map-node__name {
    display: none;
  }

  .hud-status .map-legend {
    display: none;
  }

  .map-node__label strong {
    font-size: 0.74rem;
  }

  .map-node__label small {
    font-size: 0.66rem;
  }

  .map-hud > div:first-child {
    padding: 1rem;
  }

  .dialog-copy {
    padding: 1.4rem;
  }

  .dialog-nav {
    width: 38px;
    height: 38px;
  }
}
