/* Moon missions since Apollo (/moon-missions/crewed, /moon-missions/uncrewed).
   Builds on fun-facts.css (hero, chapters, popovers, references, drawing
   classes) and its dark theme; this file adds the figures, crew and timeline,
   the mission cards and filters, and the maps. Colors come from the Fun Facts
   variables, so light and dark both follow Settings; moon-missions-dark.css
   adjusts the outcome colors. */

.mm {
  --mm-ok: #3f7a5a;
  --mm-part: #a07a35;
  --mm-fail: #a24a4a;
}
.mm-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Figures across the top ---------- */

.mm-tiles {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
.mm-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 46px 16px 18px;
  border: 1px solid var(--ff-rule);
  border-radius: 14px;
  background: var(--ff-card);
}
.mm-tile .ff-info { position: absolute; top: 12px; right: 12px; }
.mm-tile-value { font-family: var(--ff-serif); font-size: 1.9rem; line-height: 1.05; color: var(--text); }
.mm-tile-label { color: var(--muted); font-size: 0.84rem; line-height: 1.4; }

/* ---------- Cards shared by both pages ---------- */

.mm .mm-sub {
  margin-top: 34px;
  font-size: 1.35rem;
  color: var(--ff-acc);
}
.mm h4 { margin: 0; font-family: var(--ff-serif); font-weight: 500; font-size: 1.35rem; line-height: 1.15; }
.mm-card {
  display: flex;
  flex-direction: column;
  padding: 14px 18px 18px;
  background: var(--ff-card);
  border: 1px solid var(--ff-rule);
  border-radius: 14px;
  scroll-margin-top: 24px;
  --ff-paper: var(--ff-card);
}
.mm-card > p, .mm-mission > p { margin-top: 8px; font-size: 0.95rem; line-height: 1.55; }
.mm .mm-role { margin-top: 2px; color: var(--muted); font-size: 0.85rem; }
.mm .mm-first {
  margin-top: 12px;
  padding: 8px 12px;
  border-left: 2px solid var(--ff-acc);
  background: var(--ff-wash);
  border-radius: 0 8px 8px 0;
  font-size: 0.88rem;
}

.mm-intro { display: flex; gap: 14px; align-items: flex-start; max-width: 52rem; margin-bottom: 8px; }
.mm-intro p { font-size: 1.05rem; line-height: 1.6; }

/* ---------- Crew ---------- */

.mm-crew, .mm-notes, .mm-plans {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 14px;
}
.mm-crew { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.mm-notes { margin-top: 22px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.mm-plans { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
@media (min-width: 700px) {
  .mm-plans.mm-pairs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.mm-person h4 { margin-top: 10px; }
.mm-monogram {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--ff-acc);
  border-radius: 50%;
  font-family: var(--ff-serif);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  color: var(--ff-acc);
}
.mm-person .mm-first { margin-top: auto; }
.mm-person > p:not(.mm-role):not(.mm-first) { margin-bottom: 12px; }
.mm-unflown { border-style: dashed; }

/* ---------- Artemis II, day by day ---------- */

.mm-timeline { list-style: none; margin: 14px 0 0; padding: 0; }
.mm-step {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0 18px;
  position: relative;
}
.mm-step::before {
  content: "";
  position: absolute;
  left: calc(6.5rem + 8px);
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--ff-rule);
}
.mm-step::after {
  content: "";
  position: absolute;
  left: calc(6.5rem + 4px);
  top: 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ff-acc);
}
.mm-step-date { padding-top: 3px; color: var(--ff-acc); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; text-align: right; }
.mm-step-body { padding: 0 0 22px 22px; max-width: 46rem; }
.mm-step-body p { margin-top: 6px; font-size: 0.95rem; line-height: 1.55; }
@media (max-width: 560px) {
  .mm-step { grid-template-columns: 1fr; }
  .mm-step::before, .mm-step::after { display: none; }
  .mm-step-date { text-align: left; }
  .mm-step-body { padding-left: 0; }
}

/* ---------- Photographs (crewed page) ---------- */

.mm-photo { margin: 0; }
.mm-photo a { display: block; }
.mm-photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: var(--ff-rule);
}
.mm-photo figcaption { margin-top: 7px; color: var(--muted); font-size: 0.8rem; line-height: 1.45; }
.mm-photo .mm-credit { color: var(--muted); white-space: nowrap; text-decoration-color: var(--ff-rule); text-underline-offset: 2px; }
.mm-photo .mm-credit:hover { color: var(--text); }
.mm-hero-photo { width: 100%; max-width: 560px; justify-self: center; }
.mm-hero-photo img { border-radius: 16px; }
@media (min-width: 860px) {
  .mm-crewed .ff-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 520px); }
}

/* ---------- Overview: the intro beside the route ---------- */

.mm-overview { display: grid; gap: 10px 36px; align-items: center; }
.mm-route { width: 100%; max-width: 300px; justify-self: center; --ff-paper: var(--bg); }
@media (min-width: 900px) {
  .mm-overview { grid-template-columns: minmax(0, 1fr) 300px; }
}

/* ---------- Crew: home and a personal note ---------- */

.mm .mm-home { margin-top: 6px; font-size: 0.85rem; color: var(--text); }
.mm .mm-home span { color: var(--muted); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; margin-right: 4px; }
.mm .mm-story {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px dashed var(--ff-rule);
  font-family: var(--ff-serif);
  font-size: 1.02rem;
  line-height: 1.5;
}

/* ---------- Quotes ---------- */

.mm-quote { margin: 14px 0 0; padding: 2px 0 2px 16px; border-left: 2px solid var(--ff-acc); }
.mm-quote blockquote { margin: 0; quotes: "\201C" "\201D"; }
.mm-quote blockquote p { margin: 0; font-family: var(--ff-serif); font-size: 1.3rem; font-style: italic; line-height: 1.3; }
.mm-quote blockquote p::before { content: open-quote; }
.mm-quote blockquote p::after { content: close-quote; }
.mm-quote figcaption { display: flex; align-items: center; gap: 8px; margin-top: 6px; color: var(--muted); font-size: 0.82rem; letter-spacing: 0.04em; }

/* Timeline steps with a photo: text beside it on wide screens. */
.mm-step-body.has-photo { max-width: 64rem; display: grid; gap: 14px 26px; }
.mm-step-photo img { width: auto; max-width: 100%; max-height: 380px; }
@media (min-width: 900px) {
  .mm-step-body.has-photo { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
}

/* ---------- The eclipse ---------- */

.mm-feature {
  display: grid;
  gap: 18px 28px;
  margin-top: 30px;
  padding: 18px;
  border: 1px solid var(--ff-rule);
  border-radius: 16px;
  background: var(--ff-card);
  --ff-paper: var(--ff-card);
}
.mm-feature h3 { margin: 0; font-size: 1.6rem; line-height: 1.15; }
.mm-feature-text > p { margin-top: 10px; font-size: 0.97rem; line-height: 1.6; }
.mm-feature-second { margin-top: 16px; }
@media (min-width: 560px) {
  .mm-feature-second { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 14px; align-items: end; }
  .mm-feature-second figcaption { margin-top: 0; }
}
@media (min-width: 900px) {
  .mm-feature { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); align-items: start; }
}

/* ---------- Apparent sizes ---------- */

.mm-sizes {
  display: grid;
  gap: 10px 28px;
  align-items: center;
  margin-top: 22px;
  padding: 14px 18px 18px;
  border: 1px solid var(--ff-rule);
  border-radius: 16px;
  background: var(--ff-card);
  --ff-paper: var(--ff-card);
}
.mm-sizes svg { width: 100%; max-width: 460px; justify-self: center; }
.mm-sizes h3 { margin: 0; font-size: 1.35rem; }
.mm-sizes p { margin-top: 8px; font-size: 0.95rem; line-height: 1.6; }
@media (min-width: 820px) {
  .mm-sizes { grid-template-columns: minmax(0, 460px) minmax(0, 1fr); }
}

/* ---------- Wake-up calls ---------- */

.mm-songs {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 0 32px;
}
@media (min-width: 760px) {
  .mm-songs { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: column; grid-template-rows: repeat(5, auto); }
}
.mm-songs > li {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 11px 0;
  border-bottom: 1px solid var(--ff-rule);
}
.mm-song-day {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--ff-rule);
  border-radius: 50%;
  font-family: var(--ff-serif);
  font-size: 0.95rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.mm-songs > li.has-story .mm-song-day { border-color: var(--ff-acc); background: var(--ff-wash); color: var(--text); }
.mm .mm-song-title { font-family: var(--ff-serif); font-size: 1.12rem; line-height: 1.25; }
.mm-song-title span { display: block; margin-top: 2px; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--muted); font-size: 0.82rem; }
.mm-songs li > div > p:not(.mm-song-title) { margin-top: 5px; font-size: 0.88rem; line-height: 1.5; }
.mm-songs .mm-quote { margin-top: 8px; }
.mm-songs .mm-quote blockquote p { font-size: 1.05rem; }

/* ---------- Out the window ---------- */

.mm-gallery { margin-top: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px 14px; }
.mm-gallery-photo img { aspect-ratio: 3 / 2; object-fit: cover; }

/* ---------- Distance table ---------- */

.mm-table-wrap { margin-top: 26px; overflow-x: auto; }
.mm-records { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.mm-records caption { text-align: left; font-family: var(--ff-serif); font-size: 1.3rem; padding-bottom: 8px; }
.mm-records th, .mm-records td { padding: 9px 12px; border-bottom: 1px solid var(--ff-rule); text-align: left; vertical-align: middle; }
.mm-records thead th { color: var(--muted); font-size: 0.74rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.mm-records tbody th { font-weight: 600; white-space: nowrap; }
.mm-records tbody th span { color: var(--muted); font-weight: 400; margin-left: 4px; }
.mm-records td:last-child { width: 1%; }
/* Phones: each flight becomes a small card, its figures labeled. */
@media (max-width: 640px) {
  .mm-records thead { display: none; }
  .mm-records, .mm-records tbody, .mm-records tr, .mm-records th, .mm-records td { display: block; width: auto; }
  .mm-records tr { position: relative; padding: 10px 0; border-bottom: 1px solid var(--ff-rule); }
  .mm-records th, .mm-records td { padding: 2px 0; border: 0; }
  .mm-records td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 9.5rem; color: var(--muted); font-size: 0.8rem; }
  .mm-records td:last-child { position: absolute; top: 8px; right: 0; width: auto; }
}

/* ---------- Everyone who has gone ---------- */

.mm-roster-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mm-legend { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.85rem; }
.mm-walked, .mm-roster li.is-walker::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ff-acc);
}
.mm-roster {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.mm-roster > li {
  padding: 12px 16px 14px;
  border: 1px solid var(--ff-rule);
  border-radius: 12px;
  background: var(--ff-card);
}
.mm-roster > li.mm-roster-now { border-color: var(--ff-acc); }
.mm-roster-mission { font-family: var(--ff-serif); font-size: 1.2rem; }
.mm-roster-mission span { display: block; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--muted); font-size: 0.78rem; }
.mm-roster ul { list-style: none; margin: 8px 0 0; padding: 0; font-size: 0.9rem; line-height: 1.6; }
.mm-roster ul li { padding-left: 16px; position: relative; }
.mm-roster li.is-walker::before { content: ""; position: absolute; left: 1px; top: 0.55em; }

/* ---------- Maps ---------- */

.mm-map { padding-top: 36px; scroll-margin-top: 12px; }
.mm-map h2 { font-size: clamp(1.5rem, 3vw, 1.9rem); }
.mm-map-intro { margin-top: 6px; color: var(--muted); max-width: 46rem; }
.mm-maps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.mm-face {
  margin: 0;
  padding: 10px 12px 14px;
  border: 1px solid var(--ff-rule);
  border-radius: 14px;
  background: var(--ff-card);
  --ff-paper: var(--ff-card);
}
.mm-face svg { max-width: 340px; margin: 0 auto; }
.mm-face figcaption { margin-top: 6px; color: var(--muted); font-size: 0.82rem; line-height: 1.45; }
.mm-face figcaption strong { display: block; color: var(--text); font-family: var(--ff-serif); font-size: 1.15rem; font-weight: 500; }
.mm .p-halo { paint-order: stroke; stroke: var(--ff-paper); stroke-width: 2.6px; stroke-linejoin: round; }
.mm-site { cursor: pointer; }
.mm-site:hover .p-mark, .mm-site:focus-visible .p-mark { fill: var(--ff-acc); }
.mm-site:focus-visible { outline: none; }
.mm-site:focus-visible circle:last-of-type { stroke-width: 2; }
.mm-key { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 14px; color: var(--muted); font-size: 0.85rem; }
.mm-key span { display: inline-flex; align-items: center; gap: 6px; }
.mm-key svg { width: 14px; height: 14px; }
.mm-sites {
  margin: 12px 0 0;
  padding-left: 2.2em;
  columns: 3 220px;
  column-gap: 32px;
  font-size: 0.85rem;
  line-height: 1.5;
}
.mm-sites li { break-inside: avoid; }
.mm-sites li::marker { color: var(--ff-acc); font-variant-numeric: tabular-nums; }
.mm-sites a { color: var(--text); }
.mm-sites span { color: var(--muted); }

/* ---------- Filters ---------- */

.mm-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 26px;
  margin-top: 30px;
  padding: 14px 18px;
  border: 1px solid var(--ff-rule);
  border-radius: 14px;
  background: var(--ff-card);
}
.mm-filters[hidden] { display: none; }
.mm-filters fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mm-filters legend {
  width: 100%;
  margin-bottom: 6px;
  color: var(--ff-acc);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.mm-filters label {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border: 1px solid var(--ff-rule);
  border-radius: 999px;
  font-size: 0.82rem;
  cursor: pointer;
}
.mm-filters label:hover { border-color: var(--ff-acc); }
.mm-filters input[type="radio"] { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.mm-filters label:has(input:checked) { border-color: var(--ff-acc); background: var(--ff-wash); color: var(--text); }
.mm-filters label:has(input:focus-visible) { outline: 2px solid var(--ff-acc); outline-offset: 2px; }
.mm-filters select {
  padding: 6px 10px;
  border: 1px solid var(--ff-rule);
  border-radius: 999px;
  background: var(--ff-card);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
}
.mm-count { margin-left: auto; color: var(--muted); font-size: 0.85rem; }
.mm-none { margin-top: 24px; color: var(--muted); }
.mm-era[hidden], .mm-mission[hidden], .mm-none[hidden] { display: none; }

/* ---------- Mission cards ---------- */

.mm-missions {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}
.mm-mission {
  display: flex;
  flex-direction: column;
  padding: 14px 18px 18px;
  background: var(--ff-card);
  border: 1px solid var(--ff-rule);
  border-radius: 14px;
  scroll-margin-top: 24px;
  --ff-paper: var(--ff-card);
}
.mm-mission.is-picked, .mm-mission:target { animation: ff-pick 1.8s ease-out; }
.mm-mission-top { display: flex; align-items: center; gap: 12px; }
.mm .mm-glyph { width: 46px; height: 46px; flex: none; }
.mm-mission-meta { display: flex; flex-direction: column; gap: 2px; margin-right: auto; }
.mm-mission h3 { margin-top: 10px; font-size: 1.4rem; }
.mm-outcome { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; }
.mm-success .mm-outcome { color: var(--mm-ok); }
.mm-partial .mm-outcome { color: var(--mm-part); }
.mm-failure .mm-outcome { color: var(--mm-fail); }
.mm-outcome::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 1px;
}
.mm-failure .mm-outcome::before { background: transparent; border: 1.5px solid currentColor; width: 5px; height: 5px; }
.mm-partial .mm-outcome::before { background: linear-gradient(90deg, currentColor 50%, transparent 50%); border: 1px solid currentColor; width: 6px; height: 6px; }
.mm-dates { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 10px 0 0; font-size: 0.8rem; }
.mm-dates div { display: flex; gap: 6px; }
.mm-dates dt { color: var(--muted); }
.mm-dates dd { margin: 0; font-variant-numeric: tabular-nums; }
.mm-mission .mm-first { margin-top: auto; }
.mm-mission > p:not(.mm-role):not(.mm-first):not(.mm-onmap) { margin-bottom: 12px; }
.mm .mm-onmap { margin-top: 10px; font-size: 0.8rem; }
.mm-onmap a { color: var(--muted); }

/* ---------- How it was made ---------- */

.mm-method {
  margin-top: 48px;
  padding: 16px 20px;
  border: 1px solid var(--ff-rule);
  border-radius: 14px;
  background: var(--ff-card);
}
.mm-method summary { cursor: pointer; font-family: var(--ff-serif); font-size: 1.35rem; }
.mm-method summary:focus-visible { outline: 2px solid var(--ff-acc); outline-offset: 2px; }
.mm-method p { margin-top: 10px; color: var(--muted); font-size: 0.9rem; line-height: 1.6; max-width: 52rem; }

.mm .ff-next svg { max-height: 120px; }

@media (prefers-reduced-motion: reduce) {
  .mm-mission.is-picked, .mm-mission:target { animation: none; }
}
