/**
 * meridian-astro-surface.css — styling for the D1/D2/D3 sky-ledger surface. It rides
 * ENTIRELY on the existing --mer-* tokens (declared on .meridian-sky in base.css), so
 * it inherits the instrument's day/deck/night palette automatically. Component-local
 * import (from MeridianAstroSurface.tsx); no scanned scene-surface file is touched.
 */

.mer-astro-surface {
  max-width: 720px;
  margin: 0.75rem auto 1.5rem;
  padding: 0 1rem;
  color: hsl(var(--mer-ink));
  font-family: inherit;
  /* ZOOM-SCOPE (Part 1): kill browser viewport pinch-zoom across the WHOLE astro
     section (header + body), so a pinch can never scale the page here. Scoped to
     this section only — the separate MeridianSky instrument tree keeps its own
     `touch-action: pinch-zoom` affordance, and the rest of the app is untouched.
     Single-finger vertical scroll still works (pan-y). */
  touch-action: pan-y;
}

/* Subtle per-deploy build stamp at the foot of the ledger (freshness witness). */
.mer-astro-buildstamp {
  margin-top: 0.55rem;
  text-align: right;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  color: hsl(var(--mer-ink-dim) / 0.45);
  user-select: none;
}

/* ── Progressive-disclosure toggle ─────────────────────────────────────────── */
.mer-astro-toggle {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  padding: 0.85rem 0.95rem 0.85rem;
  /* ELEVATED CARD (visibility pass 2). The prior treatment tinted the black page with
     accent at 0.07–0.13 alpha and was imperceptible at arm's length. This is now an
     OPAQUE raised surface — a clearly-lighter deep-slate/blue card that reads as an
     object sitting ON the black page, with a real 2px luminous edge, an outer drop
     shadow for lift, and an inset top highlight to sell the raised-object read.
     Colours are opaque (no page bleed-through) so the card's boundary is obvious. */
  background: linear-gradient(
    180deg,
    hsl(212 34% 20%) 0%,
    hsl(214 38% 15%) 55%,
    hsl(216 42% 12%) 100%
  );
  border: 2px solid hsl(var(--mer-accent) / 0.7);
  border-radius: 0.7rem;
  color: hsl(var(--mer-ink));
  cursor: pointer;
  text-align: left;
  box-shadow:
    0 1px 0 hsl(200 60% 88% / 0.22) inset,
    0 0 0 1px hsl(216 45% 8%) inset,
    0 6px 18px hsl(0 0% 0% / 0.55),
    0 0 22px hsl(var(--mer-accent) / 0.18);
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease,
    transform 0.1s ease;
}
.mer-astro-toggle:active {
  transform: translateY(1px);
  box-shadow:
    0 1px 0 hsl(200 60% 88% / 0.18) inset,
    0 3px 10px hsl(0 0% 0% / 0.5);
}
/* The title/subtitle/chevron row — keeps the original baseline-aligned header layout. */
.mer-astro-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
}
.mer-astro-toggle.has-preview:hover {
  border-color: hsl(var(--mer-accent) / 0.9);
}

/* ── Collapsed preview: mini day band + live next-event line ─────────────────── */
.mer-astro-preview {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.mer-astro-mini {
  width: 100%;
  height: 20px;
  display: block;
  border-radius: 4px;
  /* A crisp inset-style ring + lift so the band reads as a recessed strip inside the
     elevated card, not a floating rectangle on black. */
  box-shadow:
    0 0 0 1px hsl(200 60% 88% / 0.18),
    0 1px 3px hsl(0 0% 0% / 0.4);
}
/* Contrast halo beneath every marker — a bright ring with a dark separator stroke so
   the coloured disc is legible over BOTH the pale day band and the dark night band. */
.mer-astro-mini-halo {
  fill: hsl(216 40% 10% / 0.85);
  stroke: hsl(200 55% 94%);
  stroke-width: 1.4;
}
.mer-astro-mini-sun {
  fill: hsl(var(--mer-sun));
  stroke: hsl(216 45% 8%);
  stroke-width: 1;
}
.mer-astro-mini-moon {
  fill: hsl(var(--mer-moon));
  stroke: hsl(216 45% 8%);
  stroke-width: 1;
}
.mer-astro-nextline {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: var(--mer-fs-tick);
}
.mer-astro-next-label {
  color: hsl(var(--mer-ink));
  font-weight: 600;
}
.mer-astro-next-in {
  color: hsl(var(--mer-brass-bright));
  font-variant-numeric: tabular-nums;
}
.mer-astro-next-angler {
  color: hsl(var(--mer-ink-dim));
  font-style: italic;
  font-weight: 400;
}
.mer-astro-hint {
  margin-left: auto;
  padding: 0.05rem 0.4rem;
  font-size: var(--mer-fs-tick);
  color: hsl(var(--mer-accent));
  background: hsl(var(--mer-accent) / 0.12);
  border: 1px solid hsl(var(--mer-accent) / 0.35);
  border-radius: 0.35rem;
  letter-spacing: 0.03em;
  animation: mer-hint-pulse 2.2s ease-in-out infinite;
}
@keyframes mer-hint-pulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}
.mer-astro-toggle:hover {
  background: linear-gradient(
    180deg,
    hsl(212 34% 23%) 0%,
    hsl(214 38% 17%) 55%,
    hsl(216 42% 13%) 100%
  );
  border-color: hsl(var(--mer-accent) / 0.9);
}
.mer-astro-toggle.is-open {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.mer-astro-toggle-title {
  font-size: var(--mer-fs-title);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: hsl(var(--mer-brass-bright));
}
.mer-astro-toggle-sub {
  font-size: var(--mer-fs-label);
  color: hsl(var(--mer-ink-dim));
  flex: 1;
}
/* PERMANENT thumb-sized expand control at the RIGHT edge — a filled brass pill that
   always reads as a button (not a one-time hint / decorative glyph). ~2.4rem tap
   target, opaque so it stands off the card, rotates 180° on open, and has a clear
   PRESSED state driven by the parent button's :active. */
.mer-astro-chev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  flex: 0 0 auto;
  border-radius: 50%;
  color: hsl(216 45% 12%);
  background: linear-gradient(
    180deg,
    hsl(var(--mer-brass-bright)) 0%,
    hsl(var(--mer-brass)) 100%
  );
  border: 2px solid hsl(var(--mer-brass-bright));
  box-shadow:
    0 1px 0 hsl(44 90% 92% / 0.6) inset,
    0 2px 6px hsl(0 0% 0% / 0.45);
  transition: transform 0.2s ease, background 0.18s ease, box-shadow 0.12s ease;
}
.mer-astro-chev svg {
  width: 18px;
  height: 18px;
}
.mer-astro-toggle:hover .mer-astro-chev {
  background: linear-gradient(
    180deg,
    hsl(44 82% 80%) 0%,
    hsl(40 50% 62%) 100%
  );
}
/* PRESSED state — the pill visibly depresses when the bar is tapped. */
.mer-astro-toggle:active .mer-astro-chev {
  background: linear-gradient(
    180deg,
    hsl(40 50% 58%) 0%,
    hsl(40 44% 50%) 100%
  );
  box-shadow:
    0 1px 3px hsl(0 0% 0% / 0.4) inset;
  transform: scale(0.94);
}
.mer-astro-toggle.is-open .mer-astro-chev {
  transform: rotate(180deg);
}
.mer-astro-toggle.is-open:active .mer-astro-chev {
  transform: rotate(180deg) scale(0.94);
}

.mer-astro-body {
  border: 1px solid hsl(var(--mer-accent) / 0.22);
  border-top: none;
  border-radius: 0 0 0.6rem 0.6rem;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  background: hsl(var(--mer-accent) / 0.03);
  /* ZOOM-SCOPE (Part 1): the two zoomable surfaces apply their pinch transform
     per-element inside their own <svg> viewBox — correctly scoped to the graphic.
     But a two-finger pinch whose fingers (or centroid) land on the ledger, the
     caption text, or the controls below the graphic was falling through to the
     BROWSER's own viewport pinch-zoom (the viewport meta still permits
     maximum-scale=5), which scales the ENTIRE page — graphic AND everything below
     it — together. That is the "whole surface grows/shrinks" symptom the founder
     reproduced on a fresh bundle (it was never a stale-cache artifact, and never an
     app transform on a too-wide wrapper). `pan-y` disables pinch-zoom everywhere
     inside the astro body while still allowing single-finger vertical scroll, so the
     ONLY thing that responds to a pinch here is each SVG's own graphic-scoped
     transform. The ledger / captions / controls (DOM siblings OUTSIDE every
     transformed <svg>) now stay fixed under zoom. */
  touch-action: pan-y;
}

.mer-astro-empty {
  padding: 0.9rem;
  font-size: var(--mer-fs-label);
  color: hsl(var(--mer-ink-dim));
  border: 1px dashed hsl(var(--mer-accent) / 0.3);
  border-radius: 0.5rem;
}

/* ── D2 timeline ───────────────────────────────────────────────────────────── */
.mer-timeline,
.mer-starfield {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.mer-timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mer-timeline-title {
  font-size: var(--mer-fs-label);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: hsl(var(--mer-ink-dim));
}
.mer-timeline-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.mer-daylen {
  font-size: var(--mer-fs-tick);
  color: hsl(var(--mer-sun));
  font-variant-numeric: tabular-nums;
}
.mer-reset-btn {
  font-size: var(--mer-fs-tick);
  padding: 0.15rem 0.5rem;
  background: hsl(var(--mer-accent) / 0.14);
  border: 1px solid hsl(var(--mer-accent) / 0.4);
  border-radius: 0.35rem;
  color: hsl(var(--mer-accent));
  cursor: pointer;
}
.mer-reset-btn:hover {
  background: hsl(var(--mer-accent) / 0.24);
}

.mer-timeline-svg {
  width: 100%;
  height: 148px;
  display: block;
  touch-action: none;
  user-select: none;
  cursor: grab;
}
.mer-timeline-svg:active {
  cursor: grabbing;
}
.mer-starfield-svg {
  width: 100%;
  height: 240px;
  display: block;
  touch-action: none;
  user-select: none;
  cursor: grab;
  background: radial-gradient(
    ellipse 120% 90% at 50% 100%,
    hsl(222 46% 9%),
    hsl(230 48% 6%)
  );
  border-radius: 0.5rem;
}
.mer-starfield-svg:active {
  cursor: grabbing;
}

/* Hour + compass ticks */
.mer-hour-tick,
.mer-sf-tick {
  stroke: hsl(var(--mer-ink-dim) / 0.5);
  stroke-width: 1;
}
.mer-hour-label,
.mer-sf-compass {
  fill: hsl(var(--mer-ink-dim));
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.mer-sf-compass {
  font-weight: 600;
  letter-spacing: 0.05em;
}
.mer-sf-horizon {
  stroke: hsl(var(--mer-brass) / 0.55);
  stroke-width: 1.2;
}
/* Altitude-axis labels (Overhead / Horizon) — small, high-contrast against the dark
   star field so the vertical dimension reads without prior knowledge. */
.mer-sf-axis {
  fill: hsl(var(--mer-ink-dim));
  font-size: 9px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  paint-order: stroke;
  stroke: hsl(230 48% 6% / 0.9);
  stroke-width: 2px;
}
/* One-line orientation caption under the star-field header. */
.mer-sf-caption {
  font-size: var(--mer-fs-tick);
  color: hsl(var(--mer-ink-dim) / 0.9);
  line-height: 1.3;
}

/* Now indicator */
.mer-now-line {
  stroke: hsl(var(--mer-brass-bright));
  stroke-width: 1.6;
  stroke-dasharray: 3 3;
}
.mer-now-cap {
  fill: hsl(var(--mer-brass-bright));
}

/* Moonless window band */
.mer-moonless {
  fill: hsl(var(--mer-ink) / 0.05);
  stroke: hsl(var(--mer-moonglade) / 0.6);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}
.mer-moonless-label {
  fill: hsl(var(--mer-moonglade));
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}

/* Event markers */
.mer-marker-tick {
  stroke-width: 1.4;
}
.mer-marker-dot {
  stroke: none;
}
.mer-marker-label {
  font-size: 10px;
  font-weight: 600;
  fill: hsl(var(--mer-ink));
}
.mer-marker-time {
  font-size: 9.5px;
  fill: hsl(var(--mer-ink-dim));
  font-variant-numeric: tabular-nums;
}
.mer-marker-angler {
  font-size: 8.5px;
  font-style: italic;
  fill: hsl(var(--mer-ink-dim) / 0.85);
}
.mer-mk-sun .mer-marker-tick { stroke: hsl(var(--mer-sun)); }
.mer-mk-sun .mer-marker-dot { fill: hsl(var(--mer-sun)); }
.mer-mk-twilight .mer-marker-tick { stroke: hsl(28 60% 60%); }
.mer-mk-twilight .mer-marker-dot { fill: hsl(28 60% 60%); }
.mer-mk-moon .mer-marker-tick { stroke: hsl(var(--mer-moon)); }
.mer-mk-moon .mer-marker-dot { fill: hsl(var(--mer-moon)); }
.mer-marker.is-selected .mer-marker-dot {
  filter: drop-shadow(0 0 4px currentColor);
}
.mer-marker.is-selected .mer-marker-label {
  fill: hsl(var(--mer-brass-bright));
}

/* Stars */
.mer-star-dot {
  fill: hsl(var(--mer-star));
}
.mer-star.is-selected .mer-star-dot {
  fill: hsl(var(--mer-star-warm));
  filter: drop-shadow(0 0 5px hsl(var(--mer-star-warm)));
}
.mer-star-name {
  font-size: 9px;
  fill: hsl(var(--mer-star-warm));
  letter-spacing: 0.02em;
}

.mer-timeline-hint {
  font-size: var(--mer-fs-tick);
  color: hsl(var(--mer-ink-dim) / 0.85);
  text-align: center;
}

/* Major-mark labels (sunrise/sunset/noon/moonrise/moonset) read bolder + brighter than
   the minor threshold labels so the five glanceable marks stand out on the 24h band. */
.mer-marker.is-major .mer-marker-label {
  font-size: 10.5px;
  font-weight: 700;
  fill: hsl(var(--mer-brass-bright));
  paint-order: stroke;
  stroke: hsl(224 46% 10% / 0.85);
  stroke-width: 2.4px;
}
.mer-marker.is-major .mer-marker-time {
  fill: hsl(var(--mer-ink));
  paint-order: stroke;
  stroke: hsl(224 46% 10% / 0.85);
  stroke-width: 2px;
}

/* ── Legend (compact, one tap away) ──────────────────────────────────────────── */
.mer-legend-btn {
  font-size: var(--mer-fs-tick);
  padding: 0.15rem 0.55rem;
  background: hsl(var(--mer-accent) / 0.1);
  border: 1px solid hsl(var(--mer-accent) / 0.4);
  border-radius: 0.35rem;
  color: hsl(var(--mer-accent));
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: background 0.16s ease;
}
.mer-legend-btn:hover,
.mer-legend-btn.is-open {
  background: hsl(var(--mer-accent) / 0.22);
}
.mer-legend {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid hsl(var(--mer-accent) / 0.2);
  border-radius: 0.45rem;
  background: hsl(var(--mer-accent) / 0.05);
}
.mer-legend-section {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
}
.mer-legend-heading {
  font-size: var(--mer-fs-tick);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: hsl(var(--mer-ink-dim));
  min-width: 4.2rem;
}
.mer-legend-ramp {
  flex: 1 1 140px;
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(
    90deg,
    hsl(224 46% 12%) 0%,
    hsl(222 46% 30%) 22%,
    hsl(28 60% 52%) 38%,
    hsl(200 72% 74%) 50%,
    hsl(28 60% 52%) 62%,
    hsl(222 46% 30%) 78%,
    hsl(224 46% 12%) 100%
  );
}
.mer-legend-ramp-labels {
  display: flex;
  justify-content: space-between;
  flex: 1 1 100%;
  font-size: var(--mer-fs-tick);
  color: hsl(var(--mer-ink-dim));
}
.mer-legend-key {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: var(--mer-fs-tick);
  color: hsl(var(--mer-ink));
}
.mer-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.mer-lg-sun { background: hsl(var(--mer-sun)); }
.mer-lg-twilight { background: hsl(28 60% 60%); }
.mer-lg-moon { background: hsl(var(--mer-moon)); }
.mer-legend-note {
  font-size: var(--mer-fs-tick);
  color: hsl(var(--mer-ink-dim) / 0.85);
  font-style: italic;
}

/* ── Tap detail card ───────────────────────────────────────────────────────── */
.mer-tapdetail {
  min-height: 2.4rem;
  padding: 0.5rem 0.7rem;
  border-radius: 0.45rem;
  background: hsl(var(--mer-accent) / 0.07);
  border: 1px solid hsl(var(--mer-accent) / 0.18);
  font-size: var(--mer-fs-label);
}
.mer-tapdetail.is-empty {
  color: hsl(var(--mer-ink-dim));
  font-style: italic;
  background: transparent;
  border-style: dashed;
}
.mer-td-formal {
  font-weight: 600;
  color: hsl(var(--mer-ink));
}
.mer-td-angler {
  font-style: italic;
  color: hsl(var(--mer-ink-dim));
  font-size: var(--mer-fs-tick);
}
.mer-td-time {
  color: hsl(var(--mer-brass-bright));
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.mer-td-absent {
  color: hsl(var(--mer-ink-dim));
  font-size: var(--mer-fs-tick);
}
.mer-td-illum,
.mer-td-star-meta {
  font-size: var(--mer-fs-tick);
  color: hsl(var(--mer-moonc-bright));
  font-variant-numeric: tabular-nums;
}
.mer-illum {
  color: hsl(var(--mer-moonc-bright));
}
.mer-td-star .mer-td-formal {
  color: hsl(var(--mer-star-warm));
}

/* ── D1 ledger ─────────────────────────────────────────────────────────────── */
.mer-ledger {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.9rem;
}
.mer-ledger-col {
  min-width: 0;
}
.mer-ledger-title {
  font-size: var(--mer-fs-tick);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: hsl(var(--mer-accent));
  padding-bottom: 0.35rem;
  border-bottom: 1px solid hsl(var(--mer-accent) / 0.2);
  margin-bottom: 0.4rem;
}
.mer-ledger-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.mer-ledger-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.mer-ledger-name {
  font-size: var(--mer-fs-tick);
  color: hsl(var(--mer-ink));
}
.mer-ledger-angler {
  color: hsl(var(--mer-ink-dim));
  font-style: italic;
}
.mer-ledger-time {
  font-size: var(--mer-fs-tick);
  color: hsl(var(--mer-brass-bright));
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mer-ledger-absent {
  font-size: var(--mer-fs-tick);
  color: hsl(var(--mer-ink-dim) / 0.7);
  font-style: italic;
  white-space: nowrap;
}
.mer-ledger-row.is-absent .mer-ledger-name {
  color: hsl(var(--mer-ink-dim));
}

/* ── Point-to-identify ─────────────────────────────────────────────────────────
   Compass-driven crosshair over the star field. The stage stacks the star-field SVG
   and the crosshair overlay in one positioned box so they register exactly; the overlay
   never intercepts pointer events (the star SVG keeps all gestures — Rider 3). */
.mer-pti {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.mer-sf-stage {
  position: relative;
  width: 100%;
  line-height: 0;
}
.mer-pti-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* never steals the star SVG's pinch/pan/tap (Rider 3) */
}
.mer-pti-ring {
  fill: none;
  stroke: hsl(var(--mer-brass-bright));
  stroke-width: 1.5;
  opacity: 0.9;
  filter: drop-shadow(0 0 4px hsl(var(--mer-brass-bright) / 0.7));
}
.mer-pti-hair {
  stroke: hsl(var(--mer-brass-bright));
  stroke-width: 1.5;
  opacity: 0.9;
}
.mer-pti-label {
  font-size: 10px;
  fill: hsl(var(--mer-brass-bright));
  font-weight: 600;
  letter-spacing: 0.02em;
  paint-order: stroke;
  stroke: hsl(230 48% 6% / 0.85);
  stroke-width: 2px;
}

.mer-pti-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
}
.mer-pti-btn {
  padding: 0.4rem 0.85rem;
  border-radius: 0.5rem;
  background: hsl(var(--mer-brass-bright) / 0.14);
  border: 1px solid hsl(var(--mer-brass-bright) / 0.45);
  color: hsl(var(--mer-brass-bright));
  font: inherit;
  font-size: var(--mer-fs-label);
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
}
.mer-pti-btn:hover:not(:disabled) {
  background: hsl(var(--mer-brass-bright) / 0.24);
}
.mer-pti-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.mer-pti-btn.is-stop {
  background: hsl(var(--mer-accent) / 0.1);
  border-color: hsl(var(--mer-accent) / 0.4);
  color: hsl(var(--mer-ink));
}
.mer-pti-readout {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}
.mer-pti-star {
  font-size: var(--mer-fs-label);
  font-weight: 600;
  color: hsl(var(--mer-star-warm));
}
/* Honest empty-sky readout (Part 2): the crosshair is over sky with no bright star
   within the snap tolerance. Muted + italic so it reads as a state, not a star name. */
.mer-pti-emptysky {
  color: hsl(var(--mer-ink-dim));
  font-weight: 400;
  font-style: italic;
}
.mer-pti-sep {
  color: hsl(var(--mer-ink-dim));
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.mer-pti-constellation {
  font-size: var(--mer-fs-tick);
  color: hsl(var(--mer-accent));
  letter-spacing: 0.03em;
}
.mer-pti-state {
  font-size: var(--mer-fs-tick);
  padding: 0.35rem 0.6rem;
  border-radius: 0.4rem;
  color: hsl(var(--mer-ink-dim));
  background: hsl(var(--mer-accent) / 0.06);
  border: 1px solid hsl(var(--mer-accent) / 0.16);
}
.mer-pti-state.is-calibrating,
.mer-pti-state.is-requesting {
  color: hsl(var(--mer-brass-bright));
  background: hsl(var(--mer-brass-bright) / 0.08);
  border-color: hsl(var(--mer-brass-bright) / 0.3);
}
.mer-pti-state.is-denied,
.mer-pti-state.is-stale {
  color: hsl(28 70% 62%);
  background: hsl(28 60% 40% / 0.12);
  border-color: hsl(28 60% 52% / 0.35);
}
.mer-pti-state.is-hint {
  font-style: italic;
  background: transparent;
  border-style: dashed;
}

/* ══════════════════════════════════════════════════════════════════════════
   NIGHT PALETTE — Today's Sky surface (TWO independent triggers, OR-ed)
   ----------------------------------------------------------------------------
   ROOT CAUSE this block fixes: the whole astro surface is painted from the
   `--mer-*` tokens (declared on .meridian-sky for its OWN day/deck/night scene
   mode) plus a few hardcoded hsl() literals. The APP-LEVEL night-vision sweep in
   base.css only reaches inline style="color/background", Tailwind color utilities,
   and SVG fill/stroke ATTRIBUTES — it never redefines the --mer-* tokens and
   cannot touch stylesheet-level hardcoded gradients. So the rest of the Meridian
   page chrome re-shifted to scotopic red while THIS section kept its blue/brass/
   teal look. We scope the red-shift to `.mer-astro-surface` ONLY (a class unique
   to Today's Sky — the main Meridian instrument is NOT affected): redefine the
   tokens it reads, then override the handful of hardcoded surfaces the token swap
   can't reach.

   TWO TRIGGERS — this surface must go red under EITHER:
     1. GLOBAL Night Vision — `html.display-nightvision` (the app-wide display mode).
     2. MERIDIAN scene-night — `.mer-astro-surface[data-scene-night="true"]`, set by
        MeridianAstroSurface when the instrument's OWN scene mode is night. The surface
        is a DOM SIBLING of the instrument so it cannot inherit the instrument's
        `data-mode="night"` via CSS — it reflects the scene state onto itself instead.
   Under scene-night the base.css global sweep does NOT fire, so this block is the
   SOLE source of the red-shift there; the token redefine + the hardcoded-surface
   overrides below give full parity with the global path. Every other mode is
   byte-unchanged.
   ══════════════════════════════════════════════════════════════════════════ */
html.display-nightvision .mer-astro-surface,
.mer-astro-surface[data-scene-night="true"] {
  --mer-accent: 0 100% 40%;         /* teal identity → scotopic red */
  --mer-ink: 0 100% 45%;            /* primary text */
  --mer-ink-dim: 0 100% 33%;        /* secondary labels */
  --mer-brass: 0 100% 30%;          /* chevron / furniture (mid red) */
  --mer-brass-bright: 0 100% 48%;   /* lit brass → bright red */
  --mer-sun: 0 100% 48%;            /* sun ticks */
  --mer-moon: 0 100% 42%;           /* moon ticks */
  --mer-moonglade: 0 100% 42%;
  --mer-moonc-bright: 0 100% 48%;
  --mer-star: 0 100% 45%;
  --mer-star-warm: 0 100% 50%;
  --mer-grid: 0 100% 30%;
  color: #cc0000;
}

/* Elevated toggle card — kill the deep-slate-blue gradient + the bluish inset
   highlight so the card reads as dark red/black like the rest of the page. */
html.display-nightvision .mer-astro-toggle,
html.display-nightvision .mer-astro-toggle:hover,
.mer-astro-surface[data-scene-night="true"] .mer-astro-toggle,
.mer-astro-surface[data-scene-night="true"] .mer-astro-toggle:hover {
  background: linear-gradient(180deg, hsl(0 60% 8%) 0%, hsl(0 70% 5%) 55%, #000 100%);
  box-shadow:
    0 1px 0 hsl(0 60% 40% / 0.2) inset,
    0 0 0 1px #000 inset,
    0 6px 18px hsl(0 0% 0% / 0.6),
    0 0 22px hsl(0 100% 40% / 0.18);
}

/* Chevron control — the brass pill + glyph would otherwise leave gold photons.
   Pin a dark pill with a bright-red glyph for an unmistakable (and scotopic-safe)
   control. The glyph svg override beats base.css `svg { color:#cc0000 }`. */
html.display-nightvision .mer-astro-chev,
.mer-astro-surface[data-scene-night="true"] .mer-astro-chev {
  background: #1a0000;
  border-color: hsl(0 100% 40%);
}
html.display-nightvision .mer-astro-chev svg,
.mer-astro-surface[data-scene-night="true"] .mer-astro-chev svg {
  color: hsl(0 100% 55%) !important;
}

/* Mini day band — strip the bluish inset ring highlight. */
html.display-nightvision .mer-astro-mini,
.mer-astro-surface[data-scene-night="true"] .mer-astro-mini {
  box-shadow:
    0 0 0 1px hsl(0 60% 35% / 0.25),
    0 1px 3px hsl(0 0% 0% / 0.5);
}

/* Mini-band marker contrast halo — its near-white stroke carried non-red light. */
html.display-nightvision .mer-astro-mini-halo,
.mer-astro-surface[data-scene-night="true"] .mer-astro-mini-halo {
  fill: #000;
  stroke: hsl(0 100% 42%);
}

/* Star-field backdrop — blue radial gradient (not a token / not inline) → red-black. */
html.display-nightvision .mer-starfield-svg,
.mer-astro-surface[data-scene-night="true"] .mer-starfield-svg {
  background: radial-gradient(ellipse 120% 90% at 50% 100%, hsl(0 60% 7%), #000);
}

/* Twilight event markers hardcode a warm-orange hue. */
html.display-nightvision .mer-mk-twilight .mer-marker-tick,
.mer-astro-surface[data-scene-night="true"] .mer-mk-twilight .mer-marker-tick { stroke: #cc0000; }
html.display-nightvision .mer-mk-twilight .mer-marker-dot,
.mer-astro-surface[data-scene-night="true"] .mer-mk-twilight .mer-marker-dot { fill: #cc0000; }

/* Legend ramp hardcodes the full day→night color gradient. */
html.display-nightvision .mer-legend-ramp,
.mer-astro-surface[data-scene-night="true"] .mer-legend-ramp {
  background: linear-gradient(90deg, hsl(0 70% 6%) 0%, hsl(0 90% 22%) 50%, hsl(0 70% 6%) 100%);
}

/* Point-to-identify warm-orange state chips. */
html.display-nightvision .mer-pti-state.is-denied,
html.display-nightvision .mer-pti-state.is-stale,
.mer-astro-surface[data-scene-night="true"] .mer-pti-state.is-denied,
.mer-astro-surface[data-scene-night="true"] .mer-pti-state.is-stale {
  color: #cc0000;
}

/* ══════════════════════════════════════════════════════════════════════════
   PAGE-SHELL NIGHT PARITY — the "white strip above Today's Sky" fix
   ----------------------------------------------------------------------------
   `.meridian-page-shell` wraps BOTH the Meridian instrument and the Today's Sky
   card (MeridianSkyPage). It was `display:contents` (no box), so the sibling-
   margin GAP created by the Today's Sky section's `margin-top: 0.75rem` painted
   the PAGE background (`--background`). Under the daylight display modes
   (`html.display-overcast` / `html.display-fullsun`) that background is near-
   white, so when the instrument is in its own SCENE night mode the gap stayed a
   bright strip — the global `html.display-nightvision` sweep that blacks out
   `--background` does NOT fire on the scene-night path.

   `flow-root` gives the shell a real box (and its own block-formatting context)
   so it can paint that inter-child gap. Day / deck keep a transparent shell
   (byte-unchanged). Under EITHER night trigger — global Night Vision OR the
   instrument's scene-night (reflected by MeridianSkyPage onto the shell as
   `data-scene-night="true"`) — the shell paints scotopic black, so no light
   strip can show above the card in either night system.
   ══════════════════════════════════════════════════════════════════════════ */
.meridian-page-shell {
  display: flow-root;
  background: transparent;
}
html.display-nightvision .meridian-page-shell,
.meridian-page-shell[data-scene-night="true"] {
  background: #000;
}
