/* Apollo landing sites (/apollo): the Moon as it looks from the visitor's
   location with the six sites, then one dossier per mission. An observer's
   chart annotated like a mission report: the night-sky stage stays dark in
   both themes, the rest follows the site's colors with a brass accent.
   This is the light theme; apollo-dark.css overrides it (linked like
   css/dark.css, so it follows the OS or the theme chosen in Settings).
   Without the apollo island (.ap without .is-live) the page shows a face-on
   picture of the near side and every dossier in full. */

.ap {
  --ap-acc: #8a6420;
  --ap-acc-soft: #f3ead8;
  --ap-on-acc: #ffffff;
  --ap-card: var(--surface);
  --ap-wash: #f0eee8;
  --ap-sky0: #05071a;
  --ap-sky1: #0b1130;
  --ap-sky2: #18224a;
  --ap-corona: #fff7e6;
  --ap-sun: #ffd98a;
  --ap-night: #8fa3ff;
  --ap-mark: rgb(201 168 106 / 0.45);
  --ap-shadow: 0 10px 30px rgb(5 7 26 / 0.18);
  font-variant-numeric: tabular-nums;
}
.ap [hidden] { display: none !important; }
.ap:not(.is-live) .ap-live { display: none !important; }
.ap.is-live .ap-still,
.ap.is-live .ap-still-pins,
.ap.is-live .ap-still-note,
.ap.is-live .ap-toc { display: none; }
.ap-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:where(.ap) button, :where(.ap) input { font: inherit; color: inherit; }
:where(.ap) button { cursor: pointer; }
.ap :focus-visible { outline: 2px solid var(--ap-acc); outline-offset: 2px; }
.ap h1, .ap h2, .ap h3, .ap h4 { text-wrap: balance; }
.ap-note { font-size: 0.82rem; color: var(--muted); }

/* ---------- Hero: intro, the Moon, the six sites ---------- */

.ap-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "intro" "viewer" "panel";
  gap: 18px;
  margin-top: 8px;
}
.ap-intro { grid-area: intro; }
.ap-viewer { grid-area: viewer; }
.ap-panel { grid-area: panel; }
@media (min-width: 860px) {
  .ap-hero {
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    grid-template-areas: "viewer intro" "viewer panel";
    grid-template-rows: auto 1fr;
    gap: 14px 24px;
    align-items: start;
  }
}
.ap-kicker { color: var(--ap-acc); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; }
.ap-intro h1 { margin-top: 6px; font-size: clamp(2rem, 4.4vw, 2.9rem); line-height: 1.05; letter-spacing: -0.01em; }
.ap-intro h1 em { font-style: normal; color: var(--ap-acc); }
.ap-lede { margin-top: 10px; color: var(--muted); max-width: 52ch; }
.ap-kids { margin-top: 8px; font-size: 0.9rem; }
.ap-kids a { color: var(--muted); text-underline-offset: 3px; }
.ap-kids a:hover { color: var(--text); }

.ap-stage {
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 320px;
  max-height: calc(100vh - 110px);
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius);
  background: radial-gradient(120% 90% at 50% 45%, var(--ap-sky2), var(--ap-sky1) 48%, var(--ap-sky0));
  color: var(--ap-corona);
  box-shadow: var(--ap-shadow);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.ap.is-live .ap-stage { cursor: grab; }
.ap-stage.is-dragging { cursor: grabbing; }
/* The face-on picture has the stage's darkest color around the Moon. */
.ap:not(.is-live) .ap-stage { background: #03050b; }
.ap-still { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: contain; }
.ap-still-pins { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ap-still-pins circle { fill: rgb(5 7 26 / 0.4); stroke: var(--ap-sun); stroke-width: 3; }
.ap-still-pins text { fill: var(--ap-corona); font-size: 26px; font-weight: 600; paint-order: stroke; stroke: rgb(5 7 26 / 0.85); stroke-width: 5px; }
.ap-still-pins a:hover circle, .ap-still-pins a:focus circle { stroke: #ffffff; stroke-width: 4; }
.ap-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ap-stars { opacity: 0.55; pointer-events: none; }
.ap-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ap-limb { fill: none; stroke: rgb(255 247 230 / 0.16); stroke-width: 1; }
.ap-grid { fill: none; stroke: rgb(143 163 255 / 0.35); stroke-width: 0.8; }
.ap-grid-main { fill: none; stroke: rgb(143 163 255 / 0.6); stroke-width: 1; }
.ap-labels, .ap-pins { position: absolute; inset: 0; pointer-events: none; }
.ap-label {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.1;
  color: rgb(255 247 230 / 0.78);
  text-shadow: 0 1px 3px #000000;
  white-space: nowrap;
}
.ap-label.is-crater { font-style: italic; color: rgb(255 247 230 / 0.62); }
.ap-pin {
  --ap-c: var(--ap-sun);
  position: absolute;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  pointer-events: auto;
}
.ap-pin.is-night { --ap-c: var(--ap-night); }
.ap-pin i {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--ap-c);
  background: rgb(5 7 26 / 0.35);
  box-shadow: 0 0 0 2px rgb(5 7 26 / 0.65), 0 0 10px var(--ap-c);
  transition: transform 0.2s;
}
.ap-pin span {
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  padding: 3px 6px;
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 6px;
  background: rgb(5 7 26 / 0.72);
  color: var(--ap-corona);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.ap-pin:hover i, .ap-pin.is-current i { transform: scale(1.35); }
.ap-pin.is-current i { border-color: #ffffff; box-shadow: 0 0 0 2px rgb(5 7 26 / 0.7), 0 0 0 7px rgb(255 247 230 / 0.28), 0 0 16px #ffffff; }
.ap-pin.is-current span { background: var(--ap-corona); color: var(--ap-sky1); border-color: var(--ap-corona); }
.ap-pin.is-flipped span { left: auto; right: 24px; }
/* Apollo 13: a dashed ring off to one side, tied to its planned target. */
.ap-pin.is-planned i { border-style: dashed; background: rgb(5 7 26 / 0.55); }
.ap-tether { fill: none; stroke: rgb(255 247 230 / 0.6); stroke-width: 1; stroke-dasharray: 2 2; }
.ap-still-pins .is-planned circle { stroke-dasharray: 5 4; }
.ap-still-pins line { stroke: rgb(255 247 230 / 0.75); stroke-width: 2; stroke-dasharray: 4 3; }

.ap-stage-top {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  pointer-events: none;
}
.ap-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 999px;
  background: rgb(5 7 26 / 0.62);
  color: var(--ap-corona);
  font-size: 0.8rem;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.ap-chip:empty { display: none; }
.ap-chip b { font-weight: 600; }
.ap-chip-warn { background: rgb(143 163 255 / 0.22); border-color: rgb(143 163 255 / 0.45); }
.ap-stage-bottom {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}
.ap-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.75rem; color: rgb(255 247 230 / 0.8); text-shadow: 0 1px 2px #000000; }
.ap-legend span::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 5px;
  border: 2px solid var(--ap-sun);
  border-radius: 50%;
  vertical-align: -1px;
}
.ap-legend .ap-key-night::before { border-color: var(--ap-night); }
.ap-legend .ap-key-planned::before { border-style: dashed; border-color: var(--ap-corona); }
.ap-tools { display: flex; flex-wrap: wrap; gap: 6px; pointer-events: auto; }
.ap-tool, .ap-seg {
  border: 1px solid rgb(255 255 255 / 0.16);
  border-radius: 12px;
  background: rgb(5 7 26 / 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.ap-tool { min-width: 40px; height: 40px; padding: 0 10px; color: var(--ap-corona); font-size: 0.86rem; display: inline-grid; place-items: center; }
.ap-seg { display: inline-flex; overflow: hidden; }
.ap-seg button { height: 40px; padding: 0 11px; border: 0; background: transparent; color: var(--ap-corona); font-size: 0.8rem; }
.ap-tool[aria-pressed="true"], .ap-seg button[aria-pressed="true"] { background: var(--ap-corona); color: var(--ap-sky1); border-color: var(--ap-corona); }

.ap-controls {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--ap-card);
}
.ap-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ap-place { font-weight: 600; }
.ap-time { font-weight: 600; font-size: 1.05rem; }
.ap-btn {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--ap-wash);
  font-size: 0.86rem;
  font-weight: 500;
  white-space: nowrap;
}
.ap-btn[aria-pressed="true"] { background: var(--ap-acc); border-color: var(--ap-acc); color: var(--ap-on-acc); }
.ap-input { height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 1rem; }
.ap-range { flex: 1 1 220px; height: 40px; accent-color: var(--ap-acc); }
.ap-still-note { margin-top: 10px; }

.ap-now {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--line);
}
.ap-now div { padding: 10px 12px; background: var(--ap-card); }
.ap-now dt { font-size: 0.75rem; color: var(--muted); }
.ap-now dd { margin: 2px 0 0; font-weight: 600; }
.ap-now dd small { display: block; font-weight: 400; color: var(--muted); font-size: 0.8rem; }
.ap-sites { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.ap-site {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 8px 12px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--ap-card);
  color: var(--text);
  text-decoration: none;
}
.ap-site:hover { border-color: var(--ap-acc); }
.ap-site[aria-current="true"] { border-color: var(--ap-acc); box-shadow: inset 3px 0 0 var(--ap-acc); }
.ap-site.is-planned { border-style: dashed; }
.ap-site img { width: 44px; height: 44px; object-fit: contain; }
.ap-site-name b { display: block; font-size: 1.02rem; }
.ap-site-name small { display: block; overflow: hidden; color: var(--muted); font-size: 0.8rem; text-overflow: ellipsis; white-space: nowrap; }
.ap-site-sun { font-size: 0.78rem; text-align: right; white-space: nowrap; }
.ap-site-sun i { display: inline-block; width: 9px; height: 9px; margin-right: 5px; border-radius: 50%; background: var(--ap-sun); box-shadow: 0 0 0 1px rgb(138 100 32 / 0.5); }
.ap-site-sun.is-night i { background: var(--ap-night); box-shadow: 0 0 0 1px rgb(60 80 170 / 0.5); }
.ap-site-sun small { display: block; color: var(--muted); }

/* ---------- Dossiers: missions, categories, search ----------
   No horizontal scrolling: the seven missions are one row of equal buttons
   (numbers only on narrow screens), and the categories are a sticky rail
   beside the facts on wide screens and wrapped chips above them otherwise. */

.ap-dossiers { margin-top: 38px; }
.ap-tabs {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: center;
  gap: 6px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.ap-tabs-label { display: none; margin-right: 4px; color: var(--muted); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.ap-tabs a {
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--ap-card);
  color: var(--text);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}
.ap-tabs a:hover { border-color: var(--ap-acc); }
.ap-tabs a.is-planned { border-style: dashed; }
.ap-tabs a[aria-current="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
@media (min-width: 900px) {
  /* Under the circumstances bar, which also sticks (--sticky-top: its height). */
  .ap.is-live .ap-tabs { position: sticky; top: var(--sticky-top, 0px); z-index: 6; }
}
/* Narrow screens: "Apollo" once, above the seven numbers. */
@media (max-width: 759px) {
  .ap-tabs { gap: 4px; }
  .ap-tabs-label { display: block; grid-column: 1 / -1; font-size: 0.72rem; }
  .ap-tab-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .ap-tabs a { padding: 8px 0; }
}

.ap.is-live .ap-dossier-body { margin-top: 16px; }
.ap-content { scroll-margin-top: calc(var(--sticky-top, 0px) + 12px); }
@media (max-width: 899px) {
  .ap.is-live .ap-content { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
  .ap.is-live .ap-content { scroll-margin-top: calc(var(--sticky-top, 0px) + 56px); } /* clear of the bars */
}
@media (min-width: 900px) {
  .ap.is-live .ap-dossier-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
  .ap-rail { position: sticky; top: calc(var(--sticky-top, 0px) + 74px); max-height: calc(100vh - 86px - var(--sticky-top, 0px)); overflow-y: auto; }
}
.ap-search { display: grid; gap: 6px; }
.ap-search .ap-input { width: 100%; height: 38px; border-radius: 999px; padding: 0 14px; }
.ap-check { display: inline-flex; gap: 6px; align-items: center; min-height: 28px; font-size: 0.84rem; }
.ap-cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; }
@media (min-width: 900px) {
  .ap-cats { flex-direction: column; flex-wrap: nowrap; gap: 2px; }
}
.ap-cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--ap-card);
  font-size: 0.86rem;
  text-align: left;
  white-space: nowrap;
}
@media (min-width: 900px) {
  .ap-cat { border-color: transparent; border-radius: 10px; background: transparent; }
  .ap-cat:hover { background: var(--ap-card); border-color: var(--line); }
}
.ap-cat small { color: var(--muted); font-size: 0.78rem; }
.ap-cat[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.ap-cat[aria-pressed="true"] small { color: inherit; opacity: 0.7; }
.ap-cat.is-empty { opacity: 0.45; }

/* Phones: the categories fold behind one button naming the current one. */
.ap-cat-toggle { display: none; }
@media (max-width: 899px) {
  .ap.is-live .ap-cat-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    margin-top: 10px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--ap-card);
    text-align: left;
  }
  .ap-cat-toggle > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ap-cat-toggle small { color: var(--muted); font-size: 0.78rem; }
  .ap-cat-toggle::after { content: "\25BE"; color: var(--muted); }
  .ap-cat-toggle[aria-expanded="true"]::after { content: "\25B4"; }
  .ap.is-live .ap-rail:not(.is-open) .ap-cats { display: none; }
}

/* Phones, while reading facts: the mission and category, fixed at the top; a tap goes back to the choices. */
.ap-bar { display: none; }
@media (max-width: 899px) {
  .ap.is-live .ap-bar:not([hidden]) {
    position: fixed;
    inset: 0 0 auto;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    backdrop-filter: blur(8px);
    text-align: left;
  }
  .ap-bar b { color: var(--ap-acc); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap; }
  .ap-bar span { flex: 1; min-width: 0; overflow: hidden; font-size: 0.92rem; text-overflow: ellipsis; white-space: nowrap; }
  .ap-bar::after { content: "\25BE"; color: var(--muted); }
}

/* Another mission's dossier on its way. */
.ap.is-loading .ap-content { opacity: 0.55; transition: opacity 0.2s; }
.ap.is-loading { cursor: progress; }

/* Which parts of a dossier show: the overview only under "At a glance";
   the mission's name as a kicker when the overview is hidden. */
.ap.is-live:not(.is-overview) .ap-overview { display: none; }
.ap-mission-kicker { color: var(--ap-acc); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; }
.ap.is-live.is-overview .ap-mission-kicker { display: none; }
.ap.is-live .ap-mission { padding-top: 0; }
.ap.is-live .ap-mission + .ap-mission { margin-top: 26px; }
.ap.is-live .ap-group:first-of-type { margin-top: 10px; }
.ap.is-live.is-overview .ap-group { margin-top: 26px; }

.ap-pager { display: flex; justify-content: space-between; gap: 10px; margin-top: 28px; }
.ap-page {
  display: grid;
  gap: 2px;
  min-width: 0;
  max-width: 48%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--ap-card);
  text-align: left;
}
.ap-page:hover { border-color: var(--ap-acc); }
.ap-page small { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; }
.ap-page span { font-weight: 600; }
.ap-page span::before { content: "\2190\00a0"; }
.ap-page-next { margin-left: auto; text-align: right; }
.ap-page-next span::before { content: none; }
.ap-page-next span::after { content: "\00a0\2192"; }

/* ---------- A mission's dossier ---------- */

.ap-mission { padding-top: 26px; scroll-margin-top: 70px; }
.ap-dhead { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: center; }
.ap-dhead img { width: clamp(72px, 12vw, 112px); height: auto; }
.ap-dhead h2 { font-size: clamp(2rem, 5vw, 2.8rem); line-height: 1.05; }
.ap-sub { margin-top: 6px; color: var(--muted); font-size: 1.02rem; }
.ap-sub span { white-space: nowrap; }
.ap-crew { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0 0; }
.ap-crew div { display: flex; flex-direction: column; }
.ap-crew dt { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.ap-crew dd { margin: 0; font-weight: 600; }
.ap-blurb { margin-top: 14px; max-width: 72ch; font-size: 1.05rem; }
.ap-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 18px 0 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--line);
}
@media (min-width: 640px) { .ap-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Six across only when the dossier has the full width (no script, no rail). */
@media (min-width: 980px) { .ap:not(.is-live) .ap-tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.ap-tiles div { padding: 12px 14px; background: var(--ap-card); }
.ap-tiles dt { font-size: 0.75rem; color: var(--muted); }
.ap-tiles dd { margin: 4px 0 0; font-size: 1.2rem; font-weight: 650; line-height: 1.15; }
.ap-tiles dd small { display: block; margin-top: 3px; color: var(--muted); font-size: 0.75rem; font-weight: 400; line-height: 1.3; }
.ap-sitenow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.ap-sitenow p { flex: 1 1 300px; }
.ap-sitenow-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.ap-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px 10px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}
.ap-gallery a { display: block; color: var(--muted); text-decoration: none; }
.ap-gallery img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: var(--ap-wash); }
.ap-gallery span { display: -webkit-box; margin-top: 6px; overflow: hidden; font-size: 0.78rem; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.ap-gallery a:hover span { color: var(--text); }
.ap-more { margin-top: 12px; }
.ap-toc ol { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 18px 0 0; padding: 0; list-style: none; font-size: 0.9rem; }
.ap-toc small { color: var(--muted); }
.ap-group { margin-top: 26px; scroll-margin-top: 80px; }
.ap-group h3 { display: flex; align-items: baseline; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); font-size: 1.4rem; }
.ap-group h3 small { color: var(--muted); font-size: 0.8rem; font-weight: 500; }
.ap-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; margin: 12px 0 0; padding: 0; list-style: none; }
.ap-fact { position: relative; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--ap-card); }
.ap-fact h4 { margin: 0 28px 4px 0; font-size: 0.92rem; line-height: 1.3; }
.ap-fact p { font-size: 0.95rem; line-height: 1.5; }
.ap-info {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 26px;
  height: 26px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-family: Georgia, serif;
  font-size: 0.9rem;
  font-style: italic;
  line-height: 1;
}
.ap-info:hover, .ap-info[aria-expanded="true"] { color: var(--text); border-color: var(--ap-acc); }
::highlight(ap-search) { background-color: var(--ap-mark); color: inherit; }

/* Searching: matches from every category (and every mission with "All
   missions"), each mission under its name. */
.ap.is-searching .ap-overview { display: none; }

/* ---------- Comparison, sources ---------- */

.ap-compare, .ap-sources { margin-top: 44px; padding-top: 26px; border-top: 1px solid var(--line); }
.ap-compare h2, .ap-sources h2 { font-size: clamp(1.6rem, 3.4vw, 2.1rem); }
/* Sources: closed until asked for. */
.ap-sources summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; cursor: pointer; list-style: none; }
.ap-sources summary::-webkit-details-marker { display: none; }
.ap-sources summary h2 { margin: 0; }
.ap-sources summary span { flex: 1; color: var(--muted); font-size: 0.9rem; }
.ap-sources summary::after { content: "\25BE"; color: var(--muted); font-size: 1.2rem; }
.ap-sources[open] summary::after { content: "\25B4"; }
.ap-sources summary:hover h2 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.ap-compare > p { margin: 8px 0 14px; max-width: 70ch; color: var(--muted); }
.ap-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--ap-card); }
.ap-table table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.ap-table th, .ap-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.ap-table tbody th { position: sticky; left: 0; z-index: 1; background: var(--ap-card); color: var(--muted); font-weight: 500; text-align: left; }
.ap-table thead th { font-size: 0.95rem; }
.ap-table thead a { padding: 4px 6px; border-radius: 8px; color: var(--text); text-decoration: none; }
.ap-table thead th.is-current a { background: var(--ap-acc); color: var(--ap-on-acc); }
.ap-table td.is-current { background: var(--ap-acc-soft); }
.ap-table tbody tr:last-child > * { border-bottom: 0; }
.ap-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; margin-top: 14px; }
.ap-sources h3 { margin-bottom: 8px; font-size: 1.05rem; }
.ap-sources p { margin-bottom: 8px; color: var(--muted); font-size: 0.88rem; }
.ap-ref-list { margin: 0; padding-left: 20px; font-size: 0.88rem; }
.ap-ref-list li { margin-bottom: 6px; scroll-margin-top: 80px; }
.ap-sources a, .ap-pop a { color: var(--text); }

/* (i): a fact's source, in a popover. Without script the browser centers it;
   the island anchors it under the button. */
.ap-pop {
  width: min(320px, calc(100vw - 24px));
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.18);
  font-size: 0.85rem;
  line-height: 1.45;
}
.ap-pop.is-anchored { position: fixed; inset: auto; margin: 0; }
.ap-pop::backdrop { background: transparent; }
.ap-pop-h { margin-bottom: 6px; color: var(--ap-acc); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; }
.ap-pop .ap-pop-all { display: inline-block; margin-top: 10px; color: var(--muted); font-size: 0.8rem; }

/* ---------- Photo viewer ---------- */

.ap-lightbox { width: 96vw; max-width: min(1100px, 96vw); padding: 0; border: 0; background: transparent; color: var(--ap-corona); }
.ap-lightbox::backdrop { background: rgb(2 3 9 / 0.95); }
.ap-lightbox figure { display: grid; gap: 10px; margin: 0; }
.ap-lightbox img { display: block; width: auto; height: auto; max-width: 100%; max-height: 76vh; margin: 0 auto; object-fit: contain; border-radius: 8px; background: #000000; }
.ap-lightbox figcaption { max-width: 80ch; margin: 0 auto; text-align: center; font-size: 0.95rem; }
.ap-lightbox figcaption small { display: block; margin-top: 4px; color: #a7aec8; }
.ap-lightbox figcaption a { color: inherit; }
.ap-lightbox-nav { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.ap-lightbox .ap-btn { border-color: rgb(255 255 255 / 0.2); background: rgb(255 255 255 / 0.08); color: var(--ap-corona); }

/* ---------- Small screens ---------- */

@media (max-width: 600px) {
  .ap-stage { aspect-ratio: 4 / 5; }
  .ap-seg button { padding: 0 8px; font-size: 0.75rem; }
  .ap-tool { min-width: 36px; height: 36px; padding: 0 8px; font-size: 0.75rem; }
  .ap-seg button { height: 36px; }
  .ap-pin span { display: none; }
  .ap-pin.is-current span { display: block; }
  .ap-legend { display: none; }
  .ap-dhead { grid-template-columns: minmax(0, 1fr); }
  .ap-dhead img { width: 80px; }
  .ap-table table { font-size: 0.8rem; }
}
@media (prefers-reduced-motion: reduce) {
  .ap-pin i { transition: none; }
}
