/* Rain radar · Puerto Varas — full-viewport map with a compact control panel */
.radar-html,
.radar-body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

.radar-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 1100px;
  margin: 0 auto;
  /* Normally nothing overflows; on very short (landscape phone) viewports the
     panel can still be reached by scrolling instead of being clipped. */
  overflow-y: auto;
  overflow-x: hidden;
}

.radar-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 1rem;
  padding-top: calc(0.45rem + env(safe-area-inset-top));
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

.radar-back {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  padding: 0.35rem 0.5rem;
  margin-left: -0.5rem;
  border-radius: 8px;
}

.radar-back:hover,
.radar-back:focus-visible {
  background: rgba(37, 99, 235, 0.08);
}

/* "English" / "Español" at the right end of the header; the title ellipsizes first */
.radar-lang {
  flex: 0 0 auto;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  padding: 0.35rem 0.5rem;
  margin-right: -0.5rem;
  border-radius: 8px;
}

.radar-lang:hover,
.radar-lang:focus-visible {
  background: rgba(37, 99, 235, 0.08);
}

.radar-title {
  flex: 1 1 auto;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.radar-map {
  flex: 1 1 auto;
  min-height: 160px;
  position: relative;
  background: #dbe4ee;
  z-index: 0; /* keeps Leaflet panes below the control panel */
}

.radar-point-label {
  font-weight: 700;
  font-size: 0.8rem;
  padding: 2px 6px;
}

.radar-you-label {
  color: #2563eb;
}

/* "Use my location" control: bottom-right corner of the map, stacked above the attribution
   by Leaflet; a 44x44 px tap target that stays clear of the zoom control (top-left). */
.radar-locate-ctl {
  pointer-events: auto;
}

.radar-locate {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  background: #fff;
  color: var(--fg);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 120ms ease, color 120ms ease;
}

.radar-locate svg {
  display: block;
  width: 24px;
  height: 24px;
}

.radar-locate:hover {
  background: #f1f5f9;
}

.radar-locate:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.radar-locate.is-on,
.radar-locate[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.radar-locate.is-on:hover {
  background: var(--accent-hover);
}

.radar-locate.is-searching svg {
  animation: radar-locate-pulse 1.2s ease-in-out infinite;
}

@keyframes radar-locate-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  .radar-locate.is-searching svg {
    animation: none;
  }
}

.radar-overlay {
  image-rendering: auto;
}

/* Control panel */
.radar-panel {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  padding-bottom: calc(0.55rem + env(safe-area-inset-bottom));
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 1;
  min-width: 0;
}

.radar-status-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  flex-wrap: wrap;
  font-size: 0.76rem;
  color: var(--fg-muted);
  line-height: 1.3;
}

.radar-status {
  font-weight: 600;
}

.radar-motion:empty {
  display: none;
}

.radar-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
}

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

/* Timeline: one column per frame, bar height = rain rate at the point */
.radar-timeline {
  display: flex;
  align-items: stretch;
  gap: 2px;
  height: 36px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

.radar-timeline:empty {
  display: none;
}

.tl-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  border-radius: 3px 3px 0 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tl-col:hover {
  background: rgba(37, 99, 235, 0.08);
}

.tl-col:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.tl-fill {
  width: 100%;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
  transition: height 160ms ease;
}

.tl-fill.tl-dry {
  background-color: #cbd5e1;
}

/* Forecast bars: hatched and slightly faded so they read as "estimate" */
.tl-fcst .tl-fill {
  background-image: repeating-linear-gradient(
    135deg,
    transparent 0 3px,
    rgba(255, 255, 255, 0.6) 3px 5px
  );
  opacity: 0.85;
}

.tl-cur {
  background: rgba(26, 31, 46, 0.1);
}

.tl-cur .tl-fill {
  box-shadow: 0 0 0 2px var(--fg);
  opacity: 1;
}

.tl-divider {
  flex: 0 0 0;
  border-left: 2px dashed var(--fg-muted);
  margin: 0 1px;
}

/* Transport: play/pause + slider + readout */
.radar-transport {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.radar-play {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 120ms ease;
}

.radar-play:hover,
.radar-play:focus-visible {
  background: var(--accent-hover);
}

.radar-play:disabled {
  background: var(--border);
  color: var(--fg-muted);
  cursor: default;
}

.radar-speed {
  flex: 0 0 auto;
  min-width: 48px;
  height: 36px;
  padding: 0 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--fg);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 120ms ease, border-color 120ms ease;
}

.radar-speed:hover,
.radar-speed:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.radar-speed:disabled {
  color: var(--fg-muted);
  cursor: default;
}

.radar-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: 32px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  touch-action: pan-y;
}

.radar-slider:disabled {
  cursor: default;
  opacity: 0.5;
}

.radar-slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: var(--border);
}

.radar-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -11px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.35);
}

.radar-slider::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: var(--border);
}

.radar-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.35);
}

.radar-slider:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.radar-readout {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  min-width: 6.5rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.radar-time {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.radar-kind {
  font-size: 0.72rem;
  color: var(--fg-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.radar-kind.is-fcst {
  color: #b45309;
}

.radar-rate {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  max-width: 8.5rem; /* lets "outside the radar area" wrap instead of squeezing the slider */
}

.radar-rate:empty {
  display: none;
}

/* Legend */
.radar-legend {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  font-size: 0.66rem;
  color: var(--fg-muted);
  min-width: 0;
}

.radar-legend:empty {
  display: none;
}

.lg-title {
  flex: 0 0 auto;
  padding-right: 0.4rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
  padding-bottom: 1px;
}

.lg-item {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  line-height: 1.2;
}

.lg-swatch {
  height: 8px;
  border-radius: 2px;
  margin-bottom: 2px;
}

@media (max-width: 420px) {
  .radar-head {
    gap: 0.5rem;
  }

  .radar-title {
    font-size: 0.95rem;
  }

  .radar-back,
  .radar-lang {
    font-size: 0.8rem;
    padding: 0.35rem 0.35rem;
  }
}

/* Desktop: same page, centred with a little breathing room */
@media (min-width: 720px) {
  .radar-app {
    padding: 0.75rem 1.25rem;
    gap: 0.75rem;
  }

  .radar-head {
    border: none;
    background: transparent;
    padding: 0 0.25rem;
  }

  .radar-title {
    font-size: 1.4rem;
  }

  .radar-map {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
  }

  .radar-panel {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.85rem 1.25rem;
    gap: 0.6rem;
  }

  .radar-status-row {
    font-size: 0.85rem;
  }

  .radar-timeline {
    height: 48px;
  }

  .radar-legend {
    font-size: 0.72rem;
  }

  .radar-readout {
    min-width: 9rem;
  }

  .radar-rate {
    max-width: none;
  }
}
