/* 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);
    border-radius: 0;
}

/* Remove padding from group sections in columns */
.wp-block-column .wp-block-group.alignfull[class*="is-style-section-"],
.wp-site-blocks > .wp-block-column .wp-block-group[class*="is-style-section-"],
.wp-site-blocks > .wp-block-template-part > .wp-block-column .wp-block-group[class*="is-style-section-"],
.is-root-container > .wp-block-column > .wp-block-group[class*="is-style-section-"] {
    padding: 0;
    margin-top: var(--wp--preset--spacing--60);
    margin-bottom: var(--wp--preset--spacing--60);
}

.wp-block-column :last-child.wp-block-group.alignfull[class*="is-style-section-"],
.wp-site-blocks > .wp-block-column :last-child.wp-block-group[class*="is-style-section-"],
.wp-site-blocks > .wp-block-template-part > .wp-block-column :last-child.wp-block-group[class*="is-style-section-"],
.is-root-container > .wp-block-column > :last-child.wp-block-group[class*="is-style-section-"] {
    margin-bottom: 0;
}

.wp-block-column :first-child.wp-block-group.alignfull[class*="is-style-section-"],
.wp-site-blocks > .wp-block-column :first-child.wp-block-group[class*="is-style-section-"],
.wp-site-blocks > .wp-block-template-part > .wp-block-column :first-child.wp-block-group[class*="is-style-section-"],
.is-root-container > .wp-block-column > :first-child.wp-block-group[class*="is-style-section-"] {
    margin-top: 0;
}

/* Remove padding from adjacent sections */
.wp-site-blocks > .wp-block-template-part + .wp-block-group:not(.is-style-section-hero-alt),
.wp-site-blocks > .wp-block-group:not(.is-style-section-hero-alt) {
    &[class*="is-style-section-base"]:not([class*="base-variant"]) + .wp-block-group[class*="is-style-section-base"]:not([class*="base-variant"]),
    &[class*="is-style-section-base-variant"] + .wp-block-group[class*="is-style-section-base-variant"],
    &[class*="is-style-section-primary"]:not([class*="primary-dark"]) + .wp-block-group[class*="is-style-section-primary"]:not([class*="primary-dark"]),
    &[class*="is-style-section-primary-dark"] + .wp-block-group[class*="is-style-section-primary-dark"] {
        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) );
}

/* Primary shaped section */
.wp-block-group.is-style-section-primary-shaped {
    position: relative;
    z-index: 0;
    overflow: hidden;
    &::before {
        content: "";
        position: absolute;
        top: 0;
        left: -10%;
        background-image: url(../../../img/shape.png);
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        width: 120%;
        height: 100%;
        transform: translateZ(0);
        z-index: -1;
    }
}

footer.wp-block-template-part .wp-block-group.is-style-section-primary-shaped::before{
    background-position: center top;
    width: 100%;
    left: auto;
    right: 0;
    top: 150px;
    background-size: contain;
}

@media (min-width: 782px) {
    .wp-block-group.is-style-section-primary-shaped::before{
        background-position: right bottom;
        background-size: contain;
        background-repeat: no-repeat;
    }
    footer.wp-block-template-part .wp-block-group.is-style-section-primary-shaped::before{
        background-position: center top;
        background-repeat: cover;
        top: 0;
        width: 30%;
    }
}

/* Bordered section */
.is-style-section-base-variant .wp-block-group.is-style-bordered {
    background: var(--wp--preset--color--base);
}

/* Add margin for groups in post content */
.wp-block-post-content > :not(:first-child).wp-block-group:not(.alignfull),
.wp-block-group.alignfull > :not(:first-child).wp-block-group:not(.alignfull) {
    margin-top: var(--wp--preset--spacing--60);
}

.wp-block-post-content > :not(:last-child).wp-block-group:not(.alignfull),
.wp-block-group.alignfull > :not(:last-child).wp-block-group:not(.alignfull) {
    margin-bottom: var(--wp--preset--spacing--60);

}
/* Make group grid responsive */
@media (max-width: 782px) {
    .wp-block-group.is-layout-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));

        .is-layout-flex {
            grid-column: span 1;
        }
    }
}

/* Hero Alt */
.wp-block-group.is-style-section-hero-alt:has(.is-vertical) {
    overflow: clip;
}
.wp-block-group.is-style-section-hero-alt .wp-block-group.is-vertical {
    position: relative;
    z-index: 3;
    &:has(.wp-block-button):not(:last-child) {
        margin-bottom: 0;
    }
}
.wp-block-group.is-style-section-hero-alt figure.wp-block-image,
.wp-block-group.is-style-section-hero-alt .wp-block-cover {
    position: relative;
    overflow: visible;
    figcaption {
        display: none;
    }
}

.wp-block-group.is-style-section-hero-alt figure.wp-block-image img,
.wp-block-group.is-style-section-hero-alt .wp-block-cover {
    position: relative;
    z-index: 2;
    aspect-ratio: 1200/656;
    object-fit: cover;
    width: 100%;
}

.wp-block-group.is-style-section-hero-alt .wp-block-cover img {
    border-radius: var(--wp--custom--global--border--radius--base);
}

@media (max-width: 782px) {
    .wp-block-group.is-style-section-hero-alt figure.wp-block-image img,
    .wp-block-group.is-style-section-hero-alt .wp-block-cover {
        aspect-ratio: 342/238;
    }
}

.wp-block-group.is-style-section-hero-alt figure.wp-block-image:before,
.wp-block-group.is-style-section-hero-alt .wp-block-cover:before {
    content:'';
    display: block;
    position: absolute;
    width: 100vw;
    height: 50%;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--wp--preset--color--base);
}

.wp-block-group.is-style-section-hero-alt:has(.wp-block-buttons) figure.wp-block-image,
.wp-block-group.is-style-section-hero-alt:has(.wp-block-buttons) .wp-block-cover {
    margin-top: -30px;
}

@media (max-width: 782px) {
    .wp-block-group.is-style-section-hero-alt {
        padding-right: var(--wp--style--root--padding-right) !important;
        padding-left: var(--wp--style--root--padding-left) !important;
    }
}

/* Offset section */
.wp-block-group.is-style-section-offset[class*="is-style-section-"] {
    z-index: 0;
    padding-bottom: 0;
    &:after {
        content: '';
        display: block;
        width: 100%;
        height: var(--wp--preset--spacing--80);
        background: var(--wp--preset--color--base);
        position: absolute;
        bottom: 0;
        left: 0;
        top: auto !important;
        z-index: -1 !important;
    }
    &:has(+ .is-style-section-base-variant):after {
        background: var(--wp--preset--color--base-variant);
    }
    &:has(+ .is-style-section-primary-shaped):after,
    &:has(+ .is-style-section-primary):after {
        background: var(--wp--preset--color--primary);
    }
    &:has(+ .is-style-section-primary-dark):after {
        background: var(--wp--preset--color--primary-dark);
    }
    .wp-block-column:last-child > .wp-block-group {
        min-height: 100%;
    }
}

@media (min-width: 782px) {
    .wp-block-group.is-style-section-offset[class*="is-style-section-"] {
        .wp-block-column:first-child {
            padding-bottom: calc(var(--wp--preset--spacing--80) * 2);
        }    
    }
}

.entry-content > :last-child.wp-block-group.is-style-section-offset[class*="is-style-section-"] {
    margin-bottom: var(--wp--preset--spacing--80);
}

/* Styles next element */
.wp-block-group.is-style-section-hero-alt:has(+ .wp-block-group[class*="is-style-section-primary"]) .wp-block-cover:before,
.wp-block-group.is-style-section-hero-alt:has(+ .wp-block-group[class*="is-style-section-primary-shaped"]) .wp-block-cover:before,
.wp-block-group.is-style-section-hero-alt:has(+ .wp-block-group[class*="is-style-section-primary"]) .wp-block-image:before,
.wp-block-group.is-style-section-hero-alt:has(+ .wp-block-group[class*="is-style-section-primary-shaped"]) .wp-block-image:before {
    background-color: var(--wp--preset--color--primary);
}

.wp-block-group.is-style-section-hero-alt:has(+ .wp-block-group[class*="is-style-section-base-variant"]) .wp-block-cover:before,
.wp-block-group.is-style-section-hero-alt:has(+ .wp-block-group[class*="is-style-bordered"]) .wp-block-cover:before,
.wp-block-group.is-style-section-hero-alt:has(+ .wp-block-group[class*="is-style-bordered"]) .wp-block-image:before,
.wp-block-group.is-style-section-hero-alt:has(+ .wp-block-group[class*="is-style-section-base-variant"]) .wp-block-image:before {
    background-color: var(--wp--preset--color--base-variant);
}

.wp-block-group.is-style-section-hero-alt:has(+ .wp-block-group[class*="is-style-section-primary-dark"]) .wp-block-cover:before,
.wp-block-group.is-style-section-hero-alt:has(+ .wp-block-group[class*="is-style-section-primary-dark"]) .wp-block-image:before {
    background-color: var(--wp--preset--color--primary-dark);
}