:root {
  color-scheme: dark;
  --chrome-top: #2357a6;
  --chrome-mid: #0d3477;
  --chrome-low: #071a44;
  --panel-top: #123f8a;
  --panel-low: #05163d;
  --cyan: #74d8ff;
  --amber: #ffd45c;
  --red: #e31f2f;
  --green: #43e392;
  --white: #f5f8ff;
  --safe-x: 28px;
  --topbar-h: 78px;
  --ticker-h: 40px;
  --shadow: rgba(0, 0, 0, 0.55);
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
.frame,
#map {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background:
    radial-gradient(circle at 50% 40%, #122c5f 0%, #050914 54%, #01030a 100%);
}

body,
#map,
.topbar,
.forecast-panel,
.lower-third,
.ticker,
.vignette,
.scanlines,
.mode,
.radar-stamp {
  transition:
    background 900ms ease,
    border-color 900ms ease,
    box-shadow 900ms ease,
    color 900ms ease,
    filter 900ms ease,
    opacity 900ms ease;
}

.frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #071326;
}

#map {
  position: absolute;
  inset: 0;
}

#map .leaflet-tile-pane {
  filter: saturate(1.06) contrast(1.04) brightness(1);
}

.night-mode #map .leaflet-tile-pane {
  filter: saturate(1.04) contrast(1.08) brightness(1.18);
}

#map .leaflet-radarPane-pane,
#map .leaflet-labelPane-pane {
  filter: none;
}

#map .leaflet-layer {
  transition:
    opacity 1800ms ease,
    filter 1800ms ease;
}

/* The radar loop steps frames every 1.4s; the 1800ms basemap crossfade never
   finishes between steps, so adjacent scans ghost on top of each other and
   smear storm cells. A short fade keeps the step crisp with a slight blend. */
#map .leaflet-radarPane-pane .leaflet-layer {
  transition: opacity 400ms linear;
}

.leaflet-control-container {
  display: none;
}

/* Classic regional-observations plot: city temps sit on the map as bare text
   with a hard shadow — boxed chips over radar read as clutter. Leaflet
   anchors a null-size divIcon at its top-left, so the inner span centers
   itself on the coordinate. */
.city-temp .city-temp-inner {
  display: flex;
  align-items: baseline;
  gap: 6px;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  font-family: Arial, Helvetica, sans-serif;
}

.city-temp-name {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #f5f8ff;
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.92),
    0 0 7px rgba(0, 0, 0, 0.6);
}

.city-temp-val {
  font-size: 22px;
  font-weight: 900;
  color: var(--amber);
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.92),
    0 0 7px rgba(0, 0, 0, 0.65);
}

.scanlines,
.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 400;
}

.scanlines {
  opacity: 0.09;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.16),
    rgba(255, 255, 255, 0.16) 1px,
    transparent 1px,
    transparent 4px
  );
}

.vignette {
  background:
    linear-gradient(90deg, rgba(3, 9, 25, 0.34), transparent 20%, transparent 70%, rgba(3, 9, 25, 0.36)),
    linear-gradient(180deg, rgba(22, 68, 143, 0.04), transparent 42%, rgba(1, 4, 12, 0.18)),
    radial-gradient(circle at center, transparent 58%, rgba(0, 0, 0, 0.3));
}

.night-mode .scanlines {
  opacity: 0.13;
}

.night-mode .vignette {
  background:
    linear-gradient(90deg, rgba(1, 4, 14, 0.24), transparent 18%, transparent 72%, rgba(1, 4, 14, 0.24)),
    radial-gradient(circle at center, rgba(0, 18, 40, 0.03) 0%, rgba(0, 0, 0, 0.16) 74%),
    linear-gradient(180deg, rgba(1, 5, 17, 0.02), rgba(1, 5, 17, 0.1));
}

.topbar,
.forecast-panel,
.camera-panel,
.lower-third,
.ticker {
  position: absolute;
  z-index: 500;
  color: var(--white);
  text-shadow: 0 2px 6px var(--shadow);
}

.camera-panel {
  left: var(--safe-x);
  top: calc(var(--topbar-h) + 26px);
  width: 336px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), transparent 52px),
    linear-gradient(180deg, rgba(4, 19, 45, 0.92), rgba(1, 8, 22, 0.88));
  border: 2px solid rgba(230, 247, 255, 0.78);
  box-shadow:
    inset 0 0 0 2px rgba(14, 67, 147, 0.56),
    8px 8px 0 rgba(0, 0, 0, 0.38);
}

.camera-panel[hidden] {
  display: none;
}

.camera-header,
.camera-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  font-size: 14px;
  font-weight: 900;
  color: #06142f;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent 42%),
    linear-gradient(180deg, #ffdc6a, #e7a521);
  text-shadow: none;
}

.camera-header span:last-child,
.camera-footer span:last-child {
  white-space: nowrap;
}

.camera-image,
#camera-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #020711;
  border-top: 2px solid rgba(255, 255, 255, 0.34);
  border-bottom: 2px solid rgba(255, 255, 255, 0.28);
}

.camera-footer {
  color: #dff8ff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(18, 63, 138, 0.96), rgba(5, 22, 61, 0.94));
  text-shadow: 0 2px 6px var(--shadow);
}

#camera-location {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar {
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 196px;
  align-items: center;
  gap: 22px;
  padding: 0 var(--safe-x);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 12px),
    linear-gradient(180deg, rgba(33, 87, 172, 0.98), rgba(7, 25, 70, 0.95) 72%, rgba(3, 11, 31, 0.98));
  border-bottom: 2px solid rgba(160, 224, 255, 0.92);
  box-shadow:
    inset 0 -5px 0 rgba(0, 0, 0, 0.26),
    0 7px 18px rgba(0, 0, 0, 0.42);
}

.night-mode .topbar {
  background: linear-gradient(180deg, rgba(2, 8, 22, 0.96), rgba(2, 8, 22, 0.74));
  border-bottom-color: rgba(118, 145, 255, 0.78);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 78px;
  height: 46px;
  color: #071431;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent 38%),
    linear-gradient(180deg, #ffe891, #f5ae2d 58%, #c87511);
  font-weight: 900;
  font-size: 26px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    inset 0 -3px 0 rgba(91, 41, 0, 0.34),
    5px 5px 0 rgba(0, 0, 0, 0.42);
}

.brand-title {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  color: #ffffff;
  -webkit-text-stroke: 1px rgba(3, 13, 35, 0.45);
}

.mode {
  min-width: 272px;
  padding: 10px 18px;
  text-align: center;
  font-size: 19px;
  font-weight: 900;
  color: #04122e;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent 42%),
    linear-gradient(180deg, #9beaff, #40acd9 64%, #1479a7);
  border: 2px solid rgba(255, 255, 255, 0.75);
  box-shadow:
    inset 0 -3px 0 rgba(0, 44, 77, 0.32),
    4px 4px 0 rgba(0, 0, 0, 0.28);
}

.night-mode .mode {
  color: #eaf1ff;
  background: #3142d4;
  box-shadow: inset 0 0 18px rgba(126, 181, 255, 0.38);
}

.clock-block {
  text-align: right;
}

.clock {
  font-size: 27px;
  font-weight: 900;
  color: #d8efff;
  font-variant-numeric: tabular-nums;
}

.clock-date {
  margin-top: 1px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #8fbde8;
}

.night-mode .clock-date {
  color: #93a7e0;
}

.forecast-panel {
  top: calc(var(--topbar-h) + 26px);
  right: var(--safe-x);
  width: 392px;
  padding: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 70px),
    linear-gradient(180deg, rgba(18, 63, 138, 0.96), rgba(5, 22, 61, 0.94));
  border: 2px solid rgba(230, 247, 255, 0.86);
  box-shadow:
    inset 0 0 0 2px rgba(14, 67, 147, 0.68),
    inset 0 -7px 0 rgba(0, 0, 0, 0.16),
    9px 9px 0 rgba(0, 0, 0, 0.4);
}

.night-mode .forecast-panel {
  background: linear-gradient(180deg, rgba(5, 16, 49, 0.94), rgba(2, 8, 25, 0.9));
  border-color: rgba(191, 207, 255, 0.76);
  box-shadow:
    10px 10px 0 rgba(0, 0, 0, 0.44),
    0 0 34px rgba(61, 87, 255, 0.18);
}

.region {
  padding: 12px 15px 10px;
  font-size: 23px;
  line-height: 1.02;
  font-weight: 900;
  text-transform: uppercase;
  color: #06142f;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.36), transparent 42%),
    linear-gradient(180deg, #ffdc6a, #e7a521);
  text-shadow: none;
}

.conditions-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 16px 16px 14px;
  border-top: 2px solid rgba(255, 255, 255, 0.42);
}

.temperature {
  font-size: 78px;
  line-height: 0.88;
  font-weight: 900;
  color: #ffffff;
}

.condition {
  margin-top: 8px;
  font-size: 16px;
  font-weight: 800;
  text-transform: uppercase;
  color: #c8eaff;
}

.feels-like {
  margin-top: 5px;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  color: #ffd77e;
}

.night-mode .feels-like {
  color: #ffcf8f;
}

.metric-stack {
  display: grid;
  gap: 8px;
  align-content: center;
  min-width: 136px;
  font-size: 16px;
  font-weight: 800;
}

.metric-stack span,
.daily div {
  padding: 7px 9px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border-left: 5px solid rgba(116, 216, 255, 0.88);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.night-mode .metric-stack span,
.night-mode .daily div {
  background: rgba(138, 168, 255, 0.13);
  border-left-color: rgba(145, 166, 255, 0.9);
}

.daily-header {
  padding: 7px 15px;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #04122e;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent 42%),
    linear-gradient(180deg, #9beaff, #40acd9 64%, #1479a7);
  border-top: 2px solid rgba(255, 255, 255, 0.42);
  text-shadow: none;
}

.night-mode .daily-header {
  color: #eaf1ff;
  background: #3142d4;
}

.daily {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 10px 16px 16px;
}

.daily div {
  display: grid;
  /* Wide enough for the after-sunset TONIGHT lead row, not just TODAY/MON. */
  grid-template-columns: 66px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 9px;
  font-size: 15px;
  font-weight: 900;
}

.day-cond {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  color: #bfe2ff;
}

.night-mode .day-cond {
  color: #c3d0ff;
}

.day-temps {
  text-align: right;
}

.lower-third {
  left: var(--safe-x);
  bottom: calc(var(--ticker-h) + 18px);
  width: min(900px, calc(100vw - 56px));
  min-height: 100px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  align-items: stretch;
  gap: 0;
  padding: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 42%),
    linear-gradient(90deg, rgba(19, 66, 150, 0.97), rgba(6, 20, 60, 0.95));
  border: 2px solid rgba(235, 247, 255, 0.84);
  box-shadow:
    inset 0 -6px 0 rgba(0, 0, 0, 0.18),
    9px 9px 0 rgba(0, 0, 0, 0.38);
}

.lower-third > div:first-child {
  min-width: 0;
  padding: 13px 18px 14px;
}

.night-mode .lower-third {
  background: linear-gradient(90deg, rgba(5, 18, 58, 0.97), rgba(2, 8, 27, 0.92));
  border-color: rgba(191, 207, 255, 0.76);
}

.kicker {
  font-size: 17px;
  font-weight: 900;
  color: var(--amber);
}

/* Slides used to hard-swap their text mid-air; broadcast graphics cut in with
   a beat. A short rise-and-fade marks each rotation without calling attention
   to itself — the class is re-applied per change, so the refresh re-render of
   an identical slide doesn't blink the copy. */
@keyframes slide-copy-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.slide-copy.slide-change {
  animation: slide-copy-in 280ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .slide-copy.slide-change {
    animation: none;
  }
}

/* Minor advisories keep the blue chrome (STORM WATCH red is reserved for
   severe alerts), so the alert slide announces itself with a red kicker chip
   instead of blending in with the routine conditions slides. */
.alert-slide .kicker {
  display: inline-block;
  padding: 2px 10px;
  color: #ffffff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent 42%),
    linear-gradient(180deg, #ff5967, var(--red) 64%, #96111c);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.32);
}

.summary {
  margin-top: 3px;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 28px;
  line-height: 1.08;
  font-weight: 900;
  text-transform: uppercase;
}

.radar-stamp {
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
  font-size: 18px;
  line-height: 1.1;
  font-weight: 900;
  color: #031228;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.46), transparent 42%),
    linear-gradient(180deg, #75ffb2, #21b970 68%, #0a6a43);
  border-left: 2px solid rgba(255, 255, 255, 0.7);
  text-shadow: none;
}

.night-mode .radar-stamp {
  color: #06122d;
  background: #8fb3ff;
}

/* Broadcast radar packages always carry an intensity key; without one the
   reflectivity colors are just decoration. Sits opposite the lower-third and
   only airs while a radar layer is actually on screen. */
.radar-legend {
  position: absolute;
  z-index: 500;
  right: var(--safe-x);
  bottom: calc(var(--ticker-h) + 18px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--white);
  text-shadow: 0 2px 6px var(--shadow);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(18, 63, 138, 0.96), rgba(5, 22, 61, 0.94));
  border: 2px solid rgba(230, 247, 255, 0.84);
  box-shadow:
    inset 0 -4px 0 rgba(0, 0, 0, 0.16),
    7px 7px 0 rgba(0, 0, 0, 0.38);
}

.radar-legend[hidden] {
  display: none;
}

.night-mode .radar-legend {
  background: linear-gradient(180deg, rgba(5, 16, 49, 0.94), rgba(2, 8, 25, 0.9));
  border-color: rgba(191, 207, 255, 0.76);
}

.legend-title {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--amber);
}

.legend-scale {
  display: grid;
  gap: 3px;
}

/* Standard NWS reflectivity ramp: greens into yellows, orange, reds, magenta. */
.legend-bar {
  width: 168px;
  height: 10px;
  background: linear-gradient(
    90deg,
    #29f229 0%,
    #01c501 16%,
    #008e00 30%,
    #fdf802 46%,
    #fd9500 62%,
    #fd0000 76%,
    #bc0000 88%,
    #f800fd 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.legend-ends {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #bfe2ff;
}

.night-mode .legend-ends {
  color: #c3d0ff;
}

.ticker {
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--ticker-h);
  display: flex;
  align-items: center;
  overflow: hidden;
  background:
    linear-gradient(180deg, #111827, #02050d);
  border-top: 3px solid var(--amber);
  box-shadow: 0 -7px 16px rgba(0, 0, 0, 0.34);
}

.night-mode .ticker {
  background: #02040d;
  border-top-color: #8fb3ff;
}

.ticker-text {
  white-space: nowrap;
  padding-left: 100%;
  font-size: 20px;
  font-weight: 900;
  color: #f5f8ff;
  animation: ticker 44s linear infinite;
}

.alert-mode .mode,
.alert-mode .radar-stamp {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 42%),
    linear-gradient(180deg, #ff5967, var(--red) 64%, #96111c);
  color: #fff;
}

.alert-mode .topbar {
  border-bottom-color: var(--red);
}

/* The takeover frames the whole screen: the topbar rule line goes red, so the
   ticker's rule line matches instead of staying routine amber. Declared after
   the night-mode ticker rule so alert red wins the tie at night. */
.alert-mode .ticker {
  border-top-color: var(--red);
}

@keyframes ticker {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-100%);
  }
}

@media (max-width: 760px) {
  .topbar {
    height: 64px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand clock"
      "mode mode";
    gap: 4px 8px;
    padding: 6px 10px 7px;
    border-bottom-width: 2px;
  }

  .brand {
    grid-area: brand;
    gap: 8px;
  }

  .brand-mark {
    width: 42px;
    height: 28px;
    font-size: 17px;
    border-width: 1px;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
  }

  .brand-title {
    font-size: 18px;
    line-height: 1;
    white-space: nowrap;
  }

  .mode {
    grid-area: mode;
    justify-self: start;
    min-width: 0;
    max-width: 100%;
    padding: 4px 9px;
    font-size: 13px;
    border-width: 1px;
  }

  .clock-block {
    grid-area: clock;
  }

  .clock {
    font-size: 13px;
    white-space: nowrap;
  }

  /* The 64px two-row mobile topbar has no headroom for a date line. */
  .clock-date {
    display: none;
  }

  .forecast-panel {
    top: 76px;
    left: 10px;
    right: 10px;
    width: auto;
    max-width: calc(100vw - 20px);
    overflow: hidden;
    padding: 11px;
    border-width: 2px;
    box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.34);
  }

  .camera-panel,
  .radar-legend {
    display: none;
  }

  /* Phone layouts cover most of the map with panels; city temps peeking out
     from under them read as noise, not observations. */
  .city-temp {
    display: none;
  }

  .region {
    font-size: 18px;
    line-height: 1.02;
  }

  .conditions-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 9px;
    padding-top: 9px;
  }

  .temperature {
    font-size: 54px;
  }

  .condition {
    margin-top: 5px;
    font-size: 13px;
  }

  .metric-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
    gap: 5px;
    font-size: 12px;
  }

  .metric-stack span,
  .daily div {
    padding: 5px 7px;
    border-left-width: 4px;
  }

  .metric-stack span {
    overflow: hidden;
    white-space: nowrap;
  }

  .metric-stack span:last-child {
    grid-column: 1 / -1;
  }

  .daily-header,
  .daily {
    display: none;
  }

  .lower-third {
    left: 10px;
    right: 10px;
    bottom: 40px;
    width: auto;
    min-height: 78px;
    grid-template-columns: minmax(0, 1fr) 82px;
    gap: 8px;
    padding: 10px;
    border-width: 2px;
    box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.34);
  }

  .kicker {
    font-size: 13px;
  }

  .summary {
    font-size: clamp(17px, 5.3vw, 22px);
    line-height: 1.05;
    overflow-wrap: anywhere;
  }

  .radar-stamp {
    padding: 8px 6px;
    font-size: 13px;
  }

  .ticker {
    height: 31px;
    border-top-width: 2px;
  }

  .ticker-text {
    font-size: 14px;
    animation-duration: 26s;
  }

  .scanlines {
    opacity: 0.08;
  }

  .vignette {
    background:
      linear-gradient(90deg, rgba(3, 10, 24, 0.54), transparent 22%, transparent 72%, rgba(3, 10, 24, 0.54)),
      radial-gradient(circle at center, transparent 46%, rgba(0, 0, 0, 0.38));
  }
}

@media (max-width: 420px) {
  .brand-title {
    font-size: 16px;
  }

  .clock {
    font-size: 12px;
  }

  .forecast-panel {
    top: 74px;
  }

  .temperature {
    font-size: 49px;
  }

  .metric-stack {
    min-width: 104px;
  }

  .lower-third {
    grid-template-columns: minmax(0, 1fr) 76px;
  }
}
