/* Panorama · mappa dei comprensori (/sci/mappa). Si appoggia a tokens.css, landing.css e sci.css. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sci--mappa { padding-bottom: var(--space-10); }
.m-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-3) var(--space-8); padding: var(--space-3) 0 var(--space-5); }
.m-head .s-h1 { font-size: clamp(30px, 4.2vw, 46px); margin-top: var(--space-2); }
.m-lead { max-width: 46ch; color: var(--ink-2); font-size: 16px; line-height: 1.55; }

/* Applicazione: pannello + mappa */
.m-app { scroll-margin-top: 84px; --m-h: clamp(540px, calc(100svh - 120px), 920px); display: grid; gap: var(--space-3); width: min(100% - 2 * var(--space-4), 1480px); margin: 0 auto; }
.m-stage { position: relative; height: min(72svh, 640px); min-height: 420px; border-radius: var(--radius-xl); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-card); background: var(--bg); isolation: isolate; }
.m-stage .m-map { position: absolute; inset: 0; }
/* Telefono: ricerca e filtri sopra la mappa, elenco sotto (il pannello si scioglie nella griglia). */
.m-panel { display: contents; }
.m-app { grid-template-columns: minmax(0, 1fr); }
.m-tools { order: 0; min-width: 0; }
.m-stage { order: 1; }
.m-count, .m-list, .m-empty { order: 2; }
.m-tools, .m-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow-card); }
.m-count { padding: var(--space-2) var(--space-2) 0; }
.m-list { padding: var(--space-2); }
@media (min-width: 1000px) {
  .m-app { grid-template-columns: 380px minmax(0, 1fr); height: var(--m-h); gap: var(--space-4); }
  .m-panel { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow-card); overflow: hidden; }
  .m-tools, .m-list { background: none; border: 0; border-radius: 0; box-shadow: none; }
  .m-tools { border-bottom: 1px solid var(--line); }
  .m-count { padding: var(--space-3) var(--space-4) var(--space-2); }
  .m-list { padding: 0 var(--space-2) var(--space-3); }
  .m-stage { height: auto; }
}

.m-tools { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); }
.m-search { display: flex; align-items: center; gap: var(--space-2); height: var(--control-md); padding: 0 var(--space-3); border-radius: var(--radius-md); background: var(--bg); border: 1px solid var(--line-strong); color: var(--icon-muted); transition: border-color .15s; }
.m-search:focus-within { border-color: var(--action); background: var(--surface); }
.m-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 600 15px/20px var(--font-sans); color: var(--ink); }
.m-search input::placeholder { color: var(--ink-3); font-weight: 500; }
.m-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.m-select { flex: 1 1 140px; }
.m-select select { width: 100%; height: var(--control-sm); padding: 0 32px 0 var(--space-3); border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%235b6b82' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center; appearance: none; font: 600 13.5px/18px var(--font-sans); color: var(--ink); cursor: pointer; }
.m-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius-sm); background: var(--surface-sunken); }
.m-seg button { height: 30px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-xs); background: transparent; font: 700 12.5px/16px var(--font-sans); color: var(--ink-3); cursor: pointer; }
.m-seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-segment); }
.m-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.m-chips .chip, .m-zone .chip { cursor: pointer; transition: border-color .15s, color .15s, background .15s; }
.m-chips .chip:hover, .m-zone .chip:hover { border-color: var(--action); }
.m-chips .chip.is-on:hover, .m-zone .chip.is-on:hover { border-color: var(--chip-selected); }

.m-count { display: flex; align-items: baseline; gap: 6px; font: 600 13.5px/20px var(--font-sans); color: var(--ink-3); }
.m-count b { font: 800 17px/20px var(--font-sans); color: var(--ink); font-variant-numeric: tabular-nums; }
.m-reset, .m-link { margin-left: auto; border: 0; background: none; padding: 0; font: 700 13px/20px var(--font-sans); color: var(--action); cursor: pointer; }
.m-link { margin: 0; }
.m-list { list-style: none; margin: 0; overflow-y: auto; max-height: 520px; overscroll-behavior: contain; }
@media (min-width: 1000px) { .m-list { max-height: none; flex: 1; } }
.m-list li[hidden] { display: none; }
.m-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2); border-radius: var(--radius-md); text-decoration: none; color: var(--ink); transition: background .12s; }
.m-list li.is-hov .m-item, .m-item:hover { background: var(--bg); }
.m-list li.is-sel .m-item { background: var(--action-soft); }
.m-item__img { flex: none; width: 64px; height: 48px; border-radius: var(--radius-xs); overflow: hidden; background: var(--surface-sunken); }
.m-item__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-item__txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.m-item__txt b { font: 700 14.5px/19px var(--font-sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-item__txt small { font: 500 12.5px/17px var(--font-sans); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-item .pill { flex: none; }
.m-empty { padding: var(--space-4); color: var(--ink-2); font-size: 14.5px; }

/* Sopra la mappa: zone, legenda, scheda veloce */
.m-zone { position: absolute; left: var(--space-3); top: var(--space-3); right: 64px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; z-index: 2; padding-bottom: 2px; }
.m-zone::-webkit-scrollbar { display: none; }
.m-zone .chip { box-shadow: var(--shadow-segment); flex: none; }
.m-3d { gap: 6px; }
.m-legend { position: absolute; left: var(--space-3); bottom: var(--space-3); z-index: 2; display: flex; flex-direction: column; gap: 5px; padding: var(--space-3); border-radius: var(--radius-md); font: 600 12px/16px var(--font-sans); color: var(--ink-2); max-width: 230px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(6px); }
.m-legend b { font: 800 12.5px/16px var(--font-sans); color: var(--ink); margin-bottom: 2px; }
.m-legend span { display: flex; align-items: center; gap: var(--space-2); }
.m-legend i { flex: none; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); }
.m-legend__size { margin-top: 3px; padding-top: 6px; border-top: 1px solid var(--line); }
.m-legend__size i { background: var(--surface-sunken); box-shadow: 0 0 0 1px var(--icon-muted); border: 0; }
.m-legend__size i:nth-child(1) { width: 6px; height: 6px; }
.m-legend__size i:nth-child(2) { width: 9px; height: 9px; margin-left: -4px; }
.m-legend__size i:nth-child(3) { width: 13px; height: 13px; margin: 0 2px 0 -4px; }
@media (max-width: 759px) { .m-legend { display: none; } }

.m-card { position: absolute; z-index: 3; left: var(--space-3); right: var(--space-3); bottom: var(--space-3); display: grid; grid-template-columns: 112px minmax(0, 1fr); overflow: hidden; border-radius: var(--radius-lg); box-shadow: var(--shadow-raised); animation: m-in .22s var(--ease); }
.m-card[hidden] { display: none; }
@keyframes m-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (min-width: 760px) { .m-card { left: auto; right: 60px; top: var(--space-3); bottom: auto; width: 340px; grid-template-columns: 1fr; } }
.m-card__img { position: relative; min-height: 100%; background: linear-gradient(135deg, var(--action-soft), var(--brand-pale)); color: var(--brand); display: grid; place-items: center; }
.m-card__img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
@media (min-width: 760px) { .m-card__img { aspect-ratio: 16 / 9; min-height: 0; } }
.m-card__img .pill { position: absolute; left: var(--space-2); top: var(--space-2); }
.m-card__x { position: absolute; z-index: 1; right: var(--space-2); top: var(--space-2); width: 32px; height: 32px; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--ink); font: 600 20px/1 var(--font-sans); cursor: pointer; box-shadow: var(--shadow-segment); }
.m-card__body { display: flex; flex-direction: column; gap: 4px; padding: var(--space-3) var(--space-4) var(--space-4); min-width: 0; }
.m-card__h { font: 800 19px/24px var(--font-sans); letter-spacing: -0.01em; padding-right: 32px; }
@media (min-width: 760px) { .m-card__h { padding-right: 0; } }
.m-card__nums { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2) var(--space-3); margin: var(--space-2) 0 var(--space-3); }
.m-card__nums dt { font: 700 11.5px/14px var(--font-sans); color: var(--ink-3); }
.m-card__nums dd { margin: 0; font: 800 16px/22px var(--font-sans); color: var(--ink); }
.m-card__nums small { font-size: 12px; font-weight: 700; color: var(--ink-3); }
.m-card__cta { display: flex; flex-wrap: wrap; gap: var(--space-2); }
@media (max-width: 759px) { .m-card__nums { gap: 2px var(--space-3); margin: var(--space-1) 0 var(--space-2); } .m-card__nums dd { font-size: 13.5px; } .m-card__body .s-foot { font-size: 12.5px; line-height: 16px; } .m-card__cta .btn--ghost { display: none; } }
.m-nojs { position: absolute; inset: auto var(--space-4) var(--space-4); padding: var(--space-4); background: var(--surface); border-radius: var(--radius-md); }
.m-src { margin-top: var(--space-3); }

/* Controlli MapLibre in stile Panorama */
.m-stage .maplibregl-ctrl-group { border-radius: var(--radius-md); box-shadow: var(--shadow-segment); border: 1px solid var(--line); overflow: hidden; }
.m-stage .maplibregl-ctrl-group button { width: 36px; height: 36px; }
.m-stage .maplibregl-ctrl-top-right { top: 4px; right: 4px; }
.m-stage .maplibregl-ctrl-attrib { font: 500 11px/16px var(--font-sans); color: var(--ink-3); }
.m-stage .maplibregl-ctrl-attrib a { color: var(--ink-2); }
.m-stage .maplibregl-cooperative-gesture-screen { font: 700 15px/22px var(--font-sans); background: var(--scrim); }
.m-stage:fullscreen { border-radius: 0; }
@media (max-width: 999px) {
  /* Sul telefono i filtri stanno in una riga che scorre, così la mappa resta vicina. */
  .m-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--space-4)); padding: 0 var(--space-4) 2px; }
  .m-chips::-webkit-scrollbar { display: none; }
  .m-chips .chip { flex: none; }
  .m-card__nums dd { white-space: nowrap; }
}

/* Mappa della neve (/sci/neve e zone): stessa scena di /sci/mappa, più bassa, legenda visibile anche su telefono. */
.nm-stage { height: min(62svh, 560px); min-height: 380px; }
@media (max-width: 759px) { .nm-stage { height: 440px; } .nm-legend { display: flex; left: var(--space-2); bottom: 34px; padding: var(--space-2); font-size: 11px; } }
.nm-stage .maplibregl-popup-content { border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); box-shadow: var(--shadow-card); font: 500 13px/18px var(--font-sans); color: var(--ink-2); }
.nm-pop__n { font: 800 14px/18px var(--font-sans); color: var(--ink); margin: 0 0 2px; }
.nm-pop__v { margin: 0 0 6px; }
.nm-pop__v b { color: var(--ink); }
.nm-pop__a { font-weight: 700; color: var(--action); text-decoration: none; }
