/* ──────────────────────────────────────────────────────────────────
   TarantoRespira — /avanzata/: the temporal map (archive slider)
   Floating glass controls over the map, same family as map.css.
   ────────────────────────────────────────────────────────────────── */

/* ── Pollutant chips — top center, under the brand ── */
.storia-chips {
  position: fixed;
  top:  calc(env(safe-area-inset-top, 0px) + 4.2rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  display: flex;
  gap: 0.4rem;
  max-width: calc(100vw - 1.6rem);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0.15rem;
}
.storia-chips::-webkit-scrollbar { display: none; }

.storia-chip {
  font-family: var(--font);
  font-size: 0.78rem;
  padding: 0.4rem 0.8rem;
  border-radius: 2rem;
  border: 1px solid var(--border);
  background: var(--glass-strong);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.storia-chip:hover { border-color: var(--teal); }
.storia-chip.active { background: var(--sea); color: #fff; border-color: var(--sea); }

/* ── Time bar — bottom center ── */
.storia-timebar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 1.2rem);
  z-index: 12;
  width: min(680px, calc(100vw - 11rem));   /* leaves the launcher corner free */
  padding: 0.7rem 0.9rem 0.6rem;
  border-radius: 1.1rem;
  background: var(--glass-strong);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(20, 45, 64, 0.16);
  font-family: var(--font);
}

.storia-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.45rem;
}
.storia-legend {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1 1 auto;
  min-width: 0;
}
.storia-leg-bar {
  flex: 1 1 4rem;
  height: 0.5rem;
  border-radius: 0.25rem;
  border: 1px solid rgba(20, 45, 64, 0.15);
  min-width: 3rem;
}
.storia-leg-min, .storia-leg-max, .storia-leg-unit {
  font-size: 0.66rem;
  color: var(--muted);
  white-space: nowrap;
}
.storia-time {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sea);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Median-of-stations strip: magnitude context + scrubber. touch-action
   none so dragging it seeks instead of scrolling. */
.storia-spark {
  display: block;
  width: 100%;
  height: 54px;
  margin: 0.1rem 0 0.4rem;
  cursor: crosshair;
  touch-action: none;
}

.storia-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.storia-play {
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--sea);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.storia-play:hover { border-color: var(--teal); color: var(--teal); }
.storia-play.on { background: var(--sea); color: #fff; border-color: var(--sea); }
.storia-play svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: currentColor;
  stroke: none;
}

#tSlider {
  flex: 1 1 auto;
  accent-color: var(--sea);
  height: 1.4rem;      /* generous touch target */
  cursor: pointer;
}

.storia-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.45rem;
  flex-wrap: wrap;
}
.storia-ranges { display: flex; gap: 0.3rem; }
.storia-ranges .storia-chip {
  font-size: 0.7rem;
  padding: 0.28rem 0.6rem;
  background: var(--surface);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.storia-ranges .storia-chip.active { background: var(--sea); }
.storia-note {
  font-size: 0.66rem;
  color: #8a5a00;
  flex: 1 1 12rem;
  min-width: 0;
}
.storia-note[hidden] { display: none; }

/* ── Station popup ── */
.storia-pop { font-family: var(--font); font-size: 0.8rem; color: var(--text); }
.storia-pop b { font-size: 0.84rem; }
.storia-pop-net {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0 0.35em;
  border: 1px solid var(--border-strong);
  border-radius: 0.6em;
  font-size: 0.62rem;
  color: var(--muted);
  vertical-align: middle;
}
.storia-pop-v { font-size: 1.05rem; font-weight: 600; margin-top: 0.2rem; }
.storia-pop-t { font-size: 0.7rem; color: var(--muted); margin-top: 0.1rem; }

/* ── Narrow / medium screens ── */
/* Below ~900px the centered 680px bar's left edge reaches the launcher
   FAB's corner — lift the whole bar FULLY above the FAB. (The FAB zone is
   ~5.8rem tall incl. margin; 7rem clears it with room.) */
@media (max-width: 900px) {
  .storia-timebar {
    width: calc(100vw - 1.6rem);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 7rem);
    padding: 0.6rem 0.75rem 0.5rem;
  }
  .storia-time { font-size: 0.72rem; }
  .storia-note { flex-basis: 100%; }
}

/* ── Phones ── */
@media (max-width: 640px) {
  .storia-chips {
    top: calc(env(safe-area-inset-top, 0px) + 3.9rem);
    left: 0;
    transform: none;
    max-width: 100vw;
    padding: 0.15rem 0.8rem;
    justify-content: flex-start;
  }
}
