/* Sherpa — override post-Webflow (header/footer, gutters, a11y) */

:root {
  --page-gutter: 20px;
}

@media screen and (max-width: 479px) {
  :root {
    --page-gutter: 16px;
  }
}

/* ---- Overflow / media safety ---- */
html {
  overflow-x: clip;
}

body {
  overflow-x: clip;
}

img,
svg,
video,
iframe {
  max-width: 100%;
}

.newsletter-box iframe {
  display: block;
  width: 100% !important;
  max-width: 100%;
}

/* ---- Page gutters (≤991px): content inset, backgrounds stay full-bleed ---- */
@media screen and (max-width: 991px) {
  .section-basic > .wrapper,
  .section-cards > .wrapper,
  .section-img-paragraph > .wrapper,
  .header-section > .w-container {
    box-sizing: border-box;
    padding-left: var(--page-gutter);
    padding-right: var(--page-gutter);
  }

  /* Newsletter: restore horizontal padding (Webflow uses 32px 0 at ≤479) */
  .newsletter-box.centered.with-bg {
    box-sizing: border-box;
    margin-left: var(--page-gutter);
    margin-right: var(--page-gutter);
    padding: 32px var(--page-gutter);
    max-width: calc(100% - (var(--page-gutter) * 2));
  }

  /* Header tablet / mobile */
  .navigation-bar .navigation-wrapper {
    flex-direction: column;
    align-items: stretch;
    padding-left: 0;
    padding-right: 0;
  }

  .navigation-bar .horizontal-flex {
    display: flex;
    flex: 1 1 auto;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 16px;
    box-sizing: border-box;
  }

  .navigation-bar .brand,
  .navigation-bar .brand.w--current {
    position: static;
    left: auto;
    padding-left: 0;
    padding-right: 0;
    display: flex;
    align-items: center;
  }

  .navigation-bar .brand-image {
    display: block;
    height: 36px;
    width: auto;
    max-width: 140px;
    margin: 0;
  }

  .navigation-bar .menu-button.w-nav-button {
    position: static;
    inset: auto;
    margin: 0;
    float: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 10px;
    /* Match logo mark border: #0D655B @ 20% */
    border: 1px solid rgba(13, 101, 91, 0.22);
    border-radius: 10px;
    background-color: transparent;
    line-height: 1;
    color: #1a1a1a;
  }

  .navigation-bar .menu-button.w-nav-button.w--open {
    background-color: rgba(13, 101, 91, 0.08);
    color: #0d655b;
    border-color: rgba(13, 101, 91, 0.35);
  }

  /* Bomberos block: clean stacked layout on tablet */
  #bomberos .horizontal-content,
  .section-img-paragraph.yellow-bg .horizontal-content {
    flex-flow: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 28px;
    width: 100%;
    max-width: 100%;
    padding: 8px 0 0;
  }

  #bomberos .horizontal-card-left-wrapper,
  .section-img-paragraph.yellow-bg .horizontal-card-left-wrapper {
    max-width: 100%;
    width: 100%;
    padding-left: 0;
    align-items: flex-start;
    margin-bottom: 0;
  }

  #bomberos .image-squared-container,
  .section-img-paragraph.yellow-bg .image-squared-container {
    width: 100%;
    max-width: 100%;
    max-height: none;
    aspect-ratio: 4 / 3;
  }

  #bomberos .bomberos-image,
  .section-img-paragraph.yellow-bg .bomberos-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* Decorative absolute graphic clashes in stacked layout */
  #bomberos .absolute-image.bottom-left,
  .section-img-paragraph.yellow-bg .absolute-image.bottom-left {
    display: none;
  }

  /* Valori / split rows: avoid 43% max-width leftover */
  .section-basic .horizontal-wrapper {
    flex-flow: column;
    align-items: stretch;
    gap: 24px;
  }

  .section-basic .horizontal-wrapper .section-split {
    max-width: 100%;
  }

  /* Canali: fill grid tracks (Webflow caps cards at 350px) */
  .section-cards .rounded-card,
  .section-cards .rounded-card.bordered {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .section-cards .three-boxes {
    width: 100%;
    justify-items: stretch;
  }

  /* Footer: stack partner logos vertically */
  .footer .footer-wrapper {
    flex-direction: column;
    align-items: flex-start;
    gap: 32px;
  }

  .footer .footer-right-col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
    margin-top: 0;
    width: 100%;
  }

  .footer .footer-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .footer .footer-column {
    align-items: flex-start;
  }
}

@media screen and (max-width: 767px) {
  .wrapper.centered {
    padding-left: var(--page-gutter);
    padding-right: var(--page-gutter);
  }

  /* Progetti: one card per row */
  #progetti .w-layout-layout.stack-elements,
  #progetti .wf-layout-layout.stack-elements {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
  }

  #progetti .w-layout-cell.cell-layout {
    width: 100%;
    max-width: 100%;
  }

  /* Canali: single full-width column near mobile */
  .section-cards .three-boxes {
    grid-template-columns: 1fr;
    grid-row-gap: 16px;
    padding-left: 0;
    padding-right: 0;
  }

  /* Footer bottom: copyright + social in column */
  .footer .footer-bottom-container.w-layout-hflex,
  .footer .footer-bottom-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 20px;
    width: 100%;
  }

  .footer .social-icon-wrapper {
    flex-wrap: wrap;
  }
}

@media screen and (max-width: 479px) {
  .navigation-bar .brand-image {
    height: 32px;
    max-width: 120px;
  }

  .navigation-bar .menu-button.w-nav-button {
    padding: 8px;
  }

  .newsletter-box.centered.with-bg {
    padding: 32px var(--page-gutter);
  }
}

/* ---- Focus visible (a11y) ---- */
:focus-visible {
  outline: 2px solid #1a1a1a;
  outline-offset: 3px;
}

.w-nav-button:focus {
  outline: none;
}

.w-nav-button:focus-visible {
  outline: 2px solid #1a1a1a;
  outline-offset: 3px;
}

.brand.w-nav-brand:focus-visible {
  outline: 2px solid #1a1a1a;
  outline-offset: 4px;
}

/* ---- Skip link ---- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  padding: 12px 16px;
  background: #0d655b;
  color: #fff;
  font-family: "Work Sans", sans-serif;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 8px 0;
}

.skip-link:focus,
.skip-link:focus-visible {
  left: 0;
  outline: 2px solid #1a1a1a;
  outline-offset: 2px;
}

/* ---- CTA contrast (≥ 4.5:1 on white) ---- */
.primary_btn,
.primary_btn.w-button,
a.primary_btn,
.primary-btn {
  background-color: #0d655b !important;
  color: #fff !important;
}

.primary_btn:hover,
.primary_btn.w-button:hover,
a.primary_btn:hover {
  background-color: #0a524a !important;
  color: #fff !important;
}

.accent-btn,
.accent-btn.w-button,
a.accent-btn {
  background-color: #a64a12 !important;
  color: #fff !important;
}

.accent-btn:hover,
.accent-btn.w-button:hover,
a.accent-btn:hover {
  background-color: #8a3d0f !important;
  color: #fff !important;
  box-shadow: 0 4px 20px -1px rgba(166, 74, 18, 0.35);
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

}

/* ---- Minimal legal footer (corsi / thank-you) ---- */
.footer.footer-minimal {
  background: #1a1a1a;
  padding: 24px var(--page-gutter);
}

.footer.footer-minimal .footer-minimal-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
}

.footer.footer-minimal .pages-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.footer.footer-minimal .link-white {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---- Book description: unify font (override Lato on p) ---- */
.post-content-big .body-copy,
.post-content-big .body-copy p,
.post-content-big .body-copy li,
.post-content-big .body-copy strong,
.post-content-big .body-copy em,
.post-content-big .body-copy a {
  font-family: "Work Sans", sans-serif;
}

/* ---- Nav current state: no layout shift on scroll ---- */
.navigation-bar .brand.w--current,
.navigation-bar .w-nav-brand.w--current {
  border-bottom: none;
}

.navigation-bar .navigation-link {
  border-bottom: 6px solid transparent;
  box-sizing: border-box;
}

.navigation-bar .navigation-link.w--current {
  border-bottom-color: var(--pale-turquoise, #95e9df);
  /* Match default .navigation-link metrics (Webflow zeroes padding / bumps margin) */
  margin-left: 10px;
  margin-right: 10px;
  padding: 15px 0;
  font-weight: 400;
}

@media screen and (max-width: 991px) {
  .navigation-bar .navigation-link.w--current {
    margin-left: 0;
    margin-right: 0;
    padding: 8px 0;
  }
}

@media screen and (max-width: 767px) {
  .navigation-bar .navigation-link.w--current {
    padding: 10px 0;
  }
}

/* ---- Canali / row title+paragraph: top align ---- */
.row-title-paragraph {
  align-items: flex-start;
}

.row-title-paragraph .home-hero-heading-title {
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  line-height: 1.1;
}

.row-title-paragraph .body-text {
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
}

/* ---- Progetti cards: less top padding (was 32px vs 20px sides) ---- */
#progetti .cell-content-wrapper {
  padding: 20px 20px 0;
}

#progetti .cell-content-wrapper.no-padding {
  padding-top: 0;
  padding-bottom: 24px;
}

/* Mobile: space between CTA and image below */
@media screen and (max-width: 767px) {
  #progetti .cell-content-wrapper:not(.no-padding) {
    padding-bottom: 24px;
  }

  #progetti .cell-image-wrapper {
    margin-top: 0;
  }
}
#bomberos .primary-btn,
.section-img-paragraph.yellow-bg .primary-btn {
  margin-top: 24px;
}

/* Bomberos title: keep "di Bomberos Design" together; on desktop start on new line */
#bomberos .bomberos-title-tail {
  white-space: nowrap;
}

@media screen and (min-width: 992px) {
  #bomberos .bomberos-title-tail {
    display: block;
  }
}

/* ---- Libreria: equal-height cards per row + hide "Leggi la scheda" ---- */
.filter_collection-list {
  align-items: stretch;
}

.filter_collection-list > .collection-item-2 {
  display: flex;
  height: 100%;
}

.filter_collection-list .post-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  margin-bottom: 0;
}

.filter_collection-list .post-card {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  height: 100%;
  margin-bottom: 0;
  box-sizing: border-box;
}

.filter_collection-list .post-summary-wrapper,
.filter_collection-list .read-more-link {
  display: none !important;
}
