/* Responsive repair: content-led layouts, independent of desktop viewport fitting. */
@media (max-width: 1100px) {
    .sd-reference-hero { height: auto; min-height: 0; padding: 40px 0; }
    .sd-reference-hero > .container { padding-inline: clamp(20px, 4vw, 40px); }
    .sd-reference-hero .banner-grid {
        display: grid; grid-template-columns: minmax(0, 1fr);
        height: auto; min-height: 0; gap: 32px;
    }
    .sd-reference-hero .banner-text,
    .sd-reference-hero .banner-visual { width: 100%; min-width: 0; }
    .sd-reference-hero .hero-title { font-size: clamp(32px, 5.5vw, 48px); }
    .sd-reference-hero .hero-title > span { white-space: normal; }
    .sd-reference-hero .hero-description { font-size: 16px; }
    .sd-reference-hero .sd-hero-story { width: 100%; max-width: 720px; margin: 0 auto; }
    .sd-reference-hero .sd-approved-story-stage { min-height: 0; }
    .sd-reference-hero .banner-btn-group { align-items: stretch; }
    .sd-reference-hero .banner-btn-group > a { flex: 0 1 auto; min-height: 52px; }
    .ec-method.ec-fitted { height: auto; }
    .ec-method.ec-fitted .ec-shell { transform: none; }
}
@media (max-width: 1024px) {
    #why-choose-us .sd-why-waves {
        position: absolute; inset: auto 0 0; width: 100%; height: 180px;
        pointer-events: none; z-index: 0;
    }
    #why-choose-us .sd-why-card-title br { display: block; }
    .container > *, .ec-shell > *, .er-report-shell > *,
    .db-contact-grid > *, .footer-grid > * { min-width: 0; }
}
@media (max-width: 992px) {
    .sd-reference-header .nav-container { position: relative; height: 72px; padding-inline: 20px; }
    .sd-reference-header .mobile-menu-toggle { display: flex; min-width: 44px; min-height: 44px; justify-content: center; }
    .sd-reference-header .mobile-menu-toggle span { background: #13213d; }
    .sd-reference-header .nav-menu { display: none; }
    .sd-reference-header .nav-menu.open {
        display: flex; position: absolute; inset: 100% 0 auto;
        flex-direction: column; align-items: stretch; gap: 4px;
        max-height: calc(100svh - 110px); overflow-y: auto;
        padding: 16px 20px; background: #fff;
        box-shadow: 0 18px 30px rgba(9,24,54,.12);
    }
    .sd-reference-header .nav-menu .nav-item { display: block; padding: 12px 8px; font-size: 16px; }
    .sd-reference-header .nav-item.active::after,
    .sd-reference-header .nav-divider { display: none; }
    .sd-reference-header .btn-nav-talk { margin: 8px 0 0; text-align: center; }
}
@media (max-width: 900px) {
    /* Entry animations must not restore the desktop paper rotations. */
    .er-dossier.animated .er-cover,
    .er-dossier.animated .er-open-report,
    .er-dossier.animated .er-brief,
    .er-dossier.animated .er-retest { animation: none; transform: none; opacity: 1; }
    .er-dossier { grid-template-columns: minmax(0, 1fr); }
    .er-cover, .er-open-report, .er-brief, .er-retest { grid-column: 1; min-width: 0; }
    .er-cover { min-height: 360px; }
    .er-open-report { grid-template-columns: minmax(0, 1fr); min-height: 0; }
    .er-open-report::before { display: none; }
    .er-page { min-height: 0; padding: 24px; }
    .er-page + .er-page { border-top: 1px solid #d7e2ec; }
    .er-page-kicker, .er-finding-title, .er-evidence-head, .er-diff-title { flex-wrap: wrap; gap: 8px; }
    .er-finding-title h3, .er-remediation-page > h3 { font-size: 24px; }
    .er-impact p, .er-remediation-intro, .er-fix-list p { font-size: 16px; line-height: 1.5; }
    .er-impact strong, .er-fix-list strong, .er-brief li strong { font-size: 14px; }
    .er-brief li small { font-size: 14px; line-height: 1.5; }
    .er-evidence code, .er-code-before code, .er-code-after code { font-size: 12px; overflow-wrap: anywhere; }
    .er-validation, .er-page-no, .er-signature { position: static; display: block; width: fit-content; margin-top: 18px; transform: none; }
    .er-brief, .er-retest { min-height: 0; padding: 24px; }
    .er-retest h3 { padding-right: 48px; }
    .er-retest p { max-width: none; font-size: 16px; line-height: 1.5; }
    .er-retest dl div { grid-template-columns: 80px minmax(0, 1fr); font-size: 14px; }
    .er-signature, .er-page-kicker, .er-page-no { font-size: 12px; }
}
@media (max-width: 768px) {
    .container, .sd-reference-hero > .container, .ec-shell { padding-inline: 20px; }
    .sd-reference-header .sd-reference-wordmark { font-size: 25px; }
    .sd-reference-header .brand-logo { min-width: 0; gap: 8px; }
    .sd-reference-header .sd-brand-copy small { font-size: 8px; letter-spacing: .12em; }
    .sd-reference-hero .hero-title { margin-bottom: 20px; line-height: 1.12; }
    .sd-reference-hero .hero-subhead { font-size: 18px; line-height: 1.5; }
    .sd-reference-hero .hero-description { margin-bottom: 24px; line-height: 1.6; }
    .sd-reference-hero .banner-btn-group { flex-direction: column; }
    .sd-reference-hero .banner-btn-group > a { width: 100%; flex: none; padding: 14px 18px; font-size: 16px; justify-content: center; }
    .sd-hero-benefits { gap: 6px 14px; font-size: 14px; line-height: 1.5; }
    .sd-hero-benefits span + span::before { display: none; }
    .sd-hero-stats { margin-top: 24px; padding-top: 20px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .sd-hero-stats > div { padding-right: 8px; }
    .sd-hero-stats > div + div { padding-left: 10px; }
    .sd-hero-stats dd { font-size: 12px; line-height: 1.5; }
    .sd-reference-hero .sd-story-controls { gap: 8px; margin-top: 12px; }
    .sd-reference-hero .sd-story-tabs button { font-size: 12px; flex-direction: column; gap: 4px; min-width: 0; min-height: 52px; }
    #why-choose-us .sd-why-title, #services .db-section-title,
    #industries .sd-sec-title, #pricing .db-section-title,
    .ec-heading h2, .er-report-heading h2 { font-size: clamp(30px, 7.5vw, 38px); line-height: 1.15; }
    #why-choose-us .sd-why-foot { flex-direction: column; align-items: stretch; gap: 20px; }
    #why-choose-us .sd-why-cta { min-width: 0; width: 100%; white-space: normal; text-align: center; }
    #services .db-products-grid { grid-template-columns: minmax(0, 1fr); }
    #services .db-product-desc { display: block; -webkit-line-clamp: unset; min-height: 0; overflow: visible; font-size: 16px; line-height: 1.5; }
    #services .db-product-specs { font-size: 14px; }
    #industries .sd-sec-card p { -webkit-line-clamp: unset; overflow: visible; }
    #pricing .sd-jbody p { max-width: none; font-size: 16px; }
    .ec-timing { max-width: 100%; white-space: normal; line-height: 1.5; }
    .ec-card, .ec-rules, .ec-rules dl { min-width: 0; }
    .ec-card summary { min-height: 44px; align-items: center; font-size: 14px; }
    .ec-output, .ec-phase, .ec-endpoint { font-size: 12px; }
    .ec-endpoint { position: relative; z-index: 2; }
    .ec-rules dl { flex-basis: 100%; }
    .ec-rules dl > div { min-width: 0; padding-inline: 10px; }
    .ec-rules dd { font-size: 14px; overflow-wrap: anywhere; }
    .db-contact-channel-card, .db-form-wrapper { min-width: 0; }
    .db-contact-channel-card a, .footer-contact-info a { overflow-wrap: anywhere; }
    .db-contact-section input, .db-contact-section select,
    .db-contact-section textarea, .newsletter-box input { min-width: 0; max-width: 100%; font-size: 16px; }
    .footer-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 400px) {
    #why-choose-us .sd-why-card { grid-template-columns: 36px minmax(0, 1fr); column-gap: 12px; }
    #why-choose-us .sd-why-icon { width: 32px; height: 32px; }
    .ec-card { padding: 20px; }
    .ec-evidence dl { grid-template-columns: 62px minmax(0, 1fr); }
    .ec-timing { letter-spacing: .04em; }
    .er-report-footer ul { grid-template-columns: minmax(0, 1fr); }
}

/* Testimonials: override the late desktop masonry rules on smaller screens. */
@media (max-width: 1024px) {
    #testimonials { padding: 48px 0; }
    #testimonials .sd-tst-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        columns: auto;
        gap: 18px;
        align-items: start;
    }
    #testimonials .sd-tst-card { min-width: 0; margin: 0; }
}
@media (max-width: 768px) {
    #testimonials { padding: 40px 0; }
    #testimonials .sd-tst-head { margin-bottom: 24px; }
    #testimonials .sd-tst-title { font-size: clamp(28px, 7.5vw, 36px); line-height: 1.15; margin-bottom: 18px; }
    #testimonials .sd-tst-rating { display: flex; flex-direction: column; gap: 10px; }
    #testimonials .sd-tst-score { font-size: 14px; line-height: 1.5; }
    #testimonials .sd-tst-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    #testimonials .sd-tst-card { width: 100%; padding: 24px; }
    #testimonials .sd-tst-quote { font-size: 16px; line-height: 1.6; margin-bottom: 20px; overflow-wrap: break-word; }
    #testimonials .sd-tst-who { align-items: flex-start; }
    #testimonials .sd-tst-name { font-size: 14px; }
    #testimonials .sd-tst-role { font-size: 13px; line-height: 1.45; }
    #testimonials .sd-tst-foot { margin-top: 24px; }
}
