/* ---------------------------------------------------------
   Río en Ituzaingó — sistema visual
   Paleta: negro con matiz verde-agua profundo, acentos de
   estado (normal / atención / alerta) inspirados en boyas
   de navegación. Tipografía condensada y pesada para el
   número principal, grotesca limpia para el resto.
--------------------------------------------------------- */

:root{
  --bg-void: #060B09;
  --bg-surface: #0D1917;
  --bg-surface-2: #12211E;
  --line: rgba(163, 214, 200, 0.14);
  --line-strong: rgba(163, 214, 200, 0.28);

  --text-primary: #EEF5F1;
  --text-muted: #92A69D;
  --text-faint: #5E6F68;

  --teal: #2FD9BE;
  --teal-dim: rgba(47, 217, 190, 0.16);
  --amber: #F2A93B;
  --amber-dim: rgba(242, 169, 59, 0.16);
  --coral: #FF6259;
  --coral-dim: rgba(255, 98, 89, 0.16);

  --radius: 4px;
  --font-display: 'Archivo Expanded', 'Space Grotesk', sans-serif;
  --font-head: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
}

*{ box-sizing: border-box; }

html{ color-scheme: dark; }

body{
  margin: 0;
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.sr-only{
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

a, button{ font-family: inherit; }

:focus-visible{
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

.wrap{
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Fondo: degradé diagonal profundo con un resplandor detrás del hero,
   evocando la superficie del agua de noche. */
.bg-glow{
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 40% at 50% 18%, rgba(47,217,190,0.16) 0%, rgba(47,217,190,0) 60%),
    linear-gradient(155deg, #081512 0%, #060B09 45%, #030605 100%);
}

/* ---------- header ---------- */

.site-header{
  padding: 20px 0 8px;
}

.header-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand{
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.brand-mark{
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 10px 2px rgba(47,217,190,0.55);
  flex-shrink: 0;
}

.update-info{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.update-dot{
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
}
.update-dot.live{ background: var(--teal); box-shadow: 0 0 6px 1px rgba(47,217,190,0.7); }
.update-dot.warn{ background: var(--amber); }
.update-dot.error{ background: var(--coral); }

/* ---------- hero ---------- */

.hero{
  padding: 56px 24px 40px;
  text-align: center;
}

.hero-eyebrow{
  margin: 0 0 18px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hero-figure{
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  line-height: 1;
}

.hero-number{
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(4.2rem, 18vw, 7.5rem);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.hero-unit{
  font-family: var(--font-head);
  font-size: 1.6rem;
  color: var(--text-muted);
  padding-bottom: 0.9rem;
}

.hero-meta{
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.status-pill{
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: var(--font-head);
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg-surface-2);
  border: 1px solid var(--line-strong);
  color: var(--text-primary);
}
.status-pill.normal{ background: var(--teal-dim); border-color: rgba(47,217,190,0.4); color: var(--teal); }
.status-pill.atencion{ background: var(--amber-dim); border-color: rgba(242,169,59,0.4); color: var(--amber); }
.status-pill.alerta{ background: var(--coral-dim); border-color: rgba(255,98,89,0.4); color: var(--coral); }

.hero-trend{
  font-size: 0.85rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.hero-note{
  margin: 20px auto 0;
  max-width: 46ch;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* ---------- secciones genéricas ---------- */

main section{
  padding: 44px 24px;
  border-top: 1px solid var(--line);
}

main section h2{
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.3rem;
  margin: 0 0 6px;
}

.section-sub{
  margin: 0 0 26px;
  color: var(--text-muted);
  font-size: 0.92rem;
  max-width: 52ch;
}

/* ---------- estaciones ---------- */

.station-track{
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin: 0 -24px;
  padding-left: 24px;
  padding-right: 24px;
  scroll-snap-type: x proximity;
}

.station-card{
  flex: 0 0 208px;
  scroll-snap-align: start;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.station-card .st-name{
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0 0 2px;
}

.station-card .st-position{
  font-size: 0.75rem;
  color: var(--text-faint);
  margin: 0 0 14px;
}

.station-card .st-height{
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.9rem;
  font-variant-numeric: tabular-nums;
}

.station-card .st-unit{
  font-size: 0.9rem;
  color: var(--text-muted);
}

.st-bar-track{
  margin-top: 14px;
  height: 5px;
  border-radius: 3px;
  background: var(--bg-surface-2);
  overflow: hidden;
}

.st-bar-fill{
  height: 100%;
  border-radius: 3px;
  background: var(--teal);
}
.st-bar-fill.atencion{ background: var(--amber); }
.st-bar-fill.alerta{ background: var(--coral); }

.st-bar-label{
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--text-faint);
}

/* ---------- mapa ---------- */

.river-map{
  height: 340px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-surface);
  overflow: hidden;
}

.river-map:focus-visible{
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* Leaflet inyecta sus propios controles; los retocamos para que
   convivan con la paleta oscura en vez de quedar como un
   recuadro blanco genérico. */
.leaflet-control-zoom a{
  background: var(--bg-surface-2) !important;
  color: var(--text-primary) !important;
  border-color: var(--line) !important;
}
.leaflet-control-attribution{
  background: rgba(6,11,9,0.75) !important;
  color: var(--text-faint) !important;
}
.leaflet-control-attribution a{ color: var(--text-muted) !important; }

.leaflet-popup-content-wrapper{
  background: var(--bg-surface-2);
  color: var(--text-primary);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
.leaflet-popup-tip{ background: var(--bg-surface-2); }
.leaflet-popup-content{ font-family: var(--font-body); font-size: 0.85rem; margin: 10px 14px; }
.popup-title{ font-family: var(--font-head); font-weight: 600; margin: 0 0 4px; }

.map-legend{
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.map-legend li{ display: flex; align-items: center; gap: 6px; }

.legend-dot{
  width: 9px; height: 9px;
  border-radius: 50%;
  display: inline-block;
  background: var(--teal);
}
.legend-dot.atencion{ background: var(--amber); }
.legend-dot.alerta{ background: var(--coral); }
.legend-dot.rain{ background: #4FA3E3; }

/* ---------- clima ---------- */

.weather-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.weather-card{
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.weather-card .w-name{
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0 0 12px;
}

.weather-card .w-temp{
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  font-variant-numeric: tabular-nums;
}

.weather-card .w-temp-unit{ font-size: 1rem; color: var(--text-muted); }

.weather-card .w-rows{
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.weather-card .w-rows strong{ color: var(--text-primary); font-variant-numeric: tabular-nums; }

@media (min-width: 640px){
  .weather-grid{ grid-template-columns: repeat(3, 1fr); }
}

/* ---------- tendencia ---------- */

.trend-chart-wrap{
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 16px;
}

.trend-chart{
  width: 100%;
  height: 180px;
  display: block;
  overflow: visible;
}

.trend-line{
  fill: none;
  stroke: var(--teal);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-fill{
  fill: url(#trendGradient);
  stroke: none;
}

.trend-empty{
  margin: 0;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.85rem;
}

/* ---------- contexto ---------- */

.context-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.context-card{
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.context-card h3{
  margin: 0 0 8px;
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
}

.context-card p{
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* ---------- footer ---------- */

.site-footer{
  border-top: 1px solid var(--line);
  padding: 24px 0 40px;
}

.footer-row{
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
}

.footer-row p{
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-faint);
  max-width: 50ch;
}

.refresh-btn{
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--text-primary);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.refresh-btn:hover{
  border-color: var(--teal);
  background: var(--teal-dim);
}

.refresh-btn[disabled]{
  opacity: 0.5;
  cursor: default;
}

/* ---------- responsive ---------- */

@media (min-width: 640px){
  .context-grid{ grid-template-columns: repeat(3, 1fr); }
  .footer-row{ flex-direction: row; align-items: center; justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; }
}
