/* V11 - Unified content width and overflow-safe responsive layout
   Loaded LAST on public pages. Keeps the original full-bleed backgrounds and
   every existing service, SEO, footer, directory, article and FAQ component. */
:root {
  --be-page-max: 1200px;
  --be-page-gap: clamp(14px, 2.3vw, 28px);
  --max: var(--be-page-max);
}

/* The page shell is the same width in every section, even where legacy
   inline CSS and individual premium modules previously disagreed. */
body .wrap,
#article.pseo-article-section .wrap,
#faq.pseo-faq-section .pseo-faq-shell,
#bePremiumFooter .be4__wrap {
  width: min(var(--be-page-max), calc(100% - var(--be-page-gap) - var(--be-page-gap))) !important;
  max-width: calc(100% - var(--be-page-gap) - var(--be-page-gap)) !important;
  margin-inline: auto !important;
}

/* Sections intentionally keep their edge-to-edge background colours. */
body main, body main > section, body .topbar, #bePremiumFooter {
  width: 100%; max-width: 100%; min-width: 0;
}
body main > section > .wrap { position: relative; }
body .wrap > *, body .wrap > * > *,
body .articleWrap > *, body .heroText > *, body .twoCol > *,
body .howtoShowcase > *, body .grid > *,
body .serviceList > *, body .categoryGrid > *,
#bePremiumFooter .be4__feature > *, #bePremiumFooter .be4__main > * {
  min-width: 0;
}

/* <figure> has a browser default 40px inline margin: the old hero image
   was 80px narrower than the other sections on wide screens and phones. */
body main .heroBanner {
  margin: 0 !important;
  width: 100%; max-width: 100%;
}
body main figure.imagePanel {
  width: 100%; max-width: 100%;
  margin-inline: 0 !important;
}
/* The portrait how-to illustration is still a deliberate grid column;
   the OUTER section aligns with every other section. */
body main .imagePanel.square {
  max-width: none !important;
}
body main .heroBanner > img,
body main .imagePanel.wide > img {
  display: block; width: 100%; max-width: 100%;
  height: auto; min-height: 0;
  object-fit: contain;
}
body main .howtoImage > img {
  display: block; max-width: 100%; width: 100%;
  object-fit: contain;
}
body main img,
body main video,
body main iframe,
body main canvas,
body main svg {
  max-width: 100%;
}
body main .sectionHead {
  width: 100%; max-width: 100%;
  margin-inline: auto;
}

/* Unbreakable names, long URLs and tables must not force a wider viewport. */
body main .headline, body main .quickCard,
body main .panel, body main .card, body main .prose,
body main .keywordBox, body main .contactBig,
body main .linkBox, body main .catGroup,
body main .pseo-faq-item, body main .pseo-article-toc,
body main .pseo-related-v7, #bePremiumFooter .be4__feature,
#bePremiumFooter .be4__brand {
  min-width: 0; max-width: 100%;
}
body main h1, body main h2, body main h3,
body main p, body main li, body main a,
body main summary, body main figcaption,
#bePremiumFooter a, #bePremiumFooter h2, #bePremiumFooter h3 {
  overflow-wrap: anywhere;
}
body main table, body main pre, body main code {
  max-width: 100%;
}
body main table, body main pre {
  overflow-x: auto;
}
body main .heroText,
body main .twoCol,
body main .articleWrap,
body main .howtoShowcase,
body main .grid,
body main .serviceList {
  max-width: 100%; min-width: 0;
}
body main .ctaRow, body main .navlinks,
body main .chips, body main .catLinks {
  max-width: 100%;
}

@media (max-width: 980px) {
  body main .heroText, body main .twoCol,
  body main .articleWrap, body main .howtoShowcase,
  body main .contactBig {
    grid-template-columns: minmax(0, 1fr);
  }
  body main .howtoImage { height: auto; }
  body main .howtoImage > img { height: auto; min-height: 0; }
}
@media (max-width: 640px) {
  :root { --be-page-gap: 14px; }
  body main .heroBanner,
  body main .imagePanel { border-radius: 18px; }
  body main .heroBanner > img,
  body main .imagePanel.wide > img {
    aspect-ratio: auto !important;
    height: auto !important;
    min-height: 0 !important;
    object-fit: contain !important;
  }
  body main .grid.cards,
  body main .serviceList,
  body main .howtoShowcase .serviceList {
    grid-template-columns: minmax(0, 1fr);
  }
  body main .floatingCta {
    left: var(--be-page-gap);
    right: var(--be-page-gap);
    bottom: max(9px, env(safe-area-inset-bottom));
  }
  /* Bottom contact bar replaces redundant floating SIDE buttons on mobiles. */
  body .sideContact { display: none; }
  body main .btn, body main input, body main select,
  body main textarea { max-width: 100%; }
}
@media (max-width: 370px) {
  body main .heroText, body main .twoCol,
  body main .articleWrap, body main .howtoShowcase { gap: 12px; }
  body main .headline, body main .quickCard,
  body main .panel, body main .prose { padding-inline: 14px; }
  #bePremiumFooter .be4__feature { padding-inline: 15px; }
}
