/* ===== BCC Pontassieve – stili condivisi ===== */
body {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  background-color: #ffffff;
  overflow-wrap: break-word;
}
img, svg, video, table { max-width: 100%; }
input, select, textarea, button { font-family: inherit; }
.font-cursive { font-family: 'Caveat', 'Brush Script MT', cursive; }

.bg-bcc-green-dark { background-color: #4a7a49; }
.bg-bcc-green { background-color: #417b44; }
.bg-bcc-green-light { background-color: #79a13f; }
.text-bcc-green { color: #417b44; }
.text-bcc-blue { color: #28377b; }
.bg-bcc-blue { background-color: #28377b; }
.border-bcc-blue { border-color: #28377b; }
.text-bcc-service-icon { color: #5a7092; }
.border-bcc-service-icon { border-color: #5a7092; }

.widget-shadow { box-shadow: 2px 4px 15px rgba(0,0,0,0.1); }

/* Breadcrumb */
.breadcrumb { font-size: 13px; color: #6b7280; }
.breadcrumb a { color: #417b44; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span.sep { margin: 0 .5rem; color: #9ca3af; }

/* Page hero */
.page-hero {
  background: linear-gradient(135deg, #417b44 0%, #355f38 60%, #28377b 160%);
  color: #fff;
  padding: 3.5rem 1.5rem 3rem;
}
.page-hero h1 { font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1.05; margin: 0 0 .75rem; font-weight: 700; overflow-wrap: break-word; hyphens: auto; }
.page-hero p { font-size: clamp(1rem, 2vw, 1.25rem); max-width: 52rem; margin: 0; opacity: .95; }

/* Prose */
.prose-bcc { max-width: 52rem; margin: 0 auto; color: #374151; line-height: 1.75; font-size: 1.05rem; }
.prose-bcc h2 { color: #28377b; font-size: 1.75rem; margin: 2.5rem 0 1rem; line-height: 1.2; }
.prose-bcc h3 { color: #417b44; font-size: 1.25rem; margin: 2rem 0 .75rem; }
.prose-bcc p { margin: 0 0 1.1rem; }
.prose-bcc ul, .prose-bcc ol { margin: 0 0 1.25rem; padding-left: 1.4rem; }
.prose-bcc li { margin-bottom: .5rem; }
.prose-bcc a { color: #417b44; font-weight: 600; }

/* Cards grid */
.card-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  padding: 1.75rem;
  box-shadow: 0 2px 15px rgba(0,0,0,.05);
  transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: 0 10px 30px rgba(0,0,0,.09); transform: translateY(-2px); }
.card h3 { color: #28377b; font-size: 1.15rem; margin: 0 0 .6rem; }
.card p { color: #4b5563; margin: 0; font-size: .97rem; line-height: 1.6; }

/* Buttons */
.btn-primary {
  display: inline-flex; align-items: center; gap: .5rem;
  background: #417b44; color: #fff; font-weight: 700;
  padding: .75rem 1.5rem; border-radius: 9999px; text-decoration: none;
  transition: background .2s; border: none; cursor: pointer; font-size: .95rem;
}
.btn-primary:hover { background: #366039; }
.btn-outline {
  display: inline-flex; align-items: center; gap: .5rem;
  background: transparent; color: #28377b; font-weight: 700;
  padding: .7rem 1.4rem; border-radius: 9999px; text-decoration: none;
  border: 2px solid #28377b; transition: background .2s, color .2s; cursor: pointer; font-size: .95rem;
}
.btn-outline:hover { background: #28377b; color: #fff; }

/* Forms */
.form-grid { display: grid; gap: 1.1rem; grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.field label { display: block; font-size: .85rem; font-weight: 700; color: #374151; margin-bottom: .35rem; }
.field input, .field select, .field textarea {
  width: 100%; box-sizing: border-box;
  border: 1px solid #d1d5db; border-radius: .6rem; padding: .7rem .85rem;
  font-size: .95rem; color: #111827; background: #fff; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: #417b44; box-shadow: 0 0 0 3px rgba(65,123,68,.15);
}
.field textarea { min-height: 7rem; resize: vertical; }

.notice {
  background: #f0f7ee; border-left: 4px solid #417b44; color: #294f2b;
  padding: 1rem 1.25rem; border-radius: .5rem; font-size: .95rem; line-height: 1.6;
}
.notice-blue { background: #eef1fa; border-left-color: #28377b; color: #1f2c63; }

/* Tables */
.table-bcc { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table-bcc th { text-align: left; background: #f4f6f4; color: #28377b; padding: .8rem 1rem; font-weight: 700; border-bottom: 2px solid #e5e7eb; }
.table-bcc td { padding: .8rem 1rem; border-bottom: 1px solid #eef0f2; color: #374151; vertical-align: top; }

/* Section headings */
.section-title { color: #28377b; font-size: clamp(1.6rem, 3vw, 2.25rem); font-weight: 600; margin: 0 0 1.75rem; }

/* Back to top */
.back-to-top { position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 40; width: 48px; height: 48px; border-radius: 9999px; background: #417b44; color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(0,0,0,.2); cursor: pointer; border: none; opacity: 0; pointer-events: none; transition: opacity .25s; }
.back-to-top.show { opacity: 1; pointer-events: auto; }

/* Mobile menu */
.mobile-menu { display: none; position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.45); }
.mobile-menu.open { display: block; }
.mobile-menu-panel { position: absolute; top: 0; left: 0; bottom: 0; width: min(360px, 88vw); background: #fff; overflow-y: auto; padding: 1.5rem; box-shadow: 8px 0 30px rgba(0,0,0,.25); }
.mobile-menu-panel h4 { color: #28377b; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; margin: 1.25rem 0 .5rem; }
.mobile-menu-panel a { display: block; padding: .55rem .25rem; color: #374151; text-decoration: none; font-weight: 600; font-size: .95rem; border-radius: .4rem; }
.mobile-menu-panel a:hover { background: #f0f7ee; color: #417b44; }

/* Search overlay */
.search-overlay { display: none; position: fixed; inset: 0; z-index: 70; background: rgba(40,55,123,.6); padding: 4rem 1rem; }
.search-overlay.open { display: block; }
.search-box { max-width: 640px; margin: 0 auto; background: #fff; border-radius: 1rem; padding: 1.5rem; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.search-box input { width: 100%; box-sizing: border-box; font-size: 1.1rem; padding: .9rem 1rem; border: 2px solid #28377b; border-radius: .6rem; }
.search-results { margin-top: 1rem; max-height: 60vh; overflow-y: auto; }
.search-results a { display: block; padding: .7rem .5rem; border-bottom: 1px solid #eef0f2; text-decoration: none; color: #374151; }
.search-results a:hover { background: #f0f7ee; }
.search-results a strong { color: #28377b; display: block; font-size: .98rem; }
.search-results a small { color: #6b7280; }

/* ===== Responsive ===== */

/* Tabelle: su mobile diventano schede impilate */
@media (max-width: 640px) {
  .table-bcc thead { display: none; }
  .table-bcc, .table-bcc tbody, .table-bcc tr, .table-bcc td { display: block; width: 100%; box-sizing: border-box; }
  .table-bcc tr { padding: .6rem 0; border-bottom: 1px solid #e5e7eb; }
  .table-bcc td { border: none; padding: .35rem 1rem; }
  .table-bcc td::before {
    content: attr(data-label);
    display: block;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #6b7280;
    margin-bottom: .1rem;
  }
  .table-bcc tr td:first-child { background: #f4f6f4; }
}

/* Hero di pagina */
@media (max-width: 640px) {
  .page-hero {
    padding: 1.75rem 1.1rem 1.6rem;
    margin-left: .75rem !important;
    margin-right: .75rem !important;
    width: auto !important;
    max-width: calc(100% - 1.5rem) !important;
    border-radius: .9rem !important;
  }
  .page-hero h1 { font-size: clamp(1.6rem, 7.8vw, 2.15rem); }
  .breadcrumb { padding-left: 1rem !important; padding-right: 1rem !important; }
  main { padding-left: 1rem !important; padding-right: 1rem !important; padding-top: 1.75rem !important; padding-bottom: 1.75rem !important; }
  .breadcrumb { font-size: 12px; line-height: 1.6; }
  .prose-bcc h2 { font-size: 1.4rem; }
  .prose-bcc h3 { font-size: 1.15rem; }
  .prose-bcc { font-size: 1rem; }
  .section-title { text-align: center; }
}

/* Pulsanti a tutta larghezza su mobile */
@media (max-width: 640px) {
  .btn-primary, .btn-outline { justify-content: center; padding: .85rem 1.4rem; }
  .back-to-top { right: 1rem; width: 44px; height: 44px; }
  .btn-primary, .btn-outline { width: 100%; box-sizing: border-box; }
  /* griglie a due colonne che non hanno già una variante mobile */
  .grid-cols-2.gap-10 { grid-template-columns: minmax(0, 1fr) !important; }
  .card { padding: 1.25rem; }
  .card-grid { gap: 1rem; grid-template-columns: 1fr; }
  .form-grid { gap: .9rem; }
  form.p-8, .p-8 { padding: 1.25rem !important; }
  .section-title { font-size: clamp(1.4rem, 6vw, 1.8rem); }
  .prose-bcc { font-size: .98rem; line-height: 1.7; }
  .notice { padding: .85rem 1rem; font-size: .9rem; }
}

/* Tablet / telefono in orizzontale */
@media (max-width: 767px) {
  img, video, iframe { height: auto; }
}

/* ===== Barra legale (TRASPARENZA, OBBLIGAZIONI, …) e footer ===== */
@media (max-width: 767px) {
  .legal-bar ul { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .1rem !important; text-align: center; }
  .legal-bar li a { display: block; padding: .55rem .25rem; font-size: 10.5px; line-height: 1.3; }
  .site-footer { padding-top: 2.25rem; padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)); }
  .site-footer-inst { padding-left: 1rem; padding-right: 1rem; }
  /* il pulsante "torna su" fisso (nav.js) basta: nasconde il duplicato nel footer */
  .site-footer button[data-back-to-top] { display: none; }
}

/* ===== Barra di accesso rapido in basso (widget laterale su mobile) ===== */
.bcc-quickbar { display: none; }

@media (max-width: 767px) {
  /* spazio in fondo per la barra fissa */
  body { padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)); }
  .mobile-menu-panel { padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px)); }
  .back-to-top { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }

  .bcc-quickbar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 55;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -4px 18px rgba(0,0,0,.08);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .bcc-quickbar a {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .15rem;
    min-height: 56px;
    padding: .4rem .25rem;
    font-size: 11px;
    font-weight: 700;
    color: #374151;
    text-decoration: none;
    border-right: 1px solid #f0f0f0;
  }
  .bcc-quickbar a:last-child { border-right: 0; }
  .bcc-quickbar a:active { background: #f0f7ee; color: #417b44; }
  .bcc-quickbar svg { width: 22px; height: 22px; color: #28377b; }
}
@media (max-width: 1023px) {
  /* la barra di accesso rapido sostituisce il widget laterale */
  .bcc-side-widget { display: none !important; }
}
/* il pop-up di chiamata deve stare sopra la barra in basso */
#call-modal { z-index: 9999 !important; }

/* ===== Header ===== */
@media (max-width: 767px) {
  .site-header-inner { padding-top: .75rem !important; padding-bottom: .75rem !important; padding-left: 1rem !important; padding-right: 1rem !important; gap: .5rem; }
  .site-header-left { gap: .75rem !important; min-width: 0; }
  .site-header-right { gap: .75rem !important; }
  .site-header-right .hdr-reserved { display: none; }
  .site-header-right .hdr-banca { padding: .55rem .9rem !important; font-size: .8rem !important; }
  .site-logo-badge { padding: .25rem .4rem !important; }
  .site-logo-badge svg { width: 30px; height: 32px; margin-right: .35rem !important; }
  .site-logo-badge .logo-bcc { font-size: 1.25rem !important; }
  .site-logo-badge .logo-city { font-size: 1rem !important; padding: .3rem .5rem !important; margin-left: .35rem !important; }
  .site-logo-badge .logo-tag { display: none; }
}
@media (max-width: 400px) {
  .site-logo-badge .logo-city { font-size: .9rem !important; }
  .hdr-menu-label { display: none; }
}

/* ===== Home page ===== */
@media (max-width: 767px) {
  .home-hero-text { padding: 2.25rem 1.25rem !important; }
  .home-hero-title { font-size: clamp(2.6rem, 13vw, 3.5rem) !important; line-height: .9 !important; }
  .home-hero-badge { right: 0 !important; bottom: -1.2rem !important; white-space: normal; max-width: 100%; }
  .home-hero-sub { font-size: clamp(1.05rem, 4.5vw, 1.3rem) !important; }
  .home-hero-media { min-height: 220px; }
  .home-h2 { font-size: clamp(1.7rem, 7.5vw, 2.25rem) !important; margin-bottom: 2rem !important; }
  .home-evidence { height: auto !important; min-height: 420px; }
  .home-news-card { padding: 1.1rem 1rem !important; gap: .4rem !important; }
  .home-news-card .news-date span.n { font-size: 1.8rem !important; }
  .home-news-card .news-date span.m, .home-news-card .news-date span.y { font-size: 1rem !important; }
  .home-news-card .news-sep { width: .4rem !important; }
  .home-news-card h3 { font-size: 1.1rem !important; padding-right: 0 !important; margin-bottom: 1rem !important; }
  .home-legend { padding: 0 1rem; }
}
@media (max-width: 767px) and (min-width: 400px) {
  .home-cat-grid { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .home-cat-grid > a { width: auto !important; }
}
@media (max-width: 399px) {
  .home-cat-grid { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-cat-grid > a { width: auto !important; }
}
