/* ======================================================================
   SGS responsive layout rebuild — v3.2.4
   Loaded after every theme stylesheet. This file intentionally owns the
   homepage breakpoints so older, conflicting responsive declarations do
   not create horizontal overflow or unstable grids.
   ====================================================================== */

/* Shared sizing rules */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; }
body { min-width: 320px; overflow-x: hidden; }
img, svg, video, canvas, iframe { max-width: 100%; }
.sgs-main, .sgs-main > section, .sgs-main > div { min-width: 0; }
.sgs-container {
    width: min(100% - 40px, 1440px) !important;
    max-width: 1440px !important;
    margin-inline: auto !important;
    padding-inline: 0 !important;
}
.sgs-hero__grid > *,
.sgs-about__grid > *,
.sgs-export__grid > *,
.sgs-calculator__wrapper > *,
.sgs-comparison__cards > * { min-width: 0; }

/* Large desktop: keep the content readable rather than overly wide. */
@media (min-width: 1441px) {
    .sgs-hero .sgs-container,
    .sgs-products .sgs-container,
    .sgs-about .sgs-container,
    .sgs-benefits .sgs-container,
    .sgs-services .sgs-container,
    .sgs-calculator .sgs-container,
    .sgs-comparison .sgs-container,
    .sgs-steps .sgs-container,
    .sgs-projects .sgs-container,
    .sgs-export .sgs-container,
    .sgs-cta .sgs-container { max-width: 1320px !important; }
}

/* Desktop and laptop */
@media (min-width: 1025px) {
    .sgs-hero__grid { grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr) !important; }
    .sgs-products__grid,
    .sgs-services__grid,
    .sgs-projects__grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
    .sgs-benefits__grid { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
    .sgs-steps__grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
    .sgs-about__grid,
    .sgs-export__grid,
    .sgs-calculator__wrapper,
    .sgs-comparison__cards { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .sgs-hero__image-wrapper, .sgs-hero__image { max-width: 100% !important; }
}

/* Tablet: two-column cards, while feature rows that need room stack. */
@media (min-width: 769px) and (max-width: 1024px) {
    .sgs-container { width: min(100% - 48px, 960px) !important; }
    .sgs-hero__grid,
    .sgs-about__grid,
    .sgs-export__grid,
    .sgs-calculator__wrapper,
    .sgs-comparison__cards { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; gap: 28px !important; }
    .sgs-products__grid,
    .sgs-services__grid,
    .sgs-projects__grid,
    .sgs-steps__grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .sgs-benefits__grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
    .sgs-hero__title { font-size: clamp(2.4rem, 4.2vw, 3.7rem) !important; }
    .sgs-header__nav { gap: 12px !important; }
}

/* Phones */
@media (max-width: 768px) {
    body { font-size: 15px; line-height: 1.8; }
    .sgs-container,
    .sgs-hero .sgs-container { width: calc(100% - 32px) !important; max-width: none !important; }

    .sgs-section,
    .sgs-products, .sgs-about, .sgs-benefits, .sgs-services,
    .sgs-calculator, .sgs-comparison, .sgs-steps, .sgs-projects,
    .sgs-export, .sgs-cta { padding-block: 44px !important; }

    .sgs-section__header { margin-bottom: 24px !important; text-align: center; }
    .sgs-section__title { font-size: clamp(1.6rem, 7vw, 2.15rem) !important; line-height: 1.35 !important; }
    .sgs-section__subtitle { max-width: 34rem; margin-inline: auto; font-size: .9rem; }

    .sgs-hero { min-height: auto !important; padding-block: 24px 44px !important; }
    .sgs-hero__grid { display: flex !important; flex-direction: column-reverse !important; gap: 24px !important; min-height: 0 !important; }
    .sgs-hero__content { width: 100%; max-width: none; text-align: center; }
    .sgs-hero__badge { margin-inline: auto; }
    .sgs-hero__title { font-size: clamp(2.05rem, 9.2vw, 2.8rem) !important; line-height: 1.25 !important; }
    .sgs-hero__desc { max-width: 38rem; margin-inline: auto; font-size: .92rem; }
    .sgs-hero__actions { display: grid !important; grid-template-columns: 1fr !important; gap: 10px !important; }
    .sgs-hero__actions .sgs-btn, .sgs-products__footer .sgs-btn { width: 100%; justify-content: center; }
    .sgs-hero__visual, .sgs-hero__image-wrapper { width: 100% !important; max-width: 100% !important; }
    .sgs-hero__image { width: 100% !important; height: clamp(240px, 62vw, 390px) !important; min-height: 0 !important; object-fit: cover; }
    .sgs-hero__stats { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 8px !important; }
    .sgs-hero__stat { min-width: 0; padding: 10px 5px !important; }
    .sgs-hero__stat-num { font-size: 1.15rem !important; }
    .sgs-hero__stat-label { font-size: .65rem !important; overflow-wrap: anywhere; }

    .sgs-products__grid, .sgs-benefits__grid, .sgs-services__grid,
    .sgs-projects__grid, .sgs-steps__grid, .sgs-testimonials__grid,
    .sgs-safety__grid, .sgs-about__grid, .sgs-export__grid,
    .sgs-calculator__wrapper, .sgs-comparison__cards {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 16px !important;
    }
    .sgs-about__image, .sgs-export__image { order: -1; }
    .sgs-about__image img, .sgs-export__image img { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; }

    .sgs-product-card, .sgs-service-card, .sgs-project-card,
    .sgs-benefit-card, .sgs-step-card, .sgs-comparison__card,
    .sgs-calculator__form, .sgs-calculator__result { min-width: 0; }
    .sgs-product-card__image, .sgs-service-card__image, .sgs-project-card__image { aspect-ratio: 16 / 10; }
    .sgs-product-card__image img, .sgs-service-card__image img, .sgs-project-card__image img { width: 100%; height: 100%; object-fit: cover; }

    .sgs-calculator__form, .sgs-calculator__result { padding: 16px !important; }
    .sgs-calc-toggle, .sgs-calc-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .sgs-calc-actions, .sgs-calc-details { grid-template-columns: 1fr !important; }
    .sgs-comparison__wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .sgs-comparison table { min-width: 620px; }

    .sgs-cta__box { padding: 28px 18px !important; }
    .sgs-cta__actions { display: grid !important; grid-template-columns: 1fr !important; gap: 10px !important; }
    .sgs-cta__btn { width: 100%; justify-content: center; }
}

/* Narrow phones: prevent the three hero stat cards from becoming unusable. */
@media (max-width: 390px) {
    .sgs-container, .sgs-hero .sgs-container { width: calc(100% - 24px) !important; }
    .sgs-hero__stats { grid-template-columns: 1fr !important; max-width: 260px; margin-inline: auto; }
    .sgs-hero__stat { flex-direction: row !important; justify-content: center; gap: 8px; }
    .sgs-hero__stat-label { font-size: .75rem !important; }
}
