/* ═══════════════════════════════════════════════
   MOBILE FIX - Pagine interne (sidebar Cattolica + main content)
   Adattato a selettori reali: uc-pagewrap*, uc-sidenav*
   Attivo SOLO sotto i 900px - desktop invariato
   ═══════════════════════════════════════════════ */

@media (max-width: 899px) {

  /* Pagewrap: forza colonna singola */
  .uc-pagewrap {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 16px !important;
    padding: 16px !important;
    box-sizing: border-box;
  }

  /* Sidebar Cattolica: full-width, statica, accordion collapsed di default */
  .uc-pagewrap__side {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    position: static !important;
    top: auto !important;
    margin: 0 0 16px 0 !important;
    padding: 0 !important;
    background: #f8f9fa;
    border-bottom: 1px solid #d4d4d4;
    border-radius: 0;
  }

  /* Toggle button (iniettato via JS) */
  .uc-sidenav-mobile-toggle {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 18px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid #d4d4d4;
    font: 600 13px/1.3 -apple-system, "PT Sans", "Open Sans", sans-serif;
    color: #002F56;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
  }
  .uc-sidenav-mobile-toggle::after {
    content: "▾";
    font-size: 14px;
    color: #0050C8;
    transition: transform 0.2s ease;
  }
  .uc-sidenav-mobile-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
  }

  /* Lista uc-sidenav: collapsed di default su mobile */
  .uc-pagewrap__side > .uc-sidenav {
    max-height: 0 !important;
    overflow: hidden !important;
    transition: max-height 0.3s ease, padding 0.3s ease !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
  }
  .uc-pagewrap__side[data-mobile-expanded="true"] > .uc-sidenav {
    max-height: 1500px !important;
    padding: 8px 0 !important;
  }

  /* uc-sidenav rail destro (CSS desktop): nascosto su mobile */
  .uc-pagewrap__side > .uc-sidenav::after {
    display: none !important;
  }

  /* Voci sidenav su mobile */
  .uc-sidenav__item {
    padding: 0 !important;
    border-bottom: 1px solid #e8e8e8 !important;
    border-right: none !important;
  }
  .uc-sidenav__item:last-child {
    border-bottom: none !important;
  }
  .uc-sidenav__item > a,
  .uc-sidenav__item > span {
    display: block !important;
    padding: 14px 18px !important;
    font: 500 15px/1.35 -apple-system, "PT Sans", "Open Sans", sans-serif !important;
    color: #1a1a1a !important;
    text-decoration: none !important;
  }

  /* Voce attiva: navy bold senza bracket SVG */
  .uc-sidenav__item.is-current > span {
    color: #002F56 !important;
    font-weight: 700 !important;
  }
  /* Bracket SVG: nascosta su mobile (è elemento desktop) */
  .uc-sidenav__bracket {
    display: none !important;
  }

  /* Main content: full width, padding zero (pagewrap già gestisce padding) */
  .uc-pagewrap__main {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box;
  }
  .uc-content {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box;
  }

  /* Tipografia interna: previeni overflow */
  .uc-content h1,
  .uc-content h2,
  .uc-content h3,
  .uc-content h4,
  .uc-content p,
  .uc-content li {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
  }

  /* Tabelle: scroll orizzontale invece di overflow */
  .uc-content table,
  .uc-table-wrap {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  .uc-content img {
    max-width: 100%;
    height: auto;
  }
}

/* Default fuori da media query: nascondi toggle */
.uc-sidenav-mobile-toggle {
  display: none;
}

/* HERO VIDEO + STATS — copied from index.html so all internal pages render correctly */
.uc-hero { position: relative; overflow: hidden; min-height: 700px; background: #fff; }
.uc-hero__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.uc-hero__divider { height: 2px; background: #fff; }
@media (max-width: 900px) { .uc-hero { min-height: 500px; } }
@media (max-width: 600px) { .uc-hero { min-height: 360px; } }

.uc-stats { background: #D2EBFF; color: var(--navy, #002F56); padding: 72px 24px; border-top: 1px solid var(--line, #D9DEE4); border-bottom: 1px solid var(--line, #D9DEE4); }
.uc-stats__grid { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.uc-stats__item { text-align: center; padding: 28px 24px; position: relative; }
.uc-stats__item:not(:nth-child(3n))::after {
  content: ""; position: absolute; right: 0; top: 18%; bottom: 18%;
  width: 1px; background: rgba(0,47,86,.32);
}
.uc-stats__icon { display: block; margin: 0 auto 18px; width: 48px; height: 48px; color: var(--navy, #002F56); opacity: .85; }
.uc-stats__icon svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
.uc-stats__num { font: 700 42px/1 var(--brand-serif, Merriweather, Georgia, serif); color: #002F56; letter-spacing: -.02em; margin: 0 0 10px; }
.uc-stats__lbl { font: 400 17px/1.3 var(--brand-serif, Merriweather, Georgia, serif); color: var(--navy, #002F56); margin: 0; }
@media (max-width: 900px) {
  .uc-stats__grid { grid-template-columns: repeat(2,1fr); }
  .uc-stats__item:nth-child(2)::after { display: none; }
  .uc-stats__item:nth-child(-n+2) { border-bottom: 1px dashed rgba(0,47,86,.32); }
  .uc-stats__num { font-size: 36px; }
  .uc-stats__lbl { font-size: 15px; }
}
@media (max-width: 500px) {
  .uc-stats__grid { grid-template-columns: 1fr; }
  .uc-stats__item::after { display: none !important; }
  .uc-stats__item:not(:last-child) { border-bottom: 1px dashed rgba(0,47,86,.32); }
  .uc-stats__num { font-size: 34px; }
}
