/* Visita interattiva: la pagina si comporta come un'app */
html.ivi-visita-lock, body.ivi-visita-app { overflow: hidden; }
body.ivi-visita-app .tau-hero, body.ivi-visita-app footer, body.ivi-visita-app .wp-site-blocks > footer { display: none !important; }
body.ivi-visita-app main > .wp-block-group { padding: 0 !important; }
body.ivi-visita-app main, body.ivi-visita-app .wp-block-post-content { margin: 0 !important; padding: 0 !important; max-width: none !important; }
body.ivi-visita-app .wp-site-blocks { padding: 0 !important; }
body.ivi-visita-app .wp-block-post-content > * { max-width: none !important; margin: 0 !important; }
.ivi-visita { position: relative; isolation: isolate; height: calc(100dvh - var(--ivi-top, 110px)); min-height: 380px; overflow: hidden; background: #dfe8ec; font-family: Manrope, Arial, sans-serif; color: #16232c; }
body.ivi-visita-app .ivi-visita { position: fixed; left: 0; right: 0; top: var(--ivi-top, 110px); bottom: 0; height: auto; min-height: 0; z-index: 40; }
body.ivi-visita-app .ivi-visita.is-max, .ivi-visita:fullscreen { top: 0; }
.ivi-visita.is-max, .ivi-visita:fullscreen { position: fixed; inset: 0; z-index: 100000; width: 100%; height: 100dvh; }
.ivi-visita__map { position: absolute; inset: 0; z-index: 0; }
.ivi-visita button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ivi-visita .leaflet-control-attribution { font-size: 9px; background: rgba(255, 255, 255, .75); }
.ivi-visita .leaflet-bottom { bottom: 104px; }
.ivi-visita .leaflet-control-zoom { border: 0; box-shadow: 0 2px 8px rgba(22, 35, 44, .22); }
.ivi-visita .leaflet-control-zoom a { width: 44px; height: 44px; line-height: 44px; }

/* Punti: si vedono piccoli, ma si toccano con facilità */
.ivi-visita__marker { background: none; border: 0; }
.ivi-visita__marker span { position: absolute; left: -15px; top: -15px; display: grid; place-items: center; width: 30px; height: 30px; border: 2px solid #c98d73; border-radius: 50%; background: #fff; color: #8f4426; font: 800 13px/1 Manrope, Arial, sans-serif; box-shadow: 0 2px 6px rgba(22, 35, 44, .45); box-sizing: border-box; transform: translate(var(--dx, 0), var(--dy, 0)) scale(var(--s, 1)); transition: transform .18s, background-color .18s; }
.ivi-visita__marker span::before { content: ""; position: absolute; inset: -9px; border-radius: 50%; }
.ivi-visita__marker.is-on span { --s: 1.3; border-color: #fff; background: #8f4426; color: #fff; }

/* Controlli */
.ivi-visita__langs, .ivi-visita__tools { position: absolute; z-index: 5; display: flex; background: #fff; border-radius: 12px; box-shadow: 0 2px 8px rgba(22, 35, 44, .22); overflow: hidden; }
.ivi-visita__langs { top: 12px; left: 12px; }
.ivi-visita__langs button { min-width: 44px; height: 44px; padding: 0; border: 0; background: #fff; font: 800 .78rem Manrope, Arial, sans-serif; color: #16232c; cursor: pointer; }
.ivi-visita__langs button[aria-pressed="true"] { background: #e6edf0; color: #16232c; }
.ivi-visita__tools { top: 12px; right: 12px; flex-direction: column; }
.ivi-visita__tools button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; background: none; }
.ivi-visita__tools button + button { border-top: 1px solid #eef2f4; }
.ivi-visita__tools button[aria-pressed="true"] { background: #e7f3f8; color: #11729b; }
.ivi-visita__toast { position: absolute; top: 66px; left: 50%; z-index: 6; margin: 0; padding: .4rem .8rem; border-radius: 99px; background: #16232c; color: #fff; font-size: .8rem; transform: translateX(-50%); white-space: nowrap; }
.ivi-visita__toast[hidden] { display: none; }

/* Schede delle tappe */
.ivi-visita__cards { position: absolute; z-index: 5; display: flex; gap: 8px; }
.ivi-visita__cards > button { display: flex; align-items: center; gap: 10px; min-height: 84px; padding: 8px 10px 8px 8px; border: 0; border-radius: 16px; background: #fff; box-shadow: 0 4px 14px rgba(22, 35, 44, .22); text-align: left; box-sizing: border-box; }
.ivi-visita__thumb { position: relative; flex: none; width: 68px; height: 68px; border-radius: 12px; background: #eef2f4 center / cover no-repeat; }
.ivi-visita__thumb i { position: absolute; left: 4px; top: 4px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #fff; color: #8f4426; font-size: 12px; font-style: normal; font-weight: 800; box-shadow: 0 1px 3px rgba(22, 35, 44, .3); }
.ivi-visita__ctext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ivi-visita__ctext b { display: -webkit-box; overflow: hidden; font-size: .95rem; line-height: 1.2; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.ivi-visita__ctext small { overflow: hidden; color: #4f5e67; font-size: .76rem; white-space: nowrap; text-overflow: ellipsis; }
.ivi-visita__cards em { flex: none; padding: .55rem .85rem; border-radius: 99px; background: #eef2f4; color: #16232c; font-size: .8rem; font-style: normal; font-weight: 800; }
.ivi-visita__cards > button[aria-current="true"] em { background: #f6ece6; color: #8f4426; }
.ivi-visita__cards > button[aria-current="true"] .ivi-visita__thumb i { background: #8f4426; color: #fff; }

/* Scheda a tutto schermo */
.ivi-visita__sheet { position: fixed; inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: #fff; color: #16232c; font-family: Manrope, Arial, sans-serif; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.ivi-visita__sheet::backdrop { background: #fff; }
.ivi-visita__sheet button { font: inherit; color: inherit; cursor: pointer; }
.ivi-visita__bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: .5rem; height: 56px; padding: env(safe-area-inset-top) .6rem 0 .35rem; background: rgba(255, 255, 255, .97); border-bottom: 1px solid #eef2f4; box-sizing: content-box; }
.ivi-visita__bar > [data-back] { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 .6rem 0 .2rem; border: 0; background: none; font: inherit; font-weight: 800; color: #16232c; cursor: pointer; }
.ivi-visita__icon { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 10px; background: none; color: #33434d; cursor: pointer; }
.ivi-visita__icon:hover, .ivi-visita__icon.is-done { background: #e6edf0; }
.ivi-visita__count { margin-left: auto; white-space: nowrap; font-size: .8rem; font-weight: 700; color: #4f5e67; }
.ivi-visita__langs.is-inline { position: static; box-shadow: inset 0 0 0 1px #dfe6ea; border-radius: 10px; }
.ivi-visita__langs.is-inline button { min-width: 40px; height: 36px; background: transparent; }
.ivi-visita__langs.is-inline button[aria-pressed="true"] { background: #e6edf0; color: #16232c; }
.ivi-visita__hero { max-width: 760px; margin: 0 auto; }
.ivi-visita__hero { position: relative; }
.ivi-visita__hero button { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.ivi-visita__herocount { position: absolute; right: 10px; top: 10px; display: inline-flex; align-items: center; gap: 4px; padding: .2rem .5rem; border-radius: 99px; background: rgba(255, 255, 255, .92); color: #16232c; font-size: .75rem; font-weight: 700; pointer-events: none; }
.ivi-visita__hero img { display: block; width: 100%; height: min(36dvh, 380px); object-fit: cover; }
.ivi-visita__hero figcaption { margin: .3rem 1.1rem 0; font-size: .7rem; color: #4f5e67; }
.ivi-visita__in { max-width: 760px; margin: 0 auto; padding: .9rem 1.1rem 1.5rem; box-sizing: border-box; }
.ivi-visita__in h2 { margin: 0 0 .4rem; font-family: Manrope, Arial, sans-serif; font-size: 1.45rem; font-weight: 800; line-height: 1.2; letter-spacing: 0; text-transform: none; }
.ivi-visita__in h3 { margin: 1.25rem 0 .5rem; font-family: Manrope, Arial, sans-serif; font-size: .95rem; font-weight: 800; text-transform: none; letter-spacing: 0; }
.ivi-visita__in p { margin: 0 0 .7rem; font-size: 1rem; line-height: 1.55; }
.ivi-visita__in .ivi-visita__lead { color: #33434d; font-size: 1.02rem; font-weight: 500; }

/* Audio: un lettore vero, non un pulsante in più */
.ivi-visita__player { display: flex; align-items: center; gap: 12px; margin: .8rem 0 0; padding: 8px 14px 8px 8px; border: 1px solid #e6edf0; border-radius: 16px; background: #fff; }
.ivi-visita__player button { flex: none; cursor: pointer; display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%; background: #f6ece6; color: #8f4426; }
.ivi-visita__ptext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ivi-visita__ptext b { font-size: .92rem; }
.ivi-visita__ptext small { font-size: .74rem; color: #4f5e67; }
.ivi-visita__ptext input[type=range] { width: 100%; margin: 0; padding: 0; height: 20px; accent-color: #8f4426; background: none; border: 0; }
.ivi-visita__player > small { flex: none; font-size: .78rem; font-variant-numeric: tabular-nums; color: #4f5e67; }

/* 360: anteprime da toccare, che scorrono */
.ivi-visita__panos { display: flex; gap: 10px; margin: 0 -1.1rem .9rem; padding: 0 1.1rem; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.ivi-visita__panos::-webkit-scrollbar { display: none; }
.ivi-visita__panos button { cursor: pointer; flex: none; width: 190px; padding: 0; border: 0; background: none; text-align: left; scroll-snap-align: start; }
.ivi-visita__panos span { position: relative; display: block; height: 108px; border-radius: 14px; background: #dfe8ec center / cover no-repeat; }
.ivi-visita__panos i { position: absolute; left: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px; padding: .2rem .5rem; border-radius: 99px; background: rgba(255, 255, 255, .92); color: #16232c; font-size: .72rem; font-style: normal; font-weight: 700; }
.ivi-visita__panos small { display: block; margin-top: .3rem; overflow: hidden; font-size: .8rem; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }

.ivi-visita__btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .35rem 1rem; border: 0; border-radius: 99px; background: #8f4426; color: #fff !important; font-size: .9rem; font-weight: 700; text-align: center; text-decoration: none; }
.ivi-visita__note { margin: 1rem 0; padding: .8rem 1rem; border-left: 3px solid #d9c4b6; background: #faf7f4; border-radius: 0 12px 12px 0; }
.ivi-visita__in .ivi-visita__note h3 { margin-top: 0; }
.ivi-visita__note p:last-child { margin-bottom: 0; }
.ivi-visita__gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin: 0 0 .8rem; }
.ivi-visita__gallery button { padding: 0; border: 0; background: none; cursor: zoom-in; }
.ivi-visita__gallery img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.ivi-visita__in details { margin: .25rem 0; border-top: 1px solid #eef2f4; }
.ivi-visita__in summary { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 700; color: #16232c; cursor: pointer; }
.ivi-visita__in summary svg { color: #6c7c86; }
.ivi-visita__links { margin: 0 0 .7rem; padding-left: 1.1rem; font-size: .95rem; }
.ivi-visita__links li { margin: .45rem 0; }
.ivi-visita__in .ivi-visita__credits { margin-top: 1rem; font-size: .78rem; color: #4f5e67; }
.ivi-visita__lock { margin: 1rem 0 0; padding: .9rem 1rem; border-radius: 12px; background: #f2f6f8; }
.ivi-visita__in .ivi-visita__lock h3 { margin: 0 0 .35rem; }
.ivi-visita__lock ul { margin: 0 0 .7rem; padding-left: 1.1rem; }
.ivi-visita__in .ivi-visita__lock p { font-size: .92rem; }
.ivi-visita__foot { position: sticky; bottom: 0; z-index: 3; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: #eef2f4; border-top: 1px solid #eef2f4; padding-bottom: env(safe-area-inset-bottom); }
.ivi-visita__foot > * { background: #fff; }
.ivi-visita__foot button { cursor: pointer; display: flex; align-items: center; gap: 4px; min-width: 0; height: 54px; padding: 0 .6rem; border: 0; background: #fff; font-size: .82rem; font-weight: 700; text-align: left; }
.ivi-visita__foot button svg { flex: none; }
.ivi-visita__foot button span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ivi-visita__foot .is-next { justify-content: flex-end; text-align: right; }

/* Tour 360 e foto */
.ivi-visita-full { position: fixed; inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: #0f1b22; color: #fff; font-family: Manrope, Arial, sans-serif; overflow: hidden; }
.ivi-visita-full[open] { display: flex; flex-direction: column; }
.ivi-visita-full::backdrop { background: #0f1b22; }
.ivi-visita-full__bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: calc(.35rem + env(safe-area-inset-top)) .5rem .35rem 1rem; font-size: .85rem; font-weight: 700; }
.ivi-visita-full__bar button { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; font-size: 22px; cursor: pointer; }
.ivi-visita-full__stage { flex: 1; min-height: 0; position: relative; }
.ivi-visita-full__stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.ivi-visita-tour { flex: none; display: flex; align-items: center; gap: 4px; padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); }
.ivi-visita-tour > button { flex: none; display: grid; place-items: center; width: 44px; height: 56px; padding: 0; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; }
.ivi-visita-tour__list { flex: 1; min-width: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.ivi-visita-tour__list::-webkit-scrollbar { display: none; }
.ivi-visita-tour__list button { position: relative; flex: none; width: 92px; height: 56px; padding: 0; border: 2px solid transparent; border-radius: 10px; background: #26363f center / cover no-repeat; cursor: pointer; }
.ivi-visita-tour__list button[aria-current="true"] { border-color: #fff; }
.ivi-visita-tour__list i { position: absolute; left: 4px; top: 4px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #b8532e; color: #fff; font-size: 11px; font-style: normal; font-weight: 800; }

p.ivi-visita__preview { position: fixed; top: var(--ivi-top, 110px); left: 50%; z-index: 90; margin: 8px 0 0 !important; padding: .3rem .7rem; border-radius: 99px; background: #fbecd2; font-size: .72rem !important; font-weight: 600; line-height: 1.3; transform: translateX(-50%); white-space: nowrap; }

@media (min-width: 782px) {
	.ivi-visita .leaflet-bottom { bottom: 10px; }
	.ivi-visita__gallery { grid-template-columns: repeat(4, 1fr); }
	.ivi-visita__in h2 { font-size: 1.75rem; }
	.ivi-visita__hero img { border-radius: 0 0 14px 14px; }
	.ivi-visita__foot { grid-template-columns: minmax(0, 380px) minmax(0, 380px); justify-content: center; background: #fff; }
}
@media (max-width: 781px) {
	.ivi-visita__cards { left: 0; right: 0; bottom: 10px; padding: 2px 9vw; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
	.ivi-visita__cards::-webkit-scrollbar { display: none; }
	.ivi-visita__cards > button { flex: none; width: 82vw; scroll-snap-align: center; }
	.ivi-visita .leaflet-control-zoom { display: none; }
	p.ivi-visita__preview { display: none; }
}
@media (prefers-reduced-motion: reduce) { .ivi-visita__marker span { transition: none; } }

/* Icone informative */
.ivi-visita__sec { display: flex; align-items: center; gap: 7px; }
.ivi-visita__sec svg { flex: none; color: #6c7c86; }
.ivi-visita__facts { display: inline-flex; align-items: center; gap: 10px; }
.ivi-visita__facts span { display: inline-flex; align-items: center; gap: 3px; }
.ivi-visita__toast.is-sheet { position: sticky; top: 64px; left: auto; display: table; margin: 0 auto -32px; transform: none; z-index: 5; }
.ivi-visita__toast.is-sheet[hidden] { display: none; }

/* Foto a scorrimento */
.ivi-visita-slides { flex: 1; min-height: 0; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; outline: 0; }
.ivi-visita-slides::-webkit-scrollbar { display: none; }
.ivi-visita-slides figure { flex: none; display: grid; place-items: center; width: 100%; height: 100%; margin: 0; scroll-snap-align: center; scroll-snap-stop: always; }
.ivi-visita-slides img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ivi-visita-full__bar [data-credit] { flex: 1; min-width: 0; font-weight: 500; font-size: .75rem; }
.ivi-visita-full__n { flex: none; font-variant-numeric: tabular-nums; }
.ivi-visita-slide { position: absolute; top: 50%; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .16); color: #fff; cursor: pointer; transform: translateY(-50%); }
.ivi-visita-slide.is-prev { left: 12px; }
.ivi-visita-slide.is-next { right: 12px; }
@media (hover: none) { .ivi-visita-slide { display: none; } }
.ivi360-hotspot > b { font-family: Manrope, Arial, sans-serif; }
.ivi360-hotspot[hidden] { display: none !important; }

/* Desktop: mappa e pannello fisso della tappa */
@media (min-width: 782px) {
	.ivi-visita__side { position: absolute; top: 0; right: 0; bottom: 0; z-index: 6; display: flex; flex-direction: column; width: 440px; background: #fff; box-shadow: -6px 0 24px rgba(22, 35, 44, .12); overflow-y: auto; overscroll-behavior: contain; }
	.ivi-visita__side .ivi-visita__in { flex: 1; width: 100%; }
	.ivi-visita__side .ivi-visita__hero { margin: 0; width: 100%; }
	.ivi-visita__side .ivi-visita__hero img { height: 230px; border-radius: 0; }
	.ivi-visita__side .ivi-visita__in h2 { font-size: 1.4rem; }
	.ivi-visita__side .ivi-visita__gallery { grid-template-columns: repeat(3, 1fr); }
	.ivi-visita__side .ivi-visita__foot { grid-template-columns: 1fr 1fr; justify-content: stretch; background: #eef2f4; }
	.ivi-visita__side button { font: inherit; color: inherit; cursor: pointer; }
	.ivi-visita__tools { right: 452px; }
	.ivi-visita .leaflet-right { right: 440px; }
	.ivi-visita .leaflet-left .leaflet-control-zoom { margin-left: 12px; }
	p.ivi-visita__preview { left: calc(50% - 220px); }
}
