/* ===========================================================
   WEATHER PROTOCOL — radar page
   =========================================================== */

.radar-shell { position: absolute; inset: 0; overflow: hidden; }

.radar-host { position: absolute; inset: 0; }

.map-root {
  position: absolute;
  inset: 0;
  cursor: grab;
  outline: none;
  touch-action: none;
  background:
    radial-gradient(ellipse at 50% 50%, #0a1016 0%, #05070a 100%);
  overflow: hidden;
}
.map-root.dragging { cursor: grabbing; }
.map-root:focus-visible { box-shadow: inset 0 0 0 1px var(--a); }

.map-cv { position: absolute; inset: 0; display: block; }
.map-tiles { z-index: 1; }
.map-wind  { z-index: 2; }
.map-vec   { z-index: 3; }

/* ===========================================================
   floating panels
   =========================================================== */

.radar-panel {
  position: absolute;
  z-index: 10;
  background: rgba(8, 12, 17, .86);
  /* no backdrop blur: it re-blurs the live map under it every frame */
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
:root[data-surface="light"] .radar-panel { background: rgba(255, 255, 255, .9); }

/* --- layer switches (top-left) --- */
.radar-layers {
  top: 12px; left: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 5px;
}
.layer-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 11px 6px 8px;
  background: none;
  border: 0;
  border-radius: 2px;
  color: var(--fg-3);
  font: inherit;
  font-size: var(--fs-micro);
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--speed), background var(--speed);
}
.layer-btn svg { flex: none; }
.layer-btn:hover { color: var(--fg); background: var(--a-wash); }
.layer-btn[aria-pressed="true"] { color: var(--a); background: var(--a-wash); }
.layer-btn[aria-pressed="true"] svg { filter: drop-shadow(0 0 5px var(--a-glow)); }

/* --- zoom / locate (top-right) --- */
.radar-controls {
  top: 12px; right: 12px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px;
}
.map-btn {
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  border-radius: 2px;
  color: var(--fg-2);
  cursor: pointer;
  transition: color var(--speed), background var(--speed);
}
.map-btn:hover { color: var(--a); background: var(--a-wash); }
.map-btn:focus-visible { outline: 1px solid var(--a); outline-offset: -2px; }
.map-btn.on { color: var(--a); }

/* --- hover readout (bottom-left, above the timeline) --- */
.radar-readout {
  left: 12px;
  bottom: 74px;
  padding: 8px 11px;
  font-size: var(--fs-xs);
  line-height: 1.5;
  opacity: 0;
  transition: opacity .14s;
  pointer-events: none;
  max-width: 260px;
}
.radar-readout.show { opacity: 1; }
.rd-alert  { color: var(--danger); font-size: var(--fs-micro); margin-top: 3px; }
.rd-strike { color: #ff6b5e; font-size: var(--fs-micro); margin-top: 3px; }

/* --- legend (bottom-right) --- */
.radar-legend {
  right: 12px;
  bottom: 74px;
  padding: 9px 11px;
  min-width: 168px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.legend-ramp {
  height: 8px;
  border-radius: 2px;
  background: linear-gradient(90deg,
    #0a3d2b 0%, #00a344 18%, #7ddb00 38%, #ffe000 55%,
    #ff8a00 72%, #ff2d1f 88%, #ff4df0 100%);
}
:root[data-cvd="deut"] .legend-ramp,
:root[data-cvd="prot"] .legend-ramp,
:root[data-cvd="trit"] .legend-ramp {
  background: linear-gradient(90deg,
    #0b2a4a 0%, #1f6fb2 20%, #57b0e0 42%, #cfd9dd 60%,
    #f3c14b 78%, #e07b18 92%, #8c2d04 100%);
}
.legend-scale {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--fg-3);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.legend-row { display: flex; align-items: center; gap: 7px; }
.legend-strike {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ff2a2a;
  box-shadow: 0 0 8px rgba(255, 42, 42, .8);
  flex: none;
}
.legend-age { border-top: 1px solid var(--line); padding-top: 5px; }

/* ===========================================================
   timeline
   =========================================================== */

.radar-timeline {
  position: absolute;
  left: 12px; right: 12px; bottom: 12px;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px 8px 8px;
  background: rgba(8, 12, 17, .9);
  /* no backdrop blur: it re-blurs the live map under it every frame */
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
:root[data-surface="light"] .radar-timeline { background: rgba(255, 255, 255, .93); }

.play-btn { width: 36px; height: 36px; flex: none; }

.tl-track-wrap { position: relative; flex: 1; min-width: 0; height: 24px; }

.tl-track {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0;
  appearance: none;
  background: none;
  cursor: pointer;
  z-index: 2;
}
.tl-track::-webkit-slider-runnable-track {
  height: 3px;
  margin-top: 10px;
  border-radius: 2px;
  background: var(--line-2);
}
.tl-track::-moz-range-track {
  height: 3px;
  border-radius: 2px;
  background: var(--line-2);
}
.tl-track::-webkit-slider-thumb {
  appearance: none;
  width: 13px; height: 13px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--a);
  box-shadow: 0 0 9px var(--a-glow);
  cursor: grab;
}
.tl-track::-moz-range-thumb {
  width: 13px; height: 13px;
  border: 0;
  border-radius: 50%;
  background: var(--a);
  cursor: grab;
}
.tl-track:focus-visible { outline: 1px solid var(--a); outline-offset: 3px; }

.tl-ticks { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.tl-tick {
  position: absolute;
  top: 15px;
  width: 1px; height: 5px;
  margin-left: -.5px;
  background: var(--fg-3);
  opacity: .5;
}
.tl-tick.fcst { background: var(--warn); opacity: .9; height: 7px; }

.tl-readout { text-align: right; flex: none; min-width: 84px; }
.tl-time { font-size: var(--fs-sm); color: var(--fg-hi); }

/* ===========================================================
   attribution
   =========================================================== */

.radar-attrib {
  position: absolute;
  left: 50%;
  bottom: 58px;
  transform: translateX(-50%);
  z-index: 9;
  padding: 3px 9px;
  border-radius: 2px;
  background: rgba(5, 7, 10, .62);
  color: var(--fg-3);
  font-size: 9px;
  letter-spacing: .04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 40px);
  pointer-events: none;
}
:root[data-surface="light"] .radar-attrib { background: rgba(255, 255, 255, .7); }

/* ===========================================================
   narrow windows
   =========================================================== */

@media (max-width: 760px) {
  .radar-layers {
    top: auto;
    bottom: 74px;
    left: 12px; right: 12px;
    flex-direction: row;
    overflow-x: auto;
    padding: 4px;
  }
  .layer-btn span { display: none; }
  .layer-btn { padding: 8px 10px; }
  .radar-readout, .radar-legend { display: none; }
  .radar-attrib { bottom: 126px; }
  .radar-controls { top: 12px; right: 12px; }
}

/* ===========================================================
   e-ink: flatten everything to ink on paper
   =========================================================== */

:root[data-eink="on"] .map-root { background: #fff; }
:root[data-eink="on"] .map-tiles { filter: grayscale(1) contrast(1.35) brightness(1.1); }
:root[data-eink="on"] .radar-panel,
:root[data-eink="on"] .radar-timeline {
  background: #fff;
  border: 2px solid #000;
  backdrop-filter: none;
  box-shadow: none;
}
:root[data-eink="on"] .layer-btn[aria-pressed="true"] { background: #000; color: #fff; }
:root[data-eink="on"] .legend-ramp {
  background: linear-gradient(90deg, #fff, #c8c8c8, #909090, #4a4a4a, #000);
}
