/* assets/css/temps.css — /temps (el temps a Catalunya). Només es carrega en aquesta pàgina.
   Escena fosca a pantalla completa amb els tokens del mode fosc del DESIGN.md
   (bg-dark, surface-dark, text-dark, primary-dark, accent). Els únics colors nous
   són l'escala de dades del temps, documentada al DESIGN.md («Escala de dades»).
   Res de vidre esmerilat ni ombres de colors: llegibilitat per vel fosc i vores d'1 px. */

.tp {
  --tp-bg: #151817;          /* bg-dark */
  --tp-surface: #1C201E;     /* surface-dark */
  --tp-text: #E8E5DF;        /* text-dark */
  --tp-muted: rgba(232, 229, 223, .72);
  --tp-faint: rgba(232, 229, 223, .12);
  --tp-line: rgba(232, 229, 223, .10);
  --tp-green: #88B090;       /* primary-dark */
  --tp-lime: #A7C957;        /* accent */
  /* Escala de dades (DESIGN.md) */
  --tp-rain: #7FB3C8;
  --tp-t-cold: #6E9FC2;
  --tp-t-cool: #8FC1B5;
  --tp-t-mild: #A7C957;
  --tp-t-warm: #D4A857;
  --tp-t-hot: #C8553D;
  --tp-safe-t: env(safe-area-inset-top, 0px);
  --tp-safe-b: env(safe-area-inset-bottom, 0px);
  --tp-gutter: 16px;

  background: var(--tp-bg);
  color: var(--tp-text);
  font-family: "Manrope", "Manrope Fallback", sans-serif;
  -webkit-font-smoothing: antialiased;
}
body:has(.tp) { background: #151817; background-image: none; }
.tp a { color: inherit; }
.tp :focus-visible { outline: 2px solid var(--tp-lime); outline-offset: 2px; border-radius: 10px; }
.tp-sprite { position: absolute; }
.tp-i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ═══ Escena ═══ */
.tp-stage {
  position: relative;
  height: 100svh;
  min-height: 600px;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(120% 80% at 50% 0%, #1C201E 0%, #151817 60%);
}
.tp-map { position: absolute; inset: 0; z-index: 0; }
.tp-map .maplibregl-canvas { outline: none; }
.tp-fx { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; }
/* Vel: fosc a dalt i a baix perquè el text es llegeixi sobre qualsevol relleu. */
.tp-shade {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(21, 24, 23, .82) 0, rgba(21, 24, 23, .35) 150px, rgba(21, 24, 23, 0) 240px),
    linear-gradient(to top, rgba(21, 24, 23, .96) 0, rgba(21, 24, 23, .88) 300px, rgba(21, 24, 23, 0) 480px);
  transition: opacity .5s ease;
}

/* ── Barra de dalt ── */
.tp-top {
  position: absolute; z-index: 5;
  top: calc(var(--tp-safe-t) + 12px); left: var(--tp-gutter); right: var(--tp-gutter);
  display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center;
}
.tp-brand {
  grid-area: brand; flex: 1 1 auto; display: inline-flex; align-items: baseline; gap: 8px;
  font-family: "Source Serif 4", "Source Serif 4 Fallback", serif; font-weight: 800; font-size: 1.25rem;
  text-decoration: none; letter-spacing: -.01em; min-height: 44px; align-items: center;
}
.tp-brand span {
  font-family: "Manrope", sans-serif; font-size: .6875rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--tp-green); padding: 3px 8px; border: 1px solid rgba(136, 176, 144, .45); border-radius: 999px;
}
.tp-locate { grid-area: locate; order: 3; }
.tp-overview { grid-area: overview; order: 1; }
.tp-sound { grid-area: sound; position: relative; order: 2; }
.tp-search { grid-area: search; position: relative; order: 4; flex: 1 1 60%; min-width: 0; }
@media (max-width: 639px) { .tp-top { column-gap: 8px; } }
@media (max-width: 359px) { .tp-brand span { display: none; } }
/* 3D: a la vista, amb icona i nom; quan és actiu, s'encén. */
.tp-3d { grid-area: d3; order: 5; align-self: stretch; gap: 7px; padding: 0 14px; border-radius: 16px; border-color: rgba(167, 201, 87, .45); font-weight: 800; letter-spacing: .04em; }
.tp-3d .tp-i { color: var(--tp-lime); transition: transform .5s cubic-bezier(.3, 1.4, .5, 1); }
.tp-3d[aria-pressed="true"] { background: var(--tp-lime); color: var(--tp-bg); border-color: var(--tp-lime); }
.tp-3d[aria-pressed="true"] .tp-i { color: var(--tp-bg); }
@media (prefers-reduced-motion: no-preference) { .tp-3d:hover .tp-i, .tp-3d[aria-pressed="true"] .tp-i { transform: rotate(30deg); } }
.tp-search-i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--tp-muted); pointer-events: none; }
.tp-search input {
  width: 100%; height: 50px; padding: 0 16px 0 46px;
  background: rgba(28, 32, 30, .92); color: var(--tp-text);
  border: 1px solid var(--tp-line); border-radius: 16px;
  font: 600 1rem/1 "Manrope", sans-serif; /* 16px: iOS no fa zoom en tocar-lo */
  -webkit-appearance: none; appearance: none;
}
.tp-search input::placeholder { color: var(--tp-muted); font-weight: 500; }
.tp-search input:focus { outline: none; border-color: var(--tp-green); box-shadow: 0 0 0 3px rgba(136, 176, 144, .25); }
.tp-search input::-webkit-search-cancel-button { filter: invert(1) opacity(.6); }
.tp-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20;
  max-height: min(55svh, 360px); overflow-y: auto; overscroll-behavior: contain;
  margin: 0; padding: 6px; list-style: none;
  background: var(--tp-surface); border: 1px solid var(--tp-line); border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.tp-results li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  min-height: 48px; padding: 8px 12px; border-radius: 10px; cursor: pointer;
}
.tp-results li[aria-selected="true"], .tp-results li:hover { background: rgba(136, 176, 144, .16); }
.tp-results li small { color: var(--tp-muted); font-size: .8125rem; white-space: nowrap; }
.tp-results mark { background: none; color: var(--tp-lime); font-weight: 800; }
.tp-results .tp-empty { cursor: default; color: var(--tp-muted); }

.tp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 44px; min-height: 44px; padding: 0 14px;
  background: rgba(28, 32, 30, .92); color: var(--tp-text);
  border: 1px solid var(--tp-line); border-radius: 14px;
  font: 700 .875rem/1 "Manrope", sans-serif;
  transition: border-color .2s, background-color .2s, transform .2s;
}
.tp-btn:hover { border-color: rgba(136, 176, 144, .6); }
.tp-btn:active { transform: scale(.97); }
.tp-btn[aria-busy="true"] .tp-i { animation: tp-spin 1s linear infinite; }
@keyframes tp-spin { to { transform: rotate(360deg); } }
.tp-btn-label { display: none; }

/* ── Preferits ── */
.tp-favs {
  position: absolute; z-index: 4;
  top: calc(var(--tp-safe-t) + 128px); left: 0; right: 0;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 0 var(--tp-gutter) 4px; scroll-padding-inline: var(--tp-gutter);
}
.tp-favs::-webkit-scrollbar { display: none; }
.tp-favs:empty { display: none; }
.tp-fav {
  flex: none; display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  background: rgba(21, 24, 23, .78); border: 1px solid var(--tp-line); color: var(--tp-text);
  font: 700 .875rem/1 "Manrope", sans-serif; white-space: nowrap;
}
.tp-fav b { font-family: "Source Serif 4", serif; font-weight: 800; font-size: 1rem; color: var(--tp-text); }
.tp-fav[aria-current="true"] { border-color: var(--tp-green); background: rgba(58, 90, 64, .55); }
/* En pantalla tàctil fan 40 px d'alt però el toc s'amplia a 44 amb el marge invisible */
.tp-fav { position: relative; }
.tp-fav::after { content: ""; position: absolute; inset: -2px 0; }

/* ── Ara ── */
.tp-now {
  position: absolute; z-index: 4;
  left: var(--tp-gutter); right: var(--tp-gutter);
  bottom: calc(var(--tp-safe-b) + 150px);
  text-shadow: 0 1px 12px rgba(0, 0, 0, .35);
  transition: opacity .45s ease, transform .6s cubic-bezier(.2, .8, .2, 1);
}
.tp-now[aria-busy="true"] { opacity: .55; }
.tp-now-head { display: flex; align-items: center; gap: 6px; }
.tp-place {
  margin: 0; font-family: "Source Serif 4", "Source Serif 4 Fallback", serif; font-weight: 800;
  font-size: clamp(1.75rem, 7.5vw, 2.5rem); line-height: 1.05; letter-spacing: -.02em;
  overflow-wrap: anywhere;
}
.tp-star {
  flex: none; width: 44px; height: 44px; display: grid; place-items: center;
  background: none; border: 0; color: var(--tp-muted); border-radius: 12px;
}
.tp-star .tp-i { width: 24px; height: 24px; transition: transform .3s cubic-bezier(.3, 1.6, .5, 1), fill .2s; }
.tp-star[aria-pressed="true"] { color: var(--tp-lime); }
.tp-star[aria-pressed="true"] .tp-i { fill: var(--tp-lime); transform: scale(1.08); }
.tp-county { margin: 2px 0 0; color: var(--tp-muted); font-size: .8125rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.tp-now-main { display: flex; align-items: flex-end; gap: 14px; margin-top: 4px; }
.tp-temp {
  margin: 0; display: flex; align-items: flex-start;
  font-family: "Source Serif 4", "Source Serif 4 Fallback", serif; font-weight: 800;
  font-size: clamp(5.25rem, 27vw, 9.5rem); line-height: .82; letter-spacing: -.05em;
  font-variant-numeric: lining-nums tabular-nums; font-feature-settings: "lnum" 1;
}
.tp-deg { font-size: .45em; line-height: 1; margin: .08em 0 0 .04em; color: var(--tp-green); }
.tp-now-side { padding-bottom: .5rem; min-width: 0; }
.tp-wicon { width: 44px; height: 44px; fill: none; stroke: var(--tp-text); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tp-cond {
  margin: 4px 0 0; font-family: "Source Serif 4", "Source Serif 4 Fallback", serif; font-style: italic; font-weight: 400;
  font-size: clamp(1.0625rem, 4.4vw, 1.375rem); line-height: 1.25;
}
/* Màxima i mínima d'avui: la barra pren els colors de la temperatura i el punt és l'ara. */
.tp-today {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  width: 100%; max-width: 420px; min-height: 44px; margin: 12px 0 0; padding: 0;
  background: none; border: 0; color: var(--tp-text); cursor: pointer; text-shadow: inherit;
  font: 800 1rem/1 "Manrope", sans-serif; font-variant-numeric: tabular-nums;
}
.tp-today[hidden] { display: none; }
.tp-today-n { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.tp-today-n small { font-size: .6875rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--tp-muted); }
.tp-today-n b { font-family: "Source Serif 4", "Source Serif 4 Fallback", serif; font-size: 1.375rem; font-weight: 800; font-feature-settings: "lnum" 1; }
.tp-today-track { position: relative; height: 6px; border-radius: 6px; background: var(--tp-faint); }
.tp-today-bar {
  position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(to right, var(--tp-lo), var(--tp-mid), var(--tp-hi));
  box-shadow: 0 0 16px color-mix(in srgb, var(--tp-cur, #A7C957) 40%, transparent);
}
.tp-today-dot {
  position: absolute; top: 50%; left: calc(var(--p, .5) * 100%); width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border-radius: 50%; background: var(--tp-text); border: 3px solid var(--tp-cur, #A7C957);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--tp-cur, #A7C957) 25%, transparent), 0 0 18px var(--tp-cur, #A7C957);
}
.tp-today:hover .tp-today-dot { transform: scale(1.15); }
.tp-today:focus-visible { outline: 2px solid var(--tp-green); outline-offset: 4px; border-radius: 10px; }
.tp-today-more { margin: 4px 0 0; max-width: 46ch; font-size: .8125rem; line-height: 1.45; color: var(--tp-muted); }
@media (prefers-reduced-motion: no-preference) {
  .tp-today-dot { transition: left 1.2s cubic-bezier(.2, .8, .2, 1), transform .2s; }
  .tp-today.is-in .tp-today-bar { animation: tp-today-draw 1.1s cubic-bezier(.2, .8, .2, 1) .15s both; }
  .tp-today.is-in .tp-today-dot { animation: tp-today-slide 1.5s cubic-bezier(.2, .8, .2, 1) .15s both, tp-today-glow 3.2s ease-in-out 1.7s infinite; }
}
@keyframes tp-today-draw { from { clip-path: inset(0 100% 0 0 round 6px); } to { clip-path: inset(0 0 0 0 round 6px); } }
@keyframes tp-today-slide { from { left: 0; opacity: 0; } 25% { opacity: 1; } }
@keyframes tp-today-glow { 50% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--tp-cur, #A7C957) 14%, transparent), 0 0 26px var(--tp-cur, #A7C957); } }
.tp-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 14px 0 0; }
.tp-metrics div { min-width: 0; }
.tp-metrics dt { font-size: .6875rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--tp-muted); }
.tp-metrics dd { margin: 2px 0 0; display: flex; align-items: center; gap: 4px; font-weight: 700; font-size: 1rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tp-arrow { width: 16px; height: 16px; fill: none; stroke: var(--tp-lime); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .8s cubic-bezier(.2, .8, .2, 1); }
.tp-source { margin: 10px 0 0; font-size: .8125rem; color: var(--tp-muted); line-height: 1.45; }
.tp-source b { color: var(--tp-text); font-weight: 700; }
.tp-source .tp-stale { color: var(--tp-t-warm); }

/* ── Moll: radar i capes ── */
.tp-dock {
  position: absolute; z-index: 5;
  left: var(--tp-gutter); right: var(--tp-gutter); bottom: calc(var(--tp-safe-b) + 12px);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "radar explore" "layers layers"; gap: 10px;
  align-items: center;
}
.tp-radar {
  grid-area: radar; display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 4px 12px 4px 4px; background: rgba(28, 32, 30, .92); border: 1px solid var(--tp-line); border-radius: 16px;
}
.tp-radar[hidden] { display: none; }
.tp-play {
  flex: none; width: 44px; height: 44px; display: grid; place-items: center;
  background: var(--tp-text); color: var(--tp-bg); border: 0; border-radius: 12px;
}
.tp-play .tp-i { fill: currentColor; stroke: currentColor; }
.tp-i-pause { display: none; }
.tp-play[aria-pressed="true"] .tp-i-play { display: none; }
.tp-play[aria-pressed="true"] .tp-i-pause { display: block; stroke-width: 2.6; }
.tp-scrub { flex: 1; min-width: 0; position: relative; }
.tp-scrub-label { display: flex; justify-content: space-between; gap: 8px; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--tp-muted); }
.tp-scrub-label span { color: var(--tp-text); letter-spacing: 0; text-transform: none; font-variant-numeric: tabular-nums; }
.tp-scrub input[type="range"] {
  width: 100%; height: 28px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; accent-color: var(--tp-lime);
}
.tp-scrub input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px;
  background:
    linear-gradient(to right, var(--tp-rain) var(--tp-pct, 100%), transparent var(--tp-pct, 100%)),
    linear-gradient(to right, var(--tp-faint) var(--tp-now, 100%), transparent var(--tp-now, 100%)),
    repeating-linear-gradient(to right, rgba(232, 229, 223, .32) 0 4px, transparent 4px 8px);
}
.tp-scrub input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: var(--tp-text); border: 4px solid var(--tp-bg); }
.tp-scrub input[type="range"]::-moz-range-track {
  height: 4px; border-radius: 4px;
  background:
    linear-gradient(to right, var(--tp-faint) var(--tp-now, 100%), transparent var(--tp-now, 100%)),
    repeating-linear-gradient(to right, rgba(232, 229, 223, .32) 0 4px, transparent 4px 8px);
}
.tp-scrub input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--tp-rain); }
.tp-scrub input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--tp-text); border: 4px solid var(--tp-bg); }

.tp-explore { grid-area: explore; }
.tp-explore .tp-i-shut, .tp-explore-label { display: none; }
.tp-explore[aria-pressed="true"] .tp-i-open { display: none; }
.tp-explore[aria-pressed="true"] .tp-i-shut { display: block; }

.tp-layers { grid-area: layers; display: flex; align-items: center; gap: 8px; }
.tp-layers::-webkit-scrollbar { display: none; }
.tp-chip {
  flex: none; min-height: 44px; padding: 0 16px; border-radius: 999px;
  background: rgba(21, 24, 23, .8); color: var(--tp-muted); border: 1px solid var(--tp-line);
  font: 700 .8125rem/1 "Manrope", sans-serif; letter-spacing: .02em;
  transition: background-color .2s, color .2s, border-color .2s;
}
.tp-chip[aria-pressed="true"] { background: var(--tp-text); color: var(--tp-bg); border-color: var(--tp-text); }
.tp-chip-base { margin-left: auto; }
.tp-chip[data-layer][aria-pressed="true"]::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%;
  background: var(--tp-chip-dot, var(--tp-green)); vertical-align: 1px;
}
.tp-chip[data-layer="radar"] { --tp-chip-dot: var(--tp-rain); }
.tp-chip[data-layer="lightning"] { --tp-chip-dot: var(--tp-t-warm); }
.tp-chip[data-layer="stations"] { --tp-chip-dot: var(--tp-lime); }

.tp-scroll {
  position: absolute; z-index: 4; left: 50%; bottom: calc(var(--tp-safe-b) + 128px); transform: translateX(-50%);
  display: none; align-items: center; gap: 6px; padding: 8px 12px; min-height: 44px;
  font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--tp-muted); text-decoration: none;
}

/* ── Mode explora: només el mapa i el moll ── */
.tp.is-exploring .tp-now, .tp.is-exploring .tp-favs, .tp.is-exploring .tp-scroll, .tp.is-exploring .tp-top {
  opacity: 0; pointer-events: none; transform: translateY(12px);
}
.tp.is-exploring .tp-shade { opacity: .25; }
.tp.is-exploring .tp-stage { height: 100dvh; }
body:has(.tp.is-exploring) { overflow: hidden; }
.tp-top, .tp-favs { transition: opacity .35s ease, transform .5s cubic-bezier(.2, .8, .2, 1); }

/* ── Marcadors del mapa ── */
.tp-st {
  display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 4px 8px 4px 6px; border-radius: 999px;
  background: rgba(21, 24, 23, .84); border: 1px solid rgba(232, 229, 223, .16); color: var(--tp-text);
  font: 800 .75rem/1 "Manrope", sans-serif; font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer;
  transition: opacity .3s ease;
}
.tp-st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tp-dot, var(--tp-t-mild)); }
.tp-st:hover, .tp-st:focus-visible { border-color: var(--tp-dot); }
.tp-pin { display: grid; justify-items: center; pointer-events: none; }
.tp-pin-label {
  padding: 6px 10px; border-radius: 12px; background: var(--tp-text); color: var(--tp-bg);
  font: 800 .875rem/1.1 "Manrope", sans-serif; white-space: nowrap; box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
}
.tp-pin-label b { font-family: "Source Serif 4", serif; font-size: 1.0625rem; margin-left: 6px; }
.tp-pin-stem { width: 2px; height: 26px; background: linear-gradient(var(--tp-text), rgba(232, 229, 223, 0)); }
.tp-pin-dot { width: 12px; height: 12px; margin-top: -2px; border-radius: 50%; background: var(--tp-lime); box-shadow: 0 0 0 6px rgba(167, 201, 87, .22); }
.maplibregl-popup.tp-pop .maplibregl-popup-content {
  background: var(--tp-surface); color: var(--tp-text); border: 1px solid var(--tp-line); border-radius: 14px;
  padding: 12px 14px; font: 500 .875rem/1.45 "Manrope", sans-serif; box-shadow: 0 20px 50px rgba(0, 0, 0, .45);
}
.maplibregl-popup.tp-pop .maplibregl-popup-tip { border-top-color: var(--tp-surface); border-bottom-color: var(--tp-surface); }
.maplibregl-popup.tp-pop .maplibregl-popup-close-button { color: var(--tp-muted); width: 32px; height: 32px; font-size: 20px; }
.tp-pop h3 { margin: 0 24px 4px 0; font: 800 1rem/1.2 "Source Serif 4", serif; }
.tp-pop p { margin: 0; color: var(--tp-muted); }
.tp-pop strong { color: var(--tp-text); }
.tp .maplibregl-ctrl-attrib { background: rgba(21, 24, 23, .7); color: var(--tp-muted); font-size: 10px; }
.tp .maplibregl-ctrl-attrib a { color: var(--tp-text); }
.tp .maplibregl-ctrl-attrib-button { filter: invert(1); }
/* Al mòbil, la «i» queda just damunt del bloc de l'ara (temps-map.js en mesura l'alçada). */
.tp .maplibregl-ctrl-bottom-right { bottom: calc(var(--tp-now-h, 280px) + 6px); }
.tp .maplibregl-cooperative-gesture-screen { background: none; color: var(--tp-text); font: 700 .9375rem/1.35 "Manrope", sans-serif; text-align: center; }
.tp .maplibregl-cooperative-gesture-screen > div {
  max-width: min(420px, 86vw); padding: 11px 18px; border-radius: 999px;
  background: rgba(21, 24, 23, .9); border: 1px solid var(--tp-line); box-shadow: 0 16px 44px rgba(0, 0, 0, .5);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.tp-explore { transition: border-color .5s ease 1.4s, box-shadow .5s ease 1.4s, transform .2s; }
.tp-stage:has(.maplibregl-cooperative-gesture-screen.maplibregl-show) .tp-explore {
  border-color: var(--tp-lime); box-shadow: 0 0 0 5px rgba(167, 201, 87, .22), 0 0 24px rgba(167, 201, 87, .35); transition-delay: 0s;
}

/* ═══ Seccions de sota ═══ */
.tp-sec { padding: 56px 0; border-top: 1px solid var(--tp-line); }
.tp-wrap { max-width: 80rem; margin: 0 auto; padding: 0 24px; }
.tp-h2 { margin: 0 0 20px; font-family: "Source Serif 4", "Source Serif 4 Fallback", serif; font-weight: 800; font-size: clamp(1.625rem, 5.5vw, 2.25rem); line-height: 1.15; letter-spacing: -.015em; }
.tp-first { border-top: 0; }
.tp-nowcast { margin: -8px 0 24px; max-width: 34ch; font-family: "Source Serif 4", serif; font-style: italic; font-size: clamp(1.25rem, 4.8vw, 1.625rem); line-height: 1.35; color: var(--tp-text); }

/* Capçalera de secció amb controls: títol i botons, a sota en mòbil i al costat en ample. */
.tp-sec-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.tp-sec-head .tp-h2 { margin: 0; }
/* Botons segmentats: la píndola clara llisca fins al triat. */
.tp-seg {
  position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 4px;
  border-radius: 999px; background: rgba(28, 32, 30, .92); border: 1px solid var(--tp-line);
}
.tp-seg button {
  position: relative; z-index: 1; min-width: 52px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 999px;
  background: none; color: var(--tp-muted); font: 800 .875rem/1 "Manrope", sans-serif; font-variant-numeric: tabular-nums; cursor: pointer;
  transition: color .3s ease;
}
@media (hover: hover) { .tp-seg button:not([aria-pressed="true"]):not(:disabled):hover { color: var(--tp-text); } }
.tp-seg button[aria-pressed="true"] { color: var(--tp-bg); }
.tp-seg button:disabled { opacity: .3; cursor: default; }
.tp-seg button:focus-visible { outline: 2px solid var(--tp-lime); outline-offset: 2px; }
.tp-seg-thumb {
  position: absolute; top: 4px; bottom: 4px; left: 0; width: var(--w, 0); transform: translateX(var(--x, 0));
  border-radius: 999px; background: var(--tp-text); box-shadow: 0 4px 18px rgba(0, 0, 0, .35);
}
@media (prefers-reduced-motion: no-preference) {
  .tp-seg-thumb { transition: transform .5s cubic-bezier(.3, 1.35, .5, 1), width .5s cubic-bezier(.3, 1.35, .5, 1); }
  /* En canviar d'hores, el gràfic s'escombra d'esquerra a dreta. */
  .tp-pcp-svg.is-sweep .tp-pcp-plot { animation: tp-sweep .9s cubic-bezier(.2, .8, .2, 1) both; }
}
@keyframes tp-sweep { from { clip-path: inset(-20px 100% -20px 0); } to { clip-path: inset(-20px 0 -20px 0); } }
@media (max-width: 639px) {
  .tp-sec-head .tp-seg { width: 100%; }
  .tp-seg button { min-width: 0; padding: 0 6px; }
}
/* Sec: una línia tranquil·la i la frase, en comptes d'una gràfica plana. */
.tp-pcp.is-dry .tp-pcp-help { display: none; }
.tp-pcp-dry { position: relative; display: grid; place-items: center; min-height: 72px; }
.tp-pcp-dry-line { position: absolute; left: 0; right: 0; top: 50%; height: 2px; border-radius: 2px; background: linear-gradient(to right, var(--tp-lime), rgba(167, 201, 87, .15)); }
.tp-pcp-dry p { position: relative; margin: 0; padding: 6px 16px; border-radius: 999px; background: var(--tp-bg); border: 1px solid rgba(167, 201, 87, .35); font-size: .9375rem; color: var(--tp-muted); }
.tp-pcp-dry b { color: var(--tp-lime); font-weight: 800; margin-right: 4px; }
@media (prefers-reduced-motion: no-preference) {
  .tp-pcp-dry.is-sweep .tp-pcp-dry-line { animation: tp-sweep .9s cubic-bezier(.2, .8, .2, 1) both; }
}
.tp-pcp-tick.is-day { fill: var(--tp-green); text-transform: uppercase; letter-spacing: .08em; font-size: 10px; }

/* ── Precipitació: gràfic compacte i interactiu ── */
.tp-minutely { position: relative; outline: none; border-radius: 12px; }
.tp-minutely:focus-visible { outline: 2px solid var(--tp-lime); outline-offset: 6px; }
.tp-pcp-read { margin: 0 0 8px; min-height: 1.5em; font-size: .9375rem; color: var(--tp-muted); font-variant-numeric: tabular-nums; }
.tp-pcp-read b { color: var(--tp-text); font-weight: 800; }
.tp-pcp-svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; cursor: crosshair; }
.tp-pcp-area { opacity: .85; }
.tp-pcp-line { fill: none; stroke-width: 2; stroke-linejoin: round; }
.tp-pcp-base { stroke: rgba(232, 229, 223, .28); stroke-width: 1; }
.tp-pcp-guide { stroke: rgba(232, 229, 223, .1); stroke-width: 1; stroke-dasharray: 2 4; }
.tp-pcp-zone { fill: rgba(232, 229, 223, .62); font: 700 10px/1 "Manrope", sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.tp-pcp-tick { fill: var(--tp-muted); font: 700 11px/1 "Manrope", sans-serif; font-variant-numeric: tabular-nums; }
.tp-pcp-fog { fill: url(#tp-fog-p); }
.tp-pcp-bolt { fill: var(--tp-t-warm); }
.tp-pcp-cursor line { stroke: var(--tp-text); stroke-width: 1.5; }
.tp-pcp-cursor circle { fill: var(--tp-text); stroke: var(--tp-bg); stroke-width: 2; }
.tp-pcp-help { margin: 10px 0 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; font-size: .75rem; color: var(--tp-muted); }
.tp-pcp-key { display: inline-flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; }
.tp-pcp-key i { display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 3px; vertical-align: -1px; }
.tp-pcp-key .is-rain { background: #7FB3C8; }
.tp-pcp-key .is-snow { background: #E8E5DF; }
.tp-pcp-key .is-fog { background: repeating-linear-gradient(45deg, rgba(232, 229, 223, .5) 0 2px, transparent 2px 4px); }

/* ── 48 hores ── */
.tp-hnav { display: none; gap: 8px; }
.tp-hnav-b {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  background: rgba(28, 32, 30, .92); color: var(--tp-text); border: 1px solid var(--tp-line); transition: border-color .2s, transform .2s;
}
.tp-hnav-b:hover { border-color: rgba(136, 176, 144, .6); }
.tp-hnav-b:active { transform: scale(.94); }
.tp-hnav-b[data-d="-1"] .tp-i { transform: rotate(90deg); }
.tp-hnav-b[data-d="1"] .tp-i { transform: rotate(-90deg); }
@media (hover: hover) { .tp-hnav { display: flex; } }

/* La lectura de l'hora triada. */
.tp-hsel {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "when when" "main meta"; align-items: center; gap: 2px 20px;
  margin: 0 0 14px; padding: 12px 16px; border-radius: 16px; border: 1px solid var(--tp-line);
  background: linear-gradient(100deg, color-mix(in srgb, var(--tp-hsel, #A7C957) 16%, transparent), rgba(28, 32, 30, .6) 60%);
}
.tp-hsel-when { grid-area: when; margin: 0; font-size: .75rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--tp-muted); }
.tp-hsel-main { grid-area: main; display: flex; align-items: center; gap: 10px; min-width: 0; }
.tp-hsel-ico { width: 38px; height: 38px; flex: none; fill: none; stroke: var(--tp-text); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tp-hsel-t { font-family: "Source Serif 4", "Source Serif 4 Fallback", serif; font-weight: 800; font-size: 2.25rem; line-height: 1; font-variant-numeric: lining-nums tabular-nums; color: var(--tp-hsel, var(--tp-text)); }
.tp-hsel-cond { padding-right: .25em; font-family: "Source Serif 4", serif; font-style: italic; font-size: 1.125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-hsel-meta { grid-area: meta; margin: 0; font-size: .875rem; color: var(--tp-muted); line-height: 1.45; }
@media (max-width: 639px) {
  .tp-hsel { grid-template-columns: minmax(0, 1fr); grid-template-areas: "when" "main" "meta"; padding: 10px 14px; }
  .tp-hsel-t { font-size: 1.875rem; }
  .tp-hsel-meta { font-size: .8125rem; }
}

.tp-hours {
  position: relative; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding-bottom: 12px;
  scrollbar-color: rgba(232, 229, 223, .25) transparent; outline: none; border-radius: 14px;
}
.tp-hours:focus-visible { outline: 2px solid var(--tp-lime); outline-offset: 4px; }
.tp-hours.is-grab { cursor: grabbing; scroll-snap-type: none; user-select: none; }
@media (pointer: fine) { .tp-hours { cursor: grab; } }
.tp-hours-inner { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 58px; padding-top: 18px; }
/* La cinta del cel: el color de cada hora, esvaït per dalt i per baix. */
.tp-sky {
  position: absolute; left: 0; right: 0; top: 18px; height: 250px; border-radius: 14px; opacity: .55; pointer-events: none;
}
.tp-hours svg.tp-curve { position: absolute; left: 0; top: 88px; pointer-events: none; overflow: visible; }
.tp-curve path.tp-curve-line { fill: none; stroke: var(--tp-text); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.tp-curve-ext { stroke: var(--tp-bg); stroke-width: 2; }
/* L'agulla de l'hora triada. */
.tp-hneedle {
  position: absolute; top: 14px; bottom: 6px; left: 0; width: 2px; margin-left: -1px; transform: translateX(var(--x, 29px));
  border-radius: 2px; background: linear-gradient(to bottom, transparent, rgba(232, 229, 223, .7) 15%, rgba(232, 229, 223, .7) 85%, transparent);
  box-shadow: 0 0 14px rgba(232, 229, 223, .35); pointer-events: none; z-index: 1;
}
.tp-sunmark {
  position: absolute; top: 0; z-index: 2; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px 2px 4px; border-radius: 999px; background: rgba(21, 24, 23, .85); border: 1px solid rgba(212, 168, 87, .45);
  font-size: .6875rem; font-weight: 800; color: var(--tp-t-warm); font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none;
}
.tp-sunmark .tp-i { width: 14px; height: 14px; }
.tp-h {
  position: relative; z-index: 1; scroll-snap-align: start; display: grid; grid-template-rows: 20px 44px 120px 18px 46px 26px;
  justify-items: center; align-items: center; padding: 6px 0; border-left: 1px solid transparent; cursor: pointer; border-radius: 12px;
  transition: background-color .2s ease;
}
.tp-h.is-day0 { border-left-color: var(--tp-line); border-radius: 0; }
.tp-h.is-sel { background: rgba(232, 229, 223, .06); }
.tp-h-time { font-size: .75rem; font-weight: 700; color: var(--tp-muted); font-variant-numeric: tabular-nums; }
.tp-h-time.is-now { color: var(--tp-lime); }
.tp-h.is-sel .tp-h-time { color: var(--tp-text); }
.tp-h .tp-wicon { width: 30px; height: 30px; }
.tp-h-t { align-self: start; font-weight: 800; font-size: .9375rem; font-variant-numeric: tabular-nums; transform: translateY(var(--y, 0)); text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
.tp-h-t.is-max, .tp-h-t.is-min { color: var(--c); font-size: 1.0625rem; }
.tp-h-pop { font-size: .6875rem; font-weight: 700; color: var(--tp-rain); font-variant-numeric: tabular-nums; }
.tp-h-rain { width: 18px; align-self: end; height: 46px; display: flex; align-items: flex-end; }
.tp-h-rain i { display: block; width: 100%; border-radius: 4px 4px 0 0; background: var(--tp-rain); transform-origin: bottom; }
.tp-h-wind { display: inline-flex; align-items: center; gap: 2px; font-size: .6875rem; font-weight: 800; color: var(--tp-muted); font-variant-numeric: tabular-nums; }
.tp-h-wind .tp-arrow { width: 11px; height: 11px; stroke: currentColor; }
.tp-h-wind.is-fresh { color: var(--tp-text); }
.tp-h-wind.is-strong { color: var(--tp-t-warm); }
.tp-h-day { position: absolute; top: -2px; left: 6px; font-size: .6875rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--tp-green); white-space: nowrap; }
/* Entrada: la corba es dibuixa, el cel s'encén i les hores pugen una darrere l'altra. */
@media (prefers-reduced-motion: no-preference) {
  .tp-curve-line { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 2.2s cubic-bezier(.3, .7, .2, 1) .2s; }
  .tp-curve-ext, .tp-sky { opacity: 0; transition: opacity 1.2s ease .6s; }
  .tp-h { opacity: 0; transform: translateY(12px); transition: opacity .5s ease calc(var(--i, 0) * 45ms), transform .6s cubic-bezier(.2, .8, .2, 1) calc(var(--i, 0) * 45ms), background-color .2s ease; }
  .tp-h-rain i { transform: scaleY(0); transition: transform .7s cubic-bezier(.2, .8, .2, 1) calc(var(--i, 0) * 35ms + .5s); }
  .is-shown .tp-curve-line { stroke-dashoffset: 0; }
  .is-shown .tp-curve-ext { opacity: 1; }
  .is-shown .tp-sky { opacity: .55; }
  .is-shown .tp-h { opacity: 1; transform: none; }
  .is-shown .tp-h-rain i { transform: none; }
  .tp-hneedle { transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
}

.tp-split { display: grid; gap: 48px; }
.tp-days { list-style: none; margin: 0; padding: 0; }
.tp-days > li { border-top: 1px solid var(--tp-line); }
.tp-days > li:first-child { border-top: 0; }
.tp-day-row {
  position: relative; isolation: isolate; display: grid; grid-template-columns: 6.2rem 40px minmax(0, 1fr) 20px; align-items: center; gap: 12px;
  min-height: 62px; padding: 0 8px; margin: 0 -8px; border-radius: 14px; cursor: pointer; list-style: none;
}
.tp-day-row::-webkit-details-marker { display: none; }
.tp-day-row:focus-visible { outline: 2px solid var(--tp-lime); outline-offset: 2px; }
/* El cel del dia, de mitjanit a mitjanit, darrere la fila (esvaït on hi ha el nom). */
.tp-day-sky {
  position: absolute; inset: 6px 0; z-index: -1; border-radius: 12px; opacity: .42;
  -webkit-mask-image: linear-gradient(to right, transparent 0, rgba(0, 0, 0, .35) 22%, #000 55%);
  mask-image: linear-gradient(to right, transparent 0, rgba(0, 0, 0, .35) 22%, #000 55%);
  transition: opacity .3s ease;
}
.tp-day-row:hover .tp-day-sky, .tp-day[open] .tp-day-sky { opacity: .62; }
.tp-day-name { font-weight: 800; }
.tp-day-name small { display: block; font-weight: 600; font-size: .75rem; color: var(--tp-muted); }
.tp-day-row .tp-wicon { width: 32px; height: 32px; }
.tp-day-wx { display: grid; justify-items: center; gap: 1px; }
.tp-day-pop { font-size: .75rem; font-weight: 800; line-height: 1; color: var(--tp-rain); font-variant-numeric: tabular-nums; }
.tp-day-pop:empty { display: none; }
.tp-day-chev { width: 18px; height: 18px; fill: none; stroke: var(--tp-muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.tp-day[open] .tp-day-chev { transform: rotate(180deg); stroke: var(--tp-text); }
.tp-range { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr) 2.6rem; align-items: center; gap: 10px; font-weight: 800; font-variant-numeric: tabular-nums; text-shadow: 0 1px 6px rgba(0, 0, 0, .55); }
.tp-range .tp-min { color: var(--tp-muted); text-align: right; }
.tp-range-track { position: relative; height: 6px; border-radius: 6px; background: rgba(21, 24, 23, .55); }
.tp-range-bar { position: absolute; top: 0; bottom: 0; border-radius: 6px; background: var(--tp-grad); }
.tp-range-now { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--tp-text); border: 2px solid var(--tp-bg); }
/* El dia obert: les hores de tres en tres. */
.tp-dayx { padding: 6px 0 16px; }
.tp-dayx-chart { position: relative; }
.tp-dayx-line { position: absolute; left: 0; right: 0; top: 44px; width: 100%; height: 40px; overflow: visible; pointer-events: none; }
.tp-dayx-line path { fill: none; stroke: rgba(232, 229, 223, .55); stroke-width: 1.6; stroke-linejoin: round; }
.tp-dayx-slots { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); }
.tp-dayx-slots li { display: grid; justify-items: center; gap: 2px; grid-template-rows: 16px 30px 52px 20px; align-items: center; }
.tp-dayx-slots li.is-past { opacity: .4; }
.tp-dayx-h { font-size: .6875rem; font-weight: 700; color: var(--tp-muted); font-variant-numeric: tabular-nums; }
.tp-dayx-slots .tp-wicon { width: 26px; height: 26px; }
.tp-dayx-slots b { align-self: end; font-size: .875rem; font-variant-numeric: tabular-nums; }
.tp-dayx-rain { display: block; width: 10px; align-self: start; border-radius: 0 0 3px 3px; background: var(--tp-rain); }
.tp-dayx-facts { margin: 8px 0 0; font-size: .875rem; color: var(--tp-muted); }
@supports (interpolate-size: allow-keywords) {
  .tp-days { interpolate-size: allow-keywords; }
  @media (prefers-reduced-motion: no-preference) {
    .tp-day::details-content { height: 0; overflow: clip; transition: height .45s cubic-bezier(.2, .8, .2, 1), content-visibility .45s allow-discrete; }
    .tp-day[open]::details-content { height: auto; }
  }
}
/* Entrada: les barres creixen una darrere l'altra. */
@media (prefers-reduced-motion: no-preference) {
  .tp-days .tp-range-bar { transform: scaleX(0); transform-origin: left; transition: transform .9s cubic-bezier(.2, .8, .2, 1) calc(var(--i, 0) * 90ms + .1s); }
  .tp-days .tp-day-sky { opacity: 0; transition: opacity 1s ease calc(var(--i, 0) * 90ms); }
  .tp-days.is-shown .tp-range-bar { transform: none; }
  .tp-days.is-shown .tp-day-sky { opacity: .42; }
  .tp-days.is-shown .tp-day-row:hover .tp-day-sky, .tp-days.is-shown .tp-day[open] .tp-day-sky { opacity: .62; transition-delay: 0s; }
}
.tp-days > li { --i: 0; }
@media (max-width: 639px) {
  .tp-day-row { grid-template-columns: 5.6rem 32px minmax(0, 1fr) 14px; gap: 8px; }
  .tp-day-row .tp-wicon { width: 28px; height: 28px; }
  .tp-range { grid-template-columns: 2.2rem minmax(0, 1fr) 2.2rem; gap: 8px; }
  .tp-dayx-slots .tp-wicon { width: 22px; height: 22px; }
  .tp-dayx-slots b { font-size: .8125rem; }
}

/* ── La llum d'avui: el cel de l'hora triada, la corba del sol, les estrelles de nit ── */
@property --sky-top { syntax: "<color>"; inherits: false; initial-value: #151817; }
@property --sky-bot { syntax: "<color>"; inherits: false; initial-value: #1C201E; }
.tp-light {
  position: relative; overflow: hidden; border-radius: 20px; border: 1px solid var(--tp-line); cursor: ew-resize; touch-action: pan-y;
  background: linear-gradient(to bottom, var(--sky-top), var(--sky-bot) 64%, #151817 64.5%);
  outline: none; user-select: none; -webkit-user-select: none;
}
.tp-light:focus-visible { outline: 2px solid var(--tp-lime); outline-offset: 3px; }
.tp-light-svg { display: block; width: 100%; height: auto; }
.tp-light-stars circle { fill: #E8E5DF; opacity: var(--stars, 0); }
.tp-light-ground { fill: rgba(16, 18, 18, .82); }
.tp-light-horizon { stroke: rgba(232, 229, 223, .35); stroke-width: 1; }
.tp-light-path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tp-light-path.is-down { stroke: rgba(232, 229, 223, .22); stroke-width: 1.5; stroke-dasharray: 2 4; }
.tp-light-path.is-up { stroke: rgba(255, 231, 168, .9); stroke-width: 2.4; }
.tp-light-path.is-gold { stroke: #F2A44B; stroke-width: 4; }
.tp-light-path.is-blue { stroke: #8C8FE0; stroke-width: 4; }
.tp-light-mark line { stroke: rgba(232, 229, 223, .55); stroke-width: 1.5; }
.tp-light-mark text, .tp-light-tick { fill: rgba(232, 229, 223, .75); font: 800 10px/1 "Manrope", sans-serif; font-variant-numeric: tabular-nums; }
.tp-light-tick { fill: rgba(232, 229, 223, .45); font-weight: 700; }
.tp-light-now { stroke: var(--tp-lime); stroke-width: 2; stroke-linecap: round; }
.tp-light-ghost path { fill: none; stroke: rgba(232, 229, 223, .2); stroke-width: 1; stroke-dasharray: 1 3; }
.tp-light-gtext { fill: rgba(232, 229, 223, .72); font: 700 9.5px/1 "Manrope", sans-serif; letter-spacing: .04em; }
.tp-light-shadow { margin: 4px 0 0; font-family: "Source Serif 4", serif; font-style: italic; font-size: 1.0625rem; line-height: 1.4; color: var(--tp-text); min-height: 1.4em; }
.tp-light-disc { fill: #FFF3D1; }
.tp-light-ring { fill: rgba(21, 24, 23, .25); stroke: rgba(255, 243, 209, .75); stroke-width: 1.5; }
.tp-light-chev { fill: none; stroke: rgba(255, 243, 209, .9); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tp-light-time { fill: #FFF3D1; font: 800 10px/1 "Manrope", sans-serif; font-variant-numeric: tabular-nums; paint-order: stroke; stroke: rgba(21, 24, 23, .7); stroke-width: 3px; }
.tp-light-sun.is-down .tp-light-ring { stroke: rgba(232, 229, 223, .4); }
.tp-light-sun.is-down .tp-light-chev, .tp-light-sun.is-down .tp-light-time { opacity: .7; }
.tp-light { cursor: grab; }
.tp-light:active { cursor: grabbing; }
.tp-light-hint {
  position: absolute; left: 12px; top: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 9px;
  border-radius: 999px; background: rgba(21, 24, 23, .7); border: 1px solid rgba(255, 243, 209, .35); color: #FFF3D1;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-size: .75rem; font-weight: 800; letter-spacing: .02em; pointer-events: none; transition: opacity .5s ease, transform .5s ease;
}
.tp-light-hint .tp-i { width: 16px; height: 16px; }
.tp-light.is-tried .tp-light-hint { opacity: 0; transform: translateY(-6px); }
@media (prefers-reduced-motion: no-preference) {
  .tp-light.is-nudge:not(.is-tried) .tp-light-chev { animation: tp-chev 1.6s ease-in-out 3; }
  .tp-light.is-nudge:not(.is-tried) .tp-light-ring { animation: tp-ring 1.6s ease-in-out 3; transform-origin: center; transform-box: fill-box; }
  .tp-light.is-nudge:not(.is-tried) .tp-light-hint .tp-i { animation: tp-chev 1.6s ease-in-out 3; }
}
@keyframes tp-chev { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
@keyframes tp-ring { 50% { transform: scale(1.18); stroke-opacity: .35; } }
.tp-light-sun.is-down .tp-light-disc { fill: rgba(232, 229, 223, .35); }
.tp-light-sun.is-down .tp-light-glow { opacity: .15; }
.tp-light-read { margin: 12px 0 0; font-size: .9375rem; color: var(--tp-muted); font-variant-numeric: tabular-nums; }
.tp-light-read b { color: var(--tp-text); font-weight: 800; }
.tp-light-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 12px; margin: 16px 0 0; }
.tp-light-facts dt { font-size: .6875rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--tp-muted); }
.tp-light-facts dd { margin: 3px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tp-light-facts small { flex-basis: 100%; font-size: .75rem; font-weight: 600; color: var(--tp-muted); }
.tp-moon { width: 18px; height: 18px; flex: none; }
.tp-moon circle { fill: rgba(232, 229, 223, .14); }
.tp-moon path { fill: #E8E5DF; }
@media (prefers-reduced-motion: no-preference) {
  .tp-light-path.is-up { stroke-dasharray: 1; stroke-dashoffset: 1; }
  .tp-light.is-shown .tp-light-path.is-up { stroke-dashoffset: 0; transition: stroke-dashoffset 2.4s cubic-bezier(.3, .7, .2, 1); }
}

/* ── Peu: el cel d'avui, la marca, compartir, les fonts i la línia en directe ── */
.tp-foot { padding: 64px 0 calc(28px + var(--tp-safe-b)); border-top: 1px solid var(--tp-line); }
.tp-fsky { margin: 0 0 56px; }
.tp-fsky-band { position: relative; height: 76px; border-radius: 18px; border: 1px solid var(--tp-line); background: var(--tp-surface); overflow: hidden; }
.tp-fsky-now { position: absolute; top: 0; bottom: 0; left: var(--x, 50%); width: 2px; margin-left: -1px; background: rgba(255, 243, 209, .9); box-shadow: 0 0 18px rgba(255, 243, 209, .65); }
.tp-fsky-now b {
  position: absolute; top: 10px; left: 10px; padding: 4px 10px; border-radius: 999px; white-space: nowrap;
  background: rgba(21, 24, 23, .78); color: #FFF3D1; font: 800 .75rem/1 "Manrope", sans-serif; font-variant-numeric: tabular-nums;
}
.tp-fsky-now.is-late b { left: auto; right: 10px; }
.tp-fsky-ticks { display: flex; justify-content: space-between; margin-top: 8px; font-size: .6875rem; font-weight: 700; color: var(--tp-muted); font-variant-numeric: tabular-nums; }
.tp-fsky figcaption { margin-top: 10px; font-family: "Source Serif 4", serif; font-style: italic; font-size: 1rem; color: var(--tp-muted); }
.tp-fsky figcaption b { font-style: normal; font-family: "Manrope", sans-serif; font-weight: 800; color: var(--tp-text); }
@media (prefers-reduced-motion: no-preference) {
  .tp-fsky-now { animation: tp-fsky-pulse 3s ease-in-out infinite; }
  @keyframes tp-fsky-pulse { 50% { box-shadow: 0 0 30px rgba(255, 243, 209, .95); } }
}

.tp-foot-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px 32px; padding-bottom: 36px; border-bottom: 1px solid var(--tp-line); }
.tp-foot-mark {
  display: inline-flex; align-items: flex-start; gap: 12px; text-decoration: none; color: var(--tp-text);
  font: 800 clamp(3.25rem, 15vw, 7rem)/.88 "Source Serif 4", "Source Serif 4 Fallback", serif; letter-spacing: -.04em;
}
.tp-foot-mark span {
  margin-top: .5em; padding: 4px 10px; border: 1px solid rgba(136, 176, 144, .45); border-radius: 999px;
  font: 700 .6875rem/1 "Manrope", sans-serif; letter-spacing: .14em; text-transform: uppercase; color: var(--tp-green);
}
.tp-foot-made { margin: 14px 0 0; font-family: "Source Serif 4", serif; font-style: italic; font-size: clamp(1.0625rem, 3.6vw, 1.375rem); color: var(--tp-muted); }
.tp-foot-made a { color: var(--tp-text); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: rgba(136, 176, 144, .7); }
.tp-foot-acts { display: flex; flex-wrap: wrap; gap: 10px; }
.tp-foot-btn { min-height: 48px; padding: 0 18px; border-radius: 999px; text-decoration: none; font-size: .9375rem; }
.tp-foot-btn.is-main { background: var(--tp-text); color: var(--tp-bg); border-color: var(--tp-text); }
.tp-foot-btn.is-main:hover { background: #fff; }
.tp-i-up { transform: rotate(180deg); }

.tp-foot-label { margin: 36px 0 18px; font: 700 .6875rem/1 "Manrope", sans-serif; letter-spacing: .16em; text-transform: uppercase; color: var(--tp-green); }
.tp-src { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 18px; margin: 0; }
.tp-src > div { padding-top: 12px; border-top: 1px solid var(--tp-line); }
.tp-src dt { margin-bottom: 6px; font: 800 .6875rem/1.2 "Manrope", sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--tp-text); }
.tp-src dd { margin: 0; font-size: .8125rem; line-height: 1.55; color: var(--tp-muted); }
.tp-src a, .tp-foot-link { color: var(--tp-text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(232, 229, 223, .35); }
.tp-src a:hover, .tp-foot-made a:hover, .tp-foot-link:hover { text-decoration-color: var(--tp-lime); }
@media (min-width: 900px) { .tp-src { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px 40px; } .tp-src dd { font-size: .875rem; } }

/* Última fila: al mòbil, «En directe» a dalt i, a sota, © i l'enllaç; en ample, tot en una línia. */
.tp-foot-bottom {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "live live" "copy link"; align-items: center; gap: 4px 16px;
  margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--tp-line); font-size: .8125rem; color: var(--tp-muted);
}
.tp-foot-live {
  grid-area: live; justify-self: start; display: inline-flex; align-items: center; gap: 8px; margin: 0 0 6px; padding: 7px 14px 7px 12px;
  border-radius: 999px; border: 1px solid rgba(167, 201, 87, .3); background: rgba(167, 201, 87, .06); font-variant-numeric: tabular-nums;
}
.tp-foot-live b { color: var(--tp-lime); font-weight: 800; }
.tp-foot-live::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--tp-lime); box-shadow: 0 0 0 4px rgba(167, 201, 87, .16); }
@media (prefers-reduced-motion: no-preference) {
  .tp-foot-live::before { animation: tp-live 2.4s ease-in-out infinite; }
  @keyframes tp-live { 50% { box-shadow: 0 0 0 7px rgba(167, 201, 87, .04); } }
}
.tp-foot-copy { grid-area: copy; }
.tp-foot-link { grid-area: link; font-weight: 700; min-height: 44px; display: inline-flex; align-items: center; }
@media (min-width: 900px) {
  .tp-foot-bottom { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "copy live link"; gap: 16px 24px; }
  .tp-foot-live { justify-self: center; margin: 0; }
}

/* ═══ Entrada (coreografia) ═══ */
@media (prefers-reduced-motion: no-preference) {
  .tp.is-intro .tp-dock, .tp.is-intro .tp-favs { opacity: 0; transform: translateY(18px); }
  .tp.is-intro .tp-now { transform: translateY(10px); }
  .tp-dock { transition: opacity .6s ease .15s, transform .8s cubic-bezier(.2, .8, .2, 1) .15s; }
  .tp-scroll .tp-i { animation: tp-nudge 2.4s ease-in-out 3; }
  @keyframes tp-nudge { 50% { transform: translateY(4px); } }
}

/* ═══ Pantalles més grans ═══ */
@media (min-width: 640px) {
  .tp { --tp-gutter: 24px; }
  .tp-btn-label { display: inline; }
  .tp-explore-label { display: inline; }
}
@media (min-width: 900px) {
  .tp { --tp-gutter: 32px; }
  .tp-top { display: grid; grid-template-columns: auto minmax(0, 420px) 1fr auto auto auto auto; grid-template-areas: "brand search . overview sound locate d3"; gap: 20px 12px; }
  .tp-3d { align-self: center; border-radius: 14px; }
  .tp-favs { top: calc(var(--tp-safe-t) + 80px); padding-left: var(--tp-gutter); }
  .tp-now { right: auto; width: min(460px, 44vw); bottom: calc(var(--tp-safe-b) + 40px); }
  .tp-dock {
    left: auto; width: min(560px, 46vw); bottom: calc(var(--tp-safe-b) + 40px);
    grid-template-areas: "layers layers" "radar explore";
  }
  .tp-layers { justify-content: flex-end; }
  .tp-scroll { display: inline-flex; bottom: calc(var(--tp-safe-b) + 14px); }
  .tp-shade {
    background:
      linear-gradient(to bottom, rgba(21, 24, 23, .78) 0, rgba(21, 24, 23, 0) 200px),
      linear-gradient(to top, rgba(21, 24, 23, .9) 0, rgba(21, 24, 23, 0) 360px),
      linear-gradient(to right, rgba(21, 24, 23, .55) 0, rgba(21, 24, 23, 0) 45%);
  }
  .tp .maplibregl-ctrl-bottom-right { bottom: calc(var(--tp-safe-b) + 170px); }
  .tp-sec { padding: 88px 0; }
  .tp-wrap { padding: 0 48px; }
  .tp-split { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 72px; }
}
/* Only really short screens (iPhone SE in Safari, phone in landscape) drop the data row:
   an iPhone 13-16 in Safari is ~660 px tall and has room for it. */
@media (max-height: 600px) and (max-width: 899px) {
  .tp-metrics { display: none; }
}

/* ═══ Preferències d'accessibilitat ═══ */
@media (prefers-reduced-motion: reduce) {
  .tp *, .tp *::before, .tp *::after { transition-duration: 0s !important; animation: none !important; }
}
@media (prefers-contrast: more) {
  .tp { --tp-muted: rgba(232, 229, 223, .9); --tp-line: rgba(232, 229, 223, .35); }
  .tp-shade { background: linear-gradient(to bottom, rgba(21, 24, 23, .95) 0, rgba(21, 24, 23, 0) 260px), linear-gradient(to top, rgba(21, 24, 23, 1) 0, rgba(21, 24, 23, .95) 330px, rgba(21, 24, 23, 0) 520px); }
}

/* ── Avisos breus (On sóc) i sense mapa ── */
.tp-toast {
  position: absolute; z-index: 30; left: 50%; top: calc(var(--tp-safe-t) + 190px); transform: translate(-50%, -8px);
  width: max-content; max-width: calc(100% - 32px); margin: 0; padding: 10px 14px; border-radius: 12px;
  background: var(--tp-text); color: var(--tp-bg); font-weight: 700; font-size: .875rem; line-height: 1.4;
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .35s ease;
}
.tp-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.tp-stage.no-map .tp-dock .tp-layers, .tp-stage.no-map .tp-explore { display: none; }
/* Llegenda del radar: escala «Universal Blue» de RainViewer, de feble a molt forta (dBZ 15–50; el beix de sota es filtra). */
.tp-legend {
  flex: 1; max-width: 96px; height: 5px; margin: 0 auto 0 10px; align-self: center; border-radius: 5px;
  background: linear-gradient(to right, #88ddee, #00a3e0, #005588, #ffee00, #ffaa00, #ff4400, #c10000);
}

/* ── Noms de les comarques (sobre el mapa, sense fons: es distingeixen de les estacions) ── */
.tp-cmq {
  font: 800 .6875rem/1 "Manrope", sans-serif; letter-spacing: .16em; text-transform: uppercase; white-space: nowrap;
  color: rgba(232, 229, 223, .82); pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .95), 0 0 12px rgba(0, 0, 0, .7);
  transition: opacity .5s ease;
}
@media (min-width: 900px) { .tp-cmq { font-size: .75rem; } }

/* ── Línia de temps: ara, previsió i mode ── */
.tp-now-tick {
  position: absolute; bottom: 10px; width: 2px; height: 12px; margin-left: -1px; border-radius: 2px; pointer-events: none;
  left: calc(11px + (100% - 22px) * var(--tp-nowf, 1)); background: var(--tp-text); opacity: 0;
}
.tp-radar.has-future .tp-now-tick { opacity: .9; }
.tp-radar.is-future #tp-frame-kind { color: var(--tp-lime); }
.tp-radar.is-future #tp-frame-time { font-style: italic; }
.tp-radar.is-sym .tp-legend { visibility: hidden; }

.tp-modes {
  flex: none; display: inline-flex; gap: 2px; padding: 2px; border-radius: 999px;
  background: rgba(21, 24, 23, .8); border: 1px solid var(--tp-line);
}
.tp-mode {
  min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: none; color: var(--tp-muted);
  font: 700 .8125rem/1 "Manrope", sans-serif; letter-spacing: .02em; transition: background-color .25s, color .25s;
}
.tp-mode[aria-pressed="true"] { background: var(--tp-text); color: var(--tp-bg); }
.tp-chip:disabled { opacity: .38; cursor: default; }


/* ── Mapa clàssic de símbols ── */
.tp-sym {
  display: grid; justify-items: center; gap: 3px; padding: 2px 4px; border: 0; background: none; color: var(--tp-text);
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .55));
}
.tp-sym-i { width: 42px; height: 42px; overflow: visible; }
.tp-sym-t {
  padding: 3px 8px; border-radius: 999px; background: rgba(21, 24, 23, .86);
  border: 1px solid color-mix(in srgb, var(--tp-dot, #A7C957) 70%, transparent);
  font: 800 .9375rem/1 "Source Serif 4", "Source Serif 4 Fallback", serif; font-variant-numeric: lining-nums;
}
.tp-sym-n { font: 700 .6875rem/1.1 "Manrope", sans-serif; color: rgba(232, 229, 223, .88); white-space: nowrap; text-shadow: 0 1px 3px rgba(0, 0, 0, .9); }
.tp-map.is-far .tp-sym-n { display: none; }
.tp-sym:hover .tp-sym-t, .tp-sym:focus-visible .tp-sym-t { background: var(--tp-text); color: var(--tp-bg); }
@media (prefers-reduced-motion: no-preference) {
  .tp-sym[data-ico="wm-sun"] .tp-sym-i { animation: tp-rays 28s linear infinite; }
  .tp-sym[data-ico^="wm-partly"] .tp-sym-i, .tp-sym[data-ico="wm-cloud"] .tp-sym-i, .tp-sym[data-ico="wm-fog"] .tp-sym-i { animation: tp-drift 7s ease-in-out infinite alternate; }
  .tp-sym[data-ico="wm-rain"] .tp-sym-i, .tp-sym[data-ico="wm-heavy"] .tp-sym-i, .tp-sym[data-ico="wm-drizzle"] .tp-sym-i, .tp-sym[data-ico="wm-snow"] .tp-sym-i { animation: tp-bob 2.4s ease-in-out infinite; }
  .tp-sym[data-ico="wm-storm"] .tp-sym-i { animation: tp-bob 3.2s ease-in-out infinite; }
}
@keyframes tp-rays { to { transform: rotate(360deg); } }
@keyframes tp-drift { from { transform: translateX(-2px); } to { transform: translateX(2px); } }
@keyframes tp-bob { 50% { transform: translateY(1.5px); } }
@media (min-width: 900px) {
  .tp-sym-i { width: 48px; height: 48px; }
  .tp-sym-t { font-size: 1.0625rem; }
}

.tp-scrub-label #tp-frame-kind { text-transform: uppercase; letter-spacing: .08em; }
@media (max-width: 899px) {
  .tp-sym-i { width: 36px; height: 36px; }
  .tp-sym-t { font-size: .875rem; padding: 2px 7px; }
}

/* ── Capes: un sol botó amb un panell d'interruptors (cap fila de botons tallada) ── */
.tp-capes { position: relative; }
.tp-capes-btn { display: inline-flex; align-items: center; gap: 8px; }
.tp-capes-btn[aria-expanded="true"] { background: var(--tp-text); color: var(--tp-bg); border-color: var(--tp-text); }
.tp-capes-panel {
  position: absolute; z-index: 30; bottom: calc(100% + 10px); left: 0; width: min(280px, calc(100vw - 32px));
  display: grid; gap: 2px; padding: 6px; border-radius: 18px;
  background: var(--tp-surface); border: 1px solid var(--tp-line); box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
  transform-origin: bottom left; animation: tp-panel .22s cubic-bezier(.2, .8, .2, 1);
}
.tp-capes-panel[hidden] { display: none; }
@keyframes tp-panel { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.tp-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; min-height: 52px;
  padding: 8px 12px; border: 0; border-radius: 12px; background: none; color: var(--tp-text); text-align: left;
  font: 700 .9375rem/1.2 "Manrope", sans-serif;
}
.tp-toggle:hover { background: rgba(232, 229, 223, .06); }
.tp-toggle small { display: block; margin-top: 2px; font-weight: 600; font-size: .75rem; color: var(--tp-muted); }
.tp-toggle i { flex: none; position: relative; width: 40px; height: 24px; border-radius: 24px; background: rgba(232, 229, 223, .18); transition: background-color .2s; }
.tp-toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--tp-text); transition: transform .25s cubic-bezier(.3, 1.4, .5, 1); }
.tp-toggle[aria-pressed="true"] i { background: var(--tp-green); }
.tp-toggle[aria-pressed="true"] i::after { transform: translateX(16px); }
.tp-toggle:disabled { opacity: .45; cursor: default; }
@media (min-width: 900px) { .tp-capes-panel { left: auto; right: 0; transform-origin: bottom right; } }

/* ── So: l'altaveu i, quan sona, tres barres que ballen ── */
.tp-sound .tp-eq { display: none; align-items: flex-end; gap: 2px; height: 14px; }
.tp-sound .tp-eq i { width: 3px; height: 40%; border-radius: 2px; background: var(--tp-lime); }
.tp-sound[aria-pressed="true"] { border-color: var(--tp-green); }
.tp-sound[aria-pressed="true"] .tp-eq { display: inline-flex; }
.tp-sound[aria-pressed="true"] > .tp-i { color: var(--tp-lime); }
@media (prefers-reduced-motion: no-preference) {
  .tp-sound[aria-pressed="true"] .tp-eq i { animation: tp-eq 1.1s ease-in-out infinite; }
  .tp-sound[aria-pressed="true"] .tp-eq i:nth-child(2) { animation-delay: -.4s; }
  .tp-sound[aria-pressed="true"] .tp-eq i:nth-child(3) { animation-delay: -.75s; }
}
@keyframes tp-eq { 50% { height: 100%; } }
@media (max-width: 639px) { .tp-sound[aria-pressed="true"] > .tp-i { display: none; } }
/* Pobles que omplen el mapa clàssic: sense nom fins que t'hi apropes. */
.tp-map.is-mid .tp-sym.is-minor .tp-sym-n { display: none; }
.tp-sym.is-minor .tp-sym-i { opacity: .92; }
/* Icona del temps dins l'etiqueta del municipi triat. */
.tp-pin-label { display: inline-flex; align-items: center; gap: 6px; }
.tp-pin-i { width: 26px; height: 26px; margin: -4px 0 -4px -2px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .35)); }
/* Al mapa del temps, el municipi triat porta la icona gran a sobre: mai es queda sense. */
.tp-pin-wi { display: none; width: 54px; height: 54px; margin-bottom: 2px; overflow: visible; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .6)); }
.tp-map.is-sym .tp-pin.has-ico .tp-pin-wi { display: block; }
.tp-map.is-sym .tp-pin-i { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .tp-pin[data-ico="wm-sun"] .tp-pin-wi { animation: tp-rays 28s linear infinite; }
  .tp-pin[data-ico^="wm-partly"] .tp-pin-wi, .tp-pin[data-ico="wm-cloud"] .tp-pin-wi, .tp-pin[data-ico="wm-fog"] .tp-pin-wi { animation: tp-drift 7s ease-in-out infinite alternate; }
  .tp-pin[data-ico="wm-rain"] .tp-pin-wi, .tp-pin[data-ico="wm-heavy"] .tp-pin-wi, .tp-pin[data-ico="wm-drizzle"] .tp-pin-wi, .tp-pin[data-ico="wm-snow"] .tp-pin-wi, .tp-pin[data-ico="wm-storm"] .tp-pin-wi { animation: tp-bob 2.4s ease-in-out infinite; }
}

/* ── Vista: 2D / 3D, girar i nord (columna a la dreta del mapa) ── */
.tp-view {
  position: absolute; z-index: 5; right: var(--tp-gutter); top: calc(var(--tp-safe-t) + 184px);
  display: grid; gap: 8px; justify-items: end;
  transition: opacity .35s ease, transform .5s cubic-bezier(.2, .8, .2, 1);
}
.tp-view[hidden], .tp-vbtn[hidden] { display: none; }
.tp-view:not(:has(.tp-vbtn:not([hidden]))) { display: none; }
.tp-vbtn { width: 44px; padding: 0; font-weight: 800; letter-spacing: .02em; }
.tp-vbtn[aria-pressed="true"] { background: var(--tp-text); color: var(--tp-bg); border-color: var(--tp-text); }
.tp-vbtn-label { display: none; }
#tp-north svg { transition: transform .2s linear; }
#tp-north .tp-i { stroke: currentColor; fill: none; }
.tp-map.is-orbiting { cursor: grab; }
.tp-map.is-orbiting:active { cursor: grabbing; }
.tp.is-exploring .tp-view { transform: translateY(calc(-1 * (var(--tp-safe-t) + 168px))); }
@media (min-width: 900px) {
  .tp-view { top: calc(var(--tp-safe-t) + 84px); }
  .tp-vbtn { width: auto; min-width: 44px; padding: 0 12px; }
  #tp-orbit .tp-vbtn-label { display: inline; }
  .tp.is-exploring .tp-view { transform: translateY(-68px); }
}

/* ═══ Mòbil: el bloc de l'ara, compacte (el mapa és el protagonista) ═══
   La temperatura a l'esquerra; nom, comarca i cel al costat; a sota, una línia de dades. */
@media (max-width: 899px) {
  .tp-now {
    display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; align-items: center;
    bottom: calc(var(--tp-safe-b) + 12px + var(--tp-dock-h, 118px) + 20px);
  }
  .tp-now-main { display: contents; }
  .tp-temp { grid-column: 1; grid-row: 1 / span 3; font-size: clamp(3.75rem, 19vw, 4.75rem); line-height: .8; }
  .tp-now-head { grid-column: 2; grid-row: 1; min-width: 0; }
  .tp-place { font-size: clamp(1.25rem, 6vw, 1.625rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tp-star { width: 40px; height: 40px; margin: -4px 0; }
  .tp-county { grid-column: 2; grid-row: 2; margin: 0; font-size: .6875rem; }
  .tp-now-side { grid-column: 2; grid-row: 3; display: flex; align-items: center; gap: 6px; padding: 2px 0 0; }
  .tp-wicon { width: 26px; height: 26px; }
  .tp-cond { margin: 0; font-size: 1.0625rem; }
  .tp-today { grid-column: 1 / -1; max-width: none; min-height: 40px; margin-top: 6px; gap: 10px; }
  .tp-today-n b { font-size: 1.0625rem; }
  .tp-today-n small { font-size: .5625rem; letter-spacing: .08em; }
  .tp-today-more { grid-column: 1 / -1; margin: 0 0 2px; font-size: .75rem; }
  .tp-metrics { grid-column: 1 / -1; margin-top: 6px; gap: 4px; }
  .tp-metrics dt { font-size: .5625rem; letter-spacing: .08em; }
  .tp-metrics dd { font-size: .875rem; margin-top: 1px; }
  .tp-arrow { width: 13px; height: 13px; }
  .tp-source { grid-column: 1 / -1; margin-top: 10px; font-size: .6875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tp-source br { display: none; }
  .tp-shade {
    background:
      linear-gradient(to bottom, rgba(21, 24, 23, .82) 0, rgba(21, 24, 23, .35) 150px, rgba(21, 24, 23, 0) 230px),
      linear-gradient(to top, rgba(21, 24, 23, .96) 0, rgba(21, 24, 23, .86) 240px, rgba(21, 24, 23, 0) 360px);
  }
  .tp-scroll { display: none; }
}
@media (max-width: 899px) and (max-height: 700px) {
  .tp-now { bottom: calc(var(--tp-safe-b) + 12px + var(--tp-dock-h, 118px) + 14px); }
}
/* Noms llargs («Sant Joan de Vilatorrada»): retallats, perquè hi càpiguen més pobles. */
.tp-sym-n { max-width: 104px; overflow: hidden; text-overflow: ellipsis; }

/* ═══ En baixar: el mapa s'apaga, el bloc de l'ara s'endarrereix i les seccions pugen ═══
   Animacions lligades al scroll, natives (sense JS). On no n'hi ha, tot queda quiet. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .tp-stage { view-timeline: --tp-stage block; }
    .tp-stage::after {
      content: ""; position: absolute; inset: 0; z-index: 6; pointer-events: none; background: var(--tp-bg); opacity: 0;
      animation: tp-veil linear both; animation-timeline: --tp-stage; animation-range: exit 0% exit 85%;
    }
    .tp-now { animation: tp-lag linear both; animation-timeline: --tp-stage; animation-range: exit 0% exit 70%; }
    .tp-dock, .tp-top, .tp-favs, .tp-view, .tp-scroll { animation: tp-fade linear both; animation-timeline: --tp-stage; animation-range: exit 0% exit 40%; }
    .tp-sec > *, .tp-foot .tp-wrap > * { animation: tp-rise linear both; animation-timeline: view(); animation-range: entry 0% entry 80%; }
  }
}
@keyframes tp-veil { to { opacity: .82; } }
@keyframes tp-lag { to { transform: translateY(20vh) scale(.96); opacity: 0; } }
@keyframes tp-fade { to { opacity: 0; } }
@keyframes tp-rise { from { opacity: 0; transform: translateY(36px); } }

/* ═══ Municipis: a prop, de la comarca i el directori (enllaços de debò, també per als cercadors) ═══ */
.tp-places-intro { margin: -8px 0 22px; max-width: 60ch; font-size: 1rem; line-height: 1.55; color: var(--tp-muted); }
.tp-near { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 10px; }
.tp-near a {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-height: 52px; padding: 13px 16px;
  border-radius: 14px; border: 1px solid var(--tp-line); background: rgba(28, 32, 30, .6); color: var(--tp-text); text-decoration: none;
  transition: border-color .2s ease, background-color .2s ease, transform .25s cubic-bezier(.2, .8, .2, 1);
}
.tp-near a:hover { border-color: rgba(167, 201, 87, .55); background: rgba(167, 201, 87, .06); transform: translateY(-2px); }
.tp-near b { min-width: 0; font-weight: 800; overflow-wrap: anywhere; }
.tp-near small { flex: none; font-size: .75rem; font-weight: 700; color: var(--tp-muted); font-variant-numeric: tabular-nums; }
.tp-places-h3 { margin: 40px 0 12px; font: 700 .6875rem/1 "Manrope", sans-serif; letter-spacing: .16em; text-transform: uppercase; color: var(--tp-green); }
.tp-comarca { list-style: none; margin: 0; padding: 0; columns: 2 150px; column-gap: 24px; }
.tp-comarca li, .tp-dir-k li { break-inside: avoid; }
.tp-comarca a, .tp-dir-k a { display: inline-block; min-height: 32px; padding: 6px 0; font-size: .9375rem; color: var(--tp-muted); text-decoration: none; }
.tp-comarca a:hover, .tp-dir-k a:hover { color: var(--tp-text); text-decoration: underline; text-decoration-color: var(--tp-lime); text-underline-offset: 3px; }
.tp-places-all { margin: 26px 0 0; }
.tp-places-all a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 800; color: var(--tp-text); text-decoration: underline; text-decoration-color: rgba(167, 201, 87, .6); text-underline-offset: 4px; }
.tp-near a:focus-visible, .tp-comarca a:focus-visible, .tp-dir-k a:focus-visible, .tp-places-all a:focus-visible { outline: 2px solid var(--tp-lime); outline-offset: 2px; border-radius: 8px; }
@media (min-width: 900px) { .tp-comarca { columns: 4 180px; } }

/* Directori: les 43 comarques en un índex de pastilles. El fons de cada una s'omple segons quants
   municipis té (la plena és l'Alt Empordà); oberta, s'estira a tota l'amplada amb els seus pobles. */
.tp-dir { display: flex; flex-wrap: wrap; gap: 8px; }
.tp-dir-k { flex: 0 1 auto; max-width: 100%; border: 1px solid var(--tp-line); border-radius: 23px; background: rgba(28, 32, 30, .6); transition: border-color .2s ease, background-color .2s ease; }
.tp-dir-k:hover { border-color: rgba(167, 201, 87, .5); }
.tp-dir-k summary {
  position: relative; z-index: 0; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 7px 0 16px;
  overflow: hidden; border-radius: 22px; cursor: pointer; list-style: none; font-weight: 800; font-size: .9375rem;
}
@media (pointer: fine) { .tp-dir-k summary { min-height: 38px; font-size: .875rem; } }
@media (max-width: 599px) {
  .tp-dir { gap: 6px; }
  .tp-dir-k summary { gap: 6px; padding: 0 5px 0 12px; font-size: .875rem; }
  .tp-dir-k summary small { padding: 1px 7px; }
}
.tp-dir-k summary::-webkit-details-marker { display: none; }
.tp-dir-k summary::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(167, 201, 87, .12);
  transform: scaleX(var(--n, 0)); transform-origin: left;
  transition: transform 1s cubic-bezier(.2, .8, .2, 1) calc(var(--i, 0) * 16ms), opacity .2s ease, background-color .2s ease;
}
@media (prefers-reduced-motion: no-preference) { .tp-dir:not(.is-in) summary::before { transform: scaleX(0); } }
.tp-dir-k:hover summary::before { background-color: rgba(167, 201, 87, .2); }
.tp-dir-k summary small { padding: 2px 9px; border-radius: 999px; border: 1px solid var(--tp-line); font-size: .75rem; font-weight: 700; color: var(--tp-muted); font-variant-numeric: tabular-nums; transition: color .2s, border-color .2s; }
.tp-dir-k[open] summary small, .tp-dir-k summary:hover small { color: var(--tp-lime); border-color: rgba(167, 201, 87, .5); }
.tp-dir-k summary:focus-visible { outline: 2px solid var(--tp-lime); outline-offset: 3px; }
.tp-dir-k[open] { flex-basis: 100%; border-radius: 18px; border-color: rgba(167, 201, 87, .45); background: rgba(167, 201, 87, .04); }
.tp-dir-k[open] summary { min-height: 58px; padding: 0 12px 0 20px; border-radius: 17px 17px 0 0; font-size: 1.125rem; }
.tp-dir-k[open] summary::before { opacity: 0; }
.tp-dir-k[open] summary::after {
  content: ""; flex: none; width: 34px; height: 34px; margin-left: auto; border: 1px solid var(--tp-line); border-radius: 50%; transform: rotate(45deg);
  background: linear-gradient(var(--tp-text) 0 0) center / 12px 1.5px no-repeat, linear-gradient(var(--tp-text) 0 0) center / 1.5px 12px no-repeat;
}
.tp-dir-k ul { list-style: none; margin: 0; padding: 0 20px 16px; columns: 2 140px; column-gap: 20px; }
@media (min-width: 900px) { .tp-dir-k ul { columns: 5 150px; } }
@media (prefers-reduced-motion: no-preference) {
  .tp-dir-k[open] li { animation: tp-dir-in .5s cubic-bezier(.2, .8, .2, 1) calc(var(--d, 0) * 1ms) both; }
}
@keyframes tp-dir-in { from { opacity: 0; transform: translateY(10px); } }

/* Què ha après la previsió de l'estació propera. */
.tp-calib { margin: 10px 0 0; max-width: 70ch; font-size: .8125rem; line-height: 1.5; color: var(--tp-muted); }
.tp-calib b { color: var(--tp-text); font-weight: 700; }

/* Avisos del Meteocat: el text i un «escenari» de la mida del giny (297×525). De portada, les
   comarques dibuixades aquí; quan es demana, el giny hi entra fos. */
.tp-alerts { display: grid; gap: 32px; align-items: center; }
@media (min-width: 768px) { .tp-alerts { grid-template-columns: minmax(0, 1fr) auto; gap: 48px; } }
.tp-alerts-txt p { margin: 0 0 12px; max-width: 60ch; font-size: 1rem; line-height: 1.55; }
.tp-alerts-txt .tp-alerts-note { font-size: .875rem; color: var(--tp-muted); }
.tp-alerts-act { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; margin-top: 20px; }
.tp-alerts-btn { min-height: 44px; padding: 0 20px; border: 1px solid rgba(167, 201, 87, .55); border-radius: 999px; background: rgba(167, 201, 87, .1); color: var(--tp-text); font: 800 .9375rem/1 "Manrope", sans-serif; cursor: pointer; transition: background-color .2s, border-color .2s, transform .2s; }
.tp-alerts-btn:hover { background: rgba(167, 201, 87, .18); border-color: var(--tp-lime); }
.tp-alerts-btn:active { transform: scale(.97); }
.tp-alerts-out { display: inline-flex; align-items: center; min-height: 44px; font-weight: 800; color: var(--tp-text); text-decoration: underline; text-decoration-color: rgba(167, 201, 87, .6); text-underline-offset: 4px; }
.tp-alerts-fig { margin: 0; width: 297px; max-width: 100%; justify-self: center; }
.tp-alerts-stage { position: relative; width: 100%; height: 525px; overflow: hidden; border: 1px solid var(--tp-line); border-radius: 22px;
  background: radial-gradient(120% 70% at 50% 0%, rgba(136, 176, 144, .14), transparent 60%), var(--tp-surface);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .7); transition: border-color .3s; }
.tp-alerts-stage:hover { border-color: rgba(167, 201, 87, .35); }
.tp-alerts-cover { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer;
  transition: opacity .6s, transform .8s cubic-bezier(.22, 1, .36, 1), filter .6s; }
.tp-alerts-map { width: 100%; height: auto; overflow: visible; }
.tp-alerts-map path { fill: rgba(136, 176, 144, .07); stroke: rgba(232, 229, 223, .32); stroke-width: .8; stroke-linejoin: round; transition: fill .25s, stroke .25s; }
.tp-alerts-map path:hover { fill: rgba(167, 201, 87, .28); stroke: var(--tp-lime); }
.tp-alerts-name { position: absolute; top: 22px; left: 0; right: 0; text-align: center; font: 800 1.125rem/1.2 "Source Serif 4", "Source Serif 4 Fallback", serif; color: var(--tp-text); opacity: 0; transform: translateY(-4px); transition: opacity .2s, transform .2s; pointer-events: none; }
.tp-alerts-name.on { opacity: 1; transform: none; }
.tp-alerts-cta { position: absolute; bottom: 26px; display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border: 1px solid rgba(167, 201, 87, .5); border-radius: 999px; background: rgba(21, 24, 23, .7); font: 800 .875rem/1 "Manrope", sans-serif; color: var(--tp-text); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.tp-alerts-cta i { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--tp-lime); }
.tp-alerts-scan { position: absolute; left: 0; right: 0; top: 0; height: 38%; pointer-events: none; opacity: 0;
  background: linear-gradient(to bottom, transparent, rgba(167, 201, 87, .13) 70%, rgba(167, 201, 87, .35) 99%, transparent); }
.tp-alerts-box { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; visibility: hidden; transform: scale(.98); transition: opacity .6s, transform .8s cubic-bezier(.22, 1, .36, 1), visibility 0s .6s; }
.tp-alerts-box iframe { display: block; width: 297px; height: 525px; border: 0; }
.tp-alerts-stage.is-ready.is-open .tp-alerts-box { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.tp-alerts-stage.is-ready.is-open .tp-alerts-cover { opacity: 0; transform: scale(1.06); filter: blur(6px); pointer-events: none; }
.tp-alerts-wait { position: absolute; left: 0; right: 0; bottom: 74px; margin: 0; text-align: center; font-size: .8125rem; font-weight: 700; color: var(--tp-muted); }
.tp-alerts-wait:empty { display: none; }
.tp-alerts-cap { margin: 12px 0 0; text-align: center; font-size: .75rem; color: var(--tp-muted); }
.tp-alerts-cap a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
@media (prefers-reduced-motion: no-preference) {
  .tp-alerts-stage.is-on .tp-alerts-map path { stroke-dasharray: 1; animation: tp-al-draw 1.4s cubic-bezier(.22, 1, .36, 1) both; animation-delay: calc(var(--i) * 28ms); }
  .tp-alerts-stage.is-on .tp-alerts-scan { animation: tp-al-scan 4.2s cubic-bezier(.45, 0, .25, 1) 1.2s infinite; }
  .tp-alerts-stage.is-on .tp-alerts-cta i::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--tp-lime); animation: tp-al-ping 1.8s ease-out infinite; }
  .tp-alerts-stage.is-loading .tp-alerts-scan { animation-duration: 1.4s; }
  @keyframes tp-al-draw { from { stroke-dashoffset: 1; fill-opacity: 0; } }
  @keyframes tp-al-scan { 0% { transform: translateY(-100%); opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { transform: translateY(270%); opacity: 0; } }
  @keyframes tp-al-ping { to { transform: scale(3); opacity: 0; } }
}
