/* Galleria Villa — stile del sito (colori e caratteri del tema attuale: ambra #E09900, sabbia #D1AF83). */
.vg {
  --vg-accent: #e09900;
  --vg-sand: #d1af83;
  --vg-ink: #3e3f56;
  --vg-gap: 2%;
  --vg-cols: 3;
  --vg-h: min(70vh, 620px);
  --vg-radius: 4px;
  position: relative;
  margin: 0 0 1.5em;
  color: var(--vg-ink);
}
.vg *, .vg *::before, .vg *::after { box-sizing: border-box; }
.vg [hidden], .vg-lb [hidden] { display: none !important; }
.vg .vg__grid, .vg .vg__track { list-style: none !important; margin: 0 !important; padding: 0 !important; }
.vg .vg__item { margin: 0 !important; padding: 0 !important; list-style: none !important; }
.vg .vg__item::before { content: none !important; }
.vg img { display: block; max-width: 100%; }
.vg__title { text-align: center; margin: 0 0 .8em; }

/* Pulsanti comuni */
.vg-btn {
  display: inline-block; padding: .65em 1.4em; border: 2px solid var(--vg-accent, #e09900); border-radius: 3px;
  background: var(--vg-accent, #e09900); color: #fff !important; font: inherit; font-weight: 600; line-height: 1.3;
  text-decoration: none !important; cursor: pointer; transition: background .2s, color .2s;
}
.vg-btn:hover { background: #fff; color: var(--vg-accent, #e09900) !important; }
.vg-btn[disabled] { opacity: .6; cursor: progress; }
.vg button:focus-visible, .vg a:focus-visible, .vg select:focus-visible, .vg [tabindex]:focus-visible,
.vg-lb button:focus-visible, .vg-lb a:focus-visible, .vg-lb input:focus-visible, .vg-lb textarea:focus-visible {
  outline: 3px solid var(--vg-accent, #e09900); outline-offset: 2px;
}

/* ── Filtri ── */
.vg__filters { display: flex; flex-wrap: wrap; gap: .6em 1.2em; justify-content: center; align-items: center; margin: 0 0 1.4em; }
.vg__fgroup { display: flex; flex-wrap: wrap; align-items: center; gap: .5em; }
.vg__flabel { font-size: .75em; text-transform: uppercase; letter-spacing: .12em; color: #8a7a62; }
.vg__select {
  appearance: none; -webkit-appearance: none; font: inherit; font-size: .9em; color: var(--vg-ink); min-width: 11em; max-width: 100%;
  padding: .5em 2.4em .5em 1em; border: 1px solid var(--vg-sand); border-radius: 999px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a7a62' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right .8em center / 14px no-repeat;
  transition: border-color .2s, box-shadow .2s;
}
.vg__select:hover, .vg__select:focus { border-color: var(--vg-accent); }
.vg__chip {
  border: 1px solid var(--vg-sand); background: #fff; color: var(--vg-ink); border-radius: 999px; padding: .35em .95em;
  font: inherit; font-size: .9em; line-height: 1.4; cursor: pointer; transition: background .2s, color .2s, border-color .2s;
}
.vg__chip:hover { border-color: var(--vg-accent); }
.vg__chip.is-on { background: var(--vg-accent); border-color: var(--vg-accent); color: #fff; }
.vg__n { font-size: .8em; opacity: .7; }
.vg.is-loading .vg__body { opacity: .45; transition: opacity .2s; pointer-events: none; }
.vg__empty { text-align: center; color: #777; padding: 2em 0; }

/* ── Griglia e muratura (come la galleria Divi di prima: 3 colonne, velo bianco al passaggio) ── */
.vg__grid { display: grid; grid-template-columns: repeat(var(--vg-cols), minmax(0, 1fr)); gap: 14px; }
.vg--muratura .vg__grid { display: block; columns: var(--vg-cols); column-gap: 1.2vw; }
.vg--muratura .vg__item { break-inside: avoid; margin-bottom: 1.2vw !important; }
.vg__link { position: relative; display: block; overflow: hidden; border-radius: var(--vg-radius); color: inherit; }
.vg--griglia .vg__link { aspect-ratio: 4 / 3; }
.vg--griglia .vg__link img, .vg--carosello .vg__link img { width: 100%; height: 100%; object-fit: cover; }
.vg--muratura .vg__link img { width: 100%; height: auto; }
.vg__link { box-shadow: 0 1px 3px rgba(62, 63, 86, .12); transition: box-shadow .3s, transform .3s; }
.vg__link:hover, .vg__link:focus-visible { box-shadow: 0 8px 22px rgba(62, 63, 86, .2); }
.vg__link img { transition: transform .5s ease; }
.vg__link:hover img { transform: scale(1.04); }
.vg__cap {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 1.6em .9em .7em; font-size: .85em; line-height: 1.35; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .6)); opacity: 0; transition: opacity .3s;
}
.vg__link:hover .vg__cap, .vg__link:focus-visible .vg__cap { opacity: 1; }
.vg__more, .vg__zip { text-align: center; margin-top: 1.4em; }
.vg__pages { display: flex; justify-content: center; flex-wrap: wrap; gap: .4em; margin-top: 1.4em; }
.vg__page { min-width: 2.4em; height: 2.4em; border: 1px solid var(--vg-sand); border-radius: 50%; background: #fff; color: var(--vg-ink); font: inherit; cursor: pointer; }
.vg__page.is-on { background: var(--vg-accent); border-color: var(--vg-accent); color: #fff; }

/* ── Slider e carosello ── */
.vg__frame { position: relative; }
.vg__viewport { position: relative; }
.vg__track { display: flex; gap: 1.2vw; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.vg__track::-webkit-scrollbar { display: none; }
.vg__track > .vg__item { scroll-snap-align: start; flex: 0 0 auto; }
.vg--slider .vg__track { gap: 0; }
.vg--slider .vg__track > .vg__item { width: 100%; }
.vg--slider .vg__link { height: var(--vg-h); display: flex; align-items: center; justify-content: center; border-radius: 0; }
.vg--slider .vg__link img { width: 100%; height: 100%; object-fit: contain; }
.vg--slider .vg__cap { opacity: 1; font-size: .95em; text-align: center; }
.vg--carosello .vg__track > .vg__item { width: calc((100% - (var(--vg-cols) - 1) * 1.2vw) / var(--vg-cols)); }
.vg--carosello .vg__link { aspect-ratio: 4 / 3; }
.vg__arrow {
  position: absolute; top: 50%; z-index: 2; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .92); box-shadow: 0 2px 10px rgba(0, 0, 0, .18); color: var(--vg-ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background .2s, color .2s;
}
.vg__arrow:hover { background: var(--vg-accent); color: #fff; }
.vg__arrow svg, .vg__play svg, .vg-lb svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vg__arrow--prev { left: 12px; }
.vg__arrow--next { right: 12px; }
.vg__bar { display: flex; align-items: center; justify-content: center; gap: .8em; margin-top: .6em; font-size: .85em; color: #8a7a62; }
.vg__play { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--vg-sand); background: #fff; color: var(--vg-ink); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.vg__play svg { width: 16px; height: 16px; }
.vg__play .vg-i-play, .vg__play.is-paused .vg-i-pause { display: none; }
.vg__play.is-paused .vg-i-play { display: inline; fill: currentColor; }
.vg__thumbs { display: flex; gap: 6px; overflow-x: auto; margin-top: .6em; padding: 3px; scrollbar-width: thin; }
.vg__thumb { flex: 0 0 auto; width: 96px; height: 64px; padding: 0; border: 2px solid transparent; border-radius: 2px; background: #eee; cursor: pointer; opacity: .6; transition: opacity .2s, border-color .2s; }
.vg__thumb img { width: 100%; height: 100%; object-fit: cover; }
.vg__thumb:hover, .vg__thumb.is-on { opacity: 1; }
.vg__thumb.is-on { border-color: var(--vg-accent); }

@media (max-width: 980px) {
  .vg__grid { grid-template-columns: repeat(var(--vg-cols-m, 2), minmax(0, 1fr)); gap: 10px; }
  .vg--muratura .vg__grid { columns: var(--vg-cols-m, 2); column-gap: 10px; }
  .vg--carosello .vg__track > .vg__item { width: calc((100% - 10px) / 2); }
  .vg__track { gap: 10px; }
}
@media (max-width: 600px) {
  .vg__grid { grid-template-columns: repeat(var(--vg-cols-m, 2), minmax(0, 1fr)); gap: 6px; }
  .vg--muratura .vg__grid { columns: var(--vg-cols-m, 2); column-gap: 6px; }
  .vg--carosello .vg__track > .vg__item { width: 82%; }
  .vg--slider { --vg-h: min(62vh, 85vw); }
  .vg__arrow { width: 38px; height: 38px; }
  .vg__arrow--prev { left: 6px; } .vg__arrow--next { right: 6px; }
  .vg__filters { justify-content: flex-start; }
}

/* ── Visualizzatore ── */
html.vg-lock { overflow: hidden; } /* la larghezza della barra sparita la compensa gallery.js (padding), lo schermo intero resta largo quanto la finestra */
.vg-lb {
  position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgba(20, 17, 13, .97); color: #f3ede3; font-family: inherit;
}
.vg-lb[open] { display: block; }
.vg-lb::backdrop { background: rgba(0, 0, 0, .85); }
/* dissolvenza all'apertura e alla chiusura (stessa della foto successiva) */
.vg-lb, .vg-lb::backdrop { transition: opacity .35s ease; }
.vg-lb.is-fading, .vg-lb.is-fading::backdrop { opacity: 0; }
.vg-lb__head { display: flex; flex-direction: column; justify-content: flex-start; }
/* fasce sopra e sotto sovrapposte alla foto, con una sfumatura per leggere: la foto prende tutto lo schermo */
.vg-lb__head, .vg-lb__info { position: absolute; left: 0; right: 0; z-index: 3; pointer-events: none; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
.vg-lb__head { top: 0; padding-bottom: 22px; background: linear-gradient(to bottom, rgba(14, 12, 9, .78), rgba(14, 12, 9, .45) 65%, rgba(14, 12, 9, 0)); }
.vg-lb__info { bottom: 0; background: linear-gradient(to top, rgba(14, 12, 9, .78), rgba(14, 12, 9, .45) 65%, rgba(14, 12, 9, 0)); }
.vg-lb__head a, .vg-lb__head button, .vg-lb__info a, .vg-lb__info button, .vg-lb.is-form .vg-lb__info { pointer-events: auto; }
.vg-lb.is-form .vg-lb__info { background: rgba(14, 12, 9, .94); }
.vg-lb__info:not(:has(:not(:empty):not([hidden]))) { display: none; }
.vg-lb__info { display: flex; flex-direction: column; justify-content: flex-start; }
.vg-lb__top { display: flex; align-items: center; justify-content: space-between; padding: max(10px, env(safe-area-inset-top)) 14px 6px; }
.vg-lb__count { font-size: .9em; opacity: .8; }
.vg-lb__tools { display: flex; gap: 6px; }
.vg-lb__btn, .vg-lb__nav { border: 0; background: rgba(255, 255, 255, .1); color: #fff; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; }
.vg-lb__btn[hidden], .vg-lb__nav[hidden] { display: none; }
.vg-lb__btn:hover, .vg-lb__nav:hover, .vg-lb__btn[aria-pressed="true"] { background: var(--vg-accent, #e09900); }
.vg-lb__stage { position: absolute; inset: 0; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 0 64px; touch-action: none; /* dita e pizzico gestiti da gallery.js */ }
.vg-lb__img.is-out { opacity: 0; }
.vg-share { position: absolute; top: calc(max(10px, env(safe-area-inset-top)) + 52px); right: 14px; z-index: 5; display: flex; flex-direction: column; min-width: 210px; padding: 6px; background: #2a251f; border: 1px solid rgba(255, 255, 255, .12); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.vg-share[hidden] { display: none; }
.vg-share > * { display: block; text-align: left; padding: 10px 12px; border: 0; border-radius: 8px; background: none; color: #f3ede3; font: inherit; font-size: .95em; text-decoration: none; cursor: pointer; }
.vg-share > *:hover, .vg-share > *:focus-visible { background: rgba(255, 255, 255, .1); outline: none; }
.vg-lb__img { max-width: 100%; max-height: 100%; width: auto; height: auto; flex: none; object-fit: contain; user-select: none; -webkit-user-drag: none; cursor: default; transform-origin: center center; will-change: transform; }
.vg-lb__stage.is-zoomed { cursor: grab; }
.vg-lb__stage.is-zoomed:active { cursor: grabbing; }
.vg-lb__stage.is-zoomed .vg-lb__img { cursor: inherit; position: relative; z-index: 2; }
.vg-lb__stage.is-zoomed ~ .vg-lb__nav { opacity: .35; }
.vg-lb__alt { margin: 0 auto .35em; max-width: 60em; font-size: .88em; font-style: italic; opacity: .8; }
.vg-lb__alt:empty, .vg-lb__cap:empty { display: none; }
.vg-lb__nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; z-index: 4; }
.vg-lb__nav--prev { left: 10px; }
.vg-lb__nav--next { right: 10px; }
.vg-lb__info { padding: 28px 18px max(14px, env(safe-area-inset-bottom)); text-align: center; max-height: 45vh; overflow: auto; }
.vg-lb__cap { margin: 0 auto .3em; max-width: 60em; font-size: 1em; line-height: 1.45; }
.vg-lb__meta { margin: 0 0 .4em; font-size: .85em; opacity: .8; }
.vg-lb__meta a { color: #f0c46a; }
.vg-lb__report, .vg-lb__link { background: none; border: 0; color: #cdbfa8; text-decoration: underline; font: inherit; font-size: .8em; cursor: pointer; padding: .3em; }
.vg-lb__report[hidden] { display: none; }
.vg-lb__form { max-width: 34em; margin: .6em auto 0; text-align: left; background: rgba(255, 255, 255, .06); padding: 14px 16px; border-radius: 6px; }
.vg-lb__ftitle { font-size: 1.05em; margin: 0 0 .3em; color: #fff; }
.vg-lb__fintro { font-size: .85em; margin: 0 0 .8em; opacity: .85; }
.vg-lb__row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vg-lb__form label { display: block; font-size: .85em; margin-bottom: 8px; }
.vg-lb__form input:not([type="checkbox"]), .vg-lb__form textarea { display: block; width: 100%; margin-top: 3px; padding: .5em .6em; border: 1px solid #6d6355; border-radius: 3px; background: #1d1a15; color: #fff; font: inherit; }
.vg-lb__check { display: flex !important; gap: .5em; align-items: flex-start; }
.vg-lb__check a { color: #f0c46a; }
.vg-lb__factions { display: flex; gap: 12px; align-items: center; margin-top: 6px; }
.vg-lb__fmsg { margin: .6em 0 0; font-size: .9em; }
.vg-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 600px) {
  .vg-lb__stage { padding: 0; }
  .vg-lb__nav { width: 40px; height: 40px; background: rgba(0, 0, 0, .35); }
  .vg-lb__row { grid-template-columns: 1fr; }
}

.vg-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #222; color: #fff; padding: .6em 1.2em; border-radius: 4px; font-size: .9em; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; z-index: 100000; }
.vg-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* Blocchi nella pagina evento */
.vg-event-photos { margin: 2.5em 0 1em; }
.vg-event-photos__title { text-align: center; }
.vg-event-upload { text-align: center; margin: 1.2em 0 2em; }

@media (prefers-reduced-motion: reduce) {
  .vg *, .vg-lb * { transition: none !important; scroll-behavior: auto !important; }
  .vg__link:hover img { transform: none; }
}

.vg__more .vg-btn { background: transparent; color: var(--vg-ink) !important; border: 1px solid var(--vg-sand); border-radius: 999px; padding: .55em 1.8em; font-weight: 400; letter-spacing: .04em; }
.vg__more .vg-btn:hover { border-color: var(--vg-accent); color: var(--vg-accent) !important; background: #fff; }

/* Carosello e slider: sfondo, colori e spazio interno (impostazioni della galleria o parametri sfondo, colore, colore_testo, padding) */
.vg--carosello, .vg--slider { background: var(--vg-bg, transparent); padding: var(--vg-pad, 0); border-radius: var(--vg-radius); }
.vg--carosello .vg__arrow, .vg--slider .vg__arrow { color: var(--vg-ink); }
.vg--carosello .vg__arrow:hover, .vg--slider .vg__arrow:hover { background: var(--vg-accent); color: #fff; }
.vg--carosello .vg__count, .vg--slider .vg__count { color: var(--vg-ink); }

/* riga in alto: contatore · titolo e descrizione · tasti, tutto sulla stessa riga */
.vg-lb__top { display: grid; grid-template-columns: minmax(max-content, 1fr) minmax(0, 3fr) minmax(max-content, 1fr); grid-template-areas: "count titles tools"; align-items: center; gap: 0 10px; }
.vg-lb__count { grid-area: count; }
.vg-lb__tools { grid-area: tools; justify-self: end; }
.vg-lb__titles { grid-area: titles; min-width: 0; text-align: center; }
.vg-lb__titles .vg-lb__cap { margin: 0 auto; padding: 0; font-weight: 600; line-height: 1.3; }
.vg-lb__titles .vg-lb__alt { margin: 0 auto; padding: 0; max-height: none; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
.vg-lb__head { padding-bottom: 14px; }
/* riga in basso: evento (o album) e «Chiedi la rimozione» sulla stessa riga */
.vg-lb__info { display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 2px 18px; padding-top: 22px; }
.vg-lb__info .vg-lb__meta { margin: 0; }
.vg-lb__info .vg-lb__report { padding: 0; }
.vg-lb__info .vg-lb__form { flex: 1 1 100%; }
/* telefono in verticale: titolo e descrizione sotto i tasti, a tutta larghezza */
@media (max-width: 600px) and (orientation: portrait) {
  .vg-lb__top { grid-template-columns: 1fr auto; grid-template-areas: "count tools" "titles titles"; }
  .vg-lb__titles { padding: 4px 4px 0; }
}
