/* Add padding to group sections */
.wp-block-group.alignfull[class*="is-style-section-"],
.wp-site-blocks > .wp-block-group[class*="is-style-section-"],
.wp-site-blocks > .wp-block-template-part > .wp-block-group[class*="is-style-section-"],
.is-root-container > .wp-block-group[class*="is-style-section-"] {
    padding-top: var(--wp--custom--global--spacing--padding--section);
    padding-bottom: var(--wp--custom--global--spacing--padding--section);
}

/* Remove padding from adjacent sections */
.wp-block-group,
.wp-site-blocks > .wp-block-group {
    &[class*="is-style-section-base"]:not([class*="base-variant"]):not([class*="base-logo"]) + .wp-block-group[class*="is-style-section-base"]:not([class*="base-variant"]):not([class*="base-logo"]),
    &[class*="is-style-section-base-variant"]:not([class*="base-variant-logo"]) + .wp-block-group[class*="is-style-section-base-variant"]:not([class*="base-variant-logo"]),
    &[class*="is-style-section-contrast"] + .wp-block-group[class*="is-style-section-contrast"],
    &[class*="is-style-section-contrast-variant"] + .wp-block-group[class*="is-style-section-contrast-variant"],
    &[class*="is-style-section-primary"] + .wp-block-group[class*="is-style-section-primary"],
    &[class*="is-style-section-secondary"] + .wp-block-group[class*="is-style-section-secondary"] {
        padding-top: 0;
    }
}

/* Remove margin from adjacent sections */
.wp-site-blocks > .wp-block-template-part + .wp-block-group,
.wp-site-blocks > .wp-block-group {
    margin-top: 0;
}

/* Stretch child elements of stack groups to fill the width of the parent */
.wp-block-group.is-vertical > * {
    width: 100%;
}

/* Remove border radius from full width groups */
.wp-block-group.alignfull,
.wp-site-blocks > .wp-block-group,
.wp-site-blocks > .wp-block-template-part > .wp-block-group {
    border-radius: 0;
}

/* Enlarge top attribute of sticky groups */
.wp-block-group.is-position-sticky {
    top: calc( var(--wp--preset--spacing--60) + var(--wp-admin--admin-bar--height,0px) );
    &.alignfull {
        top: calc( 0 + var(--wp-admin--admin-bar--height,0px) );
    }
}

/* Add pseudo elements to sections with logo based block styles */
.wp-block-group[class*="is-style-section-base-dots"],
.wp-block-group[class*="is-style-section-base-logo"],
.wp-block-group[class*="is-style-section-base-variant-dots"],
.wp-block-group[class*="is-style-section-base-variant-logo"],
.wp-block-group[class*="is-style-section-primary-dots"] {
    z-index: 0;

    &:before {
        content: "";
        display: block;
        width: 100%;
        height: 100%;
        aspect-ratio: 1;
        background-image: url(../../../svg/logo-fill-white.svg);
        background-size: contain;
        background-position: right top;
        background-repeat: no-repeat;
        position: absolute;
        top: 0;
        right: 0;
        z-index: -1;
    }

    &.alignwide {
        position: relative;

        &:before {
            left: auto;
            right: var(--wp--preset--spacing--50);
            background-image: url(../../../svg/logo-dots-white-small.svg);
            background-position: bottom right;
            width: 20%;
        }
    }
}

.wp-block-group[class*="is-style-section-base-logo"]:before {
    background-image: url(../../../svg/logo-fill-gray.svg);
}

.wp-block-group[class*="is-style-section-base-variant-dots"]:before,
.wp-block-group[class*="is-style-section-primary-dots"]:before {
    background-image: url(../../../svg/logo-dots-white.svg);
    background-size: 200%;
    aspect-ratio: inherit;
}

@media screen and (min-width: 782px) {

    .wp-block-group[class*="is-style-section-base-dots"]:before,
    .wp-block-group[class*="is-style-section-base-logo"]:before,
    .wp-block-group[class*="is-style-section-base-variant-dots"]:before,
    .wp-block-group[class*="is-style-section-base-variant-logo"]:before {
        width: 40%;
    }

    .wp-block-group[class*="is-style-section-base-variant-dots"]:before,
    .wp-block-group[class*="is-style-section-primary-dots"]:before {
        width: 60%;
        right: auto;
        left: 0;
        background-size: 100%;
    }

    .wp-block-group[class*="is-style-section-primary-dots"].alignwide:before {
        width: 10%;
    }

}

/* Use alternate color for bordered sections in primary section */
.wp-block-group[class*="is-style-section-primary"] .wp-block-group[class*="is-style-bordered-left"] {
    border-left-color: var(--wp--preset--color--contrast);
}

/* Add subtle border to group with orange top border in query loop blocks */
.wp-block-group[class*="is-style-section-base"]:not([class*="base-variant"]) > .wp-block-query .wp-block-group[class*="is-style-bordered-top"] {
    border-left: 1px solid var(--wp--preset--color--base-variant);
    border-right: 1px solid var(--wp--preset--color--base-variant);
    border-bottom: 1px solid var(--wp--preset--color--base-variant);
}