/* Visual styling for individual UI pieces. Mobile-first; breakpoints are in
   responsive.css. Hover rules use background-color (never the background
   shorthand) so the custom select arrow is never wiped. */

/* Typography ------------------------------------------------------------- */
.eyebrow {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4.5vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.panel h2 {
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.panel-head h2 {
  font-size: clamp(1.2rem, 2.2vw, 1.6rem);
  margin-top: 2px;
}

.hero-text {
  margin: 10px 0 0;
  max-width: 54ch;
  color: var(--muted);
  line-height: 1.6;
}

.panel-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Buttons ---------------------------------------------------------------- */
/* Solid graphite controls — one flat neutral surface, no gradients or colour
   tints, so the button layer reads as a single system on the charcoal theme. */
.btn {
  cursor: pointer;
  position: relative;
  overflow: hidden; /* clips the hover sheen sweep (ANIM-14) */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--btn-border);
  background-color: var(--btn-bg);
  color: var(--text);
  padding: 11px 16px;
  font-weight: 500;
  transition:
    transform var(--motion-fast) var(--ease-standard),
    border-color var(--motion-normal) var(--ease-standard),
    background-color var(--motion-normal) var(--ease-standard),
    box-shadow var(--motion-normal) var(--ease-standard);
}

@media (hover: hover) {
  .btn:hover {
    transform: translateY(-1px);
    border-color: var(--btn-border-hover);
    background-color: var(--btn-bg-hover);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
  }
}

.btn:active {
  transform: translateY(1px) scale(0.99);
  background-color: var(--btn-bg-active);
}

.btn:focus-visible {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 4px var(--focus-ring-glow);
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* The HTML `hidden` attribute must win over `.btn { display: inline-flex }`
   (equal specificity, author rule otherwise wins on source order). Without this,
   the paginated "Load 10 more" / "Show all" buttons stayed visible even when JS
   set them hidden — the long-standing pagination-visibility bug. */
.btn[hidden] {
  display: none !important;
}

/* Primary keeps hierarchy through a lighter step of the SAME gray, not colour. */
.btn-primary {
  background-color: var(--btn-primary-bg);
  border-color: var(--btn-primary-border);
}

@media (hover: hover) {
  .btn-primary:hover {
    background-color: var(--btn-primary-bg-hover);
  }
}

/* Ghost = recessed variant of the same solid family. */
.btn-ghost {
  background-color: rgba(255, 255, 255, 0.03);
  border-color: var(--line);
}

@media (hover: hover) {
  .btn-ghost:hover {
    background-color: var(--btn-bg);
  }
}

.btn-small {
  padding: 9px 12px;
  font-size: 0.9rem;
}

.count-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background-color: rgba(255, 255, 255, 0.14);
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 600;
}

/* Inputs & dark native selects ------------------------------------------ */
/* An explicit line-height + min-height (rather than relying on padding alone)
   guarantees typed text and placeholder/typewriter text are never vertically
   clipped, and keeps a comfortable ~44px tap target across browsers. */
input,
select {
  width: 100%;
  min-width: 0;
  height: 44px;
  line-height: 1.4;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background-color: rgba(255, 255, 255, 0.045);
  color: var(--text);
  color-scheme: dark;
  padding: 0 14px;
  transition:
    border-color 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease;
}

/* Normalize the search input so no native chrome clips the text/placeholder. */
input[type="search"] {
  -webkit-appearance: none;
  appearance: none;
}

select {
  appearance: none;
  height: 44px;
  padding-right: 34px;
}

/* Custom arrow lives on a wrapper pseudo-element (not a select background image)
   so hover/focus background changes can never wipe it, and so it can rotate. */
.select-wrap {
  position: relative;
  display: block;
}

.select-wrap::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--muted);
  transform: translateY(-50%);
  transform-origin: center;
  transition: transform 0.2s ease;
  pointer-events: none;
}

/* Rotate the arrow ONLY while the dropdown is explicitly open (JS-driven
   .is-open). Focus alone must never rotate it — otherwise the arrow can stay
   "open" after the native popup closes while the select keeps focus. The focus
   ring (below) communicates focus instead. */
.select-wrap.is-open::after {
  transform: translateY(-50%) rotate(180deg);
}

input:hover,
select:hover {
  border-color: var(--line-strong);
  background-color: rgba(255, 255, 255, 0.07);
}

input:focus-visible {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 4px var(--focus-ring-glow);
}

/* Selects get a quieter focus ring than inputs. Chromium matches
   :focus-visible on a <select> even for a plain mouse click, and focus stays on
   the control after the native popup closes, so the bright white ring sat there
   looking like a stuck open state long after the user had moved on. The loud
   treatment is reserved for actually being open, below. Focus is still clearly
   indicated, which keyboard users need. */
select:focus-visible {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(226, 232, 240, 0.1);
}

/* Open: the full ring, driven by the same JS state that rotates the arrow. */
.select-wrap.is-open select {
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 4px var(--focus-ring-glow);
}

/* Explicit dark popup so the option list isn't white on light. */
select option,
select optgroup {
  background-color: #14171d;
  color: var(--text);
}

.field-label {
  font-size: 0.82rem;
  color: var(--muted);
}

/* Inline search clear (×) ------------------------------------------------ */
.field-search {
  position: relative;
}

/* Leave room for the custom clear button and suppress the WebKit native one so
   there is a single, consistent clear control across browsers. */
.field-search input[type="search"] {
  padding-right: 40px;
}

.field-search input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.search-clear[hidden] {
  display: none;
}

.search-clear:hover {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: var(--line-strong);
  color: var(--text);
}

.search-clear:focus-visible {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 3px var(--focus-ring-glow);
}

/* Indicators ------------------------------------------------------------- */
.pill-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.82rem;
}

/* Next-launch spotlight -------------------------------------------------- */
.next-launch-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 300px;
  /* Charcoal spotlight; a faint provider-accent wash on the active org only
     (set via --card-accent below) keeps it from reading as a blue block. */
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 36%),
    radial-gradient(circle at top right, color-mix(in srgb, var(--card-accent, #8aa0d8) 12%, transparent), transparent 46%),
    var(--panel-strong);
  border: 1px solid var(--line);
}

.spotlight-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.spotlight-main {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.spotlight-copy {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.spotlight-title {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.15;
}

.spotlight-facts {
  margin: 0;
  display: grid;
  gap: 8px;
}

.spotlight-facts div {
  display: flex;
  flex-direction: column;
}

.spotlight-facts dt {
  color: var(--muted);
  font-size: 0.76rem;
}

.spotlight-facts dd {
  margin: 0;
  font-size: 0.98rem;
}

.countdown-ring {
  min-width: 118px;
  align-self: start;
  text-align: center;
  border-radius: var(--radius-lg);
  border: 1px solid var(--btn-border);
  background-color: rgba(255, 255, 255, 0.045);
  padding: 14px 12px;
}

.countdown-ring strong {
  display: block;
  font-size: 1.5rem;
  line-height: 1;
}

.countdown-ring span {
  display: block;
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-weather,
.weather-block {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  background-color: rgba(255, 255, 255, 0.03);
}

/* Status banner ---------------------------------------------------------- */
/* A floating toast, not a strip in the toolbar. It used to sit inside the
   filter panel, where it scrolled off with the page and was missed more often
   than it was read. Pinned to the bottom-right, above everything, and it drifts
   gently so it reads as hovering rather than stuck on. */
.status {
  position: fixed;
  z-index: 60;
  right: clamp(12px, 2.5vw, 28px);
  bottom: clamp(12px, 2.5vw, 28px);
  width: min(420px, calc(100vw - 24px));
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.14);
  /* Opaque enough to stay legible over cards, images and the starfield. */
  background-color: rgba(16, 19, 26, 0.94);
  backdrop-filter: blur(10px);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.55),
    0 2px 0 rgba(255, 255, 255, 0.04) inset;
  color: var(--text);
  font-size: 0.92rem;
  /* Slides in, then sits perfectly still. The drift loop it used to run read as
     jitter rather than as floating, and a permanently animating fixed element
     kept its own compositor layer awake for the life of the page. */
  animation: toastIn 260ms var(--ease-out) both;
}

/* ANIM-32 — the toast slides in from the right and stays put. */
@keyframes toastIn {
  from { opacity: 0; transform: translate3d(28px, 0, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .status { animation: none; }
}

@supports not (backdrop-filter: blur(10px)) {
  .status { background-color: rgba(16, 19, 26, 0.985); }
}

/* Per-second countdown for auto-dismissing messages (decorative; aria-hidden). */
.status-count {
  flex: none;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  opacity: 0.8;
  min-width: 2.4ch;
  text-align: right;
}

/* Shrinking progress line along the bottom edge. Both the width and the visible
   seconds are derived from the same remaining-time value every tick (~250ms), so
   they can never desync. A short linear transition smooths the steps; the global
   reduced-motion rule zeroes it, leaving honest stepped progress. */
.status-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.25s linear;
  pointer-events: none;
}

/* Collapse fully when dismissed so no empty gap is left in the toolbar. */
.status[hidden] {
  display: none;
}

.status.is-leaving {
  /* Overrides the float loop, which would otherwise fight the exit. */
  animation: statusOut 0.2s var(--ease-standard) forwards;
}

.status-text {
  flex: 1;
  min-width: 0;
}

.status-close {
  flex: none;
  cursor: pointer;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background-color: rgba(255, 255, 255, 0.05);
  color: inherit;
  font-size: 1.05rem;
  line-height: 1;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.status-close:hover {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: var(--line-strong);
}

.status-close:focus-visible {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 3px var(--focus-ring-glow);
}

/* Semantic tones: success=green, info=blue, warning=amber, error/removed=red,
   loading=blue/neutral. A removed-saved-mission status is red-toned (destructive),
   never amber. */
.status[data-tone="success"] { border-color: rgba(98, 215, 163, 0.3); color: #c9ffe6; }
.status[data-tone="info"] { border-color: rgba(115, 182, 255, 0.3); color: #cfe2ff; }
.status[data-tone="warning"] { border-color: rgba(255, 209, 102, 0.3); color: #ffe7a5; }
.status[data-tone="error"],
.status[data-tone="removed"],
.status[data-tone="danger"] { border-color: rgba(255, 128, 142, 0.36); color: #ffc1c9; }
.status[data-tone="loading"] { border-color: rgba(115, 182, 255, 0.28); color: #cfe2ff; }

/* Debug messages read as a warning, not as ordinary information: amber text,
   an amber rule, and a dashed edge so a debug session is obvious at a glance. */
.status[data-tone="debug"] {
  border-style: dashed;
  border-color: rgba(255, 193, 64, 0.55);
  background-color: rgba(255, 193, 64, 0.08);
  color: #ffd98a;
}
.status[data-tone="debug"] .status-progress {
  background: linear-gradient(90deg, #ffc140, #ffe7a5);
}
.status[data-tone="debug"] .status-close { color: #ffd98a; }

/* A floating toast needs an obvious way out, so the close control is a real
   button rather than a faint glyph. */
.status-close {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background-color: rgba(255, 255, 255, 0.06);
}

.status-close:hover,
.status-close:focus-visible {
  background-color: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--text);
}
.status[data-tone="success"] .status-progress { background: linear-gradient(90deg, var(--success), #8be0bb); }
.status[data-tone="warning"] .status-progress { background: linear-gradient(90deg, var(--warning), #ffe7a5); }
.status[data-tone="error"] .status-progress,
.status[data-tone="removed"] .status-progress { background: linear-gradient(90deg, var(--danger), #ffb0bb); }

/* Launch cards ----------------------------------------------------------- */
.launch-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 30%),
    rgba(11, 17, 31, 0.82);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  /* Entrance is opt-in via the .motion-card-enter class (added only for fresh /
     newly-paginated cards) so cached cards appear instantly with no replay. */
  transition:
    transform var(--motion-fast) var(--ease-standard),
    border-color var(--motion-normal) var(--ease-standard),
    box-shadow var(--motion-normal) var(--ease-standard);
}

/* Organization accent edge -----------------------------------------------
   One band per organization on the launch. A single organization gets a solid
   stripe; a shared mission (a NASA payload on a SpaceX rocket) splits the edge
   into equal bands, so a joint launch is readable at a glance. The band colours
   arrive as inline --accent-1..3 custom properties pointing at the live :root
   org tokens, so customizing a colour restyles every stripe instantly. */
.launch-card[data-accent],
.previous-item[data-accent],
.saved-card[data-accent] {
  --card-accent: var(--accent-1, var(--accent));
}

.launch-card[data-accent]::before,
.previous-item[data-accent]::before,
.saved-card[data-accent]::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  /* Square ends. The rounded left corners used to taper the very top and
     bottom of the stripe, which ate into whichever band sat there and made a
     two-band split look lopsided. The card's own overflow:hidden still clips
     it to the card's radius. */
  border-radius: 0;
  background: var(--accent-1, transparent);
  opacity: 0.55;
  pointer-events: none;
  z-index: 1;
  transition: opacity var(--motion-normal) var(--ease-standard);
}

/* Hard stops, not a blend: each organization owns an exact share of the edge.
   These selectors must carry at least the specificity of the solid-colour rule
   above, or the single-colour background wins and the split never renders. */
.launch-card[data-accent-bands="2"]::before,
.previous-item[data-accent-bands="2"]::before,
.saved-card[data-accent-bands="2"]::before,
.previous-detail-head[data-accent-bands="2"]::before {
  /* A dark hairline at the midpoint. The bands are exactly equal, but NASA's
     rose is far brighter than any provider colour on this background, so
     without a divider it visually bleeds and reads as if it owns more than
     half. The line makes the split unambiguous. */
  background: linear-gradient(
    180deg,
    var(--accent-1) 0 calc(50% - 0.5px),
    rgba(0, 0, 0, 0.35) calc(50% - 0.5px) calc(50% + 0.5px),
    var(--accent-2) calc(50% + 0.5px) 100%
  );
}

.launch-card[data-accent-bands="3"]::before,
.previous-item[data-accent-bands="3"]::before,
.saved-card[data-accent-bands="3"]::before,
.previous-detail-head[data-accent-bands="3"]::before {
  background: linear-gradient(
    180deg,
    var(--accent-1) 0 33.34%,
    var(--accent-2) 33.34% 66.67%,
    var(--accent-3) 66.67% 100%
  );
}

/* A split edge is the SAME weight as a single one: same width, same opacity.
   It used to be wider and brighter so the division would read, but that made a
   shared mission shout next to its neighbours, which is not what the edge is
   for. The two colours are the difference; the emphasis should not be. */

/* Hover lift only on pointer-capable devices (never on touch). */
@media (hover: hover) {
  .launch-card:hover {
    transform: translateY(-4px);
    border-color: color-mix(in srgb, var(--card-accent, var(--accent)) 45%, transparent);
    box-shadow: var(--shadow-card-hover);
  }

  .launch-card:hover[data-accent]::before { opacity: 1; }

  /* A split card must NOT also tint its whole border with the first accent.
     The rule above sets border-color from --card-accent, which is accent-1, so
     the entire border went NASA rose and the split ring was then composited on
     top of it: the lower half read as rose showing through blue rather than as
     blue. With two or more bands the border steps back and the ring alone
     carries the colour. */
  .launch-card[data-accent-bands="2"]:hover,
  .launch-card[data-accent-bands="3"]:hover {
    border-color: var(--line);
  }

  /* A shared mission keeps both colours on hover. Recolouring the whole border
     to a single accent said "SpaceX" on a card that is NASA and SpaceX, so the
     split is carried into the border too: NASA above, the provider below.
     Drawn as a masked gradient ring rather than border-image, because
     border-image would square off the card's rounded corners. */
  .launch-card[data-accent-bands="2"]:hover::after,
  .launch-card[data-accent-bands="3"]:hover::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(
      180deg,
      var(--accent-1) 0 calc(50% - 0.5px),
      rgba(0, 0, 0, 0.35) calc(50% - 0.5px) calc(50% + 0.5px),
      var(--accent-2) calc(50% + 0.5px) 100%
    );
    /* Matched to the single-accent hover border, which is a 45% mix. */
    opacity: 0.45;
    -webkit-mask:
      linear-gradient(#000 0 0) content-box,
      linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask:
      linear-gradient(#000 0 0) content-box,
      linear-gradient(#000 0 0);
    mask-composite: exclude;
  }
}

/* Without mask support the ring would paint as a solid block over the card, so
   it is not drawn at all; the split edge stripe still carries the meaning. */
@supports not ((mask-composite: exclude) or (-webkit-mask-composite: xor)) {
  .launch-card[data-accent-bands="2"]:hover::after,
  .launch-card[data-accent-bands="3"]:hover::after { display: none; }
}

/* Keyboard focus only. Plain :focus-within also matched after the details
   modal closed, because focus is deliberately restored to the Details button
   inside the card, leaving it highlighted with no way to clear it. */
.launch-card:has(:focus-visible) {
  border-color: color-mix(in srgb, var(--card-accent, var(--accent)) 55%, transparent);
}

.launch-card[data-accent-bands="2"]:has(:focus-visible),
.launch-card[data-accent-bands="3"]:has(:focus-visible) {
  border-color: var(--line-strong);
}

@supports not selector(:has(*)) {
  .launch-card:focus-within {
    border-color: color-mix(in srgb, var(--card-accent, var(--accent)) 55%, transparent);
  }
}

.launch-card-media {
  position: relative;
  height: 190px;
  overflow: hidden;
  isolation: isolate;
  transform: translateZ(0); /* crisp clipping for the scaled image (ANIM-05) */
  border-bottom: 1px solid var(--line);
  /* Neutral charcoal media backdrop (shown behind the no-image placeholder). */
  background:
    linear-gradient(180deg, rgba(10, 11, 14, 0.2), rgba(8, 9, 12, 0.78)),
    radial-gradient(circle at top right, rgba(150, 160, 180, 0.1), transparent 45%),
    var(--bg-2);
}

/* ANIM-05 — Card media zoom.
   BUGFIX (v3.4.1): the zoom used to look smeared/distorted because the card
   itself lifts (translateY) while the image scales. Two nested transforms land
   the bitmap on fractional device pixels, so the browser resamples it every
   frame. Promoting the image to its own compositor layer (translateZ + explicit
   backface/perspective hints) makes the scale crisp, and `display:block` kills
   the inline baseline gap that let a 1px sliver of the container show through. */
/* The photo fills the frame. Showing it whole over a blurred copy of itself
   was worse in practice: the rocket shrank to the middle third and the blurred
   bars either side dominated the card. A taller frame is the honest fix, so
   less is cropped without letterboxing anything. */
.launch-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.95;
  transform: scale(1) translateZ(0);
  transform-origin: center center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: transform var(--motion-slow) var(--ease-standard);
}

/* Gentle image zoom only on pointer-capable devices. `will-change` is applied
   on hover only (not permanently) so we don't hold a layer for every card. */
@media (hover: hover) {
  .launch-card:hover .launch-card-media img {
    transform: scale(1.045) translateZ(0);
    will-change: transform;
  }
}

/* Neutral no-image placeholder: quiet centered text over the card's existing
   dark gradient — no illustrations, no fake photography. */
.media-fallback {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  opacity: 0.85;
  text-align: center;
  padding: 0 12px;
}

.badge-float {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  gap: 6px;
}

.card-types {
  margin-top: 2px;
}

/* Brief highlight when Random mission lands on a card. */
@keyframes cardFlash {
  0%   { box-shadow: 0 0 0 0 rgba(235, 238, 245, 0.45); }
  100% { box-shadow: 0 0 0 10px rgba(235, 238, 245, 0); }
}

.launch-card.is-flash {
  border-color: rgba(235, 238, 245, 0.5);
  animation: cardFlash var(--motion-emphasis) var(--ease-out) 2;
}

.launch-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.card-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.card-relative {
  color: var(--muted);
  font-size: 0.82rem;
}

.launch-card h3 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.25;
}

.card-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.card-facts {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.card-facts div {
  display: flex;
  flex-direction: column;
}

.card-facts dt {
  color: var(--muted);
  font-size: 0.74rem;
}

.card-facts dd {
  margin: 0;
  font-size: 0.9rem;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.btn-details {
  border-color: var(--btn-border);
}

@media (hover: hover) {
  .launch-card:hover .btn-details {
    background-color: var(--btn-bg-hover);
    border-color: var(--btn-border-hover);
  }
}

/* Badges ----------------------------------------------------------------- */
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 0.76rem;
  border: 1px solid var(--line);
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text);
  white-space: nowrap;
}

/* Mission-type badges */
.badge.type-starlink,
.badge.type-crew,
.badge.type-cargo,
.badge.type-science,
.badge.type-rideshare,
.badge.type-commercial,
.badge.type-national-security,
.badge.type-test-flight {
  border-color: transparent;
}

.badge.type-starlink { background-color: rgba(115, 182, 255, 0.18); }
.badge.type-crew { background-color: rgba(157, 125, 255, 0.2); }
.badge.type-cargo { background-color: rgba(255, 128, 142, 0.18); }
.badge.type-science { background-color: rgba(147, 197, 253, 0.18); }
.badge.type-rideshare { background-color: rgba(255, 209, 102, 0.2); color: #fff0b9; }
.badge.type-commercial { background-color: rgba(98, 215, 163, 0.18); }
.badge.type-national-security { background-color: rgba(255, 147, 120, 0.2); color: #ffd8c6; }
.badge.type-test-flight { background-color: rgba(190, 160, 255, 0.18); }
.badge.type-other { background-color: rgba(255, 255, 255, 0.06); color: var(--muted); }

/* Organization badges — distinct, recognizable accents derived from the central
   --org-* tokens (so user color customization propagates everywhere). A soft
   tint background + a brighter token-tinted text keep contrast on the dark UI. */
.badge.org-badge { border-color: transparent; font-weight: 600; }
.badge.org-nasa,
.badge.org-spacex,
.badge.org-blueorigin,
.badge.org-rocketlab,
.badge.org-ula,
.badge.org-firefly {
  background-color: color-mix(in srgb, var(--org-accent, var(--accent)) 22%, transparent);
  color: color-mix(in srgb, var(--org-accent, var(--accent)) 78%, #ffffff);
}
.badge.org-nasa { --org-accent: var(--org-nasa); }
.badge.org-spacex { --org-accent: var(--org-spacex); }
.badge.org-blueorigin { --org-accent: var(--org-blueorigin); }
.badge.org-rocketlab { --org-accent: var(--org-rocketlab); }
.badge.org-ula { --org-accent: var(--org-ula); }
.badge.org-firefly { --org-accent: var(--org-firefly); }

/* Fallback for browsers without color-mix(): legible static accents. */
@supports not (color: color-mix(in srgb, red, blue)) {
  .badge.org-nasa { background-color: rgba(255, 122, 144, 0.22); color: #ffd2d8; }
  .badge.org-spacex { background-color: rgba(90, 160, 255, 0.22); color: #dbe9ff; }
  .badge.org-blueorigin { background-color: rgba(255, 207, 92, 0.2); color: #ffe9b8; }
  .badge.org-rocketlab { background-color: rgba(81, 216, 168, 0.2); color: #d6ffe9; }
  .badge.org-ula { background-color: rgba(182, 155, 255, 0.22); color: #e6dcff; }
  .badge.org-firefly { background-color: rgba(255, 138, 76, 0.2); color: #ffd2b8; }
}

/* Organization badges OVER imagery need to stay legible against bright clouds
   and pale rockets: a dark translucent backing, a subtle border + shadow, and
   restrained backdrop blur where supported (the solid-ish backing below is the
   non-blur fallback). The org accent survives in the border + text color. */
.launch-card-media .badge {
  background-color: rgba(9, 14, 26, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  color: #f2f6ff;
}

@supports ((backdrop-filter: blur(6px)) or (-webkit-backdrop-filter: blur(6px))) {
  .launch-card-media .badge {
    background-color: rgba(9, 14, 26, 0.55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
  }
}

/* On-image org badges keep the dark backing (above) but take a brighter
   token-tinted border + text so provider identity reads on bright photos. */
.launch-card-media .badge.org-nasa,
.launch-card-media .badge.org-spacex,
.launch-card-media .badge.org-blueorigin,
.launch-card-media .badge.org-rocketlab,
.launch-card-media .badge.org-ula,
.launch-card-media .badge.org-firefly {
  border-color: color-mix(in srgb, var(--org-accent, var(--accent)) 70%, transparent);
  color: color-mix(in srgb, var(--org-accent, var(--accent)) 55%, #ffffff);
}

/* Flight-type badges (omitted entirely when unknown) */
.badge.flight-orbital { background-color: rgba(115, 182, 255, 0.14); border-color: rgba(115, 182, 255, 0.3); }
.badge.flight-suborbital { background-color: rgba(157, 125, 255, 0.16); border-color: rgba(157, 125, 255, 0.32); }

/* Status badges */
.badge.status-go { background-color: rgba(98, 215, 163, 0.2); border-color: transparent; color: #c9ffe6; }
.badge.status-success { background-color: rgba(98, 215, 163, 0.2); border-color: transparent; color: #c9ffe6; }
.badge.status-hold { background-color: rgba(255, 209, 102, 0.22); border-color: transparent; color: #ffe7a5; }
.badge.status-failure { background-color: rgba(255, 128, 142, 0.22); border-color: transparent; color: #ffc1c9; }
.badge.status-inflight { background-color: rgba(115, 182, 255, 0.2); border-color: transparent; color: #dbe9ff; }
.badge.status-tbd,
.badge.status-tbc { background-color: rgba(255, 255, 255, 0.06); color: var(--muted); }

/* Card / favorite action links ------------------------------------------ */
.card-link,
.favorite-btn {
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  border: 1px solid var(--btn-border);
  background-color: var(--btn-bg);
  color: var(--text);
  font-size: 0.9rem;
  transition:
    transform var(--motion-fast) var(--ease-standard),
    border-color var(--motion-normal) var(--ease-standard),
    background-color var(--motion-normal) var(--ease-standard);
}

.card-link:hover,
.favorite-btn:hover {
  transform: translateY(-1px);
  border-color: var(--btn-border-hover);
  background-color: var(--btn-bg-hover);
}

.card-link:active,
.favorite-btn:active {
  transform: translateY(1px) scale(0.99);
  background-color: var(--btn-bg-active);
}

.card-link:focus-visible,
.favorite-btn:focus-visible {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 4px var(--focus-ring-glow);
}

/* Saved state: neutral ☆ Save → green ★ Saved (star baked into the label). */
.favorite-btn.is-active {
  border-color: rgba(98, 215, 163, 0.5);
  background-color: rgba(98, 215, 163, 0.16);
  color: #d6ffe9;
}

/* Clear all — red-outline destructive action. */
.btn-danger-outline {
  border-color: rgba(255, 128, 142, 0.5);
  color: #ffc1c9;
  background-color: rgba(255, 128, 142, 0.08);
}

.btn-danger-outline:hover {
  border-color: rgba(255, 128, 142, 0.75);
  background-color: rgba(255, 128, 142, 0.16);
}

/* Overlays (drawer + modal) --------------------------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.overlay.is-open {
  visibility: visible;
  opacity: 1;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 16, 0.62);
  backdrop-filter: blur(3px);
}

.overlay-panel {
  position: relative;
  z-index: 1;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.drawer-overlay {
  justify-content: flex-end;
}

.drawer-panel {
  width: min(420px, 100vw);
  max-width: 100vw;
  height: 100%;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  padding: 20px;
  gap: 14px;
  overflow: hidden; /* the inner .drawer-list scrolls */
}

.overlay.is-open .drawer-panel {
  animation: drawerSlide 0.28s ease;
}

.modal-overlay {
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-panel {
  width: min(1120px, calc(100vw - 48px));
  /* Taller on desktop too. At 90vh with a 1120px column the details view still
     scrolled inside a short window, which is the cramped feeling reported. */
  max-height: 92vh;
  max-height: 92dvh; /* progressive: avoids mobile browser-chrome clipping */
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: var(--radius-lg);
  padding: 24px;
}

.overlay.is-open .modal-panel {
  animation: modalPop 0.28s ease;
}

.overlay.is-open .overlay-backdrop {
  animation: overlayFade 0.25s ease;
}

.overlay-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.overlay-head h2 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
}

.overlay-foot {
  margin-top: auto;
  padding-top: 8px;
}

.drawer-list {
  flex: 1;
  /* stable gutter: removing a saved mission briefly shortens the list past the
     overflow threshold, so the scrollbar was disappearing and reappearing and
     the content jumped sideways with it. The gutter is now always reserved. */
  overflow-y: scroll;
  scrollbar-gutter: stable;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.icon-btn {
  cursor: pointer;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-pill);
  border: 1px solid var(--btn-border);
  background-color: var(--btn-bg);
  color: var(--text);
  font-size: 1rem;
  transition:
    background-color var(--motion-normal) var(--ease-standard),
    border-color var(--motion-normal) var(--ease-standard),
    transform var(--motion-fast) var(--ease-spring);
}

.icon-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: var(--line-strong);
}

.icon-btn:focus-visible {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 4px var(--focus-ring-glow);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
}

/* Mission imagery in the detail views ------------------------------------ */
.details-media {
  position: relative;
  /* A flat height was the bug. The modal content column runs up to 1072px wide,
     so 260px made a 4.1:1 slot, and object-fit: cover threw away well over half
     the height of a 16:9 photograph: the rocket was cut off top and bottom. The
     cards never had this problem because their frame is already close to 16:9,
     which is why they looked right and this did not. Matching the frame to the
     shape of the photographs it holds is the whole fix. Width is capped so the
     frame does not become a wall on a wide screen. */
  margin: 0 auto;
  width: min(100%, 880px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(10, 11, 14, 0.2), rgba(8, 9, 12, 0.78)),
    var(--bg-2);
}

.details-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Own compositor layer, so the bitmap is never resampled mid-transition. */
  transform: translateZ(0);
  backface-visibility: hidden;
}

.details-media figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 6px 10px;
  background: linear-gradient(180deg, transparent, rgba(8, 9, 12, 0.85));
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.details-media.is-empty {
  display: grid;
  place-items: center;
  /* No photograph to match, so the ratio does not apply: a short dashed panel. */
  aspect-ratio: auto;
  height: 120px;
  border-style: dashed;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Details content -------------------------------------------------------- */
.details-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* A flex column stretches its children, which turned standalone buttons into
   full-width bars that ran under the absolutely-positioned close control. */
.details-content > .btn {
  align-self: flex-start;
  max-width: calc(100% - 52px);
}

/* Keep the top-right corner clear for the ✕ on any panel heading. */
.details-content > .details-title:first-child,
.details-content > .details-head:first-child {
  padding-right: 44px;
}

.details-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 44px;
}

.details-title {
  margin: 0;
  font-size: clamp(1.3rem, 2.5vw, 1.8rem);
}

.details-countdown {
  align-self: flex-start;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--btn-border);
  background-color: rgba(255, 255, 255, 0.045);
}

.details-countdown strong {
  font-size: 1.4rem;
  line-height: 1;
}

.details-countdown span {
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.details-grid {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.details-grid div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.details-grid dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.details-grid dd {
  margin: 0;
}

.details-description {
  margin: 0;
  color: #d7e0f3;
  line-height: 1.6;
}

/* Weather ---------------------------------------------------------------- */
.weather-heading {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.weather-note {
  margin: 8px 0 0;
  font-size: 0.74rem;
  color: var(--muted);
}

.weather-msg {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.weather-compact {
  margin: 0;
  font-size: 0.95rem;
}

.weather-grid {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.weather-grid div {
  display: flex;
  flex-direction: column;
}

.weather-grid dt {
  color: var(--muted);
  font-size: 0.74rem;
}

.weather-grid dd {
  margin: 0;
  font-size: 0.92rem;
}

/* Saved-mission drawer --------------------------------------------------- */
.drawer-head h2 {
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.saved-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.saved-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.saved-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px 12px 16px;
  background-color: rgba(255, 255, 255, 0.035);
  transition:
    border-color var(--motion-normal) var(--ease-standard),
    background-color var(--motion-normal) var(--ease-standard);
}

@media (hover: hover) {
  .saved-card:hover {
    background-color: rgba(255, 255, 255, 0.06);
    border-color: color-mix(in srgb, var(--card-accent, var(--accent)) 40%, transparent);
  }

  .saved-card[data-accent-bands="2"]:hover,
  .saved-card[data-accent-bands="3"]:hover { border-color: var(--line-strong); }
}

/* A launch whose time has passed stays readable but stops competing. */
.saved-card.is-past { opacity: 0.62; }

.saved-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.saved-card-head .badge-row {
  gap: 4px;
  min-width: 0;
}

/* The remove control sits quiet until you reach for the card. */
.saved-remove {
  flex: none;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1;
  opacity: 0.45;
  transition:
    opacity var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard),
    background-color var(--motion-fast) var(--ease-standard);
}

.saved-card:hover .saved-remove,
.saved-card:focus-within .saved-remove { opacity: 1; }

.saved-remove:hover,
.saved-remove:focus-visible {
  color: #ffc1c9;
  background-color: rgba(255, 128, 142, 0.14);
  border-color: rgba(255, 128, 142, 0.35);
  opacity: 1;
}

.saved-name {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.3;
}

.saved-meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.saved-date { color: var(--text); opacity: 0.8; }
.saved-place { overflow-wrap: anywhere; min-width: 0; }

.saved-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
}

.saved-flown {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}

.saved-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 40px 20px;
  text-align: center;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  background-color: rgba(255, 255, 255, 0.02);
  color: var(--muted);
}

.saved-empty-icon {
  font-size: 1.8rem;
  line-height: 1;
  opacity: 0.5;
}

.saved-empty strong {
  color: var(--text);
  font-size: 0.98rem;
}

.saved-empty-text {
  font-size: 0.85rem;
  line-height: 1.5;
  max-width: 30ch;
}

.drawer-foot {
  display: flex;
  justify-content: flex-end;
}

/* Empty & loading states ------------------------------------------------- */
.empty-state {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  gap: 12px;
  min-height: 160px;
  text-align: center;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  background-color: rgba(255, 255, 255, 0.03);
  padding: 24px;
  color: var(--muted);
}

.placeholder-card {
  display: grid;
  gap: 12px;
  min-height: 220px;
  align-content: start;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background-color: rgba(255, 255, 255, 0.03);
  padding: 18px;
}

.placeholder-line,
.placeholder-pill {
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  background-size: 220% 100%;
  animation: shimmer 1.6s linear infinite;
}

.placeholder-line { width: 100%; height: 14px; }
.placeholder-line-lg { height: 20px; width: 70%; }
.placeholder-pills { display: flex; gap: 10px; }
.placeholder-pill { width: 90px; height: 34px; }

/* Organization tabs ------------------------------------------------------ */
/* Single row that fits on desktop and becomes a clean horizontally scrollable
   the strip wraps cleanly onto multiple rows (no horizontal scrolling, no
   clipped final pill), so every organization is always fully visible. */
.org-selector {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-top: var(--space-4);
}

.org-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 2px;
  min-width: 0;
}

/* Compact "Customize colors" affordance next to the selector. */
.customize-colors-btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px dashed var(--line-strong);
  background-color: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.8rem;
  transition: color var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard), background-color var(--motion-fast) var(--ease-standard);
}
.customize-colors-btn:hover {
  color: var(--text);
  border-color: var(--accent);
  background-color: rgba(255, 255, 255, 0.06);
}
.customize-colors-btn:focus-visible {
  outline: none;
  border-style: solid;
  box-shadow: 0 0 0 3px var(--focus-ring-glow);
}
.customize-colors-icon { font-size: 0.95rem; line-height: 1; }

.org-tab {
  cursor: pointer;
  position: relative;
  flex: 0 0 auto;
  white-space: nowrap;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  padding: var(--space-2) var(--space-4);
  min-height: 38px;
  font-weight: 500;
  transition:
    border-color var(--motion-normal) var(--ease-standard),
    background-color var(--motion-normal) var(--ease-standard),
    color var(--motion-normal) var(--ease-standard);
}

@media (hover: hover) {
  .org-tab:hover {
    border-color: var(--line-strong);
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text);
  }
}

/* Per-organization accent on the pills + overview tiles (single source: the
   --org-* tokens, so customization propagates to selected states too). */
.org-tab[data-org="all"], .overview-tile.is-showing { --org-accent: var(--org-all); }
.org-tab[data-org="nasa"], .overview-tile[data-org="nasa"] { --org-accent: var(--org-nasa); }
.org-tab[data-org="spacex"], .overview-tile[data-org="spacex"] { --org-accent: var(--org-spacex); }
.org-tab[data-org="blue-origin"], .overview-tile[data-org="blue-origin"] { --org-accent: var(--org-blueorigin); }
.org-tab[data-org="rocket-lab"], .overview-tile[data-org="rocket-lab"] { --org-accent: var(--org-rocketlab); }
.org-tab[data-org="ula"], .overview-tile[data-org="ula"] { --org-accent: var(--org-ula); }
.org-tab[data-org="firefly"], .overview-tile[data-org="firefly"] { --org-accent: var(--org-firefly); }
.overview-tile.is-saved { --org-accent: var(--org-saved); }

.org-tab.is-active {
  border-color: color-mix(in srgb, var(--org-accent, var(--accent)) 60%, transparent);
  background: color-mix(in srgb, var(--org-accent, var(--accent)) 20%, transparent);
  color: #fff;
}

/* Smooth active-tab underline indicator (uses the active org's accent). */
.org-tab.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 22px;
  height: 3px;
  border-radius: var(--radius-pill);
  background: var(--org-accent, var(--accent));
  transform: translateX(-50%) scaleX(1);
  transform-origin: center;
  transition: transform var(--motion-normal) var(--ease-out);
}

.org-tab:focus-visible {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 4px var(--focus-ring-glow);
}

/* Debug data toggle ------------------------------------------------------
   Footer-only, deliberately quiet. It swaps real launches for the bundled
   sample set, which is a debugging aid rather than a feature. */
.debug-toggle {
  cursor: pointer;
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px dashed rgba(255, 255, 255, 0.14);
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  opacity: 0.55;
  transition:
    opacity var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard);
}

.debug-toggle:hover,
.debug-toggle:focus-visible {
  opacity: 1;
  border-color: rgba(255, 255, 255, 0.28);
}

.debug-toggle.is-active {
  opacity: 1;
  border-style: solid;
  border-color: color-mix(in srgb, var(--warning) 55%, transparent);
  color: var(--warning);
}

/* Pressed but still waiting on the mirror. Shown immediately on click so the
   button can never look like it did nothing. */
.debug-toggle.is-busy {
  opacity: 1;
  cursor: progress;
  border-color: rgba(255, 193, 64, 0.45);
  color: #ffd98a;
  animation: debugBusy 1.1s var(--ease-standard) infinite;
}

.debug-toggle:disabled { pointer-events: none; }

/* ANIM-31 — the debug toggle breathes only while a debug load is in flight. */
@keyframes debugBusy {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@media (prefers-reduced-motion: reduce) {
  .debug-toggle.is-busy { animation: none; }
}

@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .debug-toggle.is-active { border-color: rgba(255, 209, 102, 0.55); }
}

/* Rolling refresh window -------------------------------------------------
   Replaces the old Refresh button. Updating is automatic, so this is a
   readout, not a control: no pointer cursor, no hover state, nothing to press. */
.refresh-window {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background-color: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.2;
  min-width: 0;
}

.refresh-window-text { overflow-wrap: anywhere; }

.refresh-window-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent);
}

.refresh-window[data-state="checking"] .refresh-window-dot {
  background-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
  animation: refreshPulse 1.4s var(--ease-standard) infinite;
}

.refresh-window[data-state="paused"] .refresh-window-dot {
  background-color: var(--warning);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warning) 18%, transparent);
}

/* ANIM-30 — the dot breathes only while a check is actually in flight. */
@keyframes refreshPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  .refresh-window[data-state="checking"] .refresh-window-dot { animation: none; }
}

@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .refresh-window-dot { box-shadow: none; }
}

/* More menu (native <details> disclosure) -------------------------------- */
.more-menu {
  position: relative;
  display: inline-block;
}

.more-menu > summary {
  list-style: none;
  cursor: pointer;
}

.more-menu > summary::-webkit-details-marker {
  display: none;
}

.more-menu-list {
  position: absolute;
  z-index: 60;
  top: calc(100% + 8px);
  left: 0;
  min-width: 200px;
  max-width: calc(100vw - 48px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.more-menu-item {
  cursor: pointer;
  text-align: left;
  border-radius: 10px;
  background-color: transparent;
  color: var(--text);
  padding: 9px 12px;
  font-size: 0.9rem;
  transition: background-color 0.16s ease;
}

.more-menu-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.more-menu-item:focus-visible {
  outline: none;
  background-color: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 0 0 1px var(--focus-ring);
}

/* Flip the menu above the button when vertical space is constrained
   (e.g. mobile landscape) so it never extends past the viewport bottom. */
@media (max-height: 480px) {
  .more-menu-list {
    top: auto;
    bottom: calc(100% + 8px);
  }
}

/* Mission overview ------------------------------------------------------- */
.overview {
  padding: 16px 18px;
}

.overview-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.overview-note {
  margin: 0;
  max-width: 48ch;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.overview-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.overview-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background-color: var(--panel-soft);
  color: var(--text);
  transition: transform 0.14s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.overview-tile strong {
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
}

.overview-tile span {
  color: var(--muted);
  font-size: 0.8rem;
}

button.overview-tile {
  cursor: pointer;
}

button.overview-tile:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background-color: rgba(255, 255, 255, 0.07);
}

button.overview-tile:focus-visible {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 4px var(--focus-ring-glow);
}

/* A quiet per-org accent line on the left edge of every provider tile so they
   stay distinguishable without becoming a rainbow wall. */
.overview-tile.is-org {
  border-left: 3px solid color-mix(in srgb, var(--org-accent, var(--accent)) 45%, transparent);
}

/* Selected tile: the accent BLENDS into the charcoal instead of filling the tile
   with flat colour. A soft diagonal gradient fades a light tint from the accent
   corner out to the normal panel surface, and the border stays mostly neutral
   with only a hint of accent — the same restrained feel as the Showing tile. */
.overview-tile.is-org[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--org-accent, var(--accent)) 24%, var(--line));
  border-left-color: color-mix(in srgb, var(--org-accent, var(--accent)) 70%, transparent);
  background-image: linear-gradient(
    135deg,
    color-mix(in srgb, var(--org-accent, var(--accent)) 14%, transparent) 0%,
    color-mix(in srgb, var(--org-accent, var(--accent)) 6%, transparent) 45%,
    transparent 100%
  );
}

/* Showing tile uses the same blended treatment with the neutral token. */
.overview-tile.is-showing {
  border-color: color-mix(in srgb, var(--org-all) 22%, var(--line));
  background-image: linear-gradient(
    135deg,
    color-mix(in srgb, var(--org-all) 12%, transparent) 0%,
    color-mix(in srgb, var(--org-all) 5%, transparent) 45%,
    transparent 100%
  );
}

/* Fallback for engines without color-mix(): keep tints faint and neutral-ish. */
@supports not (color: color-mix(in srgb, red, blue)) {
  .overview-tile.is-org[aria-pressed="true"],
  .overview-tile.is-showing {
    background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.07), transparent 60%);
    border-color: var(--line-strong);
  }
}

/* Coverage note (shown only when an LL2 feed is truncated) --------------- */
.coverage-note {
  margin: 6px 0 0;
  color: var(--warning);
  font-size: 0.82rem;
}

.coverage-note[hidden] {
  display: none;
}

/* Footer ----------------------------------------------------------------- */
.footer-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-title {
  font-size: 0.98rem;
  color: var(--text);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.footer-copy {
  margin-top: 4px;
  font-size: 0.82rem;
  opacity: 0.85;
}

.footer-meta {
  align-self: flex-end;
}

/* Mission insights --------------------------------------------------------- */
.insights {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.insights-toggle {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background-color: transparent;
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.insights-toggle:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
}

.insights-toggle:focus-visible {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 3px var(--focus-ring-glow);
}

.insights-chevron {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform 0.18s ease;
}

.insights-toggle[aria-expanded="true"] .insights-chevron {
  transform: rotate(180deg);
}

.insights-body {
  margin-top: 10px;
}

.insights-body[hidden] {
  display: none;
}

.insights-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.insights-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.insight-chip {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background-color: rgba(255, 255, 255, 0.035);
  font-size: 0.8rem;
  color: var(--muted);
}

.insight-chip strong {
  color: var(--text);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

/* Webcast availability ----------------------------------------------------- */
/* Honest styling only: "Webcast available" normally; "Check live webcast" with
   a restrained pulse inside the near-launch window. Never a LIVE claim. The
   global prefers-reduced-motion rule disables the pulse animation. */
@keyframes webcastPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 128, 142, 0.35); }
  50% { box-shadow: 0 0 0 5px rgba(255, 128, 142, 0); }
}

.webcast-link.is-near-launch {
  border-color: rgba(255, 128, 142, 0.55);
  color: #ffd2d8;
  animation: webcastPulse 2.4s ease-in-out infinite;
}

/* Launch pad map (details modal) ------------------------------------------- */
.pad-map {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  background-color: rgba(255, 255, 255, 0.03);
}

.pad-map-heading {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.pad-map-place {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.pad-map-attribution {
  margin: 10px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.pad-map-attribution a {
  color: var(--accent);
  text-decoration: none;
}

.pad-map-attribution a:hover {
  text-decoration: underline;
}

/* About this data + status legend ----------------------------------------- */
/* Utility dialogs: About this data, Mission status legend ------------------
   Both were rendering into the mission-details panel, which is 1120px wide
   because a launch has a photograph and four columns of facts. A legend and a
   provenance sheet do not, so they sat in a third of their own panel with the
   rest empty. Each one now asks for the width it actually needs. */
.modal-panel.is-narrow {
  width: min(720px, calc(100vw - 48px));
}

.modal-panel.is-medium {
  width: min(920px, calc(100vw - 48px));
}

/* A dialog header: the title at utility size rather than mission-detail size,
   with the subtitle bound to it, and room kept clear of the close control. */
.dialog-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 44px;
  margin-bottom: 4px;
}

.dialog-title {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.dialog-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Headline counts. A handful of numbers is a row of stat tiles, not a grid row
   of label/value pairs at body weight, which is what buried them before. */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-3);
}

.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: var(--border-subtle);
  border-radius: var(--radius-md);
  background-color: var(--panel-soft);
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 650;
  line-height: 1.05;
  /* Proportional figures: tabular widths make a short number look loose at
     display sizes, and nothing here has to align into a column. */
  font-variant-numeric: proportional-nums;
}

.stat-label {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

/* Zero requests from the reader's browser is the point of publishing the file,
   so it reads as a settled fact rather than as a warning. */
.stat-tile.is-quiet .stat-value {
  color: var(--success);
}

/* Two tiles fit across a phone but three do not, which left the third as an
   orphan beside a gap. It spans the row instead, laid out on one line. */
@media (max-width: 560px) {
  .stat-row {
    grid-template-columns: 1fr 1fr;
  }

  .stat-tile:last-child {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: baseline;
    gap: 10px;
  }
}

.about-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 720px) {
  .about-cols {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
  }
}

.about-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.about-subhead {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Label above value, with a hairline between rows so the pairs stay grouped
   without needing a box around each one. */
.fact-list {
  margin: 0;
  display: flex;
  flex-direction: column;
}

.fact-list > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.fact-list > div:first-child {
  border-top: 0;
  padding-top: 2px;
}

.fact-list dt {
  color: var(--muted);
  font-size: 0.76rem;
}

.fact-list dd {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
}

/* The hourly request budget is one ratio against a limit, so it is a meter.
   The track is a dim step of the fill's own colour so the state reads across
   the whole bar, and the figure and caption repeat the same fact in words, so
   colour is never the only thing reporting how close the cap is. */
.budget {
  --budget-hue: var(--accent);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border: var(--border-subtle);
  border-radius: var(--radius-md);
  background-color: var(--panel-soft);
}

.budget.is-tight {
  --budget-hue: var(--warning);
}

.budget.is-over {
  --budget-hue: var(--danger);
}

.budget-figure {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.budget-figure strong {
  font-size: 1.5rem;
  font-weight: 650;
  line-height: 1;
  color: var(--budget-hue);
}

.budget-figure span {
  color: var(--muted);
  font-size: 0.85rem;
}

.budget-track {
  height: 6px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background-color: color-mix(in srgb, var(--budget-hue) 16%, transparent);
}

.budget-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background-color: var(--budget-hue);
}

.budget-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.about-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.about-foot {
  margin: 0;
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

/* Status legend ----------------------------------------------------------- */
.legend-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.legend-group-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* A real column for the pills rather than a min-width on them. The old form
   let the two longest labels push past their minimum, so the descriptions
   started at four different x positions down the list. */
.legend-row {
  display: grid;
  grid-template-columns: 152px 1fr;
  align-items: center;
  gap: 14px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}

.legend-row:first-child {
  border-top: 0;
}

.legend-row .badge {
  width: 100%;
  min-width: 0;
  justify-content: center;
}

.legend-copy {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.legend-note {
  margin: 0;
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}

@media (max-width: 520px) {
  .legend-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .legend-row .badge {
    width: auto;
    justify-self: start;
  }
}

/* ===== v3.3 interface & motion polish ==================================== */

/* Active-filter summary --------------------------------------------------- */
.active-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: var(--border-subtle);
  border-radius: var(--radius-md);
  background-color: rgba(255, 255, 255, 0.04);
  animation: motionRiseIn var(--motion-fast) var(--ease-out) both;
}
.active-filters[hidden] { display: none; }

.active-filters-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.active-filters-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.active-filter-chip {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: var(--border-subtle);
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.active-filters-clear {
  margin-left: auto;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 128, 142, 0.5);
  background-color: rgba(255, 128, 142, 0.08);
  color: #ffc1c9;
  font-size: 0.76rem;
  transition: background-color var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard);
}
.active-filters-clear:hover {
  background-color: rgba(255, 128, 142, 0.16);
  border-color: rgba(255, 128, 142, 0.75);
}
.active-filters-clear:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 128, 142, 0.28);
}

/* Skeleton loading states ------------------------------------------------- */
.placeholder-media {
  height: 150px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.1), rgba(255,255,255,0.04));
  background-size: 220% 100%;
  animation: shimmer 1.6s linear infinite;
  margin: -18px -18px 4px;
}

.placeholder-block {
  height: 56px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.1), rgba(255,255,255,0.04));
  background-size: 220% 100%;
  animation: shimmer 1.6s linear infinite;
}

.spotlight-skeleton { min-height: 280px; gap: var(--space-3); }

.overview-tile.is-skeleton,
.insight-chip.is-skeleton {
  pointer-events: none;
}
.overview-tile.is-skeleton .skeleton-num,
.overview-tile.is-skeleton .skeleton-label,
.insight-chip.is-skeleton {
  display: block;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.1), rgba(255,255,255,0.04));
  background-size: 220% 100%;
  animation: shimmer 1.6s linear infinite;
}
.overview-tile.is-skeleton .skeleton-num { width: 40%; height: 1.3rem; margin-bottom: 6px; }
.overview-tile.is-skeleton .skeleton-label { width: 80%; height: 0.7rem; }
.insight-chip.is-skeleton { height: 38px; }

/* Reduced-motion: static skeleton blocks (no shimmer movement). */
@media (prefers-reduced-motion: reduce) {
  .placeholder-line,
  .placeholder-pill,
  .placeholder-media,
  .placeholder-block,
  .overview-tile.is-skeleton .skeleton-num,
  .overview-tile.is-skeleton .skeleton-label,
  .insight-chip.is-skeleton {
    animation: none !important;
    background: rgba(255, 255, 255, 0.06) !important;
  }
}

/* Featured-mission emphasis ---------------------------------------------- */
/* Restrained final-hour countdown emphasis (gentle pulse, not a strobe). */
@keyframes finalHourPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 209, 102, 0); }
  50% { box-shadow: 0 0 0 4px rgba(255, 209, 102, 0.18); }
}
.countdown-ring.is-final-hour {
  border-color: rgba(255, 209, 102, 0.5);
  animation: finalHourPulse 2.6s var(--ease-standard) infinite;
}

/* Subtle "Go for Launch" emphasis on the spotlight status badge. */
.badge.status-go-emphasis {
  border-color: rgba(98, 215, 163, 0.5);
  box-shadow: 0 0 0 1px rgba(98, 215, 163, 0.25);
}

/* Provider-accent edge on the featured-mission card. */
.next-launch-card[data-accent="nasa"] { --card-accent: var(--org-nasa); }
.next-launch-card[data-accent="spacex"] { --card-accent: var(--org-spacex); }
.next-launch-card[data-accent="blue-origin"] { --card-accent: var(--org-blueorigin); }
.next-launch-card[data-accent="rocket-lab"] { --card-accent: var(--org-rocketlab); }
.next-launch-card[data-accent="ula"] { --card-accent: var(--org-ula); }
.next-launch-card[data-accent="firefly"] { --card-accent: var(--org-firefly); }
.next-launch-card[data-accent] {
  border-top: 2px solid color-mix(in srgb, var(--card-accent, var(--accent)) 60%, transparent);
}

/* Button press feedback (pointer devices). */
@media (hover: hover) {
  .btn:active,
  .card-link:active,
  .favorite-btn:active,
  .overview-tile:active {
    transform: translateY(1px);
  }
}

/* ===== v3.3.1 launch-stabilization polish ============================== */

/* Long-text wrapping guards (prevent overflow without shrinking type). */
.spotlight-title,
.launch-card h3,
.saved-card h3,
.details-title,
.card-facts dd,
.spotlight-facts dd,
.details-grid dd,
.pad-map-place,
.weather-grid dd {
  overflow-wrap: anywhere;
  min-width: 0;
}

/* Flex/grid children must be allowed to shrink so nothing forces desktop width. */
.hero-copy,
.spotlight-copy,
.launch-card-body,
.overview-tile,
.insight-chip,
.field,
.saved-card,
.details-grid > div {
  min-width: 0;
}

/* Organization-color customization panel --------------------------------- */
.customize-intro {
  margin: 0 0 var(--space-4);
  color: var(--muted);
  font-size: 0.9rem;
}

.customize-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.customize-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-bottom: var(--space-3);
  border-bottom: var(--border-subtle);
}
.customize-row:last-child { border-bottom: 0; }

.customize-row-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.customize-dot {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-pill);
  background: var(--swatch, var(--accent));
  border: 1px solid rgba(255, 255, 255, 0.35);
  flex: 0 0 auto;
}

.customize-org { font-weight: 600; }

.customize-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.swatch {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: var(--swatch);
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  padding: 0;
  transition: transform var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard);
}
@media (hover: hover) {
  .swatch:hover { transform: scale(1.12); }
}
.swatch.is-selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.5), 0 0 0 4px var(--swatch);
}
.swatch:focus-visible {
  outline: none;
  border-color: #fff;
  box-shadow: 0 0 0 3px var(--focus-ring-glow);
}

.swatch-custom {
  display: inline-flex;
  align-items: center;
}
.swatch-custom input[type="color"] {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-pill);
  background: transparent;
  cursor: pointer;
}

.customize-actions {
  margin-top: var(--space-5);
  display: flex;
  justify-content: flex-end;
}

/* Overview labels wrap rather than clip; provider name is never cut off. */
.overview-tile span {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

/* ===== v3.4.1 startup sequence (ANIM-01 / ANIM-02) ====================== */

/* While booting, the dashboard is held back so the title hand-off reads cleanly.
   `.is-booting` is added by JS only, so no-JS visitors always see content. */
.is-booting body { overflow: hidden; }
.is-booting .shell { opacity: 0; }
.is-booting .hero-copy h1 { opacity: 0; }

/* The overlay sits ON the real page background: the body gradient and the live
   starfield canvas show straight through, so the startup screen is the same
   space scene the dashboard uses — only a soft vignette is added for focus. */
.boot {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: var(--space-5);
  text-align: center;
  background: radial-gradient(120% 80% at 50% 45%, transparent 30%, rgba(6, 7, 10, 0.55) 100%);
  transition: opacity var(--motion-slow) var(--ease-out);
}

.boot[hidden] { display: none; }

/* The head gate adds .is-booting before first paint, so the overlay must be
   visible from that moment — before js/boot.js has even parsed. */
html.is-booting .boot[hidden] { display: grid; }

/* The backdrop fades while the title is still travelling to the hero. */
.boot.is-lifting { opacity: 0; }
.boot.is-done { opacity: 0; pointer-events: none; }

.boot-title {
  display: inline-block;
  max-width: 100%;
  font-size: clamp(1.6rem, 5.2vw, 3.6rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  /* The dimmed tone the shimmer sweeps over, applied from the first frame.
     The gradient used to arrive with a JS-added class 420ms in, so the title
     painted solid white first and then visibly flipped to the animation. The
     paint is identical from the start now; only the moving highlight is
     switched on later. */
  color: #8b94a3;
  /* Phase 1: rise + fade in. */
  animation: bootTitleIn 420ms var(--ease-out) both;
  will-change: transform, opacity;
}

@keyframes bootTitleIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Phase 2: the "thinking" shimmer — the letters stay fully visible in a dimmed
   tone and a BRIGHT band travels across them.
   BUGFIX: this previously used `background-repeat: no-repeat` with an offset
   position, so most of the text sat outside the gradient box and — because the
   glyphs are painted from that background — went transparent. Tiling the
   gradient guarantees every glyph always has paint under it. */
/* Two layers, because the highlight and the base colour have different jobs.
   The bottom layer is a flat wash that covers the whole title, so with
   -webkit-text-fill-color: transparent every glyph always has paint. The top
   layer is the moving glow: narrow, non-repeating, and positioned entirely off
   the left edge at rest, so the sweep always begins outside the text instead of
   sitting on top of it. The previous tiled gradient could not do this: a
   repeating image has a copy over the glyphs at every offset, so the glow was
   already mid-text the moment the animation started. */
.boot-title.is-shimmering {
  background-image:
    linear-gradient(
      100deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0.35) 35%,
      rgba(255, 255, 255, 1) 50%,
      rgba(255, 255, 255, 0.35) 65%,
      rgba(255, 255, 255, 0) 100%
    ),
    linear-gradient(#8b94a3, #8b94a3);
  /* The wash is oversized and centred rather than exactly the padding box.
     line-height is 1.05 while the font's content area is nearer 1.2em, so a
     descender can sit below the box; a box-sized wash would leave that ink
     unpainted, which is the same disappearing-glyph failure the old tiled
     gradient was guarding against. */
  background-size: 60% 100%, 140% 200%;
  background-repeat: no-repeat, no-repeat;
  /* -160% puts the 60%-wide glow fully clear of the left edge before it moves. */
  background-position: -160% 0, center center;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: bootShimmer 1600ms linear infinite;
}

/* Off the left edge, across, and off the right edge. The base layer never
   moves, so the letters stay painted for the whole sweep. */
@keyframes bootShimmer {
  from { background-position: -160% 0, center center; }
  to   { background-position: 260% 0, center center; }
}

/* Engines without text background-clip keep solid, readable text. */
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .boot-title.is-shimmering {
    -webkit-text-fill-color: currentColor;
    color: var(--text);
    animation: none;
  }
}

/* Loading row: spinner + label, revealed just after the title. */
.boot-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  max-width: 100%;
}

.boot-loading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity var(--motion-normal) var(--ease-out),
    transform var(--motion-normal) var(--ease-out);
}

.boot-loading.is-visible { opacity: 1; transform: translateY(0); }
.boot-loading.is-leaving { opacity: 0; transform: translateY(-4px); }

.boot-spinner {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-pill);
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--text);
  animation: bootSpin 720ms linear infinite;
}

/* The startup spinner's own keyframes. It used to borrow refreshSpin from the
   Refresh button, and when that button and its keyframes were removed the
   spinner was left naming an animation that no longer existed, so it sat still.
   Owning the keyframes here means cleaning up some other control can never
   stop it again. */
@keyframes bootSpin {
  to { transform: rotate(360deg); }
}

/* "Loaded" beat: the spinner swaps for a check before the title flies home. */
.boot-check {
  display: none;
  color: var(--success);
  font-size: 1.05rem;
  line-height: 1;
  animation: motionScaleIn var(--motion-normal) var(--ease-spring) both;
}

.boot-loading.is-loaded .boot-spinner { display: none; }
.boot-loading.is-loaded .boot-check { display: inline-block; }
.boot-loading.is-loaded .boot-loading-text { color: var(--text); }

.boot-loading-text {
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Phase 4: the dashboard sections reveal in a short, capped stagger. */
.is-booted .shell > * {
  animation: motionRiseIn var(--motion-slow) var(--ease-out) both;
}
.is-booted .shell > *:nth-child(1) { animation-delay: 0ms; }
.is-booted .shell > *:nth-child(2) { animation-delay: 70ms; }
.is-booted .shell > *:nth-child(3) { animation-delay: 140ms; }
.is-booted .shell > *:nth-child(4) { animation-delay: 210ms; }
.is-booted .shell > *:nth-child(n + 5) { animation-delay: 280ms; }

/* The hero heading fades up as the boot title lands on it. */
.is-booted .hero-copy h1 {
  animation: bootTitleIn var(--motion-normal) var(--ease-out) both;
}

@media (prefers-reduced-motion: reduce) {
  .boot,
  .boot-title,
  .is-booted .shell > *,
  .is-booted .hero-copy h1 {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .is-booting .shell,
  .is-booting .hero-copy h1 { opacity: 1 !important; }
}

/* ===== v3.4.1 motion layer ==============================================
   Every animation is numbered (ANIM-nn) and described in ANIMATIONS.md.
   All of them are transform/opacity based (compositor-friendly) and all are
   neutralised by the global prefers-reduced-motion rule in base.css.        */

/* ANIM-14 — Button sheen sweep. A soft light band crosses the button on hover,
   giving the flat gray surface a sense of material without changing colour. */
.btn::after,
.card-link::after,
.favorite-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 80%
  );
  background-size: 220% 100%;
  background-position: 180% 0;
  opacity: 0;
  transition: opacity var(--motion-fast) var(--ease-standard);
}

.card-link,
.favorite-btn {
  position: relative;
  overflow: hidden;
}

@media (hover: hover) {
  .btn:hover::after,
  .card-link:hover::after,
  .favorite-btn:hover::after {
    opacity: 1;
    /* `forwards` leaves the highlight parked at the left edge instead of
       snapping back to its start position on the right when the sweep ends. */
    animation: sheenSweep var(--motion-emphasis) var(--ease-out) forwards;
  }
}

@keyframes sheenSweep {
  from { background-position: 180% 0; }
  to   { background-position: -80% 0; }
}

/* ANIM-06 — Launch-card press. A tiny settle so taps feel physical. */
.launch-card:active {
  transform: translateY(-1px) scale(0.995);
}

/* ANIM-08 — Countdown tick. The hero countdown breathes once whenever its
   value actually changes (driven by JS adding .is-ticking), never every frame. */
@keyframes countdownTick {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.details-countdown strong.is-ticking {
  animation: countdownTick var(--motion-normal) var(--ease-spring);
}

/* ANIM-11 — Overview tile hover: lift plus a faint accent bloom from the left
   edge, so the provider identity strengthens on hover without shouting. */
.overview-tile {
  position: relative;
  overflow: hidden;
}

.overview-tile.is-org::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    120deg,
    color-mix(in srgb, var(--org-accent, var(--accent)) 18%, transparent),
    transparent 65%
  );
  transition: opacity var(--motion-normal) var(--ease-standard);
}

@media (hover: hover) {
  button.overview-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
  }
  button.overview-tile.is-org:hover::after { opacity: 1; }
}

/* ANIM-12 — Count bump. When a tile's number changes the digits pop briefly,
   so a filter change is felt as well as read (pairs with the JS roll-up). */
@keyframes countBump {
  0%   { transform: translateY(0) scale(1); }
  35%  { transform: translateY(-2px) scale(1.08); }
  100% { transform: translateY(0) scale(1); }
}

.overview-tile strong.is-bumped {
  display: inline-block;
  animation: countBump var(--motion-normal) var(--ease-spring);
}

/* ANIM-13 — Insights chips cascade in when the section is expanded. The delay
   is capped so the last chip never feels late. */
.insights-body.is-revealing .insight-chip {
  animation: motionRiseIn var(--motion-normal) var(--ease-out) both;
}
.insights-body.is-revealing .insight-chip:nth-child(1)  { animation-delay: 0ms; }
.insights-body.is-revealing .insight-chip:nth-child(2)  { animation-delay: 30ms; }
.insights-body.is-revealing .insight-chip:nth-child(3)  { animation-delay: 60ms; }
.insights-body.is-revealing .insight-chip:nth-child(4)  { animation-delay: 90ms; }
.insights-body.is-revealing .insight-chip:nth-child(5)  { animation-delay: 120ms; }
.insights-body.is-revealing .insight-chip:nth-child(n + 6) { animation-delay: 150ms; }

/* ANIM-16 — Save confetti. The button no longer jumps; a small burst of
   particles fires out of the (now gold) star instead. */
.fav-star {
  position: relative;
  display: inline-block;
  margin-right: 6px;
  line-height: 1;
}

/* Saved = green pill, gold star. */
.favorite-btn.is-active .fav-star { color: #ffcf5c; }

.favorite-btn.is-bursting { overflow: visible; }

.confetti-bit {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  pointer-events: none;
  opacity: 0;
  animation: confettiFly 640ms var(--ease-out) var(--delay, 0ms) forwards;
}

.confetti-bit[data-tone="0"] { background: #ffcf5c; }
.confetti-bit[data-tone="1"] { background: var(--success); }
.confetti-bit[data-tone="2"] { background: #ffffff; }
.confetti-bit[data-tone="3"] { background: #ffa94d; }

@keyframes confettiFly {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) translate(0, 0) scale(0.6) rotate(0deg);
  }
  70% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) translate(var(--dx, 0), var(--dy, 0)) scale(1) rotate(var(--spin, 90deg));
  }
}

/* ANIM-17 — Remove collapse. A saved card shrinks and fades before it goes, so
   items never vanish abruptly from the drawer. */
@keyframes removeCollapse {
  from { opacity: 1; transform: translateX(0) scale(1); max-height: 320px; }
  to   { opacity: 0; transform: translateX(14px) scale(0.97); max-height: 0; }
}

.saved-card.is-removing {
  overflow: hidden;
  animation: removeCollapse var(--motion-normal) var(--ease-standard) forwards;
}


/* Reduced motion: strip the decorative layers entirely (the global rule already
   zeroes durations; this removes the elements/effects that would still show). */
@media (prefers-reduced-motion: reduce) {
  .btn::after,
  .card-link::after,
  .favorite-btn::after,
  .overview-tile.is-org::after {
    display: none !important;
  }
  .saved-card.is-removing { animation: none !important; opacity: 0.4 !important; }
}

/* ANIM-29 — Segmented countdown (days : hrs : min : sec) with rolling digits.
   Only the units that actually change are re-rendered and animated, so the
   per-second ticker stays cheap even with the details modal open. */
.countdown-units {
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}

.cd-unit {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: 2.1ch;
}

.cd-value {
  display: block;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  will-change: transform;
}

.cd-label {
  margin-top: 3px;
  font-style: normal;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.cd-sep {
  align-self: flex-start;
  margin-top: 1px;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--muted);
  opacity: 0.55;
}

/* The digit rolls up and fades in as it changes. */
@keyframes countdownRoll {
  0%   { opacity: 0; transform: translateY(72%); }
  55%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0); }
}

.cd-value.is-rolling {
  animation: countdownRoll var(--motion-fast) var(--ease-out);
}

/* Fallback display once a launch time has passed / is unknown. */
.countdown-flat {
  display: block;
  font-size: 1.2rem;
  line-height: 1.1;
}

@media (prefers-reduced-motion: reduce) {
  .cd-value.is-rolling { animation: none !important; }
}

@media (max-width: 520px) {
  .cd-value { font-size: 1.2rem; }
  .countdown-units { gap: 2px; }
}

/* Compact segmented countdown used on launch cards + the saved drawer. */
.countdown-units.is-compact { gap: 3px; }
.countdown-units.is-compact .cd-value { font-size: 0.95rem; font-weight: 600; }
.countdown-units.is-compact .cd-label { font-size: 0.5rem; margin-top: 1px; }
.countdown-units.is-compact .cd-sep { font-size: 0.85rem; }
.countdown-flat.is-compact { font-size: 0.9rem; }

/* The card status row now pairs the status badge with the live countdown. */
.card-status-row { flex-wrap: wrap; row-gap: 6px; }
.card-status-row .countdown-units { margin-left: auto; }

/* Saved-drawer cards get the compact countdown under the location line. */
.saved-card .countdown-units { align-self: flex-start; }

/* The details modal reuses the full-size segmented countdown. */
.details-countdown .countdown-units { justify-content: flex-start; }

/* FIX: "All mission types" and similar long option labels were clipped because
   the select fields were too narrow once the 34px arrow gutter was reserved.
   Give the control fields room to fit their longest label, and let the search
   field take a bigger share so the typewriter hint is never truncated. */
.field { min-width: 168px; }
.field-search { flex: 3 1 300px; min-width: 260px; }

/* ===== Previous launches panel ========================================== */
.previous-note {
  margin: 0 0 var(--space-4);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}
.previous-note.is-error { color: #ffc1c9; }

.previous-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.previous-item {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  padding-left: calc(var(--space-4) + 4px);
  border: var(--border-subtle);
  border-radius: var(--radius-md);
  background-color: rgba(255, 255, 255, 0.03);
  transition: border-color var(--motion-normal) var(--ease-standard);
}

@media (hover: hover) {
  .previous-item:hover {
    border-color: color-mix(in srgb, var(--card-accent, var(--accent)) 40%, transparent);
  }
}

/* Detail view inside the panel ------------------------------------------- */
/* .details-content is a flex column, so a bare button would stretch the full
   width and run under the absolutely-positioned close control. Shrink it to
   its label and keep the top-right corner clear for the ✕. */
.previous-back {
  align-self: flex-start;
  width: auto;
  max-width: calc(100% - 52px);
  margin-bottom: var(--space-2);
}

.previous-detail-head {
  position: relative;
  padding-left: calc(var(--space-3) + 4px);
}

.previous-detail-head[data-accent]::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: var(--radius-sm);
  background: var(--accent-1, transparent);
  opacity: 0.8;
}
/* The split gradient comes from the [data-accent-bands] rules above. */

.previous-name {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.previous-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.previous-meaning {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text);
  opacity: 0.85;
}

.previous-cause {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-left: 3px solid var(--danger);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background-color: rgba(255, 128, 142, 0.08);
  font-size: 0.86rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.previous-nowatch {
  align-self: center;
  color: var(--muted);
  font-size: 0.82rem;
}

/* Outcome badges — green / amber / red, matching the status language. */
.badge.outcome-success {
  background-color: rgba(98, 215, 163, 0.2);
  border-color: transparent;
  color: #c9ffe6;
}
.badge.outcome-partial {
  background-color: rgba(255, 209, 102, 0.22);
  border-color: transparent;
  color: #ffe7a5;
}
.badge.outcome-failure {
  background-color: rgba(255, 128, 142, 0.22);
  border-color: transparent;
  color: #ffc1c9;
}
.badge.outcome-unknown {
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

/* Partial-failure status badge on regular cards (LL2 status id 7). */
.badge.status-partial {
  background-color: rgba(255, 209, 102, 0.22);
  border-color: transparent;
  color: #ffe7a5;
}

/* The wider desktop modal can afford a two-column detail grid. */
@media (min-width: 900px) {
  .details-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* The panel is wide enough for a fourth column at this size, which shortens the
   details view enough that it usually fits without scrolling. */
@media (min-width: 1180px) {
  .details-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
