/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   Applied globally — all pages share header, hero-box, and footer.
   ═══════════════════════════════════════════════════════════════ */

/* ── Prevent horizontal scroll on ALL screens ──────────────── */

html, body {
    overflow-x: hidden;
}

/* ── Desktop-small ≤ 1100px ────────────────────────────────── */

@media (max-width: 1100px) {
    .mega-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1.75rem;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

/* ── Centred nav headroom · 901–1200px ──────────────────────── */

/* Ten centred nav items need roughly 806px of text plus gaps, which leaves
   under 60px of slack at a 901px viewport — close enough that real font
   metrics would wrap or overflow the sticky header. Tighten the tracking
   and gap through this range so the row always stays on one line. */
@media (min-width: 901px) and (max-width: 1200px) {
    .site-nav {
        gap: 0.8rem;
    }

    .nav-link,
    .mega-toggle {
        font-size: 0.86rem;
    }
}

/* ── Tablet ≤ 900px ────────────────────────────────────────── */

@media (max-width: 900px) {
    /* — Header / Nav —
       The header collapses to a SINGLE row on mobile: the utility bar keeps the
       brand plus the high-value actions, and the nav toggle sits beside it.
       `top: 100%` below is measured against .site-header (which is sticky, so it
       is the containing block) instead of a hardcoded header height — the old
       `top: 64px` broke the moment the header gained a second row. */
    .site-header {
        flex-direction: row;
        align-items: center;
    }

    .header-top {
        flex: 1;
        min-width: 0;
        border-bottom: 0;
        background: none;
    }

    .header-top-inner {
        min-height: 0;
        padding: 0 0.5rem 0 1.25rem;
    }

    .header-main {
        flex: none;
        background: none;
    }

    .header-inner {
        min-height: 0;
        gap: 0;
        justify-content: flex-end;
    }

    .header-actions {
        gap: 0.15rem;
        margin-right: 0;
    }

    .header-action {
        padding: 0.45rem 0.5rem;
    }

    .header-cta {
        padding: 0.45rem 0.8rem;
    }

    .brand-logo {
        height: 42px;
        width: auto;
    }

    .nav-toggle {
        display: flex;
    }

    .site-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0 1.25rem 1.25rem;
        background: #FAF9F6;
        border-bottom: 1px solid var(--color-border);
        box-shadow: var(--shadow-md);
        display: none;
        overflow-y: auto;
        max-height: calc(100vh - 62px);
    }

    .site-nav.is-open {
        display: block;
    }

    .nav-link,
    .mega-toggle {
        width: 100%;
        justify-content: space-between;
        padding: 0.85rem 0;
        font-size: 0.95rem;
        border-bottom: 1px solid var(--color-border);
    }

    .mega-item {
        position: relative;
    }

    .mega-panel {
        position: static;
        display: none;
        padding: 0 0 0.5rem 0.9rem;
        background: #FAF9F6;
        border: 0;
        border-radius: 0 0 var(--radius) var(--radius);
        box-shadow: none;
    }

    .mega-item.is-open .mega-panel,
    .mega-item:focus-within .mega-panel {
        display: block;
    }

    .mega-grid {
        grid-template-columns: 1fr;
        gap: 1.1rem;
        padding: 0.9rem 0.6rem 0.2rem;
    }

    .mega-col a:not(.btn) {
        padding: 0.3rem 0;
    }

    .mega-highlight {
        margin-top: 0.25rem;
    }

    .mega-footer-link {
        margin: 0.4rem 0 0.2rem 0.9rem;
    }

    .page-hero h1 {
        font-size: 1.8rem;
    }

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

    /* — Hero Box — */
    .hero-box {
        padding: 0;
    }

    .hero-box-frame {
        aspect-ratio: auto;
        min-height: 300px;
        padding: 2rem 1.5rem;
    }

    .hero-box-content h1 {
        font-size: 1.75rem;
    }

    .hero-box-content p {
        font-size: 0.95rem;
    }

    .hero-box-actions .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    /* — Stats — */
    .stats-box {
        padding: 1.25rem 1.5rem;
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }

    .stats-text {
        align-items: center;
    }

    /* — Hero Box Note — */
    .hero-box-note {
        padding: 0;
    }
}

/* ── Small tablet / large phone ≤ 700px ────────────────────── */

@media (max-width: 700px) {
    .brand-logo {
        height: 38px;
    }

    .hero-box-note {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }
}

/* ── Mobile ≤ 600px ────────────────────────────────────────── */

@media (max-width: 600px) {
    /* — General — */
    .container {
        padding: 0 0.75rem;
    }

    .brand-logo {
        height: 36px;
    }

    /* — Hero Box — */
    .hero-box {
        padding: 0;
    }

    .hero-box-frame {
        min-height: 280px;
        padding: 1.25rem 1rem;
    }

    .hero-box-content {
        text-align: center;
        max-width: 100%;
    }

    .hero-box-eyebrow {
        font-size: 0.55rem;
        letter-spacing: 0.12em;
        margin-bottom: 0.3rem;
    }

    .hero-box-content h1 {
        font-size: 1.25rem;
        margin-bottom: 0.3rem;
    }

    .hero-box-content p {
        font-size: 0.78rem;
        margin-bottom: 0.6rem;
        line-height: 1.4;
    }

    .hero-box-actions {
        flex-direction: row;
        justify-content: center;
        gap: 0.4rem;
    }

    .hero-box-actions .btn {
        width: auto;
        text-align: center;
        padding: 0.35rem 0.75rem;
        font-size: 0.7rem;
        border-radius: 6px;
    }

    .btn-outline {
        border-width: 1.5px;
    }

    /* — Page Hero — */
    .page-hero {
        padding: 2rem 0;
    }

    .page-hero h1 {
        font-size: 1.4rem;
    }

    /* — Stats — */
    .stats-box {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }

    .stats-value {
        font-size: 1.5rem;
    }

    .stats-logos {
        flex-wrap: wrap;
        justify-content: center;
    }

    .stats-logos img {
        height: 36px;
    }

    /* — Footer — */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding-top: 1.75rem;
        padding-bottom: 1.75rem;
    }

    .footer-cta {
        padding: 1.5rem 0;
    }

    .footer-cta-inner {
        text-align: center;
        align-items: center;
    }

    .footer-cta-text h2 {
        font-size: 1.2rem;
    }

    .footer-cta-text p {
        font-size: 0.85rem;
    }

    .footer-cta-actions {
        width: 100%;
        flex-direction: column;
        align-items: center;
    }

    .footer-cta-actions .btn {
        width: 100%;
        text-align: center;
    }

    .footer-bottom {
        font-size: 0.75rem;
    }

    .footer-brand .brand-name {
        font-size: 1.3rem;
    }

    .site-footer h2 {
        font-size: 0.85rem;
    }

    .footer-col {
        font-size: 0.85rem;
    }
}

/* ── Small phone ≤ 400px ──────────────────────────────────── */

@media (max-width: 400px) {
    .hero-box {
        padding: 0;
    }

    .hero-box-frame {
        min-height: 240px;
        padding: 1rem 0.75rem;
    }

    .hero-box-content h1 {
        font-size: 1.05rem;
    }

    .hero-box-content p {
        font-size: 0.7rem;
    }

    .hero-box-eyebrow {
        font-size: 0.45rem;
    }

    .hero-box-actions .btn {
        font-size: 0.65rem;
        padding: 0.3rem 0.6rem;
    }

    .brand-logo {
        height: 34px;
    }

    /* Icon-only on the narrowest screens, but the label stays in the
       accessibility tree - `display: none` here would strip the accessible
       name and leave three unlabelled buttons. */
    .header-action-label {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
        border: 0;
    }

    .header-action {
        padding: 0.45rem;
    }

    .header-cta {
        padding: 0.45rem 0.7rem;
    }

    .site-nav {
        max-height: calc(100vh - 50px);
    }
}

/* ── Solar calculator ≤ 768px ──────────────────────────────── */

@media (max-width: 768px) {
    /* Single column, stacked: details, then savings, then FAQ — all three stay
       in view; nothing is collapsed or hidden. */
    .solar-calculator-body {
        grid-template-columns: 1fr;
    }

    .solar-calculator-panel.is-results,
    .solar-calculator-panel.is-faq {
        border-left: 0;
        border-top:  1px solid var(--mist-border, #DCE6EE);
    }

    .solar-calculator-header h1 {
        font-size: 1.5rem;
    }

    /* Both CTAs go full width, primary above secondary, 12px apart. */
    .solar-calculate,
    .solar-calculator-actions .solar-btn {
        width:      100%;
        align-self: stretch;
    }

    /* Hero savings number, mobile range: 28–32px. */
    .solar-hero-value {
        font-size: clamp(1.75rem, 8vw, 2rem);
    }
}

/* ── Why choose us tabs ≤ 900px ────────────────────────────── */

@media (max-width: 900px) {
    /* Two tabs per row. */
    .feature-tablist {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Illustration moves above the copy and stops being half the panel. */
    .feature-panel {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .feature-art svg {
        max-width: 420px;
    }
}

/* ── Why choose us tabs ≤ 768px ────────────────────────────── */

@media (max-width: 768px) {
    .feature-header {
        text-align: left;
    }

    /* One tab per row: at this width two per row leaves the hint text wrapping
       onto three lines and the tabs stop lining up. */
    .feature-tablist {
        grid-template-columns: 1fr;
    }

    .feature-tab {
        flex-direction: row;
        align-items: baseline;
        justify-content: space-between;
        gap: 0.75rem;
    }

    .feature-actions {
        flex-direction: column;
    }

    .feature-actions .solar-btn {
        width:      100%;
        align-self: stretch;
    }
}