/* ===========================================================================
   ACARS flight tracks + wind barbs — styles
   Dark "night-ops" basemap so the color-coded wind barbs and tracks pop, framed
   by the same dark instrument chrome + amber accents as the sounding map.
   ========================================================================== */

:root {
  --slate-900: #141b23;
  --slate-850: #18212b;
  --slate-800: #1d2832;
  --slate-700: #283643;
  --slate-600: #364654;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);

  --amber: #ffb000;
  --amber-bright: #ffc94d;
  --amber-dim: #b98300;
  --amber-glow: rgba(255, 176, 0, 0.35);

  --text: #eef2f5;
  --text-dim: #9fb0bd;
  --text-faint: #6f7f8c;

  --track: #5b8fd6;

  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "JetBrains Mono", "Cascadia Code", "SF Mono", Consolas, monospace;

  --bezel-shadow: 0 6px 22px rgba(8, 12, 16, 0.55);
  --topbar-h: 52px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  font-family: var(--font-ui); color: var(--text);
  background: #0b0f14; overflow: hidden;
}

/* ---- top instrument bar -------------------------------------------------- */
#topbar {
  position: absolute; inset: 0 0 auto 0; height: var(--topbar-h); z-index: 1200;
  display: flex; align-items: center; gap: 18px; padding: 0 16px;
  background: linear-gradient(180deg, var(--slate-800), var(--slate-850));
  border-bottom: 1px solid var(--line-strong); box-shadow: var(--bezel-shadow);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700;
  letter-spacing: 0.4px; font-size: 15px; white-space: nowrap; }
.brand .glyph { width: 26px; height: 26px; display: grid; place-items: center;
  color: var(--slate-900); background: var(--amber); border-radius: 7px;
  box-shadow: 0 0 0 1px var(--amber-dim), 0 0 12px var(--amber-glow); }
.brand .sub { color: var(--amber-bright); font-weight: 600; }

.readout { display: flex; align-items: center; gap: 16px; margin-left: auto;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text-dim); white-space: nowrap; }
.readout .field { display: flex; flex-direction: column; line-height: 1.15; }
.readout .field .k { color: var(--text-faint); font-size: 9.5px; letter-spacing: 0.6px; text-transform: uppercase; }
.readout .field .v { color: var(--text); }
.readout .v.live { color: var(--amber-bright); }
.readout .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 8px var(--amber-glow); }

/* The button row runs out of room before the window does: at 1920px it already
   measured ~1892px wide before the water-vapour toggle was added, and adding it
   pushed "Recent soundings" -- the only entry to the comparison viewer -- off
   the edge entirely. Scroll rather than clip, so a button can never become
   unreachable on a narrower screen. */
.controls {
  display: flex; align-items: center; gap: 8px;
  min-width: 0; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.controls::-webkit-scrollbar { height: 5px; }
.controls::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
.controls::-webkit-scrollbar-track { background: transparent; }
.controls > * { flex: 0 0 auto; }
.btn { font-family: var(--font-ui); font-size: 12px; color: var(--text);
  background: var(--slate-700); border: 1px solid var(--line-strong); border-radius: 7px;
  padding: 7px 11px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  transition: background 0.15s, border-color 0.15s, color 0.15s; }
.btn:hover { background: var(--slate-600); border-color: var(--amber-dim); }
.btn svg { width: 14px; height: 14px; }
.btn.toggle.on { background: var(--amber); color: var(--slate-900); border-color: var(--amber-dim); font-weight: 600; }
.btn.spin svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- map ----------------------------------------------------------------- */
#map { position: absolute; inset: var(--topbar-h) 0 0 0; background: #0b0f14; }

/* lift the dark basemap so land + state/country lines stay legible under the
   wind barbs (applies to the basemap tiles only, not the data) */
.basemap-tiles { filter: brightness(1.5) contrast(1.2); }

/* wind-barb icons carry no box; just the SVG */
.barb { pointer-events: none; }
.barb svg { display: block; filter: drop-shadow(0 0 1px rgba(0,0,0,0.6)); }

/* ---- hover tooltip + click popup (Leaflet overrides) --------------------- */
.leaflet-tooltip.obs-tip, .leaflet-popup.obs-pop .leaflet-popup-content-wrapper {
  background: var(--slate-800); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 9px;
  box-shadow: var(--bezel-shadow); font-family: var(--font-mono); font-size: 11.5px;
}
.leaflet-tooltip.obs-tip { padding: 7px 10px; line-height: 1.45; }
.leaflet-tooltip.obs-tip::before { border-top-color: var(--line-strong) !important; }
.obs-tip .id { color: var(--amber-bright); font-weight: 700; font-size: 12.5px; }
.obs-tip .wind { color: var(--amber-bright); }
.obs-tip .mut { color: var(--text-faint); }
.leaflet-popup.obs-pop .leaflet-popup-content { margin: 9px 12px; line-height: 1.5; }
.leaflet-popup.obs-pop .leaflet-popup-tip { background: var(--slate-800); }
.leaflet-popup.obs-pop a.leaflet-popup-close-button { color: var(--text-faint); }

/* ---- wind-speed legend --------------------------------------------------- */
#legend {
  position: absolute; left: 14px; bottom: 16px; z-index: 1000;
  background: var(--slate-800); border: 1px solid var(--line-strong);
  border-radius: 9px; box-shadow: var(--bezel-shadow); padding: 11px 13px;
  font-size: 11px; color: var(--text-dim); display: none;
}
#legend.show { display: block; }
#legend h4 { margin: 0 0 8px; font-size: 10px; letter-spacing: 0.7px;
  text-transform: uppercase; color: var(--text-faint); font-weight: 700; }
#legend .scale { display: flex; align-items: flex-end; gap: 0; }
#legend .seg { width: 30px; text-align: center; }
#legend .seg .bar { height: 9px; }
#legend .seg .num { font-family: var(--font-mono); font-size: 9px; color: var(--text-dim);
  margin-top: 3px; }
#legend .scale .seg:first-child .bar { border-radius: 3px 0 0 3px; }
#legend .scale .seg:last-child .bar { border-radius: 0 3px 3px 0; }
#legend .unit { margin-top: 6px; font-family: var(--font-mono); font-size: 9.5px; color: var(--text-faint); }

/* ---- turbulence (EDR) legend --------------------------------------------- */
#edr-legend {
  position: absolute; left: 14px; bottom: 104px; z-index: 1000; display: none;
  background: var(--slate-800); border: 1px solid var(--line-strong);
  border-radius: 9px; box-shadow: var(--bezel-shadow); padding: 10px 13px;
  font-size: 11px; color: var(--text-dim); max-width: 250px;
}
#edr-legend.show { display: block; }
#edr-legend h4 { margin: 0 0 7px; font-size: 10px; letter-spacing: 0.7px;
  text-transform: uppercase; color: var(--text-faint); font-weight: 700; }
.edr-scale { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.edr-key { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text); }
.edr-key i { width: 11px; height: 11px; border-radius: 50%; display: inline-block;
  border: 1px solid #0a0e14; }
.edr-note { margin-top: 7px; font-family: var(--font-mono); font-size: 9px; color: var(--text-faint);
  line-height: 1.4; }

/* ---- PIREP markers + legend ---------------------------------------------- */
.pirep-marker { pointer-events: auto; cursor: default; }
.pirep-mk {
  width: var(--s); height: var(--s); margin: auto; background: var(--c);
  transform: rotate(45deg); border: 1px solid rgba(0, 0, 0, 0.65); border-radius: 2px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.55); transition: transform 0.12s;
}
.pirep-marker:hover .pirep-mk { transform: rotate(45deg) scale(1.25); }
#pirep-legend {
  position: absolute; left: 14px; bottom: 200px; z-index: 1000; display: none;
  background: var(--slate-800); border: 1px solid var(--line-strong);
  border-radius: 9px; box-shadow: var(--bezel-shadow); padding: 10px 13px;
  font-size: 11px; color: var(--text-dim); max-width: 250px;
}
#pirep-legend.show { display: block; }
#pirep-legend h4 { margin: 0 0 7px; font-size: 10px; letter-spacing: 0.7px;
  text-transform: uppercase; color: var(--text-faint); font-weight: 700; }
.pirep-scale { display: flex; flex-wrap: wrap; gap: 5px 10px; }
.pirep-key { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text); }
.pirep-sw { width: 10px; height: 10px; display: inline-block; transform: rotate(45deg);
  border: 1px solid rgba(0, 0, 0, 0.65); border-radius: 2px; }
.obs-tip .praw { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 9.5px; color: var(--text-faint); max-width: 260px;
  white-space: normal; }

/* ---- tracks/barbs info chip + toast -------------------------------------- */
#hint {
  position: absolute; right: 14px; bottom: 16px; z-index: 1000;
  background: var(--slate-800); border: 1px solid var(--line-strong);
  border-radius: 9px; box-shadow: var(--bezel-shadow); padding: 9px 12px;
  font-size: 11px; color: var(--text-dim); max-width: 230px; line-height: 1.45;
}
#hint b { color: var(--text); }

#toast {
  position: absolute; left: 50%; transform: translateX(-50%);
  top: calc(var(--topbar-h) + 14px); z-index: 1300;
  background: var(--slate-800); border: 1px solid var(--line-strong); color: var(--text);
  font-size: 12px; padding: 9px 15px; border-radius: 8px; box-shadow: var(--bezel-shadow);
  opacity: 0; pointer-events: none; transition: opacity 0.25s; font-family: var(--font-mono);
}
#toast.show { opacity: 1; }

#loading {
  position: absolute; inset: var(--topbar-h) 0 0 0; z-index: 1400;
  display: grid; place-items: center; background: rgba(11, 15, 20, 0.82);
  font-family: var(--font-mono); color: var(--text-dim); font-size: 13px;
}
#loading.hidden { display: none; }
#loading .loading-card {
  text-align: center; padding: 22px 30px; min-width: 300px; max-width: 82vw;
  background: var(--slate-800); border: 1px solid var(--line-strong);
  border-radius: 12px; box-shadow: var(--bezel-shadow);
}
#loading #loading-msg { font-size: 14px; color: var(--text); font-weight: 600; }
#loading .loading-sub { margin-top: 8px; font-size: 11.5px; color: var(--amber-bright);
  line-height: 1.5; white-space: pre-line; min-height: 1.4em; }
#loading .spinner { width: 30px; height: 30px; border: 3px solid var(--line-strong);
  border-top-color: var(--amber); border-radius: 50%; animation: spin 0.8s linear infinite;
  margin: 0 auto 14px; }

/* Leaflet chrome on dark */
.leaflet-container { font-family: var(--font-ui); background: #0b0f14; }
.leaflet-control-zoom a { background: var(--slate-800) !important; color: var(--text) !important;
  border-color: var(--line-strong) !important; }
.leaflet-control-zoom a:hover { background: var(--slate-700) !important; }
.leaflet-bar { box-shadow: var(--bezel-shadow) !important; border: none !important; }
.leaflet-control-attribution { background: rgba(20,27,35,0.8) !important; color: var(--text-faint) !important; }
.leaflet-control-attribution a { color: var(--text-dim) !important; }

@media (max-width: 600px) {
  .readout .field.host { display: none; }
  #hint { display: none; }
}

/* ===========================================================================
   Soundings: location markers + skew-T panel
   ========================================================================== */

/* clickable airport/sounding marker */
.snd-marker { pointer-events: auto; cursor: pointer; }
.snd-marker .badge {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 176, 0, 0.16); border: 1.5px solid var(--amber);
  color: var(--amber-bright); box-shadow: 0 0 8px var(--amber-glow);
  font-size: 12px; font-weight: 800; line-height: 1;
  transition: transform 0.12s, background 0.12s;
}
.snd-marker:hover .badge { transform: scale(1.18); background: var(--amber); color: var(--slate-900); }

/* radiosonde (balloon) stations — cyan pills, distinct from the amber soundings */
.raob-marker { pointer-events: auto; cursor: pointer; }
.raob-marker .raob-pill {
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  background: rgba(8, 30, 38, 0.82); border: 1.5px solid #22d3ee;
  color: #a5f3fc; font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  line-height: 1; padding: 3px 6px; border-radius: 9px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.55); transition: transform 0.12s, background 0.12s;
}
.raob-marker .raob-glyph {
  width: 7px; height: 7px; background: #22d3ee; border-radius: 1px;
  transform: rotate(45deg); box-shadow: 0 0 6px rgba(34, 211, 238, 0.7);
}
.raob-marker:hover .raob-pill { transform: scale(1.12); background: rgba(34, 211, 238, 0.9); color: #042530; }
.raob-marker:hover .raob-glyph { background: #042530; }

.leaflet-tooltip.snd-tip {
  background: var(--slate-800); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 8px;
  font-family: var(--font-mono); font-size: 11px; padding: 6px 9px;
  box-shadow: var(--bezel-shadow);
}
.leaflet-tooltip.snd-tip::before { border-top-color: var(--line-strong) !important; }
.snd-tip b { color: var(--amber-bright); }

/* skew-T panel docked on the right */
#sndpanel {
  position: absolute; top: var(--topbar-h); right: 0; bottom: 0; width: 480px;
  max-width: 94vw; z-index: 1500; background: linear-gradient(180deg, var(--slate-850), var(--slate-900));
  border-left: 1px solid var(--line-strong); box-shadow: -10px 0 30px rgba(8,12,16,0.5);
  transform: translateX(100%); transition: transform 0.22s ease;
  display: flex; flex-direction: column;
}
#sndpanel.open { transform: translateX(0); }
.snd-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--line); background: var(--slate-800);
}
.snd-title { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1; }
.snd-hrrr { flex: none; background: var(--slate-700); border: 1px solid var(--line-strong);
  color: var(--text); height: 30px; padding: 0 11px; border-radius: 7px; font-size: 12px;
  font-weight: 600; cursor: pointer; font-family: var(--font-mono); white-space: nowrap; }
.snd-hrrr:hover { background: var(--slate-600); border-color: #5dade2; color: #9ed2f5; }
.snd-hrrr:disabled { opacity: 0.6; cursor: default; }
.snd-title #snd-tail { font-weight: 700; font-size: 15px; color: var(--amber-bright);
  font-family: var(--font-mono); }
.snd-title .snd-sub { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.snd-close { margin-left: auto; background: var(--slate-700); border: 1px solid var(--line-strong);
  color: var(--text); width: 30px; height: 30px; border-radius: 7px; font-size: 18px;
  cursor: pointer; line-height: 1; flex: none; }
.snd-close:hover { background: var(--slate-600); border-color: var(--amber-dim); }

.snd-body { flex: 1; overflow: auto; display: grid; align-content: start; justify-items: center; padding: 10px; background: #0e141b; }
.snd-body img { max-width: 100%; height: auto; border-radius: 6px; cursor: zoom-in; }
.snd-cross { position: fixed; height: 0; border-top: 1px dashed var(--amber-bright); z-index: 1600;
  pointer-events: none; display: none; opacity: 0.85; }
.snd-cross::after { content: ""; position: absolute; left: 50%; top: -3px; width: 6px; height: 6px;
  margin-left: -3px; border-radius: 50%; background: var(--amber-bright); }
.snd-readout { position: fixed; z-index: 1601; pointer-events: none; display: none;
  background: var(--slate-800); border: 1px solid var(--line-strong); border-radius: 7px;
  box-shadow: var(--bezel-shadow); padding: 7px 9px; font-family: var(--font-mono);
  font-size: 11px; color: var(--text); white-space: nowrap; line-height: 1.55; }
.snd-readout b { color: var(--amber-bright); }
.snd-readout .mut { color: var(--text-faint); }
#snd-hodo { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.snd-loading { color: var(--text-dim); font-family: var(--font-mono); font-size: 12.5px; text-align: center; }
.snd-loading .spinner { width: 26px; height: 26px; border: 3px solid var(--line-strong);
  border-top-color: var(--amber); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 10px; }
.snd-error { color: #e74c3c; font-family: var(--font-mono); font-size: 12.5px; text-align: center; padding: 20px; }

.snd-foot { padding: 9px 14px; border-top: 1px solid var(--line); background: var(--slate-800);
  font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); }
.snd-foot b { color: var(--text-dim); }

/* Warning under the sounding header (bad dewpoint, QC flags, missed launch).
   Its parent (.snd-sub) is a single nowrap/ellipsis line, so the note has to opt
   back into wrapping or long warnings get cut off mid-sentence. Red and briefly
   flashing so it's not mistaken for ordinary amber chrome, then it settles. */
.snd-note {
  display: block; margin-top: 6px;
  white-space: normal; overflow: visible; text-overflow: clip;
  color: #ff5c5c; font-family: var(--font-mono); font-size: 11.5px;
  font-weight: 700; letter-spacing: 0.2px; line-height: 1.45;
  background: rgba(255, 82, 82, 0.10); border: 1px solid rgba(255, 82, 82, 0.45);
  border-left: 3px solid #ff5c5c; border-radius: 5px; padding: 5px 8px;
  animation: noteFlash 1.1s ease-in-out 5;      /* catch the eye, then hold steady */
}
@keyframes noteFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; border-left-color: rgba(255, 92, 92, 0.25); }
}
@media (prefers-reduced-motion: reduce) { .snd-note { animation: none; } }
/* Informational tier: MADIS per-ob QC flags, "site did not launch". Worth
   knowing, not worth alarming over — red stays reserved for "this sensor is
   lying to you", so it keeps its meaning. */
.snd-note.info {
  color: var(--amber-bright); font-weight: 600;
  background: transparent; border: none; border-left: 2px solid var(--amber-dim);
  border-radius: 0; padding: 1px 0 1px 7px; animation: none;
}
/* Quietest tier: "we could not check this", as opposed to "this is wrong". It
   exists because a blank panel used to mean both "verified clean" and "never
   verified", and only one of those is a reason to trust the dewpoint. Grey, no
   icon, no flash — it must never compete with the red banner for attention. */
.snd-note.muted {
  color: var(--text-faint); font-weight: 400; font-style: italic;
  background: transparent; border: none; border-left: 2px solid var(--line);
  border-radius: 0; padding: 1px 0 1px 7px; animation: none;
}

@media (max-width: 640px) {
  #sndpanel { width: 100vw; }
}

/* "click for sounding" cue inside the obs hover tooltip */
.obs-tip .snd-cue { margin-top: 3px; color: var(--amber-bright); font-size: 10px;
  letter-spacing: 0.03em; }

/* ===========================================================================
   Sounding zoom lightbox (click the plot to enlarge / pan / zoom)
   ========================================================================== */
.snd-expand {
  background: var(--slate-700); border: 1px solid var(--line-strong);
  color: var(--text); width: 30px; height: 30px; border-radius: 7px;
  cursor: pointer; display: grid; place-items: center; flex: none; padding: 0;
}
.snd-expand:hover { background: var(--slate-600); border-color: var(--amber-dim); color: var(--amber-bright); }
.snd-expand svg { width: 16px; height: 16px; }

#sndzoom { position: fixed; inset: 0; z-index: 3000; display: none; background: rgba(6, 9, 13, 0.94); }
#sndzoom.open { display: block; }
#sndzoom .zwrap { position: absolute; inset: 0; overflow: hidden; cursor: grab; touch-action: none; }
#sndzoom .zwrap.grabbing { cursor: grabbing; }
#sndzoom img {
  position: absolute; top: 0; left: 0; transform-origin: 0 0;
  user-select: none; -webkit-user-drag: none; will-change: transform;
  image-rendering: auto; background: #0e141b; border-radius: 4px;
}
#sndzoom .zcap {
  position: absolute; top: 16px; left: 20px; z-index: 3010; pointer-events: none;
  font-family: var(--font-mono); color: var(--text); text-shadow: 0 1px 4px #000;
}
#sndzoom .zcap b { color: var(--amber-bright); font-size: 15px; }
#sndzoom .zcap span { display: block; font-size: 11px; color: var(--text-dim); margin-top: 2px; }
#sndzoom .zbar { position: absolute; top: 14px; right: 16px; z-index: 3010; display: flex; gap: 8px; }
#sndzoom .zbtn {
  background: rgba(27, 35, 44, 0.92); border: 1px solid var(--line-strong); color: var(--text);
  width: 38px; height: 38px; border-radius: 9px; cursor: pointer; font-size: 19px;
  display: grid; place-items: center; line-height: 1; backdrop-filter: blur(3px);
}
#sndzoom .zbtn:hover { background: var(--slate-700); border-color: var(--amber-dim); color: var(--amber-bright); }
#sndzoom .zhint {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 3010;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-faint);
  background: rgba(16, 22, 29, 0.8); padding: 5px 12px; border-radius: 20px;
  border: 1px solid var(--line); pointer-events: none;
}

/* ===========================================================================
   Sounding tabs (switch between multiple soundings at one airport)
   ========================================================================== */
.snd-tabs { border-top: 1px solid var(--line); background: var(--slate-850);
  display: none; flex-direction: column; flex: none; }
.snd-tabs.show { display: flex; }
.snd-tabs-label { padding: 8px 12px 2px; font-family: var(--font-mono); font-size: 10.5px;
  color: var(--text-dim); letter-spacing: 0.04em; }
.snd-tabs-label b { color: var(--amber-bright); }
.snd-tabs-row { display: flex; gap: 6px; overflow-x: auto; padding: 5px 10px 10px; scrollbar-width: thin; }
.snd-tabs-row::-webkit-scrollbar { height: 7px; }
.snd-tabs-row::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
.snd-tab { flex: 0 0 auto; background: var(--slate-700); border: 1px solid var(--line-strong);
  color: var(--text-dim); border-radius: 7px; padding: 6px 10px; cursor: pointer;
  font-family: var(--font-mono); font-size: 11px; white-space: nowrap;
  display: flex; align-items: center; gap: 5px; transition: background 0.12s, border-color 0.12s; }
.snd-tab:hover { border-color: var(--amber-dim); color: var(--text); }
.snd-tab.active { background: rgba(255, 176, 0, 0.16); border-color: var(--amber); color: var(--amber-bright); }
.snd-tab .arr { font-size: 10px; opacity: 0.85; }

/* multi-sounding marker badge shows a count */
.snd-marker .badge.multi { background: var(--amber); color: var(--slate-900);
  font-size: 11px; font-weight: 800; }

.snd-tabs-hint { color: var(--text-faint); font-style: italic; }

/* ===========================================================================
   Archive (historical date) control in the header
   ========================================================================== */
.arc { display: flex; align-items: center; gap: 6px; margin-right: 4px; }
.arc-input {
  background: var(--slate-700); border: 1px solid var(--line-strong); color: var(--text);
  border-radius: 6px; padding: 5px 7px; font-family: var(--font-mono); font-size: 11px;
  color-scheme: dark;            /* dark native date picker */
}
.arc-input.arc-hour { width: 50px; text-align: center; }
.arc-input:focus { outline: none; border-color: var(--amber); }

.find { display: flex; align-items: center; gap: 6px; margin-right: 4px; }
.find-input { width: 96px; text-transform: uppercase; }
.find-input::placeholder { text-transform: none; letter-spacing: 0; }

/* floating aircraft-lookup box (top-left of the map, right of the zoom control) */
#find-box {
  position: absolute; top: calc(var(--topbar-h) + 12px); left: 50%; transform: translateX(-50%);
  z-index: 1100;
  display: flex; align-items: center; gap: 7px;
  background: var(--slate-800); border: 1px solid var(--line-strong);
  border-radius: 9px; box-shadow: var(--bezel-shadow); padding: 7px 9px;
}
#find-box .find-label { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint);
  letter-spacing: 0.4px; text-transform: uppercase; white-space: nowrap; }
#find-id {
  width: 120px; background: var(--slate-700); border: 1px solid var(--line-strong); color: var(--text);
  border-radius: 6px; padding: 5px 8px; font-family: var(--font-mono); font-size: 12px; text-transform: uppercase;
}
#find-id::placeholder { text-transform: none; letter-spacing: 0; color: var(--text-faint); }
#find-id:focus { outline: none; border-color: var(--amber); }
#find-box .btn { padding: 5px 10px; font-size: 12px; }
#find-box .btn.find-clear { padding: 5px 8px; line-height: 1; }
/* highlighted aircraft track: bright amber, flashing */
@keyframes trackFlash { 0%, 100% { stroke-opacity: 1; } 50% { stroke-opacity: 0.2; } }
.track-flash { animation: trackFlash 0.85s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .track-flash { animation: none; stroke-opacity: 1; } }
/* pulsing locator ring at the aircraft's most recent fix */
@keyframes findPulse { 0% { transform: scale(0.5); opacity: 1; } 100% { transform: scale(2.4); opacity: 0; } }
.find-pulse { position: relative; }
.find-pulse span { position: absolute; left: 0; top: 0; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border-radius: 50%; border: 2px solid var(--amber-bright, #ffcf4d); }
.find-pulse span.ring { animation: findPulse 1.3s ease-out infinite; }
.find-pulse span.core { width: 8px; height: 8px; margin: -4px 0 0 -4px; background: var(--amber-bright, #ffcf4d); border: none; }
.btn.live-btn { border-color: var(--amber-dim); color: var(--amber-bright); }
.btn.live-btn:hover { background: rgba(255, 176, 0, 0.14); }
.btn:disabled { opacity: 0.5; cursor: default; }
.readout .v.archive { color: var(--amber-bright); }
.win-select {
  background: var(--slate-700); border: 1px solid var(--line-strong); color: var(--text);
  border-radius: 6px; padding: 2px 4px; font-family: var(--font-mono); font-size: 12px;
  font-weight: 600; cursor: pointer; color-scheme: dark; margin-top: 1px;
}
.win-select:hover, .win-select:focus { outline: none; border-color: var(--amber); }
.auto-wrap { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.auto-lbl { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--text-faint); }

/* ===========================================================================
   Sounding analysis (NSHARP-style parameter readout)
   ========================================================================== */
.snd-analysis { display: none; padding: 4px 12px 16px; }
.snd-analysis.show { display: block; }
.ana-group { margin-top: 12px; }
.ana-note { margin-top: 8px; padding: 7px 9px; border-radius: 7px;
  background: rgba(245, 166, 35, 0.10); border: 1px solid rgba(245, 166, 35, 0.30);
  font-size: 10.5px; line-height: 1.45; color: var(--text-dim); }
.ana-note b { color: var(--text); }
.ana-title { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--amber-bright); margin-bottom: 6px;
  border-bottom: 1px solid var(--line); padding-bottom: 3px; }
.ana-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 5px 12px; }
.ana-cell { display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  font-family: var(--font-mono); font-size: 11.5px; padding: 2px 0; }
.ana-k { color: var(--text-dim); white-space: nowrap; }
.ana-v { color: var(--text); font-weight: 600; text-align: right; white-space: nowrap; }
.ana-note { margin-top: 12px; font-size: 10px; color: var(--text-faint); font-style: italic; }

/* ===========================================================================
   Altitude filter (dual-handle range slider, floating top-left on the map)
   ========================================================================== */
#mapfilters {
  position: absolute; left: 14px; top: calc(var(--topbar-h) + 12px); z-index: 1000;
  display: flex; flex-direction: column; gap: 10px;
}
.mapfilter {
  width: 212px;
  background: var(--slate-800); border: 1px solid var(--line-strong);
  border-radius: 9px; box-shadow: var(--bezel-shadow); padding: 10px 12px 8px;
  font-family: var(--font-mono); color: var(--text-dim);
}
.altf-top { display: flex; justify-content: space-between; align-items: center; }
.altf-title { font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--amber-bright); }
.altf-reset { background: none; border: 1px solid var(--line-strong); color: var(--text-dim);
  font-size: 9.5px; padding: 1px 7px; border-radius: 5px; cursor: pointer;
  font-family: var(--font-mono); line-height: 1.5; }
.altf-reset:hover { color: var(--text); border-color: var(--amber); }
.altf-val { font-size: 12px; color: var(--text); font-weight: 600; margin: 7px 0 9px;
  letter-spacing: 0.02em; }
.altf-val.on { color: var(--amber-bright); }
.altf-slider { position: relative; height: 22px; }
.altf-rail { position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 2px;
  background: var(--line-strong); }
.altf-fill { position: absolute; top: 9px; height: 4px; border-radius: 2px;
  background: var(--amber); box-shadow: 0 0 6px rgba(255, 176, 0, 0.4); }
.altf-slider input[type=range] {
  position: absolute; left: 0; top: 0; width: 100%; height: 22px; margin: 0;
  -webkit-appearance: none; appearance: none; background: transparent; pointer-events: none;
}
.altf-slider input[type=range]::-webkit-slider-runnable-track { background: transparent; height: 22px; }
.altf-slider input[type=range]::-moz-range-track { background: transparent; height: 22px; }
.altf-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; pointer-events: auto; height: 15px; width: 15px; margin-top: 3.5px;
  border-radius: 50%; background: var(--amber-bright); border: 2px solid #14100a; cursor: grab;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}
.altf-slider input[type=range]::-moz-range-thumb {
  pointer-events: auto; height: 15px; width: 15px; border-radius: 50%;
  background: var(--amber-bright); border: 2px solid #14100a; cursor: grab;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}
.altf-slider input[type=range]:active::-webkit-slider-thumb { cursor: grabbing; }
.altf-scale { display: flex; justify-content: space-between; font-size: 9px;
  color: var(--text-faint); margin-top: 4px; }
.dens-tag { margin: 0; font-size: 11.5px; color: var(--amber-bright); }
@media (max-width: 720px) { .mapfilter { width: 170px; } }

/* ---- Recent-soundings comparison viewer --------------------------------- */
.cmp-modal { position: fixed; inset: 0; z-index: 2000; background: rgba(8,12,16,0.72);
  display: grid; place-items: center; }
.cmp-panel { width: min(920px, 94vw); height: min(90vh, 1040px); display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--slate-850), var(--slate-900));
  border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--bezel-shadow); overflow: hidden; }
.cmp-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); background: var(--slate-800); }
.cmp-title { font-weight: 600; color: var(--text); font-size: 14px; flex: 1; }
.cmp-hint { font-weight: 400; color: var(--text-faint); font-size: 11px; margin-left: 10px; }
.cmp-hint b { color: var(--amber-bright); }
.cmp-close { background: var(--slate-700); border: 1px solid var(--line-strong); color: var(--text);
  width: 30px; height: 30px; border-radius: 7px; font-size: 20px; line-height: 1; cursor: pointer; }
.cmp-close:hover { border-color: var(--amber); }
.cmp-plotwrap { flex: 1; overflow: auto; display: grid; place-items: center; padding: 12px;
  background: #0e141b; position: relative; }
.cmp-img { max-width: 100%; max-height: 100%; height: auto; border-radius: 6px; }
.cmp-empty { color: var(--text-faint); font-family: var(--font-mono); font-size: 12.5px;
  text-align: center; line-height: 1.7; }
.cmp-loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center;
  background: rgba(14,20,27,0.7); color: var(--text-dim); font-family: var(--font-mono); font-size: 12.5px; z-index: 2; }
.cmp-loading .spinner { width: 26px; height: 26px; border: 3px solid var(--line-strong);
  border-top-color: var(--amber); border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 10px; }
.cmp-drawer { border-top: 1px solid var(--line-strong); background: var(--slate-800);
  padding: 8px 12px 10px; max-height: 34%; overflow-y: auto; }
.cmp-group { margin-bottom: 6px; }
.cmp-grouplabel { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.5px; margin: 4px 0; }
.cmp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cmp-chips-scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
.cmp-chip { flex: 0 0 auto; display: inline-flex; flex-direction: column; align-items: flex-start;
  background: var(--slate-700); border: 1px solid var(--line-strong); border-left: 3px solid transparent;
  color: var(--text); border-radius: 6px; padding: 4px 9px; cursor: pointer; font-family: var(--font-mono);
  font-size: 11px; line-height: 1.3; white-space: nowrap; user-select: none; }
.cmp-chip:hover { border-color: var(--amber-dim); }
.cmp-chip .chsub { color: var(--text-faint); font-size: 9.5px; }
.cmp-chip.sel { border-color: var(--chipcolor, var(--amber));
  border-left-color: var(--chipcolor, var(--amber));
  background: color-mix(in srgb, var(--chipcolor, #ffcf4d) 20%, var(--slate-700)); }
.cmp-chip.sel .chlabel { color: var(--chipcolor, var(--amber-bright)); font-weight: 600; }
@media (max-width: 640px) { .cmp-panel { width: 100vw; height: 100vh; border-radius: 0; } }

/* ---- AMDAR Archive: welcome panel -------------------------------------- */
/* Anchored below #find-box using the same left:50% + topbar offset, so it sits
   over Hudson Bay on the default North America view without being pinned to a
   map coordinate -- a geo-anchored box would slide off screen the moment anyone
   panned. Shown once per browser.

   The background is a SOLID colour, not the translucent --panel used elsewhere:
   this sits directly over flight tracks and coastlines, and semi-transparency
   made the text hard to read against them. */
.welcome {
  position: fixed; z-index: 1150;
  top: calc(var(--topbar-h) + 74px); left: 50%;
  transform: translateX(-50%);
  width: min(430px, calc(100vw - 32px));
  background: #16202a;                     /* opaque on purpose */
  border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 16px 20px 18px;
  box-shadow: var(--bezel-shadow);
}
.welcome h2 {
  margin: 0 0 9px; font-size: 16px; letter-spacing: .3px;
  color: var(--amber-bright); padding-right: 18px;
}
.welcome p { margin: 0 0 9px; line-height: 1.5; font-size: 13.5px; color: var(--text); }
.welcome p:last-of-type { margin-bottom: 0; }
.welcome b { color: var(--text-bright, #fff); }
.welcome .years { color: var(--amber-bright); font-weight: 700; }
.welcome-warn {
  border-left: 2px solid var(--amber-dim); padding-left: 9px;
  color: var(--amber-bright);
}
.welcome-x {
  position: absolute; top: 6px; right: 9px;
  background: none; border: none; color: var(--text-faint);
  font-size: 20px; line-height: 1; cursor: pointer; padding: 2px 6px;
}
.welcome-x:hover { color: var(--amber-bright); }

/* ---- About panel -------------------------------------------------------- */
/* Taller and scrollable, unlike the welcome box: this one is read on purpose
   rather than glanced at, so it can afford length. Same opaque background --
   it also sits over the map. */
.about {
  position: fixed; z-index: 1160;
  top: calc(var(--topbar-h) + 20px); left: 50%;
  transform: translateX(-50%);
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - var(--topbar-h) - 52px);
  overflow-y: auto;
  background: #16202a; border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 18px 24px 20px;
  box-shadow: var(--bezel-shadow);
}
.about h2 {
  margin: 0 0 10px; font-size: 17px; letter-spacing: .3px;
  color: var(--amber-bright); padding-right: 20px;
}
.about h3 {
  margin: 16px 0 7px; font-size: 12px; letter-spacing: .8px;
  text-transform: uppercase; color: var(--amber); font-family: var(--font-mono);
}
.about p { margin: 0 0 10px; line-height: 1.58; font-size: 13.5px; color: var(--text); }
.about b { color: #fff; }
.about a { color: var(--amber-bright); }
.about-list {
  margin: 0 0 6px; padding-left: 18px;
  line-height: 1.55; font-size: 13.5px; color: var(--text);
}
.about-list li { margin-bottom: 6px; }
.about-contact {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--line); color: var(--text-dim);
}

/* The About tab lives in the brand block, not the button row. That row already
   overflows on a 1500px window, and a button past the right edge is both
   unclickable and -- because the browser scrolls it into view on click --
   enough to drag the whole page sideways underneath the overlays. */
.about-tab {
  margin-left: 14px; padding: 4px 12px;
  background: rgba(255, 176, 0, 0.10);
  border: 1px solid var(--amber-dim);
  border-radius: 5px; cursor: pointer;
  font-family: var(--font-ui); font-size: 12px; font-weight: 600;
  letter-spacing: .3px; color: var(--amber-bright);
}
.about-tab:hover { background: rgba(255, 176, 0, 0.22); border-color: var(--amber); }
