/* Give content dividers equal breathing room on both sides. Keep the spacing
 * inside each section so child margins cannot move the divider off centre. */
@media screen {
    .main-content .page-section {
        --section-divider-space: clamp(1.5rem, 3vw, 2.5rem);
    }

    .main-content .page-section > section {
        display: flow-root;
        margin-block: 0;
        padding-block: var(--section-divider-space);
        border-top: 1px solid var(--section-rule);
    }

    .main-content #page-teaching > section {
        margin-block: 0;
    }

    .main-content .page-section > section:first-child {
        padding-top: 0;
        border-top: 0;
    }

    .main-content .page-section > section:last-child {
        padding-bottom: 0;
    }

    .main-content .page-section > section > :first-child {
        margin-top: 0;
    }

    .main-content .page-section > section > :last-child {
        margin-bottom: 0;
    }

    /* A final entry's usual row padding must not add to the section gap. */
    .main-content .page-section > section > .entry:last-child,
    .main-content .page-section > section > :is(ul, ol):last-child > .entry:last-child {
        padding-bottom: 0;
    }

    /* The resource collection has a denser scale, shared by all its rules. */
    #page-ai-math {
        --collection-divider-space: 1.2rem;
    }

    #page-ai-math .ai-math-blogs {
        padding-bottom: var(--collection-divider-space);
        margin-bottom: 0;
    }

    #page-ai-math .ai-math-controls {
        margin-top: var(--collection-divider-space);
    }

    #page-ai-math .ai-math-status-row {
        margin-bottom: var(--collection-divider-space);
    }

    #page-ai-math .ai-math-resource {
        padding-block: var(--collection-divider-space);
    }
}

@media screen and (max-width: 700px) {
    #page-ai-math {
        --collection-divider-space: 1rem;
    }
}
