/* Consensus Economics — 1440px desktop layout system.
 * 1440px: outer masthead/navigation/site rail.
 * 1360px: wide content grids, directories, information pages and footer.
 * Scoped to wide desktops: tablet/mobile layouts remain unchanged.
 * This layer loads after canonical page and header owners; the Quicklinks
 * flyout, order/registration forms and editorial hero copy keep their caps.
 */
@media screen and (min-width: 1200px) {
    :root {
        --cei-layout-outer: 1440px;
        --cei-layout-content: 1360px;
        --cei-layout-gutter: 32px;
        /* Header inset and desktop rhythm share this same breakpoint. */
        --cei-header-content-inset: calc(
            (min(var(--cei-layout-outer), calc(100vw - 48px)) -
             min(var(--cei-layout-content), calc(100vw - 64px))) / 2
        );
        --cei-balance-title-ease: clamp(0px, calc(9px - 0.625vw), 1px);
        --cei-balance-hero-ease: clamp(0px, calc(72px - 5vw), 8px);
        --cei-balance-card-height-ease: clamp(0px, calc(63px - 4.375vw), 7px);
        --cei-balance-card-pad-ease: clamp(0px, calc(18px - 1.25vw), 2px);
    }

    /* Global site rail. Preserve percentage-based resizing below the max. */
    .container,
    .wrap {
        width: min(var(--cei-layout-outer), calc(100% - 48px));
        max-width: var(--cei-layout-outer);
        margin-left: auto;
        margin-right: auto;
    }

    /* The desktop header is managed by more specific !important rules. */
    html body .site-header .header-top > .wrap,
    html body .site-header .navigation-top > .wrap,
    html body.cei-faa-index .site-header .header-top > .wrap,
    html body.cei-faa-index .site-header .navigation-top > .wrap {
        width: min(var(--cei-layout-outer), calc(100% - 48px));
        max-width: var(--cei-layout-outer);
        margin-inline: auto;
        box-sizing: border-box;
    }

    /* Homepage hero, catalogues and card-grid rails. */
    body.customtheme-front-page .entry-content .container,
    body.home .cei-home-shell,
    .home .cei-home-shell,
    .front-page .cei-home-shell,
    .home .home-data-delivery-shell,
    .efp-shell,
    .efc-shell,
    .forecast-surveys-index-modern .fsi-shell,
    .cei-excel-shell,
    .cei-api-shell,
    .cei-news-shell,
    .cei-archive-shell,
    .mi-shell,
    .cei-faa-index-shell,
    .go-shell {
        width: min(var(--cei-layout-content), calc(100% - 64px));
        max-width: var(--cei-layout-content);
        margin-left: auto;
        margin-right: auto;
    }

    /* Left-aligned, two-column interior heroes share one modest desktop inset.
       Centred heroes and full-width section backgrounds stay unaffected. */
    .data-delivery-page .dd-hero > .dd-shell.dd-hero-grid,
    .global-outlook-page .go-hero > .go-shell.go-hero-grid {
        box-sizing: border-box;
        padding-inline-start: 12px;
    }

    /* Homepage call-to-action follows the same content grid. */
    .home .home-prefooter-cta-inner {
        width: min(var(--cei-layout-content), calc(100% - 64px));
        max-width: var(--cei-layout-content);
    }

    /* Global Outlook has its own embedded checkout; its form stays 1120px. */
    .global-outlook-page .go-order-section > .go-shell {
        width: min(1120px, calc(100% - 64px));
        max-width: 1120px;
    }

    /* Institutional page sections. Do not widen the narrower hero copy. */
    :is(.about-modern-stats, .about-modern-section, .about-modern-trust, .about-modern-cta),
    :is(.investor-data-stats, .investor-data-use, .investor-data-core,
        .investor-data-market, .investor-data-files, .investor-data-special,
        .investor-data-access, .investor-data-research, .investor-data-cta),
    :is(.business-info-facts, .business-info-jump, .business-info-section, .business-info-cta),
    :is(.consensus-explainer-definition, .consensus-explainer-section,
        .consensus-explainer-evidence, .consensus-explainer-balance,
        .consensus-explainer-users, .consensus-explainer-cta),
    :is(.schedule-intro-grid, .schedule-section, .schedule-continuous, .schedule-note),
    :is(.faa-proof, .faa-page-nav, .faa-content, .faa-methodology-summary, .faa-footer-cta) {
        width: min(var(--cei-layout-content), calc(100% - 64px));
        max-width: var(--cei-layout-content);
        margin-left: auto;
        margin-right: auto;
    }

    /* High-specificity published schedule overrides also set !important widths. */
    html body .publication-schedule-page :is(.schedule-section, .schedule-continuous, .schedule-note) {
        width: min(var(--cei-layout-content), calc(100% - 64px));
        max-width: var(--cei-layout-content);
    }

    /* Site-wide shared rails for breadcrumbs, evidence, data formats and footers. */
    .cei-breadcrumb-wrap,
    .cei-available-strip__inner,
    .cei-interior-evidence-wrap,
    .site-header .cei-site-announcement__inner,
    .cei-footer-shell,
    .cei-footer-bottom-shell,
    .footer .footer-bottom > .wrap {
        width: min(var(--cei-layout-content), calc(100% - 64px));
        max-width: var(--cei-layout-content);
        margin-left: auto;
        margin-right: auto;
    }

    /* Align the footer's decorative rule to its new content rail. */
    .cei-footer-main::after {
        width: min(var(--cei-layout-content), calc(100% - 64px));
        max-width: var(--cei-layout-content);
    }

    .cei-interior-evidence-wrap {
        box-sizing: border-box;
    }

    /* The utility/popover menu is deliberately not included: its 960px
       compact four-column grid must remain independent of the site rail. */


/* Align desktop header utilities to the narrower content rail.
 * The header/nav shells deliberately remain 1440px so the brand and menu
 * stay put. The right-edge inset equals half the difference between the
 * 1440px outer rail and 1360px content rail at the current viewport width.
 * At 1280px this is 8px; at 1488px+ it is 40px. No hard-coded translate.
 * The tablet and phone headers already have independent compact gutters.
 */

    /* Inset only the right side; leave logo and nav links in place. */
    html body .site-header .header-top > .wrap {
        padding-right: var(--cei-header-content-inset);
    }

    /* Search and Sample CTA terminate at the same content edge as the
       masthead proof widget and the homepage/statistics grid below. */
    html body .site-header .cei-header-smart-tools {
        right: var(--cei-header-content-inset);
    }
}

/* Standard news reading copy stays comfortable as the outer site widens.
 * Specialist research articles retain their existing table-friendly layouts. */
@media screen and (min-width: 1100px) {
    body.cei-news-single:not(.cei-commodity-research-article):not(.cei-fx-research-article):not(.cei-commodity-seasonal-article) .cei-news-article-content {
        max-width: 800px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* =======================================================================
 * 1280–1440px desktop rhythm — site-wide proportional refinement.
 * Scale the 1280px reductions gently into the roomier 1440px design.
 * Only large hero headings, spacious introductory bands and proof/stat cards
 * are affected. Publication detail text, report cards, forms, navigation,
 * transaction flows and all tablet/mobile layouts retain their own styles.
 * ======================================================================= */
@media screen and (min-width: 1200px) {
    /* At 1280px: +1px to headings, +8px to hero space and +7px to
       proof-card height relative to the 1440px refinements. These values
       ease continuously to zero by 1440px (and remain zero above it). */
    /* Homepage: ~2% smaller at 1280px; ~4% smaller at 1440px.
       Top padding eases from 105px to 94px (base desktop was 117px). */
    .cei-home-hero {
        /* 60px at 1280px, 70px at 1440px; maintain 70px above 1440px. */
        padding-top: clamp(48px, calc(6.25vw - 20px), 70px);
    }
    .cei-home-hero__title {
        font-size: clamp(43.2px, calc(3.109vw + 8.93px), 53.7px);
    }

    /* The same quieter display scale across major desktop landing pages. */
    .about-modern-page .about-modern-hero h1,
    .efp-page .efp-hero h1,
    html body .business-info-page .business-info-hero h1,
    .cei-excel-page .cei-excel-hero h1,
    .recent-data-hero h1,
    .go-hero h1,
    .research-bibliography-hero h1 {
        font-size: clamp(36.5px, calc(4.147vw + var(--cei-balance-title-ease)), calc(50px + var(--cei-balance-title-ease)));
    }
    .why-consensus-page .why-consensus-hero h1,
    .dd-hero h1 {
        font-size: clamp(40.3px, calc(4.147vw + var(--cei-balance-title-ease)), calc(55.3px + var(--cei-balance-title-ease)));
    }
    .consensus-explainer-page .consensus-explainer-hero h1,
    .cei-news-hero h1,
    .forecast-surveys-index-modern .fsi-hero h1 {
        font-size: clamp(38.4px, calc(4.05vw + var(--cei-balance-title-ease)), calc(51.65px + var(--cei-balance-title-ease)));
    }
    .cei-api-hero h1 {
        font-size: clamp(38.4px, calc(4.512vw + var(--cei-balance-title-ease)), calc(53.5px + var(--cei-balance-title-ease)));
    }
    .efc-hero h1 {
        font-size: clamp(36.5px, calc(3.686vw + var(--cei-balance-title-ease)), calc(48px + var(--cei-balance-title-ease)));
    }
    .investor-data-hero h1,
    .schedule-hero h1,
    .cei-archive-hero h1 {
        font-size: calc(46px + var(--cei-balance-title-ease));
    }
    .faa-hero h1 {
        font-size: clamp(36.5px, calc(4.33vw + var(--cei-balance-title-ease)), calc(57.1px + var(--cei-balance-title-ease)));
    }
    .cei-faa-index-hero h1 {
        font-size: clamp(34.6px, calc(4.147vw + var(--cei-balance-title-ease)), calc(53.5px + var(--cei-balance-title-ease)));
    }

    /* Reduce deep hero padding only where the original intro is generous. */
    .about-modern-page .about-modern-hero { padding-top: calc(46px + var(--cei-balance-hero-ease)); }
    html body .business-info-page .business-info-hero { padding-top: calc(74px + var(--cei-balance-hero-ease)); }
    .investor-data-hero { padding-top: calc(66px + var(--cei-balance-hero-ease)); }
    .why-consensus-hero { padding-top: calc(46px + var(--cei-balance-hero-ease)); }
    .consensus-explainer-page .consensus-explainer-hero { padding-top: calc(48px + var(--cei-balance-hero-ease)); }
    .schedule-hero { padding-top: calc(64px + var(--cei-balance-hero-ease)); }
    .efp-page .efp-hero { padding-top: calc(40px + var(--cei-balance-hero-ease)); }
    .efc-hero { padding-top: calc(40px + var(--cei-balance-hero-ease)); }
    .dd-hero { padding-top: calc(56px + var(--cei-balance-hero-ease)); }
    .cei-excel-hero { padding-top: calc(46px + var(--cei-balance-hero-ease)); }
    .cei-api-hero { padding-top: calc(66px + var(--cei-balance-hero-ease)); }
    .recent-data-hero { padding-top: calc(52px + var(--cei-balance-hero-ease)); }
    .go-hero { padding-top: calc(60px + var(--cei-balance-hero-ease)); }
    .cei-news-hero { padding-top: calc(50px + var(--cei-balance-hero-ease)); }
    .faa-hero { padding-top: calc(56px + var(--cei-balance-hero-ease)); }
    .research-bibliography-hero { padding-top: calc(42px + var(--cei-balance-hero-ease)); }
    .cei-faa-index-hero .cei-faa-index-shell { padding-top: calc(44px + var(--cei-balance-hero-ease)); }

    /* Proof statistics can be 10–15px shorter without losing their legibility. */
    .cei-home-hero__proof > .cei-home-hero__stat,
    .about-modern-stats > .cei-home-hero__stat {
        min-height: calc(130px + var(--cei-balance-card-height-ease));
        padding: calc(20px + var(--cei-balance-card-pad-ease)) 22px calc(18px + var(--cei-balance-card-pad-ease));
    }
    .investor-data-stats > div,
    .why-consensus-proof > div {
        padding-top: calc(18px + var(--cei-balance-card-pad-ease));
        padding-bottom: calc(16px + var(--cei-balance-card-pad-ease));
    }
    .dd-proof > div {
        min-height: calc(98px + var(--cei-balance-card-height-ease));
        padding-top: calc(16px + var(--cei-balance-card-pad-ease));
        padding-bottom: calc(16px + var(--cei-balance-card-pad-ease));
    }
    .go-hero-proof > div {
        min-height: calc(120px + var(--cei-balance-card-height-ease));
        padding-top: calc(20px + var(--cei-balance-card-pad-ease));
        padding-bottom: calc(18px + var(--cei-balance-card-pad-ease));
    }
    .mi-proof > div,
    .faa-proof > div {
        padding-top: calc(16px + var(--cei-balance-card-pad-ease));
        padding-bottom: calc(14px + var(--cei-balance-card-pad-ease));
    }


/* =======================================================================
 * Editorial typography restraint, wide desktops (1280px and 1440px rails).
 * Intentionally scoped: do not alter body copy, menu text, button labels,
 * country-level data tables, order/registration pages or mobile typography.
 * Hero display sizes above are ~4% quieter, the homepage an extra ~6%.
 * ======================================================================= */

    /* Homepage: retain the two-line composition with a softer bold weight. */
    .cei-home-hero__title {
        font-weight: 500;
    }

    /* The statistics remain the same size; less heavy numerals feel calmer. */
    .cei-home-hero__stat strong,
    .about-modern-stat strong,
    .why-consensus-proof strong {
        font-weight: 600;
    }

    /* Consistent but not oversized display headings on main landing pages. */
    :is(.about-modern-page .about-modern-hero h1,
        .efp-page .efp-hero h1,
        .efc-hero h1,
        .business-info-page .business-info-hero h1,
        .why-consensus-page .why-consensus-hero h1,
        .consensus-explainer-page .consensus-explainer-hero h1,
        .dd-hero h1,
        .cei-excel-page .cei-excel-hero h1,
        .cei-api-hero h1,
        .cei-news-hero h1,
        .cei-archive-hero h1,
        .faa-hero h1,
        .cei-faa-index-hero h1,
        .go-hero h1) {
        font-weight: 600;
    }

    /* Other large entry headings not handled by the original wide scale. */
    .consensus-v2-hero h1 {
        font-size: clamp(40px, 4.8vw, 59.5px);
    }
    .contact-modern-hero h1 {
        font-size: clamp(38px, 4.32vw, 52px);
    }
    .fx-child-modern-hero h1 {
        font-size: clamp(2.26rem, 4.03vw, 3.22rem);
    }

    /* Section headings: typically 2–4% smaller and one weight calmer.
       Precise selectors avoid form legends, tables, navigation and metadata. */
    .about-modern-page .about-modern-section-heading h2,
    .about-modern-page .about-modern-method-copy h2,
    .about-modern-page .about-modern-trust h2 {
        font-size: 25.3px;
        font-weight: 600;
    }
    .efp-section-heading h2,
    .efp-support h2 {
        font-size: 29px;
        font-weight: 600;
    }
    .efp-publications .forecast-section-header h2,
    .efc-section-heading h2 {
        font-size: 31px;
        font-weight: 600;
    }
    .efc-directory-head h2 {
        font-size: 29px;
    }
    .efc-support h2 {
        font-size: 27px;
    }
    .data-delivery-page .dd-section-heading h2 {
        font-size: 30px;
        font-weight: 600;
    }
    .data-delivery-page .dd-section-institutional .dd-heading h2 {
        font-size: clamp(30px, 2.92vw, 37px);
        font-weight: 600;
    }
    .data-delivery-page .dd-process h2 {
        font-size: 28.2px;
        font-weight: 600;
    }
    :is(.consensus-v2-section-heading h2,
        .consensus-v2-process-intro h2,
        .consensus-v2-benchmark h2,
        .consensus-v2-research h2,
        .consensus-v2-cta h2) {
        font-size: clamp(29px, 3.2vw, 42.5px);
        font-weight: 600;
    }
    :is(.why-consensus-intro h2,
        .why-consensus-evidence h2,
        .why-consensus-coverage h2,
        .why-consensus-reliability h2,
        .why-consensus-process h2,
        .why-consensus-cta h2) {
        font-size: clamp(31px, 3.4vw, 44.5px);
        font-weight: 600;
    }
    /* These CTAs and research headings were already smaller than their
       surrounding sections, so they get their own gentle reductions. */
    .consensus-v2-research h2 {
        font-size: 27.2px;
    }
    .consensus-v2-cta h2 {
        font-size: 30px;
    }
    .why-consensus-cta h2 {
        font-size: 29px;
    }

    /* Standard content pages using the shared site type hierarchy. */
    .site-content :where(.entry-content, .entry-summary, .page-content) > h1 {
        font-size: 36.5px;
    }
    .site-content :where(.entry-content, .entry-summary, .page-content) > h2 {
        font-size: 29px;
    }
}

/* =======================================================================
 * Six publication landing pages: consistent, quieter editorial titles.
 * This layer loads after publication-showcase-base.css, whose !important
 * 40–54px heading rule otherwise wins over normal title-size declarations.
 * 38px / 4.18vw / 48px caps publication titles at 48px on desktop.
 * Country forecasts, USA/Current Economics, body copy, line wrapping, and
 * small-screen (<=767px) headings are intentionally unaffected.
 * ======================================================================= */
@media screen and (min-width: 768px) {
    body.single-publications.regional-publication-modern .g7-modern-hero h1,
    body.single-publications.foreign-exchange-modern .g7-modern-hero h1,
    body.single-publications.energy-metals-modern .g7-modern-hero h1 {
        font-size: clamp(38px, 4.18vw, 48px);
    }
}

/* Homepage desktop transition: 48px near 1024px, easing to 60px at 1280px.
 * Keep the existing tablet/phone hero layout unchanged at <=900px. */
@media screen and (min-width: 901px) and (max-width: 1199px) {
    .cei-home-hero {
        padding-top: clamp(48px, calc(6.25vw - 20px), 70px);
    }
}

/* Homepage hero horizontal rhythm: align the headline, introduction, sample CTA
 * and proof cards on one shared inset within the existing content rail.
 * A smaller inset on tablets keeps the current phone layout untouched.
 * Padding is inside the shell, so there is no horizontal page overflow. */
@media screen and (min-width: 768px) {
    .cei-home-hero > .cei-home-hero__grid {
        box-sizing: border-box;
        padding-inline-start: clamp(16px, 2.1vw, 30px);
    }
}

/* Homepage headline wrapping at phone and tablet widths (<=1024px).
 * Keep desktop's deliberate two-line composition unchanged. The same
 * title-line reset previously appeared separately in tablet and phone rules.
 * The tablet-only size and other page headings remain tablet-only. */
@media screen and (max-width: 1024px) {
    html body.home .cei-home-hero__title {
        text-wrap: balance;
    }
    html body.home .cei-home-hero__title .cei-home-hero__title-line {
        display: inline;
        white-space: normal;
    }
}

@media screen and (min-width: 768px) and (max-width: 1024px) {
    html body.home .cei-home-hero__title {
        font-size: clamp(42px, 5.1vw, 46px);
        line-height: 1.1;
    }

    /* Follow the same editorial line-balancing principle on other major
       hero headings; do not alter their sizes, weights or page widths. */
    :is(.about-modern-hero, .efp-hero, .efc-hero,
        .business-info-hero, .why-consensus-hero, .consensus-explainer-hero,
        .dd-hero, .cei-excel-hero, .cei-api-hero, .cei-news-hero,
        .cei-archive-hero, .faa-hero, .cei-faa-index-hero,
        .go-hero, .g7-modern-hero, .contact-modern-hero,
        .fx-child-modern-hero, .schedule-hero, .recent-data-hero,
        .research-bibliography-hero, .investor-data-hero) h1 {
        text-wrap: balance;
    }
}

/* Narrow phones need a slightly more flexible type scale to keep long words
 * readable without stranding a one-word line. This meets the existing 36px
 * heading at larger phone widths and leaves tablets/desktops untouched. */
@media screen and (max-width: 439px) {
    html body.home .cei-home-hero .cei-home-hero__title {
        font-size: clamp(26px, 8.125vw, 36px);
    }
}
