:root {
    --sps-readable-width: 1023px;
    --sps-title-max: 5rem;
}

/* Site-wide title ceiling. */
.sps-home-hero__title {
    font-size: clamp(3.5rem, 5.4vw, var(--sps-title-max)) !important;
}

.sps-service-single__hero-copy h1 {
    font-size: clamp(4.2rem, 6.4vw, var(--sps-title-max)) !important;
}

/* Override the legacy 760px generic rule from style.css. */
.site-main > article:not(.page):not(.sps-service-single) > :not(.alignfull):not(.alignwide),
.site-main > article.page > :not(.alignfull):not(.alignwide) {
    width: min(var(--sps-readable-width), calc(100% - 48px)) !important;
}

/* Service pages own their outer layout: hero full width, body wide, copy readable. */
.site-main > article.sps-service-single > .sps-service-single__hero {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.site-main > article.sps-service-single > .sps-service-single__body {
    width: min(1460px, calc(100% - 72px)) !important;
    max-width: none !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.sps-home-hero__inner > *,
.sps-home-hero__title,
.sps-home-hero__lead,
.sps-section__intro {
    max-width: var(--sps-readable-width) !important;
}

.sps-service-single__content > :not(.sps-service-offer):not(.sps-service-cta) {
    width: min(var(--sps-readable-width), 100%) !important;
}

.sps-service-offer h2,
.sps-service-cta h2,
.sps-service-cta p {
    width: min(var(--sps-readable-width), 100%) !important;
    max-width: var(--sps-readable-width) !important;
}

/* Home hero: full viewport width, with content aligned to the site grid. */
.sps-home-hero__layout {
    width: 100% !important;
    max-width: none !important;
    padding-left: max(32px, calc((100vw - 1460px) / 2));
    padding-right: 0;
}

.sps-home-hero__media {
    max-width: none !important;
}

/* Service hero: full viewport width, copy aligned to the site grid, media reaches the right edge. */
.sps-service-single__hero-inner {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding-left: max(32px, calc((100vw - 1460px) / 2));
}

.sps-service-single__hero-copy {
    max-width: var(--sps-readable-width);
}

.sps-service-single__hero-media {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* 1023px is the site-wide tablet breakpoint. */
@media (max-width: 1023px) {
    .sps-shell {
        width: min(100% - 32px, 1320px);
    }

    .site-header__inner {
        min-height: 78px;
    }

    .site-header__phone {
        display: none;
    }

    .menu-toggle {
        min-height: 46px;
    }

    .site-drawer {
        width: 100%;
        padding: 24px;
    }

    .site-drawer__brand {
        max-width: 240px;
        font-size: 0.78rem;
    }

    .primary-menu li {
        grid-template-columns: 34px 1fr;
    }

    .primary-menu a {
        font-size: clamp(2rem, 11vw, 3rem);
    }

    .site-header .custom-logo {
        height: 58px;
        max-height: 58px;
    }

    .site-branding__description {
        display: none;
    }

    .site-footer__brand .custom-logo {
        height: 92px;
        max-height: 92px;
    }

    .sps-home-hero__layout {
        display: flex !important;
        flex-direction: column;
        width: 100% !important;
        max-width: none !important;
        padding: 0;
        gap: 52px !important;
    }

    .sps-home-hero__copy {
        width: 100%;
        padding-inline: 16px;
    }

    .sps-home-hero__media {
        width: 100%;
        min-height: min(118vw, 650px);
    }

    .sps-home-hero__title {
        max-width: var(--sps-readable-width) !important;
        font-size: clamp(3rem, 10vw, 4.8rem) !important;
    }

    .sps-section--services > .sps-shell,
    .sps-section--intro > .sps-shell,
    .sps-stats-section > .sps-shell,
    .sps-section--heat-pumps > .sps-feature,
    .sps-section--why > .sps-shell,
    .sps-home-cta > .sps-shell {
        width: min(100% - 32px, 1380px) !important;
    }

    .sps-intro-panel {
        display: block !important;
    }

    .sps-intro-panel .sps-section__intro {
        margin-top: 1.5rem;
    }

    .sps-section--heat-pumps .sps-feature {
        display: block !important;
    }

    .sps-service-single__hero-inner {
        grid-template-columns: 1fr !important;
        width: 100% !important;
        padding-left: 0;
        gap: 44px;
    }

    .sps-service-single__hero-copy {
        width: min(100% - 48px, var(--sps-readable-width));
        max-width: var(--sps-readable-width);
        margin-inline: auto;
    }

    .sps-service-single__hero-media {
        width: 100%;
        aspect-ratio: 16 / 9;
        border-radius: 0;
    }

    .site-main > article.sps-service-single > .sps-service-single__body {
        width: min(100% - 48px, 1180px) !important;
    }

    .sps-service-offer ul {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .sps-service-single__hero-copy,
    .site-main > article.sps-service-single > .sps-service-single__body {
        width: min(100% - 32px, var(--sps-readable-width)) !important;
    }

    .sps-service-single__hero-copy h1 {
        font-size: clamp(3rem, 15vw, 4.8rem) !important;
    }

    .sps-service-offer ul {
        grid-template-columns: 1fr;
    }
}
