﻿/* Shared spacing rhythm for public School and Foundation pages. */
:root {
    --oreilly-space-heading: clamp(22px, 2vw, 28px);
}

/* Keep ordinary content sections on one vertical rhythm. Hero, facts,
   statistics, closing panels and calls to action retain their own spacing. */
main:is(
    .school-home:not(.oreilly-leadership),
    .oreilly-leadership,
    .oreilly-about,
    .oreilly-academics,
    .oreilly-admissions:not(.oreilly-personal-record),
    .oreilly-contact,
    .oreilly-campus-page,
    .oreilly-news-story,
    .oreilly-programme-detail,
    .oreilly-personal-record,
    .foundation-story,
    .foundation-about-story,
    .foundation-projects-story,
    .foundation-involved-story,
    .foundation-donate-story,
    .foundation-project-page
) > section:not([class*="hero"]):not([class*="statistics"]):not([class*="facts"]):not([class*="final"]):not([class*="closing"]):not([class*="cta"]):not(.school-home__profile):not(.school-home__contact):not(.school-home__news) {
    padding-block: var(--oreilly-space-section) !important;
}

main.school-home:not(.oreilly-leadership) > section.school-home__profile {
    margin-top: 0 !important;
    padding-top: calc(var(--school-home-quick-half, 77px) + var(--oreilly-space-section)) !important;
    padding-bottom: var(--oreilly-space-section) !important;
}
@media (max-width: 767px) {
    main.school-home:not(.oreilly-leadership) > section.school-home__profile {
        padding-top: var(--oreilly-space-section) !important;
    }
}


main.oreilly-search > section.oreilly-search__hero {
    padding-block: var(--oreilly-space-section) !important;
}

main.foundation-about-story > .foundation-about-story__story {
    padding-block: var(--oreilly-space-section) !important;
}

/* Closing panels use the same outer spacing as the content they follow. */
main.oreilly-academics > .oreilly-academics__cta,
main.oreilly-admissions > .oreilly-admissions__record-cta,
main.foundation-involved-story > .foundation-involved-story__closing,
main.foundation-donate-story > .foundation-donate-story__final,
main.oreilly-search > .oreilly-search__results {
    padding-block: var(--oreilly-space-section) !important;
}

/* Public pages still using the legacy section component. */
.rts-contact.rts-section-padding,
.rts-faq.rts-section-padding,
.rts-campus-life.rts-section-padding {
    padding-block: var(--oreilly-space-section) !important;
}

@media (min-width: 992px) {
    main.foundation-about-story .foundation-about-story__story-grid {
        align-items: stretch;
    }

    main.foundation-about-story .foundation-about-story__story-media {
        display: flex;
        min-height: 100%;
        flex-direction: column;
    }

    main.foundation-about-story .foundation-about-story__story-media img {
        flex: 1 1 auto;
        height: 100%;
        min-height: 0;
        aspect-ratio: auto;
    }
}

/* These elements are content panels rather than standalone page sections. */
main.oreilly-news-detail > .oreilly-news-detail__article,
main.foundation-project-page > .foundation-project-section {
    padding-block: var(--oreilly-space-section) !important;
}
.foundation-project-donation {
    padding-block: var(--oreilly-space-section) !important;
}
main.foundation-project-page > .foundation-project-hero,
main.foundation-project-page > .foundation-project-facts {
    padding-block: 0 !important;
}

/* Keep section heading-to-content gaps consistent across page families. */
:is(
    .oreilly-about__section-heading,
    .oreilly-academics__section-heading,
    .oreilly-admissions__section-heading,
    .oreilly-contact__section-heading,
    .oreilly-campus-gallery__heading,
    .oreilly-news-story__section-heading,
    .foundation-about-story__heading,
    .foundation-story__section-head,
    .foundation-projects-story__section-heading,
    .foundation-projects-story__introduction-heading,
    .foundation-projects-story__impact-heading,
    .foundation-involved-story__section-heading,
    .foundation-donate-story__heading
) {
    margin-bottom: var(--oreilly-space-heading) !important;
}

@media (max-width: 991px) {
    :root {
        --oreilly-space-heading: 26px;
    }
}

@media (max-width: 767px) {
    :root {
        --oreilly-space-heading: 22px;
    }
}

@media (max-width: 767px) {
    body.oreilly-public section {
        padding-inline: 5px !important;
    }

    body.oreilly-public main.oreilly-about > #history.oreilly-about__history {
        padding-inline: 5px !important;
    }
}
