/* solar/style.css — page-specific styles for solar.openmonitor.org.
   Generic palette + typography + mascots come from /shared/style.css.
   This file adds: chart panel layout, toolbar, mobile hover strip,
   floating About button + drawer.
*/

/* Instrument-specific variables (chart traces, flare bands).
   Plotly does not resolve CSS variables — instrument_sxr.js reads them
   via getComputedStyle and passes the resolved hex into traces. */
:root {
  --goes-xrs-a:    #1565c0;       /* NOAA blue  */
  --goes-xrs-b:    #d32f2f;       /* red        */
  --rstn-main:     #7e57c2;       /* muted purple — distinct from GOES   */
  --rstn-band:     rgba(126, 87, 194, 0.18);  /* min/max envelope fill */
  --bg-widget:     #ffffff;
  --flare-a-bg:    rgba(144, 238, 144, 0.10);
  --flare-b-bg:    rgba(173, 216, 230, 0.10);
  --flare-c-bg:    rgba(255, 255,   0, 0.10);
  --flare-m-bg:    rgba(255, 165,   0, 0.10);
  --flare-x-bg:    rgba(255,   0,   0, 0.15);
}

/* Solar shell: this is the TOOL, not a marketing lander. Use horizontal
   real estate aggressively, tighten the vertical hierarchy so the chart
   sits as high on the viewport as possible. */
.solar-wrap {
  max-width: min(2000px, max(1400px, calc(100vw - 240px)));
  margin: 0 auto;
  padding: 14px 28px 50px;
  position: relative;
  z-index: 2;
}

/* Override shared topbar spacing (designed for marketing pages with a
   big lander hero). On a tool page we want it tight. */
.solar-wrap > .topbar {
  margin-bottom: 18px;
  padding-bottom: 12px;
  font-size: 0.78rem;
}
.solar-wrap > .topbar .brand-mark { width: 20px; height: 20px; }
.solar-wrap > .topbar .brand { font-size: 0.92rem; }

/* Hero: sits inline with the title, tagline and dev tag side-by-side
   on wide viewports to claw back vertical space. Stacks on narrow. */
.solar-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px 32px;
  margin-bottom: 22px;
}
.solar-hero h1 {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0 0 6px 0;
}
.solar-hero h1 .italic { font-style: italic; font-weight: 600; color: var(--accent); }
.solar-hero h1 .dot    { color: var(--accent); }
.solar-hero .tagline {
  color: var(--muted);
  font-size: clamp(0.9rem, 1.2vw, 1rem);
  max-width: 720px;
  margin: 0;
  line-height: 1.45;
}
.solar-hero .hero-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
}

/* Compact under-dev banner sits in the side column on wide screens. */
.dev-tag {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em;
  color: var(--accent);
  padding: 5px 10px;
  border: 1px solid var(--accent);
  border-radius: 5px;
  margin: 0;
}

@media (max-width: 820px) {
  .solar-hero {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 8px;
  }
  .solar-hero .hero-side { justify-content: flex-start; }
}

/* === Widget (toolbar + chart) === */

.widget {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  margin-top: 14px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  justify-content: center;
  padding: 14px max(18px, calc((100% - 1400px) / 2));
  border-bottom: 1px solid var(--line);
  background: #fdfdfa;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-family: "JetBrains Mono", monospace;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
input[type="date"], input[type="time"] {
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  height: 38px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input[type="date"]:focus, input[type="time"]:focus {
  outline: none;
  border-color: var(--cool);
  box-shadow: 0 0 0 3px rgba(27, 63, 232, 0.15);
}

button {
  padding: 9px 18px;
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  border-radius: 6px;
  border: 1px solid transparent;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  height: 38px;
  transition: background 0.15s, transform 0.05s;
}
button:hover { background: #000; }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.55; cursor: not-allowed; }

button.reset-btn  { background: #6c757d; border-color: #6c757d; }
button.reset-btn:hover { background: #5a6268; }
button.export-btn { background: var(--green); border-color: var(--green); }
button.export-btn:hover { background: #086932; }
button#scaleBtn   { background: var(--cool); border-color: var(--cool); }
button#scaleBtn.scale-auto { background: #673ab7; border-color: #673ab7; }

/* Status bar */
#status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px max(24px, calc((100% - 1400px) / 2)) 0;
  min-height: 1.5em;
}
#status {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5em;
}

/* Loading state — gentle pulse so users know the app is alive while a
   slow first-time fetch (e.g. 15 MB historic flare catalog, joint-event
   click that triggers all four instruments) takes 3–10 s. Pure CSS,
   triggered by body.is-loading toggled in lab/main.js + main.js. */
body.is-loading #status {
  color: var(--rstn-main, #7e57c2);
  animation: status-pulse 1.1s ease-in-out infinite;
}
body.is-loading #status::after {
  content: "...";
  display: inline-block;
  width: 1.2em;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: bottom;
  animation: status-dots 1.4s steps(4, end) infinite;
}
@keyframes status-pulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1;    }
}
@keyframes status-dots {
  0%   { width: 0;     }
  100% { width: 1.2em; }
}
#shareLink {
  display: none;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
  color: var(--cool);
  text-decoration: none;
  white-space: nowrap;
  opacity: 0.85;
}
#shareLink:hover { opacity: 1; text-decoration: underline; }

/* Instrument panel (chart). One per instrument; multi-instrument = stacked.
   Lab uses one combined panel with two stacked subplots (GOES+RSTN top,
   RHESSI bottom) — needs a taller container than the prod single-subplot.
   `display: flex` lets the .rstn-chart child fill whatever vertical space
   the toolbars don't take, regardless of how many toolbar rows wrap. */
.panel {
  position: relative;
  width: 100%;
  height: 820px;
  padding: 6px 6px 0;
  display: flex;
  flex-direction: column;
}
.panel + .panel { border-top: 1px solid var(--line); margin-top: 6px; }

/* Full-window mode — flex column from <body> down so the panel grows
   to fill whatever vertical space is left after toolbar+status+footnote.
   No magic pixel constants. Toggled by #fullWindowBtn, Esc exits. */
body.is-fullwindow {
  overflow: hidden;
  height: 100vh;
}
body.is-fullwindow .topbar,
body.is-fullwindow .solar-hero,
body.is-fullwindow .footnote,
body.is-fullwindow .lab-mascot-row,
body.is-fullwindow > svg.ghost,
body.is-fullwindow > svg.piggy,
body.is-fullwindow .solar-wrap > footer { display: none !important; }
body.is-fullwindow .solar-wrap {
  max-width: none;
  margin: 0;
  padding: 6px 10px 4px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 0;
}
body.is-fullwindow .widget {
  flex: 1 1 auto;
  margin: 0;
  border-radius: 6px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  min-height: 0;        /* lets flex children actually shrink */
  overflow: hidden;
}
body.is-fullwindow .toolbar,
body.is-fullwindow #status-bar { flex: 0 0 auto; }
body.is-fullwindow #panels-container {
  flex: 1 1 auto;
  min-height: 0;
}
body.is-fullwindow .panel {
  height: 100% !important;
  min-height: 0;
}
body.is-fullwindow #fullWindowBtn {
  background: #7e57c2;
  color: #fff;
}
/* Full-window: hide the date picker — its 264×280 px overlay sits on
   top of the RHESSI subplot once the panel grows to the viewport. The
   toolbar's start/end inputs above are still available for jumps. */
body.is-fullwindow .lab-date-picker { display: none !important; }

/* Mascot toggle — when active, fade the floating mascots out. The mini
   beds live inline next to the toggle button (always visible: empty
   when mascots are out, with the sleeping mascot + z-z-z animation
   faded in when body has .no-mascots). */
body.no-mascots > svg.ghost,
body.no-mascots > svg.piggy {
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.bed-mini {
  width: 70px;
  height: auto;
  flex: 0 0 auto;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.10));
}
/* Decorative potted sprout next to the ghost's bed in the mascot
   row. Aligned to flex-end so the pot's bottom sits on the same
   baseline as the bed's bottom edge — matches the visual "ground"
   the bed feet rest on. SVG viewBox 110×130 keeps the leaves tall
   and the pot proportional. */
.lab-plantita {
  width: 18px;
  height: auto;
  flex: 0 0 auto;
  align-self: flex-end;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.10));
}
.bed-mini .bed-sleeper,
.bed-mini .bed-zzz,
.bed-mini .bed-oink {
  opacity: 0;
  transition: opacity 0.45s ease;
}
body.no-mascots .bed-mini .bed-sleeper,
body.no-mascots .bed-mini .bed-zzz:not([hidden]),
body.no-mascots .bed-mini .bed-oink:not([hidden]) {
  opacity: 1;
}
/* The [hidden] attribute on <g> doesn't fully hide in SVG — Safari
   shows the children. Force display:none so the JS swap is reliable
   across browsers. */
.bed-mini .bed-zzz[hidden],
.bed-mini .bed-oink[hidden] { display: none; }

@keyframes bed-z-rise {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.9); }
  10%  { opacity: 1; }
  100% { opacity: 0; transform: translate(6px, -22px) scale(1.5); }
}
.bed-z {
  transform-box: fill-box;
  transform-origin: center;
  animation: bed-z-rise 2.4s ease-out infinite;
}
.bed-z-2 { animation-delay: 0.8s; }
.bed-z-3 { animation-delay: 1.6s; }

@media (prefers-reduced-motion: reduce) {
  .bed-z { animation: none; }
  .bed-mini .bed-sleeper, .bed-mini .bed-zzz { transition: none; }
}
.lab-mascot-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 14px 0 6px;
  flex-wrap: wrap;
}
.lab-mascot-toggle {
  background: #ffffff;
  color: #6b6f80;
  border: 1px dashed #c8c8d0;
  border-radius: 18px;
  padding: 5px 14px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.lab-mascot-toggle:hover {
  background: #efeaf8;
  color: #7e57c2;
  border-color: #7e57c2;
}
.lab-mascot-quip {
  display: inline-block;
  margin-left: 10px;
  font-style: italic;
  color: #7e57c2;
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.4s;
}
.lab-mascot-quip.is-show { opacity: 1; }

/* Custom HTML legend — single box, real 2-column layout. Lives inside
   the panel, anchored top-right, replacing Plotly's built-in legend. */
.lab-custom-legend {
  position: absolute;
  /* Bottom-anchored, just above the date picker (which is ~300 px from
     the bottom). Stacks visually with the picker so the right gutter
     reads as one sidebar instead of two pieces with a huge empty band
     between them. Grows upward, capped by max-height. */
  bottom: 320px;
  right: 10px;
  top: auto;
  width: 250px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #d6dae5;
  border-radius: 6px;
  padding: 6px 9px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10.5px;
  color: #1a1a22;
  z-index: 4;
  user-select: none;
  max-height: 380px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #c2c6d1 transparent;
}
/* In full-window the date picker is hidden, so anchor the legend back
   to top-right and let it use the whole right gutter. */
/* Hide the right-side legend whenever a coverage drawer is open — the drawer
   spans full width inside the panel and the legend sits in the right gutter
   would visually cover the calendar cells in the rightmost months. */
body.lab-cov-open .lab-custom-legend { display: none !important; }

body.is-fullwindow .lab-custom-legend {
  bottom: auto;
  top: 10px;
  max-height: calc(100% - 80px);
}
.lab-custom-legend::-webkit-scrollbar { width: 6px; }
.lab-custom-legend::-webkit-scrollbar-thumb {
  background: #c2c6d1;
  border-radius: 3px;
}
.lab-cl-group + .lab-cl-group { margin-top: 5px; }
.lab-cl-title {
  font-weight: 700;
  font-size: 10.5px;
  color: #2a2d3a;
  margin-bottom: 2px;
  letter-spacing: 0.02em;
}
.lab-cl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;                /* tight rows; native button height handles spacing */
  column-gap: 4px;
}
.lab-cl-grid-single { grid-template-columns: 1fr; }
.lab-cl-item {
  display: flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  margin: 0;
  padding: 0 3px;
  height: 16px;          /* fixed compact row — no leaked button padding */
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
  border-radius: 3px;
  font-size: 10px;
  line-height: 16px;
  white-space: nowrap;
  overflow: hidden;
}
.lab-cl-item:hover { background: #efeaf8; }
.lab-cl-item.is-hidden { opacity: 0.32; }
.lab-cl-item.is-hidden .lab-cl-label { text-decoration: line-through; }
.lab-cl-swatch {
  flex: 0 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.lab-cl-label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* On narrow viewports the legend leaves the right gutter and sits below
   the chart (flow layout, full width, simpler). */
@media (max-width: 768px) {
  .lab-custom-legend {
    position: static;
    width: 100%;
    max-height: none;
    margin: 8px 0 4px;
  }
  .lab-cl-grid { grid-template-columns: 1fr 1fr 1fr; }
}

/* Quick date picker — 3 equal columns (Year / Month / Day) anchored to the
   bottom-right empty space below Plotly's legend. Berkeley-inspired
   column-scroll metaphor for fast date navigation without typing. */
#panels-container { position: relative; }

.lab-date-picker {
  position: absolute;
  bottom: 18px;
  right: 18px;
  width: 264px;
  background: #ffffff;
  border: 1px solid #d6dae5;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(26, 26, 34, 0.08),
              0 1px 3px rgba(26, 26, 34, 0.04);
  padding: 10px 10px 9px;
  font-family: 'Inter', system-ui, sans-serif;
  color: #1a1a22;
  z-index: 5;
  user-select: none;
}
.lab-dp-header {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7e57c2;
  text-align: center;
  margin-bottom: 8px;
}
.lab-dp-cols {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.lab-dp-col-head {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a8e9c;
  text-align: center;
  margin-bottom: 4px;
}
.lab-dp-list {
  list-style: none;
  margin: 0;
  padding: 0;
  height: 184px;
  overflow-y: auto;
  border: 1px solid #e2e5ec;
  border-radius: 6px;
  background: #fafbfc;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #c2c6d1 transparent;
}
.lab-dp-list::-webkit-scrollbar { width: 8px; }
.lab-dp-list::-webkit-scrollbar-track { background: transparent; }
.lab-dp-list::-webkit-scrollbar-thumb {
  background: #c2c6d1;
  border-radius: 4px;
  border: 2px solid #fafbfc;
}
.lab-dp-list::-webkit-scrollbar-thumb:hover { background: #9ea2b0; }
.lab-dp-list li {
  padding: 5px 0;
  text-align: center;
  cursor: pointer;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  border-bottom: 1px solid #f0f2f6;
  transition: background 0.1s, color 0.1s;
}
.lab-dp-list li:last-child { border-bottom: none; }
.lab-dp-list li:hover { background: #efeaf8; color: #7e57c2; }
.lab-dp-list li.is-selected {
  background: #7e57c2;
  color: #ffffff;
  font-weight: 600;
}
.lab-dp-list li.is-selected:hover { background: #6943a8; color: #ffffff; }
.lab-dp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  gap: 8px;
}
.lab-dp-summary {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #6b6f80;
  letter-spacing: 0.02em;
}
.lab-dp-plot {
  background: #7e57c2;
  color: #ffffff;
  border: none;
  padding: 5px 11px;
  border-radius: 5px;
  font-weight: 600;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.lab-dp-plot:hover:not(:disabled) { background: #6943a8; }
.lab-dp-plot:disabled {
  background: #c8c8d0;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  #panels-container { display: flex; flex-direction: column; }
  .lab-date-picker {
    position: static;
    order: 2;
    width: 100%;
    margin: 12px 0 4px;
    box-sizing: border-box;
  }
  .lab-dp-list { height: 160px; }
}

/* Loading skeleton shown until Plotly draws into #panel-sxr. */
.panel-skeleton {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
}
.skeleton-line {
  width: 60%;
  height: 6px;
  background: linear-gradient(90deg, var(--line) 0%, var(--line-strong) 50%, var(--line) 100%);
  background-size: 200% 100%;
  border-radius: 3px;
  animation: skel-shimmer 1.4s ease-in-out infinite;
}
@keyframes skel-shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* RSTN panel: inline station + frequency selectors above the chart.
   The shell injects #panel-rstn; instrument_rstn.js fills it with this
   structure on first plot. The selects don't pollute the main toolbar. */
.rstn-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 8px max(12px, calc((100% - 1400px) / 2)) 6px;
  border-bottom: 1px solid var(--line);
  background: #fbfaf5;
  font-size: 0.82rem;
}
.rstn-field {
  display: flex;
  align-items: center;
  gap: 6px;
}
.rstn-field > span {
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.66rem;
  color: var(--muted);
  font-weight: 600;
}
.rstn-field select {
  padding: 5px 8px;
  font: inherit;
  font-size: 0.82rem;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  height: 30px;
}
.rstn-field select:focus {
  outline: none;
  border-color: var(--rstn-main);
  box-shadow: 0 0 0 3px rgba(126, 87, 194, 0.18);
}
.rstn-coverage {
  margin-left: auto;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.70rem;
  letter-spacing: 0.04em;
}
/* Chart fills the remaining space below the two stacked lab toolbars
   (~40 px each plus borders). Computed via flexbox below. */
.rstn-chart { width: 100%; flex: 1 1 auto; min-height: 0; }
.rstn-empty {
  height: calc(100% - 44px);
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 20px;
}
.rstn-empty strong { color: var(--rstn-main); }

/* === RHESSI coverage drawer ===========================================
   Sits between the lab toolbars and the chart. Hidden by default, slides
   into view when the user clicks "RHESSI coverage". Calendar heatmap of
   the 970 archived days, organised as 7 year tabs + a 12-column month
   grid for the active year. Colored cell = data available + clickable. */
.rhessi-coverage-drawer {
  flex: 0 0 auto;
  background: #fdfaef;
  border-bottom: 1px solid var(--line);
  padding: 10px 14px 12px;
  font-size: 0.78rem;
  max-height: 360px;
  overflow-y: auto;
}
.rhessi-coverage-drawer[hidden] { display: none; }
.cov-header {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: baseline;
  margin-bottom: 8px;
}
.cov-title {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  color: var(--rstn-main);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.cov-hint {
  color: var(--muted);
  font-size: 0.72rem;
}
.cov-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.cov-tab {
  padding: 3px 10px;
  font-size: 0.74rem;
  font-family: "JetBrains Mono", monospace;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  color: var(--ink);
}
.cov-tab span { color: var(--muted); font-size: 0.68rem; }
.cov-tab:hover { border-color: var(--rstn-main); color: var(--rstn-main); }
.cov-tab.cov-tab-active {
  background: var(--rstn-main);
  color: #fff;
  border-color: var(--rstn-main);
}
.cov-tab.cov-tab-active span { color: rgba(255,255,255,0.8); }

/* The year grid: 4 months wide × 3 rows = annual planner layout. Each
   month is a 4-column × 8-row matrix (32 slots, last slot blank for
   28/29/30-day months). Way less scanning than the 12-strip layout. */
.cov-year {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 18px;
}
.cov-month {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cov-mhdr {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  color: var(--ink);
  text-align: center;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.cov-mcount {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.66rem;
}
.cov-month-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 16px;
  gap: 2px;
}
.cov-cell {
  /* Identical box for div / button so on / off / empty cells line up
     exactly. Browsers add default padding + border to <button>, which
     is why the purple cells looked "inflated" next to the beige divs. */
  display: block;
  width: 100%;
  height: 16px;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 2px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.62rem;
  line-height: 16px;
  text-align: center;
  appearance: none;
  -webkit-appearance: none;
}
.cov-cell.cov-empty {
  background: transparent;
}
.cov-cell.cov-off {
  background: #ece8e0;
  color: #a8a399;
}
.cov-cell.cov-on {
  background: var(--rstn-main);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}
.cov-cell.cov-on:hover {
  background: #5e3aa1;
  outline: 1px solid #1a1a22;
}

/* Joint-coverage tinting — cell colour encodes the number of instruments
   active on that day (1 = only GOES, 4 = all four = "gold day"). */
.cov-cell.cov-on.cov-c1 { background: #d8d3c8; color: #5b5749; }
.cov-cell.cov-on.cov-c2 { background: #c0a8d6; color: #2a1e3d; }
.cov-cell.cov-on.cov-c3 { background: #7e57c2; color: #fff; }
.cov-cell.cov-on.cov-c4 { background: #d4a017; color: #2a1e0a; }
.cov-cell.cov-on.cov-c4:hover { background: #b8870b; outline: 1px solid #1a1a22; }
.cov-legend {
  display: inline-block;
  padding: 1px 6px;
  margin-left: 6px;
  border-radius: 3px;
  font-size: 0.65rem;
  font-family: "JetBrains Mono", monospace;
  vertical-align: middle;
}
.cov-legend.cov-c1 { background: #d8d3c8; color: #5b5749; }
.cov-legend.cov-c2 { background: #c0a8d6; color: #2a1e3d; }
.cov-legend.cov-c3 { background: #7e57c2; color: #fff; }
.cov-legend.cov-c4 { background: #d4a017; color: #2a1e0a; }

/* === Joint M+ events list (5th coverage drawer) ====================== */
.cov-events-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 8px 10px; border-bottom: 1px solid #ece8e0;
  font-size: 0.78rem; color: #555;
  font-family: "JetBrains Mono", monospace;
}
.cov-events-toolbar button {
  padding: 2px 8px;
  border: 1px solid #c9c2b5;
  background: #fff;
  color: var(--ink);
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit; font-size: inherit;
}
.cov-events-toolbar button:hover { background: #f3eee4; }
.cov-events-toolbar button.cev-active {
  background: var(--rstn-main, #7e57c2); color: #fff;
  border-color: var(--rstn-main, #7e57c2);
}
.cov-events-empty {
  padding: 16px; color: #888; font-style: italic; text-align: center;
}
.cov-event-list-head, .cov-event-row {
  display: grid;
  grid-template-columns: 110px 60px 60px 90px 70px;
  gap: 6px;
  padding: 4px 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  align-items: center;
}
.cov-event-list-head {
  position: sticky; top: 0;
  background: #ece8e0; color: #555; font-weight: 600;
  border-bottom: 1px solid #c9c2b5;
}
.cov-event-list {
  max-height: 360px; overflow-y: auto;
}
.cov-event-row {
  width: 100%;
  border: none; background: transparent; cursor: pointer;
  text-align: left;
  border-bottom: 1px solid #f3eee4;
  color: #2a2620;
}
.cov-event-row:hover {
  background: #f3eee4;
  outline: 1px solid #7e57c2;
}
.cov-event-row.cov-class-X {
  background: linear-gradient(90deg, rgba(212,160,23,0.14), transparent 80%);
}
.cov-event-row.cov-class-X:hover {
  background: linear-gradient(90deg, rgba(212,160,23,0.28), #f3eee4);
}
.cov-event-row .cev-class { font-weight: 700; color: #b8870b; }
.cov-event-row.cov-class-M .cev-class { color: #7e57c2; }
.cov-event-row .cev-insts { color: #b8870b; font-weight: 600; }

/* === Lab toolbar (in /lab/ — multi-station checks + event picker) ====
   Two stacked rows. Row 1 = data picking + navigation; row 2 = trace
   visibility / normalisation. Both rows wrap naturally on narrow viewports
   so nothing is ever hidden behind a horizontal scroll. */
.lab-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  padding: 8px max(14px, calc((100% - 1400px) / 2));
  border-bottom: 1px solid var(--line);
  background: #fbfaf5;
  font-size: 0.80rem;
}
.lab-toolbar-row2 {
  background: #f7f5ec;
  border-top: 1px dashed var(--line);
  border-bottom: 1px solid var(--line);
}
.lab-toolbar .lab-label {
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.65rem;
  color: var(--muted);
  font-weight: 600;
  flex-shrink: 0;
}
.lab-toolbar .lab-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
}
.lab-toolbar .lab-check input[type="checkbox"] {
  accent-color: var(--rstn-main);
  cursor: pointer;
}
.lab-toolbar .lab-check span {
  color: var(--ink);
}
.lab-toolbar .lab-sep {
  color: var(--line-strong);
  flex-shrink: 0;
}
.lab-toolbar .lab-event {
  padding: 4px 8px;
  font-size: 0.78rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
  max-width: 320px;
}
.lab-toolbar .lab-event:focus {
  outline: none;
  border-color: var(--rstn-main);
  box-shadow: 0 0 0 3px rgba(126, 87, 194, 0.18);
}
.lab-toolbar .lab-quickdate-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.lab-toolbar .lab-quickdate {
  padding: 4px 8px;
  font-size: 0.78rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  font-family: "JetBrains Mono", monospace;
  width: 220px;
  flex-shrink: 0;
  color: var(--ink);
}
.lab-toolbar .lab-quickdate::placeholder {
  color: var(--rstn-main);
  opacity: 0.65;
}
.lab-toolbar .lab-quickdate:focus {
  outline: none;
  border-color: var(--rstn-main);
  box-shadow: 0 0 0 3px rgba(126, 87, 194, 0.18);
}
.lab-toolbar .lab-quickdate-help {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--rstn-main);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  cursor: help;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.lab-toolbar .lab-quickdate-help:hover,
.lab-toolbar .lab-quickdate-help:focus {
  outline: none;
  border-color: var(--rstn-main);
  background: rgba(126, 87, 194, 0.08);
}
.lab-toolbar .lab-btn {
  padding: 4px 10px;
  height: auto;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  cursor: pointer;
  flex-shrink: 0;
}
.lab-toolbar .lab-btn:hover {
  background: var(--bg);
  border-color: var(--rstn-main);
  color: var(--rstn-main);
}
.lab-toolbar .lab-btn.lab-btn-active {
  background: var(--rstn-main);
  border-color: var(--rstn-main);
  color: #fff;
}
.lab-toolbar .lab-btn.lab-btn-active:hover {
  background: var(--rstn-main);
  color: #fff;
  filter: brightness(1.05);
}
.lab-toolbar .lab-dayflares {
  padding: 4px 8px;
  font-size: 0.78rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
  max-width: 220px;
  font-family: "Inter", system-ui, sans-serif;
}
.lab-toolbar .lab-dayflares:focus {
  outline: none;
  border-color: var(--rstn-main);
  box-shadow: 0 0 0 3px rgba(126, 87, 194, 0.18);
}
.lab-toolbar .lab-link {
  padding: 4px 10px;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
  white-space: nowrap;
}
.lab-toolbar .lab-link:hover {
  background: var(--bg);
  border-color: var(--rstn-main);
  color: var(--rstn-main);
}
.lab-toolbar .lab-stationhint {
  /* Greedy: fills any empty toolbar space at the right; if the toolbar
     is cramped, wraps to a new line and goes back to full width. The
     min-width keeps the message readable when there is room, the
     flex-basis: 0 lets it shrink-grow flexibly. */
  flex: 1 1 320px;
  min-width: 240px;
  text-align: right;
  font-size: 0.78rem;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  padding: 0 6px;
  font-style: italic;
  line-height: 1.35;
  white-space: normal;
}
.lab-toolbar .lab-stationhint[data-tone="warn"] {
  color: #a06f00;
}
.lab-toolbar .lab-stationhint[data-tone="ok"] {
  color: #5e3aa1;
}

#mob-hover { display: none; }

/* Footnote under widget */
.footnote {
  max-width: 920px;
  margin: 22px auto 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.55;
}
.footnote code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  background: var(--accent-soft);
  padding: 0 4px;
  border-radius: 3px;
}
.footnote-info-btn {
  margin-left: 8px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-family: inherit;
  background: #fff;
  border: 1px solid #7e57c2;
  color: #7e57c2;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}
/* Keep a clear lane on the right so the floating ⓘ about-fab never
   visually covers the trailing inline "Methodology, citations & RSTN
   guide" button. Right-only — bottom padding pushes the mascots away
   in document flow and is not what we want. */
.footnote { padding-right: 80px; }

/* Lab mobile heads-up banner. Hidden on desktop, visible on narrow
   viewports. The lab is genuinely a desktop tool — this banner sets
   user expectations rather than pretending the cramped layout is fine. */
.lab-mobile-note { display: none; }
.lab-mobile-preview { display: none; }

/* ==========================================================================
   "How to read this chart" tutorial — right-edge drawer + first-visit nudge.
   Trilingual (EN/ES/PT) via JS-rendered language toggle. Triggered by the
   .lab-tutorial-btn injected into toolbar row 2. Lab-only; production never
   has the trigger element so these styles are dormant on /.
   ========================================================================== */

/* Trigger button — visually distinct from the Show all / Hide buttons so
   first-time users actually see it. Lila outline, white fill, hover lila. */
.lab-toolbar .lab-tutorial-btn {
  border-color: #7e57c2;
  color: #7e57c2;
  background: #ffffff;
  font-weight: 600;
}
.lab-toolbar .lab-tutorial-btn:hover {
  background: #7e57c2;
  color: #ffffff;
  border-color: #7e57c2;
}

/* Drawer + backdrop. Drawer slides in from the right; backdrop is a
   subtle dim that lets the chart stay visible behind so users can
   read a tip and try it on the live chart. Mobile (≤768 px) is moot
   since lab mobile shows the preview card, but we keep responsive
   sizing in case of landscape tablet. */
.lab-tut-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: rgba(15, 14, 22, 0.18);
  opacity: 0;
  transition: opacity 0.24s ease;
  pointer-events: none;
}
.lab-tut-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.lab-tut-backdrop[hidden] { display: none; }

.lab-tut-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 92vw);
  max-width: 92vw;
  z-index: 1600;
  background: #ffffff;
  box-shadow: -8px 0 24px rgba(15, 14, 22, 0.18);
  display: flex;
  flex-direction: column;
  transform: translateX(105%);
  transition: transform 0.26s ease;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ink);
}
.lab-tut-drawer.open { transform: translateX(0); }
.lab-tut-drawer[hidden] { display: none; }

.lab-tut-header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: start;
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #faf8f4 0%, #ffffff 100%);
}
.lab-tut-headtxt h3 {
  margin: 0 0 2px;
  font-size: 1.05rem;
  color: #7e57c2;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.lab-tut-headtxt p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.lab-tut-langs {
  display: inline-flex;
  gap: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  overflow: hidden;
  align-self: center;
}
.lab-tut-lang {
  padding: 4px 9px;
  border: 0;
  background: #ffffff;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.04em;
  height: auto;
}
.lab-tut-lang:hover { background: #f3eee4; color: var(--ink); }
.lab-tut-lang.active {
  background: #7e57c2;
  color: #ffffff;
}
.lab-tut-close {
  align-self: start;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
}
.lab-tut-close:hover { background: #f3eee4; color: var(--ink); }

.lab-tut-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px 24px;
  font-size: 0.86rem;
  line-height: 1.5;
}

.lab-tut-section {
  margin: 0 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}
.lab-tut-section[open] { border-color: #d4c8ee; box-shadow: 0 1px 6px rgba(126, 87, 194, 0.08); }
.lab-tut-section summary {
  padding: 9px 14px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  position: relative;
  user-select: none;
  font-size: 0.92rem;
}
.lab-tut-section summary::-webkit-details-marker { display: none; }
.lab-tut-section summary::after {
  content: '+';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 400;
  font-size: 1.1rem;
}
.lab-tut-section[open] summary::after { content: '–'; }
.lab-tut-section summary:hover { background: #faf8f4; }
.lab-tut-section ul {
  margin: 0;
  padding: 4px 18px 14px 32px;
  list-style: disc;
}
.lab-tut-section ul li { margin: 6px 0; color: var(--ink); }
.lab-tut-section ul li code,
.lab-tut-footer code {
  background: #f3eee4;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.82em;
  font-family: 'JetBrains Mono', monospace;
}

.lab-tut-footer {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-top: 1px dashed var(--line);
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
}

/* Drag-to-zoom animated SVG — pure CSS keyframes, loops every 4 s. */
.tut-drag-anim {
  display: block;
  width: 100%;
  height: auto;
  margin: 8px auto 4px;
  background: #faf8f4;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px;
  box-sizing: border-box;
}
.lab-tut-anim-cap {
  margin: 0 0 8px;
  text-align: center;
  font-size: 0.74rem;
  color: var(--muted);
  font-style: italic;
}
.tut-anim-cursor { animation: tut-cursor 4s ease-in-out infinite; }
.tut-anim-rect   { animation: tut-rect   4s ease-in-out infinite; }
@keyframes tut-cursor {
  0%        { transform: translate(55px, 22px); }
  10%       { transform: translate(55px, 22px); }
  45%       { transform: translate(155px, 72px); }
  60%       { transform: translate(155px, 72px); }
  85%       { transform: translate(155px, 72px); opacity: 1; }
  92%       { transform: translate(155px, 72px); opacity: 0; }
  100%      { transform: translate(55px, 22px);  opacity: 0; }
}
@keyframes tut-rect {
  0%        { width: 0;   height: 0;  opacity: 0; }
  10%       { width: 0;   height: 0;  opacity: 0; }
  12%       { width: 0;   height: 0;  opacity: 1; }
  45%       { width: 100px; height: 50px; opacity: 1; }
  60%       { width: 100px; height: 50px; opacity: 1; }
  78%       { width: 100px; height: 50px; opacity: 0.9; }
  92%       { width: 100px; height: 50px; opacity: 0; }
  100%      { width: 0;   height: 0;  opacity: 0; }
}

/* First-visit nudge — small popover that points up at the trigger
   button. Auto-dismisses on first click or after 8 s. */
.lab-tut-nudge {
  position: absolute;
  z-index: 1450;
  width: 320px;
  padding: 12px 14px 12px 14px;
  background: #1a1a22;
  color: #f5f5f0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 14, 22, 0.25);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.85rem;
  line-height: 1.4;
  animation: tut-nudge-in 0.3s ease-out;
}
.lab-tut-nudge::before {
  content: '';
  position: absolute;
  top: -7px;
  right: 36px;
  width: 14px;
  height: 14px;
  background: #1a1a22;
  transform: rotate(45deg);
  border-radius: 2px;
}
.lab-tut-nudge em {
  font-style: normal;
  font-weight: 600;
  color: #c9a8ff;
}
.lab-tut-nudge.fade-out {
  animation: tut-nudge-out 0.28s ease-in forwards;
}
@keyframes tut-nudge-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes tut-nudge-out {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateY(-4px); }
}

/* Mobile preview "tap to open in new tab" affordance. The trigger is
   now a plain <a target="_blank"> — earlier lightbox attempts fought
   iOS Safari's viewport pinch-zoom (the backdrop and chrome zoomed
   along with the image, which felt awful). Letting the native image
   viewer in a new tab handle zoom is the simplest reliable answer. */
body.lab-page .lab-preview-trigger {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  position: relative;
  font: inherit;
  color: inherit;
  text-decoration: none;
}
body.lab-page .lab-preview-trigger img {
  display: block;
  width: 100%;
  height: auto;
}
body.lab-page .lab-preview-zoom-hint {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(26, 26, 34, 0.78);
  color: #fff;
  font-size: 0.72rem;
  font-family: "JetBrains Mono", monospace;
  padding: 4px 10px;
  border-radius: 14px;
  pointer-events: none;
  letter-spacing: 0.03em;
}
@media (max-width: 768px) {
  .lab-mobile-note {
    display: block;
    margin: 0 14px 14px;
    padding: 12px 14px;
    border-radius: 8px;
    background: #fff8ec;
    border: 1px solid #f3d889;
    font-size: 0.86rem;
    line-height: 1.4;
    color: var(--ink);
  }
  .lab-mobile-note strong { color: #ff4d0d; }
  .lab-mobile-note-tag {
    display: block;
    margin-top: 6px;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.74rem;
    color: var(--muted);
    font-style: italic;
  }
  /* Lab toolbar on mobile: switch from flex-wrap to a 2-column grid so
     the ~25 controls stack in ~13 rows instead of 25. The global
     `input, button { width: 100% }` rule below still applies — but
     since each child is now a grid cell, "100%" means "fill its cell"
     instead of "fill its row". Quick-date paste field and the event
     dropdown stay full-width because they need the room. Desktop
     untouched — this rule is inside @media (max-width: 768px). */
  .lab-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 8px;
    align-items: stretch;
  }
  .lab-toolbar > * { min-width: 0; box-sizing: border-box; }
  .lab-toolbar .lab-label,
  .lab-toolbar .lab-event,
  .lab-toolbar .lab-quickdate-wrap,
  .lab-toolbar .lab-stationhint,
  .lab-toolbar .lab-dayflares,
  .lab-toolbar .lab-sep { grid-column: 1 / -1; }
  .lab-toolbar .lab-quickdate { width: 100%; }

  /* ===== Lab mobile = preview-card mode =================================
     The lab has 4 instruments with 4 Y-axes + 25 controls — there is no
     responsive layout that makes that "look right" on 320 px. Instead,
     swap the live chart for a static desktop screenshot so visitors
     arriving via a shared link (WhatsApp, etc.) see what the live thing
     actually looks like. Real interactivity stays on desktop. Scoped to
     body.lab-page so production (`/`) is completely untouched. */

  /* Hide everything chart-related on lab mobile — toolbar, status,
     panels, footnote, modal. We keep ONLY: topbar, hero, heads-up
     banner, mobile-preview figure, mascots/about. */
  body.lab-page :is(
    .widget,
    #status-bar,
    #panels-container,
    .footnote,
    .lab-modal,
    .lab-date-picker,
    .lab-toolbar,
    .lab-toolbar-row2,
    #mob-hover
  ) {
    display: none !important;
  }

  /* Show the mobile-preview figure (default hidden — desktop never
     sees it). Polished card with subtle shadow, rounded corners,
     caption styled like the heads-up banner. */
  body.lab-page .lab-mobile-preview {
    display: block;
    margin: 0 14px 24px;
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid var(--line);
    box-shadow:
      0 6px 20px rgba(26, 26, 34, 0.08),
      0 1px 3px rgba(26, 26, 34, 0.05);
  }
  body.lab-page .lab-mobile-preview img {
    display: block;
    width: 100%;
    height: auto;
    border-bottom: 1px solid var(--line);
  }
  body.lab-page .lab-mobile-preview figcaption {
    padding: 14px 16px 16px;
    font-size: 0.86rem;
    line-height: 1.45;
    color: var(--ink);
  }
  body.lab-page .lab-mobile-preview figcaption strong {
    display: block;
    margin-bottom: 4px;
    font-size: 0.92rem;
    color: #7e57c2;
  }
  body.lab-page .lab-mobile-preview figcaption span {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
  }

  /* Topbar: stack brand + meta vertically on narrow screens so the
     "v0.3-lab · alpha" badge stops overlapping "SXR + RSTN + RHESSI
     integrated". Allow inner items to wrap too — long meta strings
     break gracefully across two lines instead of pushing horizontal
     scroll. */
  body.lab-page .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 28px;
  }
  body.lab-page .topbar .meta {
    flex-wrap: wrap;
    gap: 4px 12px;
    font-size: 0.7rem;
  }
  body.lab-page .topbar .meta span:first-child::before {
    content: "";
    margin: 0;
  }

  /* Tighten hero on narrow screens — the LAB · NOINDEX badge can
     drop below the title. Already handled by .solar-hero stacking
     at 820 px, but force a smaller h1 so it doesn't dominate. */
  body.lab-page .solar-hero h1 { font-size: clamp(1.6rem, 7vw, 2.2rem); }
  body.lab-page .solar-hero .tagline { font-size: 0.88rem; }
  .footnote { padding-right: 16px; }
  /* Force the whole solar-wrap to never exceed viewport: no element
     inside (chart, toolbar, footnote) is allowed to push horizontal
     overflow that would force a body-level horizontal scroll. */
  .solar-wrap, .widget, .panel { max-width: 100vw; overflow-x: hidden; }
}
.footnote-info-btn:hover {
  background: #7e57c2;
  color: #fff;
}

/* Floating details modal — long methodology + RSTN guide. */
.lab-modal[hidden] { display: none; }
.lab-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lab-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 30, 0.55);
  backdrop-filter: blur(2px);
}
.lab-modal-content {
  position: relative;
  width: min(760px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 12px;
  padding: 28px 36px 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
}
.lab-modal-content h3 {
  margin: 0 0 18px;
  font-family: "Fraunces", serif;
  font-size: 1.4rem;
  color: #7e57c2;
}
.lab-modal-content h4 {
  margin: 18px 0 6px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #2d2a3a;
  letter-spacing: 0.01em;
}
.lab-modal-content p {
  margin: 0 0 8px;
}
.lab-modal-content code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  background: var(--accent-soft);
  padding: 0 4px;
  border-radius: 3px;
}
.lab-modal-close {
  position: absolute;
  top: 8px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
}
.lab-modal-close:hover { color: var(--ink); }
.lab-modal-content .rstn-coverage {
  border-collapse: collapse;
  margin: 6px auto;
  font-size: 0.86rem;
}
.lab-modal-content .rstn-coverage th,
.lab-modal-content .rstn-coverage td {
  padding: 5px 14px;
  text-align: center;
}
.lab-modal-content .rstn-coverage thead th {
  border-bottom: 1px solid #d0c8e0;
  font-weight: 600;
  color: #7e57c2;
}
.lab-modal-content .rstn-coverage tbody tr + tr td {
  border-top: 1px solid #ece8f4;
}
/* BibTeX block + copy button inside the lab details modal. */
.lab-modal-content .cite-bibtex {
  background: #f6f1e8;
  border: 1px solid #e0d8c8;
  border-radius: 4px;
  padding: 10px 12px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #2a2620;
  white-space: pre;
  overflow-x: auto;
  margin: 8px 0;
}
.lab-modal-content .cite-copy-btn {
  padding: 4px 10px;
  border: 1px solid #c9c2b5;
  background: #fff;
  color: var(--ink);
  border-radius: 3px;
  cursor: pointer;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  margin-right: 8px;
}
.lab-modal-content .cite-copy-btn:hover { background: #f3eee4; }
.lab-modal-content .cite-list {
  font-size: 0.85rem;
  line-height: 1.55;
}
.lab-modal-content .cite-list li { margin-bottom: 6px; }

/* RSTN station-coverage guide block (lab page). Same typographic register
   as .footnote, but with a centered table that inherits page font. */
.rstn-guide {
  max-width: 920px;
  margin: 22px auto 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.55;
  font-family: inherit;
}
.rstn-guide p {
  margin: 0 0 12px;
}
.rstn-guide p:last-child {
  margin: 12px 0 0;
}
.rstn-guide .rstn-coverage {
  border-collapse: collapse;
  margin: 0 auto;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--muted);
}
.rstn-guide .rstn-coverage th,
.rstn-guide .rstn-coverage td {
  padding: 6px 16px;
  text-align: center;
  font-weight: inherit;
}
.rstn-guide .rstn-coverage thead th {
  border-bottom: 1px solid #d0c8e0;
  font-weight: 600;
  color: #7e57c2;
  letter-spacing: 0.02em;
}
.rstn-guide .rstn-coverage tbody tr + tr td {
  border-top: 1px solid #ece8f4;
}
.rstn-guide .rstn-coverage strong {
  color: #2d2a3a;
}

/* Tighten the shared footer for tool pages (default shared margin-top is
   60px which is sized for the marketing-style hub/pg landers). */
.solar-wrap > footer {
  margin-top: 28px;
  padding-top: 16px;
}

/* === Floating About button + drawer === */

.about-fab {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 50px; height: 50px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  z-index: 20;
  padding: 0;
  display: grid; place-items: center;
  transition: transform 0.18s, background 0.18s;
}
.about-fab:hover { background: var(--accent); transform: scale(1.06); }

.about-overlay {
  position: fixed; inset: 0;
  background: rgba(13, 13, 18, 0);
  z-index: 30;
  transition: background 0.24s;
}
.about-overlay.open { background: rgba(13, 13, 18, 0.42); }

.about-drawer {
  position: fixed;
  top: 0; right: 0;
  width: min(560px, 100%);
  height: 100vh;
  background: var(--paper);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 36px rgba(0, 0, 0, 0.18);
  z-index: 40;
  transform: translateX(100%);
  transition: transform 0.24s ease-out;
  overflow-y: auto;
  padding: 28px 32px 60px;
}
.about-drawer.open { transform: translateX(0); }
.about-close {
  position: absolute;
  top: 14px; right: 14px;
  background: transparent;
  color: var(--ink);
  font-size: 1.6rem;
  width: 36px; height: 36px;
  border-radius: 50%;
  padding: 0;
  display: grid; place-items: center;
  border: 1px solid var(--line);
}
.about-close:hover { background: var(--bg); color: var(--accent); }

.about-content h2 {
  font-family: "Fraunces", serif;
  font-size: 1.6rem; font-weight: 700;
  margin: 8px 0 12px;
  letter-spacing: -0.02em;
}
.about-content h3 {
  font-family: "Fraunces", serif;
  font-size: 1.05rem; font-weight: 600;
  margin: 22px 0 8px;
  color: var(--accent);
}
.about-content p, .about-content ul {
  font-size: 0.94rem;
  line-height: 1.6;
  color: #2a2f3a;
  margin: 0 0 10px;
}
.about-content ul { padding-left: 18px; }
.about-content li { margin-bottom: 4px; }
.about-content a { color: var(--cool); text-decoration: none; border-bottom: 1px solid rgba(27, 63, 232, 0.3); }
.about-content a:hover { border-bottom-color: var(--cool); }
.about-content .lead {
  font-size: 1.02rem;
  color: var(--muted);
  margin-bottom: 18px;
}
.about-content ul.why-table {
  list-style: none;
  padding: 0;
  margin: 12px 0 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.about-content ul.why-table li {
  padding: 10px 14px;
  margin: 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
  line-height: 1.4;
}
.about-content ul.why-table li:last-child {
  border-bottom: none;
  background: rgba(126, 87, 194, 0.07);
}
.about-content ul.why-table li strong {
  color: var(--ink);
  font-weight: 700;
}
.about-content .cite {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 12px 14px;
  border-radius: 6px;
  white-space: pre;
  overflow-x: auto;
  color: var(--ink);
}
.about-content .cite-copy-btn {
  padding: 4px 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 3px;
  cursor: pointer;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  margin-right: 8px;
}
.about-content .cite-copy-btn:hover { background: var(--bg); }

/* === Mobile === */

@media (max-width: 768px) {
  .solar-wrap { padding: 22px 14px 50px; }

  .widget { border-radius: 0; border-left: none; border-right: none; box-shadow: none; }
  .widget { display: flex; flex-direction: column; }

  .panel       { order: 1; height: 760px; padding: 0; }
  #mob-hover   { order: 2; }
  #status-bar  { order: 3; padding: 8px 16px; }
  .toolbar {
    order: 4;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 18px;
    border-bottom: none;
    border-top: 1px solid var(--line);
  }

  .field { align-items: stretch; }
  input, button { width: 100%; }

  /* Hide Plotly's floating tooltip on touch; use #mob-hover strip instead. */
  .panel .hoverlayer { display: none !important; }

  #mob-hover {
    display: block;
    min-height: 2.8em;
    padding: 8px 16px;
    font-size: 13px;
    font-family: "JetBrains Mono", monospace;
    color: var(--ink);
    background: #f5f5f0;
    border-top: 1px solid var(--line);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #mob-hover.mob-hint {
    font-family: "Inter", system-ui, sans-serif;
    font-size: 12px;
    color: var(--muted);
  }

  .about-drawer { padding: 24px 22px 50px; }
  .about-fab { bottom: 16px; right: 16px; width: 44px; height: 44px; }
}
