/* Shared page-heading scale. Loaded after each template's stylesheet. */
#main-content :is(
    .hero h1,
    .about-hero h1,
    .service-hero h1,
    .projects-hero h1,
    .case-heading h1,
    .contact-page__intro h1,
    .blog-hero h1,
    .article-hero h1,
    .axiom-single-article__title,
    .legal-document__header h1
) {
    font-size: 48px;
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -.035em;
    text-wrap: balance;
}

#main-content :is(
    .hero-lede,
    .about-lede,
    .service-hero-copy > p,
    .projects-intro,
    .projects-intro > p,
    .case-lede,
    .case-lede > p,
    .contact-page__intro > p,
    .blog-hero__copy,
    .article-hero > p
) {
    font-size: 20px;
    font-weight: 400;
    line-height: 1.6;
    letter-spacing: normal;
}

@media (max-width: 1050px) {
    #main-content :is(
        .hero h1, .about-hero h1, .service-hero h1,
        .projects-hero h1, .case-heading h1, .contact-page__intro h1,
        .blog-hero h1, .article-hero h1, .axiom-single-article__title,
        .legal-document__header h1
    ) {
        font-size: 48px;
    }
}

@media (max-width: 640px) {
    #main-content :is(
        .hero h1, .about-hero h1, .service-hero h1,
        .projects-hero h1, .case-heading h1, .contact-page__intro h1,
        .blog-hero h1, .article-hero h1, .axiom-single-article__title,
        .legal-document__header h1
    ) {
        font-size: 40px;
    }

    #main-content :is(
        .hero-lede, .about-lede, .service-hero-copy > p,
        .projects-intro, .projects-intro > p, .case-lede, .case-lede > p,
        .contact-page__intro > p, .blog-hero__copy, .article-hero > p
    ) {
        font-size: 19px;
    }
}

/* Keep the homepage's shorter introduction at a comfortable reading width. */
#main-content .hero-lede{max-width:62ch}

/* The title-to-introduction gap belongs to one side, avoiding stacked margins. */
#main-content { --sl-title-description-gap: 24px; }

#main-content :is(
    .hero h1, .about-hero h1, .service-hero h1,
    .projects-hero h1, .case-heading h1, .contact-page__intro h1,
    .blog-hero h1, .article-hero h1
) {
    margin-bottom: var(--sl-title-description-gap);
}

#main-content :is(
    .hero h1 + .hero-lede,
    .about-hero h1 + .about-lede,
    .service-hero h1 + p,
    .projects-hero h1 + .projects-intro,
    .projects-intro > p:first-child,
    .case-heading h1 + .case-lede,
    .case-lede > p:first-child,
    .contact-page__intro h1 + p,
    .blog-hero h1 + .blog-hero__copy,
    .article-hero h1 + p
) {
    margin-top: 0;
}

@media (max-width: 640px) {
    #main-content { --sl-title-description-gap: 20px; }
}

/* Local layout trial: centre desktop copy; use equal outer padding when stacked. */
/* Keep case-study numbers attached to their own heading, not the preceding text. */
#main-content .case-content .case-section-label + h2 { margin-top: 0; }
#main-content .case-body:not(.case-body-expanded) .case-content > section + section { margin-top: 72px; }
@media (max-width: 640px) {
    #main-content .case-body:not(.case-body-expanded) .case-content > section + section { margin-top: 48px; }
}

@media screen {
    #main-content { margin-top: 0; }
    #main-content .hero { margin-top: 0; }
    #main-content :is(.hero-copy, .about-hero-copy, .service-hero-copy,
        .projects-hero, .case-heading, .contact-page__intro, .blog-hero,
        .article-hero, .axiom-single-article__header) > :first-child { margin-top: 0; }
    #main-content .projects-intro > p:last-child { margin-bottom: 0; }
    #main-content.legal-page { padding-top: 0; }
}

@media screen and (min-width: 901px) {
    #main-content .hero-inner {
        display: flex;
        align-items: center;
        min-height: 560px;
        height: auto;
        padding-block: 80px;
    }
    #main-content .hero-copy { padding-block: 0; }

    #main-content .about-hero {
        min-height: 640px;
        padding-block: 80px;
        align-items: center;
    }
    #main-content .about-hero-copy { align-self: center; }

    #main-content .service-hero-inner {
        display: flex;
        align-items: center;
        min-height: 640px;
        padding-block: 80px;
    }
    #main-content .service-hero-copy { padding-block: 0; }
    #main-content .service-hero-animation { top: 50%; transform: translateY(-50%); }

    #main-content .case-hero {
        min-height: 600px;
        padding-block: 80px;
        align-items: center;
    }
    #main-content .case-heading { padding-block: 0; }
    #main-content .case-hero-art { align-self: center; margin-top: 0; }

    #main-content :is(.projects-hero, .blog-hero, .article-hero,
        .axiom-single-article__header) {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        min-height: 360px;
        padding-block: 80px;
    }
    #main-content .contact-page__inner {
        min-height: 0;
        padding-block: 80px;
        align-items: start;
    }
    #main-content .legal-document__header {
        display: flex;
        align-items: center;
        min-height: 280px;
        padding-block: 80px;
    }
}

@media screen and (max-width: 900px) {
    #main-content :is(.hero-inner, .about-hero, .service-hero-inner,
        .case-hero, .projects-hero, .blog-hero, .article-hero,
        .axiom-single-article__header, .contact-page__inner,
        .legal-document__header) {
        min-height: 0;
        height: auto;
        padding-block: 74px;
    }
    #main-content .hero-inner { display: block; }
    #main-content :is(.hero-copy, .service-hero-copy, .case-heading) { padding-block: 0; }
    #main-content .about-hero-copy { align-self: start; }
    #main-content .case-hero { row-gap: 40px; }
    #main-content .case-hero-art { margin-top: 0; }

    /* Flow and visual height stay in sync, so the bottom padding remains real. */
    #main-content .service-hero-animation {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        width: min(540px, calc(100% - 56px));
        height: 470px;
        margin: 40px auto -66px;
        transform: scale(.86);
        transform-origin: top center;
    }
}

@media screen and (max-width: 640px) {
    #main-content .service-hero-animation {
        width: calc(100% - 20px);
        margin-bottom: -141px;
        transform: scale(.7);
    }
    #main-content .meta-results-card {
        left: 120px;
        right: auto;
        width: 260px;
    }
}

/* Keep every contact option and both languages visible on narrow phones. */
@media screen and (max-width: 360px) {
    body .site-nav .nav-inner { padding-inline: 12px; gap: 4px; }
    body .site-nav .wordmark { font-size: 18px; }
    body .site-nav .nav-toggle { width: 32px; min-width: 32px; }
}


@media screen and (max-width: 360px) {
    body .site-nav .nav-contact-actions .sl-nav-call { font-size: 10px; padding-inline: 4px; }
    body .site-nav .language-switcher > a:last-child::before { margin-inline: 4px; }
}
