/* Adattamento del tema originale. I colori e gli sfondi restano nel gestionale. */
html { font-size: 16px; scroll-padding-top: 1rem; }
body { min-width: 0; line-height: 1.55; }
.site-shell, .site-shell * { box-sizing: border-box; }
.site-shell { display: grid; grid-template-columns: minmax(0, 1fr); width: calc(100% - 32px); max-width: 980px; margin: 0 auto; }
.site-header { display: contents; }
.site-header > .menu { grid-row: 4; margin-top: 20px; }
.site-shell .top { grid-row: 1; width: 100%; height: auto; min-height: 0; }
.brand { display: block; }
.brand img { display: block; width: 100%; height: auto; }
.site-shell .menulang { grid-row: 2; margin-top: 0; padding: 8px 12px; font-size: 0.875rem; line-height: 1.7; }
.toolbar-contact { display: inline-block; font-weight: bold; }
.site-shell .container { grid-row: 5; position: relative; width: 100%; padding-top: 0; }
.site-shell .bckcontentmain { position: relative; width: 100%; }
.site-shell .main { padding: 28px 30px; min-width: 0; overflow-wrap: break-word; }
.site-shell .main:after { content: ''; display: block; clear: both; }
.site-shell .main, .site-shell .main td, .site-shell .main tr { font-size: 1rem; }
.main img { max-width: 100%; height: auto; }
.main iframe, .main video, .main object, .main embed { max-width: 100%; }
.main iframe[src*="youtube"], .main iframe[src*="vimeo"] { width: 100%; height: auto; aspect-ratio: 16 / 9; }
.main table { max-width: 100%; }
.main p { line-height: 1.6; }
.main h1 { font-size: 1.75rem; line-height: 1.3; }
.main h2 { font-size: 1.5rem; line-height: 1.35; }
.main h3 { font-size: 1.25rem; line-height: 1.4; }
.main h1, .main h2, .main h3 { overflow-wrap: break-word; }
.columnas { display: flow-root; }
.columnas > div { max-width: 100%; }
.barramenu { height: auto; min-height: 44px; position: relative; z-index: 50; }
.menu > ul { display: flex; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.menu li { float: none; }
.menu a { height: auto; min-height: 44px; line-height: 1.4; padding: 12px 11px; font-size: 1rem; }
.menu ul ul { top: 100%; left: 0; width: 270px; padding: 0; height: auto; margin: 0; list-style: none; }
.menu ul ul a { width: 100%; min-height: 44px; padding: 12px; line-height: 1.4; font-size: 1rem; }
.menu ul ul:empty { display: none; }
.menu li:focus-within > ul, .menu li.submenu-open > ul { visibility: visible; }
.menu li.has-submenu > a { padding-right: 44px; }
.submenu-toggle { position: absolute; top: 0; right: 0; width: 40px; min-height: 44px; background: none; border: 0; color: inherit; cursor: pointer; }
.submenu-toggle:after { content: ''; display: inline-block; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.submenu-toggle[aria-expanded="true"]:after { transform: translateY(2px) rotate(225deg); }
.menu-toggle { display: none; }
.skip-link { position: absolute; left: 12px; top: -100px; padding: 10px 16px; background: white; color: #800000; z-index: 10000; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 3px solid #940000; outline-offset: 3px; }
.site-shell .foot { grid-row: 6; position: relative; left: auto; bottom: auto; width: 100%; margin-top: 28px; padding: 12px 16px; font-size: 0.875rem; line-height: 1.7; overflow-wrap: anywhere; }
.site-shell { padding-bottom: 20px; }
.network { z-index: 60; }
.network img { max-width: 54px; height: auto; }
.imagenUP { z-index: 60; }
.imagenUP img { max-width: 44px; height: auto; }

/* Le immagini del carosello originale non hanno più una larghezza fissa. */
#wrap { grid-row: 3; width: 100%; margin: 0; }
#carrusel { list-style: none; padding: 0; margin: 0; width: 100%; }
#carrusel > li { display: none; position: relative; width: 100%; }
#carrusel > li:first-child, .carousel-ready #carrusel > li:not([hidden]) { display: block; }
#carrusel > li[hidden] { display: none !important; }
#carrusel > li > img { display: block; width: 100%; height: auto; border: 0; }
#carrusel .jcarousel-texto { box-sizing: border-box; width: 100%; height: auto; max-height: 100%; overflow: auto; }
/* Le griglie elastiche sostituiscono le coordinate fisse di Masonry. */
.main #container { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; height: auto !important; }
.main #container .box { position: static !important; float: none; width: auto !important; max-width: 100%; margin: 0; }
.main #container .box img { width: 100%; max-width: 100%; height: auto; }
.responsive-table { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Modulo contatti: etichette leggibili e campi adatti al tocco. */
.contact-form { margin-top: 24px; max-width: 680px; }
.contact-field { margin-bottom: 18px; }
.contact-field label { display: block; font-weight: bold; margin-bottom: 6px; }
.contact-form input:not([type="hidden"]), .contact-form textarea, .contact-form select { box-sizing: border-box; width: 100%; max-width: 100%; padding: 11px 12px; font: inherit; font-size: 1rem; color: #333; background: #fff; border: 1px solid #a99a8c; border-radius: 3px; }
.contact-form textarea { min-height: 160px; resize: vertical; }
.contact-form input.captcha-answer { max-width: 160px; }
.contact-help { font-size: .875rem; color: #555; margin: 6px 0 0; }
.contact-submit { min-height: 46px; border: 1px solid #940000; padding: 11px 24px; background: #ffd733; color: #800000; font: inherit; font-weight: bold; cursor: pointer; }
.contact-submit:hover { background: #d47415; color: white; }
.contact-notice { margin: 20px 0; padding: 16px 18px; border-left: 4px solid #940000; background: #fff6f0; }
.contact-notice ul { margin-bottom: 0; padding-left: 22px; }
.contact-notice.success { border-color: #48703c; background: #f3f8ef; }
.contact-trap { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.declarazione { font-size: .875rem; }
.preview-notice { padding: 10px 16px; background: #fff; border-bottom: 1px solid #c4bcb1; font-size: .875rem; text-align: center; }

@media (max-width: 1180px) {
  .network { position: static; display: flex; justify-content: flex-end; gap: 10px; max-width: 980px; margin: 6px auto; padding: 0 16px; }
  .network br { display: none; }
  .network img { width: 36px; }
}
@media (max-width: 980px) {
  body { background-size: auto 100vh; }
  .site-shell .main { padding: 24px; }
  .columnas > #col_1, .columnas > #col_2, .columnas > #col_3 { box-sizing: border-box; float: none; width: 100% !important; padding: 0 0 24px !important; border-right: 0 !important; }
  .main .link img { max-width: 100%; }
  .imagenUP { right: 12px !important; bottom: 14px !important; }
}
@media (max-width: 980px) {
  html { scroll-padding-top: 110px; }
  .site-shell { width: calc(100% - 20px); padding-bottom: 12px; }
  .site-shell .menulang { padding: 8px 10px; }
  .site-header { display: block; grid-row: 1; position: sticky; top: 0; z-index: 100; min-width: 0; background: rgba(45,38,29,.72); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: 0 2px 5px rgba(80,40,0,.12); }
  .site-shell .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 68px; padding: 8px 10px; background: transparent !important; }
  .brand { flex: 1 1 0; min-width: 0; max-width: 400px; overflow: hidden; }
  /* Il PNG originale ha margini vuoti: il taglio CSS conserva tutti i pixel del titolo. */
  .brand img { width: 135.359116%; max-width: none; max-height: none; height: auto; margin-left: -17.679558%; }
  .site-shell .container { grid-row: 4; padding-top: 12px; }
  .site-shell .main { padding: 20px 16px; }
  .main p[style*="justify"] { text-align: left !important; }
  .main img[align], .main img[style*="float"] { float: none !important; display: block; margin: 14px auto !important; }
  .main table { width: 100%; }
  .main td { overflow-wrap: anywhere; }
  .responsive-stack-row { display: block; }
  .responsive-stack-row > td { display: block; width: 100% !important; padding: 0 0 14px; }
  .responsive-stack-row .newsfotoprincipal img { float: none; display: block; margin: 0 auto 10px; }
  .main .newstexto { text-align: left; }
  .main .newstit { font-size: 1.25rem; line-height: 1.4; }
  .menu-toggle { display: none; width: 60px; flex: 0 0 60px; flex-direction: column; gap: 10px; min-height: 60px; padding: 8px; border: 0; background: transparent !important; color: #ffd733; text-align: left; font: inherit; font-weight: bold; cursor: pointer; }
  .navigation-ready .menu-toggle { display: flex; align-items: center; justify-content: center; }
  .menu-icon, .menu-icon:before, .menu-icon:after { display: block; width: 22px; height: 2px; background: currentColor; }
  .menu-icon { position: relative; }
  .menu-icon:before, .menu-icon:after { content: ''; position: absolute; left: 0; }
  .menu-icon:before { top: -7px; }
  .menu-icon:after { top: 7px; }
  .menu > ul { display: block; }
  .navigation-ready .menu:not(.is-open) { display: none; }
  .menu { width: 100%; }
  .site-header > .menu { position: absolute; top: 100%; left: 0; right: 0; margin-top: 0; min-height: 0; max-height: calc(100vh - 110px); max-height: calc(100dvh - 110px); overflow-y: auto; overscroll-behavior: contain; box-shadow: 0 5px 12px rgba(60,30,0,.2); }
  .menu li { width: 100%; }
  .menu a { padding: 12px 16px; }
  .menu > ul > li > a { border-top: 1px solid rgba(148,0,0,.12); }
  .menu ul ul { position: static; visibility: visible; width: 100%; height: auto; padding: 0; }
  .menu ul ul a { padding-left: 30px; }
  .navigation-ready .menu ul ul { display: none; }
  .navigation-ready .menu li.submenu-open > ul { display: block; }
  .submenu-toggle { width: 46px; min-height: 46px; }
  .site-shell .foot { grid-row: 5; text-align: left; padding-right: 46px; }
  #cookieChoiceInfo { box-sizing: border-box; max-width: 100%; max-height: 40vh; overflow-y: auto; font-size: .875rem; line-height: 1.5; padding: 12px !important; }
}

/* Visualizzatore delle immagini: il dialogo occupa la finestra del dispositivo. */
html.gallery-open, html.gallery-open body { overflow: hidden; }
.image-viewer { box-sizing: border-box; position: fixed; inset: 0; width: 100%; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; color: #fff; background: #171310; }
.image-viewer[open] { display: flex; flex-direction: column; }
.image-viewer::backdrop { background: rgba(0,0,0,.85); }
.image-viewer * { box-sizing: border-box; color: inherit; }
.image-viewer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); }
.image-viewer-title { margin: 0; font: 600 1rem/1.4 Arial, Helvetica, sans-serif; }
.image-viewer button { min-width: 48px; min-height: 44px; padding: 10px 14px; border: 1px solid #9b8976; border-radius: 3px; background: #2b231d; color: #fff; font: 1rem/1.35 Arial, Helvetica, sans-serif; cursor: pointer; }
.image-viewer button:hover { background: #4b392b; }
.image-viewer button:focus-visible { outline: 3px solid #ffd733; outline-offset: 2px; }
.image-stage { display: flex; flex: 1 1 0; align-items: center; justify-content: center; position: relative; min-width: 0; min-height: 0; margin: 0; padding: 0 12px; overflow: hidden; touch-action: pan-y pinch-zoom; user-select: none; }
.image-stage img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.image-viewer-caption { max-height: 20vh; max-height: 20dvh; overflow-y: auto; padding: 10px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); font: 1rem/1.4 Arial, Helvetica, sans-serif; text-align: center; }
.image-viewer-caption:empty { display: none; }
.image-viewer-navigation { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.image-viewer-counter { min-width: 60px; text-align: center; font: 1rem/1.4 Arial, Helvetica, sans-serif; }
.image-viewer-error { position: absolute; inset: 30% 16px auto; text-align: center; font: 1rem/1.5 Arial, Helvetica, sans-serif; }
.image-viewer-error[hidden] { display: none; }
@media (max-width: 400px) {
  .image-viewer-navigation { gap: 8px; padding-left: 10px; padding-right: 10px; }
  .image-viewer-navigation button { padding: 10px; font-size: .875rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Le citazioni del gestionale restano leggibili anche su schermi stretti. */
@media (max-width: 980px) {
  #carrusel .jcarousel-texto { position: static; max-height: none; overflow: visible; padding: 10px 12px; background-color: rgba(45,38,29,.72); }
  #carrusel .jcarousel-texto h1, #carrusel .jcarousel-texto h2, #carrusel .jcarousel-texto h3, #carrusel .jcarousel-texto h4 { margin: 0; padding: 0; font-size: 1rem; line-height: 1.4; }
}
