/* =============================================================================
   css/weather.css — the live weather and ocean layers (js/weather.js),
   restyled for Hawaii Atlas Dark V1 / Topographic Night on 2026-08-20.

   The contract from P8 is unchanged and load-bearing: EVERY visual value the
   canvas renderers use is a custom property here, read once by js/weather.js
   via getComputedStyle. Change a ramp here, never in the JS. Ramps are
   space-separated hex stops, low value first.

   What changed in the restyle: the ramps were rebuilt out of the Topographic
   Night palette so a weather field reads as part of the chart rather than a
   sticker on top of it, the scalar wash was lightened and given a screen
   blend and a feathered edge (it used to land as a hard opaque rectangle over
   the island), and the timeline, legend and toast were rebuilt on the V7
   floating-panel material. The old file referenced --line, --surface-2,
   --accent-2 and --shadow-card, none of which survived the restyle, so every
   one of these surfaces was rendering unstyled.
   ============================================================================= */

:root {
  /* Particle streaks, slow → fast (wind AND currents). Teal through the
     section greens into gold and rust: the palette's own temperature run. */
  --wx-particle-ramp: #2E7F94 #48DDE3 #7FE3C8 #A8D76F #F4D15C #FF9557;

  /* Scalar fields. The low stop is deliberately near-ground so calm water
     disappears into the chart instead of tinting it. */
  --wx-waves-ramp: #06202B #1B5F73 #48DDE3 #F4D15C #FF9557;
  --wx-waves-range: 0 5;              /* metres */
  --wx-rain-ramp: #05171E #1B5F73 #48DDE3 #A8D76F;
  --wx-rain-range: 0 12;              /* mm per hour */
  --wx-temp-ramp: #245F79 #7FE3C8 #A8D76F #F4D15C #FF9557;
  --wx-temp-range: 16 34;             /* °C */

  /* Was 0.52, which read as a slab. At 0.4 under a screen blend the field
     lifts the chart instead of covering it. */
  --wx-scalar-alpha: 0.4;
}

/* The scalar overlay itself. Screen blend means a dark ramp stop contributes
   nothing, so calm water stays chart; the mask feathers the model's bounding
   rectangle, which otherwise cuts a visible straight edge across the ocean. */
.wx-scalar {
  mix-blend-mode: screen;
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, #000 58%, rgba(0, 0, 0, .55) 82%, transparent 100%);
  mask-image: radial-gradient(ellipse at 50% 50%, #000 58%, rgba(0, 0, 0, .55) 82%, transparent 100%);
}

/* ---- timeline / legend panel ------------------------------------------- */

/* An authored display beats the UA [hidden] rule — without this the empty
   timeline renders as a ghost pill whenever no weather layer is on. */
.wx-timeline[hidden] { display: none; }

.wx-timeline {
  position: absolute;
  left: 50%;
  bottom: 42px;                       /* clears #footBar and the edition badge */
  transform: translateX(-50%);
  /* Lives INSIDE #map, whose own stacking context holds the Leaflet panes at
     z 200–700 — so this must clear 700 to sit above the particle canvas.
     #map itself is z-index 1 inside #mapCanvas, so nothing here can rise
     above the app's floating panels regardless. */
  z-index: 780;
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: stretch;
  padding: 11px 13px;
  min-width: 292px;
  max-width: min(420px, calc(100% - 620px));
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: var(--shadow2);
  background-color: rgba(4, 7, 7, .97);
  background-image: var(--surface-texture);
  background-size: 100% 100%, 100% 100%, 560px auto;
  background-position: center;
  background-repeat: no-repeat;
  font-family: var(--font);
  pointer-events: auto;
}

.wx-scrub {
  display: flex;
  align-items: center;
  gap: 9px;
}

.wx-scrub__label {
  appearance: none;
  min-height: 28px;
  padding: 5px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background-color: rgba(4, 7, 7, .985);
  background-image: var(--control-texture);
  background-size: 100% 100%, 300px auto;
  background-position: center;
  color: var(--v6-ink-soft);
  font-family: var(--font-num);
  font-size: 9.5px;
  letter-spacing: .06em;
  white-space: nowrap;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease;
}
.wx-scrub__label.is-now {
  color: var(--v6-key);
  border-color: color-mix(in srgb, var(--accent) 62%, transparent);
}
.wx-scrub__label:hover { color: var(--v6-key); border-color: var(--accent); }

.wx-scrub__slider {
  flex: 1 1 auto;
  min-width: 108px;
  min-height: 28px;
  accent-color: var(--accent);
}

.wx-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wx-legend-bar {
  flex: 0 0 68px;
  height: 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.wx-legend-label,
.wx-note {
  font-size: 9px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--v6-ink-soft);
  font-family: var(--font);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wx-note { color: var(--v6-ink-faint); text-transform: none; letter-spacing: .04em; }

/* ---- failure toast ------------------------------------------------------ */

.wx-toast[hidden] { display: none; }

.wx-toast {
  position: absolute;
  left: 50%;
  top: 62px;
  transform: translateX(-50%);
  z-index: 790;                       /* same story as .wx-timeline above */
  max-width: min(360px, calc(100% - 2rem));
  padding: 9px 13px;
  border: 1px solid var(--orange);
  border-left: 3px solid var(--orange-bright);
  border-radius: var(--r-md);
  background-color: rgba(4, 7, 7, .97);
  background-image: var(--surface-texture);
  background-size: 100% 100%, 100% 100%, 420px auto;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: var(--shadow2);
  color: var(--v6-ink-soft);
  font-family: var(--font);
  font-size: 10.5px;
  line-height: 1.5;
}

/* ---- narrow desktop and phones ------------------------------------------ */

@media (max-width: 1180px) {
  .wx-timeline { max-width: min(380px, calc(100% - 540px)); }
}
@media (max-width: 980px) {
  .wx-timeline { max-width: min(380px, calc(100% - 330px)); }
}
@media (max-width: 760px) {
  .wx-timeline {
    left: 10px;
    right: 10px;
    transform: none;
    bottom: calc(42vh + 18px);
    min-width: 0;
    max-width: none;
    padding: 9px 11px;
  }
  .wx-legend-bar { flex-basis: 52px; }
  .wx-toast { top: 56px; left: 10px; right: 10px; transform: none; max-width: none; }
}
@media (prefers-contrast: more) {
  .wx-timeline, .wx-toast { background-image: none; background-color: #030505; }
  .wx-scalar { mix-blend-mode: normal; }
}
