/**
 * Mobile layout fixes (320–430px+) — causes of overflow, not overflow-x:hidden.
 */
html {
  box-sizing: border-box;
}
*,
*::before,
*::after {
  box-sizing: inherit;
}

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

.ibg-site,
.ibg-ev-page,
.ibg-reg-page {
  max-width: 100%;
}

/* Só no mobile: padding seguro. NÃO forçar max-width:100% no desktop (esticava eventos). */
@media (max-width: 991px) {
  .ibg-site .container,
  .ibg-site .container-fluid,
  .ibg-reg-page .container,
  .ibg-ev-page .container {
    width: 100%;
    max-width: 100%;
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
  }
}

/* Offcanvas: fechado fora da tela; X só dentro do painel aberto */
.ibg-site .fix-area .offcanvas__info {
  position: fixed !important;
  top: 0;
  left: 0;
  height: 100% !important;
  max-width: min(100vw - 2.5rem, 22rem) !important;
  width: min(100vw - 2.5rem, 22rem) !important;
  transform: translateX(-110%) !important;
  transition: transform 0.35s ease !important;
  z-index: 9999;
  visibility: hidden;
}

.ibg-site .fix-area .offcanvas__info.info-open {
  transform: translateX(0) !important;
  visibility: visible;
}

.ibg-site .offcanvas__close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 2;
}

.ibg-site .offcanvas__close button {
  width: 2.5rem !important;
  height: 2.5rem !important;
  border-radius: 999px !important;
  display: inline-grid !important;
  place-items: center !important;
  background: rgba(82, 183, 136, 0.95) !important;
  color: #0a0908 !important;
  border: 0 !important;
  box-shadow: none !important;
}

.ibg-site .offcanvas__overlay {
  display: none;
}
.ibg-site .offcanvas__overlay.overlay-open {
  display: block;
}

@media (max-width: 991px) {
  .ibg-site .header-main,
  .ibg-site .mega-menu-wrapper,
  .ibg-site .header-right {
    min-width: 0;
    max-width: 100%;
  }

  .ibg-site .header-1 .container-fluid {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .ibg-site .logo img,
  .ibg-site .ibg-logo img {
    max-height: 2.4rem;
    width: auto;
  }

  .ibg-site .hero-1,
  .ibg-site .hero-content,
  .ibg-site .swiper,
  .ibg-site .swiper-slide,
  .ibg-site img {
    max-width: 100%;
  }

  .ibg-site .section-title h2,
  .ibg-site h1,
  .ibg-site h2 {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .ibg-site .theme-btn,
  .ibg-reg-page .ibg-reg-submit,
  .ibg-reg-page .theme-btn {
    max-width: 100%;
    white-space: normal;
    text-align: center;
  }

  /* Formulários */
  .ibg-reg-page .ibg-reg-card,
  .ibg-reg-page .ibg-reg-layout,
  .ibg-reg-page .ibg-reg-fields,
  .ibg-reg-page .ibg-reg-field,
  .ibg-reg-page .ibg-reg-control {
    min-width: 0;
    max-width: 100%;
  }

  .ibg-reg-page .ibg-reg-shell,
  .ibg-reg-page .ibg-reg-card,
  .ibg-reg-page .ibg-reg-hero-banner {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .ibg-reg-page input,
  .ibg-reg-page select,
  .ibg-reg-page textarea,
  .ibg-reg-page .ibg-reg-select,
  .ibg-reg-page .ibg-datepicker__display {
    width: 100% !important;
    max-width: 100% !important;
  }

  .ibg-reg-page .ibg-reg-layout {
    grid-template-columns: 1fr !important;
  }

  .ibg-reg-shirt,
  .ibg-reg-chips {
    max-width: 100%;
  }

  /* Cards / grids */
  .ibg-site .ibg-pub-grid,
  .ibg-site .ibg-nm-grid,
  .ibg-site #ministerios .ibg-nm-grid {
    grid-template-columns: 1fr !important;
  }

  .ibg-site .ibg-cta-band__inner,
  .ibg-ev-page .ibg-ev-cta-band__inner {
    flex-direction: column;
    align-items: stretch;
  }

  /* Ofertas donation */
  #ofertas.ibg-ofertas-section {
    padding: 0;
    overflow: visible;
  }

  #ofertas .donation-section {
    padding: 2rem 0.75rem;
  }

  #ofertas .donation-container {
    padding: 1.75rem 1.1rem;
    border-radius: 20px;
    width: 100%;
    max-width: 100%;
  }

  #ofertas .donation-header h2 {
    font-size: clamp(1.85rem, 9vw, 2.6rem) !important;
  }

  #ofertas .donation-content {
    gap: 1.75rem;
  }

  #ofertas .qr-card,
  #ofertas .qr-caption {
    width: min(100%, 300px);
  }

  /* Evento mapa */
  .ibg-ev-loc .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .ibg-ev-loc__map {
    min-height: 0;
    height: auto;
    aspect-ratio: auto;
    border-left: 0;
  }

  .ibg-ev-loc__map-frame {
    aspect-ratio: 16 / 10;
    min-height: 0;
  }

  .ibg-ev-info-bar {
    grid-template-columns: 1fr !important;
  }

  .ibg-ev-hero,
  .ibg-ev-hero__content,
  .ibg-ev-hero__dock,
  .ibg-ev-page .container {
    max-width: 100%;
    min-width: 0;
  }

  .ibg-ev-hero__content,
  .ibg-ev-hero__dock {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .ibg-ev-hero h1 {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .donation-header h2 {
    font-size: clamp(2rem, 10vw, 2.75rem) !important;
  }
}

@media (max-width: 400px) {
  .ibg-site .ibg-lang button {
    padding: 0.3rem 0.45rem;
    font-size: 0.65rem;
  }

  .ibg-site .theme-btn.d-none.d-xl-inline-flex {
    display: none !important;
  }

  #ofertas .donation-header p,
  #ofertas .donation-intro p {
    font-size: 0.9rem;
  }

  .pix-row {
    min-height: 72px;
    gap: 0.75rem;
  }

  .pix-card {
    padding: 0.35rem 0.85rem;
  }
}
