/* The Guide · map markers and «Stile e viste» (web/map-views.js, docs/MAPPA_PERSONALE.md §2).
   Mobile first: the sheet is a bottom sheet on the phone and a popover from 960px. Light and dark via the app tokens. */

.tgv-canvas { position: absolute; left: 0; top: 0; pointer-events: none; }
.leaflet-container.tgv-pointer, .leaflet-container.tgv-pointer.leaflet-grab { cursor: pointer; }

/* ---------- Chips and list: the same badges as the map ---------- */
.tg-map-filter-badge { display: inline-flex; flex: none; margin-left: -4px; }
.tg-map-filter-badge .tgv-badge, .tg-map-result-badge .tgv-badge { display: block; filter: drop-shadow(0 1px 1.5px rgba(19, 38, 44, .22)); }
.tg-map-filter:has(input:checked) .tg-map-filter-badge circle + circle { stroke-opacity: .5; }
.tg-map-filter:not(:has(input:checked)) .tg-map-filter-badge { opacity: .72; filter: saturate(.55); }
.tg-map-result-badge { flex: none; display: inline-flex; }
.tg-map-result-list { grid-template-columns: minmax(0, 1fr); } /* long names ellipsize instead of widening the rows */
.tg-map-result small.tg-map-result-why { display: block; color: var(--accent-deep); font-weight: 700; font-size: 12px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-map-result > span:nth-child(2) small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- The bar under the search: vista banner + «Stile e viste» button ---------- */
.tgv-bar { position: absolute; left: 12px; right: 12px; top: calc(var(--safe-top) + 118px); z-index: 610; display: flex; align-items: flex-start; justify-content: flex-end; gap: 8px; pointer-events: none; }
.tgv-bar > * { pointer-events: auto; }
.tg-map-page:is([data-vista="stasera"], [data-vista="bambini"], [data-vista="mare"], [data-vista="salite"], [data-vista="musei"], [data-vista="eventi"]) .tg-map-filters { display: none; }
.tg-map-page:is([data-vista="stasera"], [data-vista="bambini"], [data-vista="mare"], [data-vista="salite"], [data-vista="musei"], [data-vista="eventi"]) .tgv-bar { top: calc(var(--safe-top) + 72px); }
.tgv-banner-slot { flex: 1; min-width: 0; order: -1; }
.tgv-banner-slot:empty { display: none; }

.tgv-fab { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px 0 12px; border-radius: var(--r-pill); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2); font-weight: 750; font-size: 13.5px; white-space: nowrap; transition: transform .15s var(--ease), background .2s; }
.tgv-fab:active { transform: scale(.97); }
.tgv-fab:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }
.tgv-fab-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-deep); }
.tgv-fab.is-active { padding: 0; width: 44px; justify-content: center; }
.tgv-fab.is-active .tgv-fab-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tgv-fab.is-active .tgv-fab-icon { background: var(--accent); color: var(--accent-ink); width: 32px; height: 32px; }
.tgv-panel-open .tgv-fab { background: var(--ink); color: var(--bg); }

.tgv-banner { position: relative; display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; column-gap: 10px; row-gap: 6px; padding: 8px 8px 9px 10px; border-radius: 18px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: var(--shadow-2); min-width: 0; }
.tgv-banner-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--tgv-tint, var(--accent)); color: #fff; }
.tgv-banner-text { min-width: 0; line-height: 1.2; }
.tgv-banner-text strong { display: block; font: 700 15px/1.15 var(--display); letter-spacing: -.005em; color: var(--ink); font-stretch: var(--display-stretch);}
.tgv-banner-text small { display: block; color: var(--muted); font-size: 12px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tgv-banner-link { font-size: 12px; font-weight: 750; color: var(--accent-deep); padding: 6px 8px; border-radius: var(--r-pill); background: var(--accent-soft); white-space: nowrap; text-decoration: none; }
.tgv-banner-close { grid-column: 4; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); font-size: 18px; line-height: 1; }
.tgv-banner-close:focus-visible, .tgv-banner-link:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }
.tgv-legend { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 6px 2px 0; border-top: 1px solid var(--line); font-size: 11.5px; font-weight: 650; color: var(--ink-2); }
.tgv-legend:empty { display: none; }
.tgv-legend-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tgv-legend .tgv-badge { width: 16px; height: 16px; }
.tgv-sym-emph { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px #fff, 0 0 0 5px color-mix(in srgb, var(--accent) 30%, transparent); margin: 0 3px; }
.tgv-sym-dim { width: 8px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--muted) 70%, transparent); box-shadow: 0 0 0 1.5px #fff; margin: 0 4px; }
.tgv-sym-event { width: 14px; height: 15px; border-radius: 4px; background: #fff; box-shadow: 0 0 0 1px var(--line-strong), 0 1px 2px rgba(0,0,0,.15); overflow: hidden; display: inline-block; }
.tgv-sym-event i { display: block; height: 5px; background: #2458a6; }
.tgv-grade { width: 22px; height: 5px; border-radius: 3px; background: var(--grade); }
.tgv-grade.is-dash { background: repeating-linear-gradient(90deg, var(--grade) 0 4px, transparent 4px 7px); }

.tgv-banner.is-per-te { --tgv-tint: var(--accent); }
.tgv-banner.is-stasera { --tgv-tint: #4b3f8c; }
.tgv-banner.is-bambini { --tgv-tint: #d9822b; }
.tgv-banner.is-mare { --tgv-tint: #2458a6; }
.tgv-banner.is-salite { --tgv-tint: #9c2a16; }
.tgv-banner.is-musei { --tgv-tint: #765b87; }
.tgv-banner.is-eventi { --tgv-tint: #2458a6; }

/* ---------- «Stile e viste»: bottom sheet (phone) ---------- */
.tgv-scrim { position: fixed; inset: 0; z-index: 940; background: rgba(8, 18, 22, .32); }
.tgv-panel { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-bottom)); z-index: 950; max-height: min(84dvh, 720px); display: flex; flex-direction: column; border-radius: var(--r-xl) var(--r-xl) 0 0; background: var(--surface); color: var(--ink); box-shadow: 0 -12px 40px rgba(8, 18, 22, .25); overflow: hidden; animation: tgv-rise .26s var(--ease); }
@keyframes tgv-rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.tgv-panel-head { position: relative; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 16px 6px 20px; }
.tgv-grabber { position: absolute; top: 7px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: var(--line-strong); }
.tgv-panel-head h2 { font: 650 22px/1.15 var(--display); letter-spacing: -.015em; margin: 0; font-stretch: var(--display-stretch);}
.tgv-close { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); font-size: 22px; line-height: 1; flex: none; }
.tgv-close:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }
.tgv-panel-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 18px; }
.tgv-section { margin-top: 10px; }
.tgv-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 4px 8px; }
.tgv-section-head h3 { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0; }
.tgv-section-head small { font-size: 11.5px; color: var(--accent-deep); font-weight: 700; text-align: right; }

/* «Mappa scura di notte»: two options side by side (Automatico / Sempre chiara). */
.tgv-night { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tgv-night-option { position: relative; display: block; min-width: 0; padding: 11px 12px; border-radius: 16px; background: var(--surface-2); cursor: pointer; transition: background .15s, box-shadow .15s; }
.tgv-night-option:hover { background: var(--surface-3); }
.tgv-night-option input, .tgv-vista input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.tgv-night-text { display: block; line-height: 1.2; }
.tgv-night-text strong { display: block; font-size: 13.5px; font-weight: 800; color: var(--ink); }
.tgv-night-text small { display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.tgv-night-option:has(input:checked) { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); box-shadow: inset 0 0 0 2px var(--accent); }
.tgv-night-option:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }

.tgv-vistas { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tgv-vista { position: relative; display: flex; align-items: flex-start; gap: 10px; min-width: 0; padding: 11px 10px 11px 11px; border-radius: 16px; background: var(--surface-2); cursor: pointer; transition: background .15s, box-shadow .15s; }
.tgv-vista:hover { background: var(--surface-3); }
.tgv-vista-icon { flex: none; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--surface); color: var(--tgv-tint, var(--ink)); box-shadow: var(--shadow-1); }
.tgv-vista-text { min-width: 0; line-height: 1.2; }
.tgv-vista-text strong { display: block; font-size: 13.5px; font-weight: 800; color: var(--ink); }
.tgv-vista-text small { display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.tgv-vista:has(input:checked) { background: color-mix(in srgb, var(--tgv-tint, var(--accent)) 12%, var(--surface)); box-shadow: inset 0 0 0 2px var(--tgv-tint, var(--accent)); }
.tgv-vista:has(input:checked) .tgv-vista-icon { background: var(--tgv-tint, var(--accent)); color: #fff; box-shadow: none; }
.tgv-vista:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }
.tgv-vista.is-tutto { --tgv-tint: var(--ink-2); }
.tgv-vista.is-per-te { --tgv-tint: var(--accent); }
.tgv-vista.is-stasera { --tgv-tint: #4b3f8c; }
.tgv-vista.is-bambini { --tgv-tint: #c7721f; }
.tgv-vista.is-mare { --tgv-tint: #2458a6; }
.tgv-vista.is-salite { --tgv-tint: #9c2a16; }
.tgv-vista.is-musei { --tgv-tint: #765b87; }
.tgv-vista.is-eventi { --tgv-tint: #1a6a73; }
.tgv-note { margin: 14px 4px 0; font-size: 11.5px; color: var(--muted); }

/* ---------- Keyboard list of the places in view (the «Elenco» is the complete alternative) ---------- */
.tgv-keys { position: absolute; left: 50%; bottom: 112px; z-index: 620; width: 0; height: 0; }
.tgv-key { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.tgv-key:focus { clip: auto; width: auto; height: auto; margin: 0; overflow: visible; left: 50%; bottom: 0; transform: translateX(-50%); max-width: min(86vw, 420px); padding: 9px 14px; border-radius: var(--r-pill); background: var(--ink); color: var(--bg); font-size: 13px; font-weight: 750; box-shadow: var(--shadow-3); text-overflow: ellipsis; outline: 3px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }

/* ---------- Popups and tooltips ---------- */
.tg-map-popup .tg-map-popup-why { color: var(--accent-deep); font-weight: 750; font-size: 12.5px; }
.tg-map-popup a.tg-map-popup-guide { display: inline-flex; color: #fff; text-decoration: none; }
.tg-map-popup a.tg-map-popup-route { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 750; color: var(--sea); }
.leaflet-tooltip.tgv-tip { padding: 5px 10px; border: 0; border-radius: var(--r-pill); background: var(--ink); color: var(--bg); box-shadow: var(--shadow-2); font-weight: 750; font-size: 12px; }
.leaflet-tooltip.tgv-tip::before { border-top-color: var(--ink); }

@media (prefers-color-scheme: dark) {
  .tgv-vista.is-stasera, .tgv-banner.is-stasera { --tgv-tint: #9d93e6; }
  .tgv-vista.is-bambini, .tgv-banner.is-bambini { --tgv-tint: #eea55a; }
  .tgv-vista.is-mare, .tgv-banner.is-mare, .tgv-vista.is-eventi, .tgv-banner.is-eventi { --tgv-tint: #7fa8f0; }
  .tgv-vista.is-salite, .tgv-banner.is-salite { --tgv-tint: #f39a78; }
  .tgv-vista.is-musei, .tgv-banner.is-musei { --tgv-tint: #b89bd6; }
  .tgv-vista:has(input:checked) .tgv-vista-icon, .tgv-banner-icon { color: #0e1a1f; }
  .tgv-sym-emph, .tgv-sym-dim { box-shadow: 0 0 0 2px var(--surface), 0 0 0 5px color-mix(in srgb, var(--accent) 30%, transparent); }
  .tgv-sym-dim { box-shadow: 0 0 0 1.5px var(--surface); }
}
@media (max-width: 380px) {
  .tgv-vistas { grid-template-columns: 1fr; }
  .tgv-fab-label { display: none; }
  .tgv-fab { padding: 0; width: 44px; justify-content: center; }
}

/* ---------- Desktop: popover at the top right of the map ---------- */
@media (min-width: 960px) {
  .tgv-bar, .tg-map-page:is([data-vista]) .tgv-bar { left: 444px; right: 16px; top: 14px; }
  .tgv-banner-slot { flex: 0 1 460px; }
  .tgv-scrim { background: transparent; }
  .tgv-panel { position: absolute; left: auto; right: 16px; top: 68px; bottom: auto; width: 400px; max-height: calc(100% - 90px); border-radius: var(--r-xl); box-shadow: var(--shadow-3); animation: tgv-pop .18s var(--ease); }
  @keyframes tgv-pop { from { transform: translateY(-6px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
  .tgv-grabber { display: none; }
  .tgv-panel-head { padding-top: 16px; }
  .tgv-keys { left: calc(50% + 210px); bottom: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .tgv-panel { animation: none; }
}
