/* =====================================================================
 * CapeLookout Weather Spine — Map Weather Layer styles
 * cl-map-weather-layer-v0.2.5.css
 *
 * v0.2.5 interaction model:
 *   - canvas weather animations (z2) + tappable temp PILLS (z3), always on
 *   - exactly ONE bottom-sheet CARD (z5), opened by tapping a pill or glyph
 *   - pills sit on a busy satellite map: high contrast, small footprint
 *
 * Everything namespaced .clwx-*, parented to the map container.
 * ===================================================================== */

.clwx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;   /* map drag passes through; glyph taps via map click */
  z-index: 2;
}

.clwx-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;   /* container ignores clicks; pills opt back in */
  z-index: 3;
  /* GDS tokens — override by setting these on the map container */
  --clwx-cyan: #55e6ff;
  --clwx-gold: #ffd568;
  --clwx-ink: #eefaff;
  --clwx-muted: #9fb6c0;
  --clwx-warn: #ff6f5d;
  --clwx-watch: #ffbd58;
  --clwx-glass: rgba(7, 17, 25, 0.90);
  --clwx-glass-solid: rgba(7, 17, 25, 0.97);
  --clwx-edge: rgba(120, 234, 255, 0.22);
}

/* ------------------------------------------------------------------ *
 * Temp pill — always visible, tappable. Positioned by JS.
 * ------------------------------------------------------------------ */
.clwx-pill {
  position: absolute;
  transform: translate(-50%, 14px);
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  background: var(--clwx-glass);
  border: 1px solid var(--clwx-edge);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255,255,255,0.04) inset;
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  backdrop-filter: blur(10px) saturate(1.1);
  white-space: nowrap;
  cursor: pointer;
  pointer-events: auto;
  font-family: 'Inter Tight', system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.clwx-pill:hover { transform: translate(-50%, 14px) scale(1.06); border-color: rgba(120,234,255,0.45); }
.clwx-pill:active { transform: translate(-50%, 14px) scale(0.97); }
.clwx-pill.clwx-pill-active {
  border-color: var(--clwx-cyan);
  box-shadow: 0 6px 22px rgba(0,0,0,0.55), 0 0 0 2px rgba(85,230,255,0.35);
}
.clwx-pill.clwx-hidden { display: none; }

.clwx-pill-dot {
  width: 8px; height: 8px; border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
  flex: 0 0 auto;
}
.clwx-pill-t {
  font-weight: 700; font-size: 14px; color: #fff; line-height: 1;
  letter-spacing: -0.01em;
}
.clwx-pill-t sup { font-size: 8px; color: var(--clwx-gold); vertical-align: super; margin-left: 1px; }

/* risk tints on the pill border */
.clwx-pill.clwx-pill-warn { border-color: rgba(255, 111, 93, 0.6); }
.clwx-pill.clwx-pill-warn .clwx-pill-dot { color: var(--clwx-warn); background: var(--clwx-warn); }
.clwx-pill.clwx-pill-watch { border-color: rgba(255, 189, 88, 0.5); }

/* ------------------------------------------------------------------ *
 * Slide-up card — one open at a time. v0.2.6: matches the filter-bar
 * width, sits ABOVE the filter bar (small gap) so nothing is hidden,
 * and lays weather info in a horizontal row. Short height = on mobile
 * it doesn't obscure the map.
 *
 * The filter bar spans the map with ~16px side insets and sits at the
 * bottom; we mirror that footprint. --clwx-bar-h lets the integration
 * tell us the bar height so we can park just above it.
 * ------------------------------------------------------------------ */
.clwx-sheet {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: var(--clwx-bar-bottom, 92px);   /* above the filter bar; overridable */
  box-sizing: border-box;
  padding: 12px 16px 11px;
  border-radius: 16px;
  background: var(--clwx-glass-solid);
  border: 1px solid var(--clwx-edge);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(120,234,255,0.06) inset;
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  backdrop-filter: blur(20px) saturate(1.2);
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transform: translateY(16px);
  font-family: 'Inter Tight', system-ui, -apple-system, sans-serif;
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}
.clwx-sheet.clwx-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.clwx-sheet.clwx-sheet-warn { border-color: rgba(255, 111, 93, 0.55); }
.clwx-sheet.clwx-sheet-watch { border-color: rgba(255, 189, 88, 0.45); }

.clwx-sheet-close {
  position: absolute; top: 8px; right: 10px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: rgba(255,255,255,0.06);
  color: var(--clwx-muted); font-size: 18px; line-height: 1;
  border-radius: 50%; cursor: pointer; padding: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s ease, color 0.12s ease;
  z-index: 1;
}
.clwx-sheet-close:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* the horizontal row: identity | big temp | stat columns */
.clwx-card-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-right: 30px;   /* clear the close button */
  flex-wrap: wrap;
}
.clwx-card-id { min-width: 0; flex: 0 1 auto; }

.clwx-r1 { display: flex; align-items: baseline; gap: 8px; }
.clwx-nm {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 600; font-size: 14px; letter-spacing: 0.04em;
  text-transform: uppercase; color: #f3fafe;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.clwx-chip {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 8.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--clwx-gold); white-space: nowrap; flex: 0 0 auto;
}
.clwx-chip.clwx-chip-warn { color: var(--clwx-warn); }
.clwx-chip.clwx-chip-watch { color: var(--clwx-watch); }

.clwx-cd { color: #a7bdc7; font-size: 12px; margin-top: 2px; white-space: nowrap; }

.clwx-tp {
  font-family: 'Inter Tight', system-ui, sans-serif;
  font-weight: 800; font-size: 36px; line-height: 1.0;
  letter-spacing: -0.03em; color: #fff;
  flex: 0 0 auto;
}
.clwx-tp sup { font-size: 15px; font-weight: 600; color: var(--clwx-gold); vertical-align: super; margin-left: 2px; }

.clwx-st {
  display: flex; gap: 20px;
  flex: 1 1 auto;
  justify-content: flex-start;
}
.clwx-stat { display: flex; flex-direction: column; gap: 3px; }
.clwx-k {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 8.5px; letter-spacing: 0.1em; text-transform: uppercase; color: #6f8d99;
}
.clwx-v {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 13px; color: #e2f5fd; white-space: nowrap;
}
.clwx-ft { font-size: 9.5px; color: #7c97a2; margin-top: 8px; letter-spacing: 0.02em; }

/* narrow screens: let the row wrap gracefully, temp stays prominent */
@media (max-width: 520px) {
  .clwx-card-row { gap: 12px 16px; }
  .clwx-tp { font-size: 30px; }
  .clwx-st { gap: 14px; width: 100%; }
}

/* ------------------------------------------------------------------ *
 * Weather on/off toggle — injected into the filter bar control row.
 * Styled to sit comfortably among the existing pill-shaped controls.
 * ------------------------------------------------------------------ */
.clwx-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: 'Inter Tight', system-ui, -apple-system, sans-serif;
  font-size: 13px; font-weight: 500; color: var(--clwx-ink, #eefaff);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(120,234,255,0.18);
  border-radius: 12px;
  padding: 9px 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.14s ease, border-color 0.14s ease, opacity 0.14s ease;
}
.clwx-toggle:hover { background: rgba(255,255,255,0.09); }
.clwx-toggle-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #55e6ff; box-shadow: 0 0 8px #55e6ff;
  transition: background 0.14s ease, box-shadow 0.14s ease;
}
.clwx-toggle.clwx-toggle-off { opacity: 0.7; }
.clwx-toggle.clwx-toggle-off .clwx-toggle-dot {
  background: #5a6b75; box-shadow: none;
}
.clwx-toggle-label { white-space: nowrap; }

/* ------------------------------------------------------------------ *
 * Reduced motion
 * ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .clwx-pill, .clwx-sheet, .clwx-sheet-close, .clwx-toggle, .clwx-toggle-dot { transition: none; }
}
