/**
 * airmap_v2.css — Mapa znečištění ovzduší (sekce úvodní stránky).
 *
 * Návrhové CSS převzaté z dodané předlohy „Mapa znečištění – standalone".
 * Vše je rozsahově uzamčeno pod #airmap, aby se styly nepromítaly
 * do zbytku stránky (předloha stylovala holý <body>/<*>).
 *
 * Leaflet vlastní CSS je v samostatném souboru leaflet.css.
 */

/* ── Kontejner + návrhové tokeny (původně :root předlohy) ───────── */
#airmap {
  --green:       #66BC29;
  --green-deep:  #4A9B1D;
  --green-50:    #F1F9EA;
  --blue:        #002072;
  --blue-deep:   #001550;
  --blue-50:     #EEF1FA;
  --ink:         #0F1933;
  --ink-soft:    #3D4869;
  --ink-muted:   #6B7390;
  --ink-faint:   #A5ACBF;
  --line:        #E9E4DA;
  --line-strong: #D9D2C3;
  --bg:          #F4EFE5;
  --bg-soft:     #ECE6D8;
  --surface:     #FBF8F2;
  --surface-elev:#FFFEFA;
  --caption-font: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --aq-1: #66BC29;
  --aq-2: #B9D24A;
  --aq-3: #F4C430;
  --aq-4: #E8994F;
  --aq-5: #C03030;
  --aq-6: #7B4E9B;

  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ink);
  line-height: 1.5;
}
/* Reset jen pro vlastní prvky mapy — NE pro sekční prvky webu
   (.page-shell, .sec-head…), které jsou rovněž potomky #airmap. */
#airmap .map-card *,
#airmap .map-section-foot * { box-sizing: border-box; margin: 0; padding: 0; }
/* "ss01" v Interu zapíná slashed/dotted zero — odstraněno, jen tabular nums. */
#airmap .tnum { font-feature-settings: "tnum"; }

/* ══ MAPOVÁ KARTA — hlavní prvek sekce ══════════════════════════ */
#airmap .map-card {
  position: relative;
  /* z-index: 0 vytvoří stacking kontext — všechny vnitřní Leaflet vrstvy
     (#am-map z1, #am-wind proudnice z400, .ovr z500, popupy z700…) jsou
     tím UVĚZNĚNÉ uvnitř karty. Bez toho soupeřily přímo s fixed topbarem
     (z-index 100) v root kontextu a 400 > 100 → proudnice lezly přes topbar. */
  z-index: 0;
  height: 640px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15,25,51,.04), 0 16px 44px rgba(15,25,51,.07);
}
#airmap #am-map { position: absolute; inset: 0; background: var(--bg); z-index: 1; }
/* Tile pane — originální CARTO dlaždice bez filtru */
#airmap .leaflet-container { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); }
#airmap .leaflet-control-attribution {
  background: rgba(251, 248, 242, .85) !important;
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 8px 0 0 0;
  font-family: var(--caption-font) !important;
  font-size: 9.5px !important;
  letter-spacing: .04em;
  color: var(--ink-muted) !important;
  padding: 4px 8px !important;
}
#airmap .leaflet-control-attribution a { color: var(--ink-soft) !important; }
#airmap .leaflet-control-zoom { display: none !important; }

#airmap #am-wind {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 400;
}

/* ── Značky stanic ──────────────────────────────────────────────── */
#airmap .station-icon { position: relative; width: 34px; height: 34px; }
#airmap .station-icon .ring {
  position: absolute; inset: -7px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  opacity: 0;
  animation: am-stationRing 3.4s ease-out infinite;
}
#airmap .station-icon .ring:nth-child(2) { animation-delay: 1.7s; }
@keyframes am-stationRing {
  0%   { transform: scale(0.65); opacity: 0; }
  35%  { opacity: .3; }
  100% { transform: scale(1.55); opacity: 0; }
}
#airmap .station-icon .core {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 4px 12px rgba(15,25,51,.18), 0 0 0 3px rgba(255,255,255,.92);
  display: grid; place-items: center;
  color: #fff;
  font-family: var(--caption-font);
  font-size: 11.5px; font-weight: 600; letter-spacing: -.01em;
}
#airmap .station-icon .core span { color: #fff; }
#airmap .station-icon.kraj { width: 40px; height: 40px; }
#airmap .station-icon.kraj .core {
  background: var(--blue);
  box-shadow: 0 6px 18px rgba(0,32,114,.34), 0 0 0 4px rgba(255,255,255,.96);
  font-size: 12.5px;
}
#airmap .station-icon.kraj .core img { filter: brightness(0) invert(1); width: 24px; height: 24px; object-fit: contain; }
#airmap .station-icon.kraj .ring { border-color: var(--blue); }

/* ── Popup stanice ──────────────────────────────────────────────── */
#airmap .leaflet-popup-content-wrapper {
  background: var(--surface-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15,25,51,.04), 0 14px 38px rgba(15,25,51,.12);
  padding: 0;
}
#airmap .leaflet-popup-content { margin: 14px 16px; min-width: 220px; }
#airmap .leaflet-popup-tip { background: var(--surface-elev); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); }
#airmap .leaflet-popup-close-button { display: none !important; }
#airmap .pop-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
#airmap .pop-title { font-size: 14px; font-weight: 600; color: var(--ink); letter-spacing: -.005em; }
#airmap .pop-type { font-family: var(--caption-font); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
#airmap .pop-aqi { margin: 8px 0 4px; display: flex; align-items: center; gap: 10px; }
#airmap .pop-aqi .dot { width: 14px; height: 14px; border-radius: 50%; }
#airmap .pop-aqi .lbl { font-family: 'Instrument Serif', serif; font-style: italic; font-size: 18px; line-height: 1; }
#airmap .pop-aqi .lbl span { font-size: 11px; color: var(--ink-muted); font-style: normal; font-family: var(--caption-font); letter-spacing: .04em; text-transform: uppercase; }
#airmap .pop-row { display: flex; align-items: baseline; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); }
#airmap .pop-row:last-child { border-bottom: 0; }
#airmap .pop-row dt { font-size: 11.5px; color: var(--ink-soft); }
#airmap .pop-row dd { font-size: 13px; font-weight: 600; color: var(--ink); font-feature-settings: "tnum"; }
#airmap .pop-row dd span { font-size: 10.5px; color: var(--ink-muted); font-weight: 400; margin-left: 3px; }

/* ══ MAPOVÉ PŘEKRYVY ════════════════════════════════════════════ */
#airmap .ovr { position: absolute; z-index: 500; }

/* Vlevo nahoře: souhrn kvality ovzduší */
#airmap .ovr-aq {
  top: 16px; left: 16px;
  width: 280px;
  padding: 14px 16px 16px;
  background: rgba(251, 248, 242, .95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15,25,51,.04), 0 10px 30px rgba(15,25,51,.08);
}
#airmap .ovr-aq header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
#airmap .ovr-aq .t { font-family: var(--caption-font); font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-muted); font-weight: 600; }
#airmap .ovr-aq .live { display: inline-flex; align-items: center; gap: 5px; font-family: var(--caption-font); font-size: 9px; color: var(--green-deep); letter-spacing: .04em; }
#airmap .ovr-aq .live i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(102,188,41,.6); animation: am-livePulse 2s ease-out infinite; }
@keyframes am-livePulse {
  0%   { box-shadow: 0 0 0 0 rgba(102,188,41,.5); }
  70%  { box-shadow: 0 0 0 8px rgba(102,188,41,0); }
  100% { box-shadow: 0 0 0 0 rgba(102,188,41,0); }
}
#airmap .ovr-aq .row { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: end; padding: 4px 0 8px; }
#airmap .ovr-aq .score {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 100; font-size: 48px; line-height: .85;
  color: var(--green-deep);
  letter-spacing: -1.5px;
  font-feature-settings: "tnum";
}
#airmap .ovr-aq .score span { font-size: 11px; color: var(--ink-muted); font-weight: 500; margin-left: 3px; letter-spacing: 0; font-family: var(--caption-font); text-transform: uppercase; }
#airmap .ovr-aq .label {
  font-family: 'Instrument Serif', serif; font-style: italic;
  font-size: 18px; line-height: 1.15; color: var(--green-deep);
}
#airmap .ovr-aq .station-meta { font-family: var(--caption-font); font-size: 9px; color: var(--ink-faint); letter-spacing: .04em; margin-top: 6px; text-transform: uppercase; }
#airmap .ovr-aq .station-meta strong { color: var(--ink-soft); font-weight: 600; }
#airmap .ovr-aq .scale { margin-top: 10px; height: 5px; border-radius: 3px;
  background: linear-gradient(90deg, var(--aq-1) 0%, var(--aq-2) 18%, var(--aq-3) 38%, var(--aq-4) 60%, var(--aq-5) 82%, var(--aq-6) 100%);
  position: relative;
}
#airmap .ovr-aq .scale > i {
  position: absolute; top: 50%; width: 3px; height: 12px;
  background: var(--ink); border-radius: 2px; transform: translate(-50%, -50%);
  transition: left .6s cubic-bezier(.4,.2,.2,1);
}
#airmap .ovr-aq .scale-lbls { display: flex; justify-content: space-between; margin-top: 4px; font-family: var(--caption-font); font-size: 8.5px; letter-spacing: .04em; color: var(--ink-faint); font-weight: 600; text-transform: uppercase; }
#airmap .ovr-aq .metrics {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line);
}
#airmap .ovr-aq .metrics .lbl { font-family: var(--caption-font); font-size: 9.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-soft); font-weight: 600; margin-bottom: 4px; }
#airmap .ovr-aq .metrics .v { font-size: 17px; font-weight: 600; color: var(--ink); font-feature-settings: "tnum"; line-height: 1.05; white-space: nowrap; }
#airmap .ovr-aq .metrics .v span { font-size: 10px; color: var(--ink-muted); font-weight: 500; margin-left: 3px; font-family: var(--caption-font); }

/* Vpravo nahoře: kompas větru */
#airmap .ovr-wind {
  top: 16px; right: 16px;
  width: 220px;
  padding: 12px 14px 14px;
  background: rgba(251, 248, 242, .95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15,25,51,.04), 0 10px 30px rgba(15,25,51,.08);
}
#airmap .ovr-wind header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
#airmap .ovr-wind .t { font-family: var(--caption-font); font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-muted); font-weight: 600; }
#airmap .ovr-wind .src { font-family: var(--caption-font); font-size: 8.5px; color: var(--ink-faint); letter-spacing: .04em; }
#airmap .compass-wrap { display: grid; grid-template-columns: 78px 1fr; gap: 12px; align-items: center; }
#airmap .compass {
  position: relative; width: 78px; height: 78px;
  border-radius: 50%;
  background: var(--surface-elev);
  border: 1px solid var(--line);
}
#airmap .compass .nlbl, #airmap .compass .slbl, #airmap .compass .elbl, #airmap .compass .wlbl {
  position: absolute; font-family: var(--caption-font);
  font-size: 8.5px; color: var(--ink-faint); font-weight: 600; letter-spacing: .04em;
}
#airmap .compass .nlbl { top: 2px; left: 50%; transform: translateX(-50%); color: var(--blue); }
#airmap .compass .slbl { bottom: 2px; left: 50%; transform: translateX(-50%); }
#airmap .compass .elbl { right: 4px; top: 50%; transform: translateY(-50%); }
#airmap .compass .wlbl { left: 4px; top: 50%; transform: translateY(-50%); }
#airmap .compass .arrow {
  position: absolute; left: 50%; top: 50%;
  width: 3.5px; height: 33px;
  background: var(--blue);
  transform-origin: 1.75px 31px;
  border-radius: 2px 2px 0 0;
  transition: transform .8s cubic-bezier(.4,.2,.2,1);
}
#airmap .compass .arrow::before {
  content: ''; position: absolute; left: -4.5px; top: -3.5px;
  width: 12.5px; height: 12.5px;
  background: var(--blue);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}
#airmap .compass .center { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; background: var(--ink); border-radius: 50%; transform: translate(-50%, -50%); }
#airmap .wind-vals { display: flex; flex-direction: column; gap: 2px; }
#airmap .wind-vals .speed {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 200; font-size: 28px; line-height: 1;
  color: var(--blue); letter-spacing: -.8px; font-feature-settings: "tnum";
}
#airmap .wind-vals .speed span { font-size: 10px; color: var(--ink-muted); font-weight: 500; margin-left: 3px; font-family: var(--caption-font); letter-spacing: .04em; text-transform: uppercase; }
#airmap .wind-vals .dir {
  font-family: 'Instrument Serif', serif; font-style: italic;
  font-size: 13.5px; color: var(--ink); line-height: 1.1;
}
#airmap .wind-vals .gust { font-family: var(--caption-font); font-size: 8.5px; color: var(--ink-muted); letter-spacing: .04em; }



/* Dole: časová osa 24 h — AQI heatmap track */
#airmap .ovr-time {
  bottom: 32px; left: 16px; right: 16px;
  padding: 8px 16px 4px;
  background: rgba(251, 248, 242, .92);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15,25,51,.04), 0 8px 24px rgba(15,25,51,.08);
}
#airmap .time-row {
  display: flex; align-items: center; gap: 10px;
}
#airmap .time-live {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 13px; border: 1px solid var(--line); border-radius: 999px;
  background: none; cursor: pointer;
  font-family: var(--caption-font); font-size: 10px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-muted); white-space: nowrap;
  transition: background .2s, color .2s, border-color .2s;
}
#airmap .time-live i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-faint); transition: background .2s, box-shadow .2s;
}
#airmap .time-live.is-live {
  color: var(--green-deep); border-color: rgba(102,188,41,.4);
  background: rgba(241,249,234,.6);
}
#airmap .time-live.is-live i {
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(102,188,41,.5);
  animation: am-livePulse 2s ease-out infinite;
}
#airmap .time-live:hover { background: var(--bg-soft); color: var(--ink); }
#airmap .time-slider-wrap { flex: 1; min-width: 0; }
#airmap .time-slider {
  --track-bg: var(--line);
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 22px;
  background: transparent; cursor: pointer;
}
#airmap .time-slider::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: var(--track-bg);
}
#airmap .time-slider::-moz-range-track {
  height: 6px; border-radius: 3px;
  background: var(--track-bg); border: 0;
}
#airmap .time-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface-elev);
  border: 2.5px solid var(--blue);
  box-shadow: 0 1px 5px rgba(0,32,114,.18), 0 4px 12px rgba(0,32,114,.08);
  margin-top: -7px;
  transition: transform .15s ease, box-shadow .15s ease;
  cursor: grab;
}
#airmap .time-slider::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface-elev);
  border: 2.5px solid var(--blue);
  box-shadow: 0 1px 5px rgba(0,32,114,.18), 0 4px 12px rgba(0,32,114,.08);
  transition: transform .15s ease, box-shadow .15s ease;
  cursor: grab;
}
#airmap .time-slider:active::-webkit-slider-thumb {
  transform: scale(1.25);
  box-shadow: 0 2px 10px rgba(0,32,114,.24), 0 6px 18px rgba(0,32,114,.12);
  cursor: grabbing;
}
#airmap .time-slider:active::-moz-range-thumb {
  transform: scale(1.25);
  box-shadow: 0 2px 10px rgba(0,32,114,.24), 0 6px 18px rgba(0,32,114,.12);
  cursor: grabbing;
}
#airmap .time-label {
  font-family: var(--caption-font); font-size: 11px;
  color: var(--ink-soft); letter-spacing: .02em;
  white-space: nowrap; min-width: 120px; text-align: right;
}
#airmap .time-ticks {
  display: flex; justify-content: space-between;
  padding: 0 10px;
  font-family: var(--caption-font); font-size: 8.5px;
  font-weight: 600; letter-spacing: .02em;
  color: var(--ink-faint);
}
/* Historie aktivní — změna indikátoru v AQ panelu */
#airmap .ovr-aq .live.is-history {
  color: var(--ink-muted); animation: none;
}
#airmap .ovr-aq .live.is-history i {
  background: var(--ink-faint); animation: none;
}

/* Vpravo: přiblížení */
#airmap .ovr-zoom {
  right: 16px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column;
  background: rgba(251, 248, 242, .95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15,25,51,.04), 0 6px 18px rgba(15,25,51,.06);
  overflow: hidden;
}
#airmap .ovr-zoom button {
  width: 34px; height: 34px; background: none; border: none;
  color: var(--ink-soft); cursor: pointer; display: grid; place-items: center;
}
#airmap .ovr-zoom button:hover { background: var(--bg-soft); color: var(--ink); }
#airmap .ovr-zoom button + button { border-top: 1px solid var(--line); }
#airmap .ovr-zoom button svg { width: 14px; height: 14px; }

/* ══ PATIČKA SEKCE — kontextové karty pod mapou ═════════════════ */
#airmap .map-section-foot {
  margin: 24px 0 0;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;
}
#airmap .info-card {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
#airmap .info-card h3 {
  font-family: var(--caption-font); font-size: 10px;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-muted); font-weight: 600; margin-bottom: 8px;
}
#airmap .info-card .h-big {
  font-family: 'Instrument Serif', serif; font-style: italic;
  font-size: 19px; color: var(--ink); line-height: 1.25;
  margin-bottom: 6px;
}
#airmap .info-card p {
  font-size: 12.5px; color: var(--ink-soft); line-height: 1.5;
}
#airmap .info-card .pill {
  display: inline-block;
  margin-top: 10px; padding: 4px 10px;
  background: var(--bg-soft);
  border-radius: 12px;
  font-family: var(--caption-font); font-size: 10px;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 600;
}
#airmap .info-card .pill.live { background: var(--green-50); color: var(--green-deep); }

/* ══ RESPONZIVITA ═══════════════════════════════════════════════ */
@media (max-width: 920px) {
  #airmap .map-card { height: 560px; }
  #airmap .ovr-ctrl { width: 360px; }
}
@media (max-width: 720px) {
  /* Vyšší mapa (480→560) + kompaktní AQ karta, aby overlay nezakrýval
     většinu mapy. Skrýváme dekorativní EAQI škálu a zhušťujeme rozteče —
     klíčové info (AQI, label, PM) zůstává viditelné. */
  #airmap .map-card { height: 560px; }
  #airmap .ovr-ctrl,
  #airmap .ovr-legend,
  #airmap .ovr-wind { display: none; }
  #airmap .ovr-aq {
    width: auto; left: 12px; right: 12px; top: 12px;
    padding: 10px 14px 12px;
  }
  /* EAQI škála + popisky jsou dekorativní — na mobilu šetříme ~30 px výšky.
     Míru znečištění uživatel přečte z barvy AQI skóre + textového labelu. */
  #airmap .ovr-aq .scale,
  #airmap .ovr-aq .scale-lbls { display: none; }
  #airmap .ovr-aq .row { padding: 2px 0 4px; }
  #airmap .ovr-aq .station-meta { margin-top: 2px; }
  #airmap .ovr-aq .metrics { gap: 8px; margin-top: 8px; }
  #airmap .ovr-zoom { right: 12px; }
  #airmap .ovr-time { left: 10px; right: 10px; bottom: 8px; padding: 8px 12px 6px; }
  #airmap .time-label { min-width: 80px; font-size: 10px; }
  #airmap .time-ticks { display: none; }
  #airmap .map-section-foot { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  #airmap *, #airmap *::before, #airmap *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
  #airmap #am-wind { display: none; }
}
