/* Shared mobile type roles for IDC components. Desktop and embedded widgets are untouched.
 * Component-specific !important declarations reconcile Elementor and shortcode styles
 * that already set important typography or enqueue their CSS after the page head.
 */
@media (max-width: 767px) {
    :root {
        --idc-mobile-title: clamp(28px, 7.7vw, 32px);
        --idc-mobile-hero: clamp(30px, 8.2vw, 36px);
        --idc-mobile-section: clamp(26px, 7.2vw, 30px);
        --idc-mobile-card: clamp(20px, 5.5vw, 22px);
        --idc-mobile-body: 16px;
        --idc-mobile-lead: 18px;
    }

    body :is(.idc-page-header, .idc-executive-hero) h1,
    body .idc-executive-profile__intro h1 {
        font-size: var(--idc-mobile-hero) !important;
        line-height: 1.16 !important;
        overflow-wrap: anywhere;
    }
    body .idc-page-header--compact h1 {
        font-size: var(--idc-mobile-title) !important;
    }

    body :is(
        .idc-about-preview, .idc-about-detail, .idc-about-ethos,
        .idc-stories__header, .idc-impact-stories__header,
        .idc-glance, .idc-sectors, .idc-news__header,
        .idc-investment-home-cta, .idc-impact-explore,
        .idc-news-hub__heading, .idc-all-news__heading,
        .idc-overview-heading, .idc-overview-performance,
        .idc-overview-action, .idc-overview-support-card,
        .idc-executive-section, .idc-executive-profile__biography header,
        .idc-portfolio-directory__intro, .idc-sector-archive__intro,
        .idc-subsidiary-profile__content, .idc-subsidiary-profile__section-heading,
        .idc-subsidiary-profile__related-heading, .idc-subsidiary-profile__news-heading,
        .idc-csr-hub, .idc-csr-single, .idc-events-heading,
        .idc-job-detail-content
    ) h2,
    body .idc-publications-home-section > h2,
    body .idc-video-home > h2 {
        font-size: var(--idc-mobile-section) !important;
        line-height: 1.2 !important;
        overflow-wrap: anywhere;
    }

    /* Elementor editorial headings, excluding the small eyebrow labels. */
    body.page-id-35 .elementor-element:is(.elementor-element-b75d183, .elementor-element-a86681e, .elementor-element-2760ddd) h2,
    body.page-id-36 .elementor-element.elementor-element-4b21948 h2,
    body.page-id-37 .elementor-element.elementor-element-d26327c h2 {
        font-size: var(--idc-mobile-section) !important;
        line-height: 1.2 !important;
        overflow-wrap: anywhere;
    }

    body :is(
        .idc-story, .idc-impact-story-card, .idc-news-lead,
        .idc-all-news-featured, .idc-pub-home__intro, .idc-youtube-latest,
        .idc-csr-story-row__content, .idc-portfolio-sector
    ) h3 {
        font-size: var(--idc-mobile-card) !important;
        line-height: 1.3 !important;
        overflow-wrap: anywhere;
    }
    body .idc-faq-section__item summary {
        font-size: var(--idc-mobile-lead) !important;
        line-height: 1.4 !important;
    }

    body .idc-about-detail__quote blockquote p,
    body .idc-about-detail__direction-grid p,
    body .idc-about-detail__focus-inner > p,
    body .idc-about-ethos__statements p {
        font-size: var(--idc-mobile-lead) !important;
        line-height: 1.55 !important;
    }
    body :is(.idc-faq-section__answer, .idc-executive-profile__prose, .idc-subsidiary-profile__prose, .idc-job-detail-content) :is(p, li) {
        font-size: var(--idc-mobile-body);
        line-height: 1.6;
    }

    /* Consent remains readable without enlarging all footer text. */
    body .idc-newsletter__consent {
        font-size: 14px !important;
        line-height: 1.5 !important;
    }
    body .idc-newsletter input[type="email"] {
        font-size: 16px !important;
    }
    body .idc-global-footer :is(h2, h3) {
        overflow-wrap: anywhere;
    }
    body .idc-global-footer :is(.idc-global-footer__utilities a, .idc-global-footer__contact) {
        font-size: 14px !important;
    }
    body .idc-global-footer__nav a {
        font-size: 14px !important;
        line-height: 1.45 !important;
    }
    body .idc-global-footer__nav h2 {
        font-size: 12px !important;
    }
    body .idc-pub-document__copy small {
        font-size: 12px !important;
    }

    /* Allow long publication names to shrink and wrap inside their grid track. */
    body .idc-pub-featured,
    body .idc-pub-section header {
        min-width: 0;
    }
    body .idc-pub-featured > *,
    body .idc-pub-section header > *,
    body .idc-pub-document__copy {
        min-width: 0;
        overflow-wrap: anywhere;
    }
    body .idc-pub-section header > a,
    body .idc-pub-section header > a i {
        flex-shrink: 0;
    }
}

@media (max-width: 359px) {
    /* Two readable navigation columns instead of three squeezed text columns. */
    body .idc-global-footer__nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    body .idc-global-footer .idc-global-footer__group ul {
        columns: 1 !important;
    }
}
