/* Fade and reveal animations for scroll-based element visibility */

/*
 * Fade in on scroll. Content is only hidden while .scroll-reveal-js is on
 * <html> (see inc/enqueue.php) and the visitor hasn't asked for reduced motion,
 * so it stays visible without JavaScript or if the script fails to start.
 */
@media (prefers-reduced-motion: no-preference) {
    .scroll-reveal-js .fade-section,
    .scroll-reveal-js .is-style-fade-in-scroll {
        transition: opacity 0.5s ease-in-out;
        opacity: 0;
    }

    .scroll-reveal-js .fade-section.reveal,
    .scroll-reveal-js .is-style-fade-in-scroll.reveal {
        opacity: 1;
    }

    /*
     * Images in a Columns block inside a fade section fade in one after another
     * once the section is revealed. --scroll-reveal-stagger (0, 1, 2...) is set
     * per image by assets/js/scroll-reveal.js. The delay only applies on the way
     * in, so a replaying section still fades its images out together.
     */
    .scroll-reveal-js .fade-section .wp-block-columns .wp-block-image:not(.fade-section),
    .scroll-reveal-js .is-style-fade-in-scroll .wp-block-columns .wp-block-image:not(.fade-section) {
        transition: opacity 0.5s ease-in-out;
        opacity: 0;
    }

    .scroll-reveal-js .fade-section.reveal .wp-block-columns .wp-block-image:not(.fade-section),
    .scroll-reveal-js .is-style-fade-in-scroll.reveal .wp-block-columns .wp-block-image:not(.fade-section) {
        opacity: 1;
        transition-delay: calc(var(--scroll-reveal-stagger, 0) * 300ms);
    }
}

.fade-text {
    opacity: 0;
}

.fade-image {
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}

.fade-out {
    opacity: 0;
}

.wp-block-image.fade-image {
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
}

.wp-block-image.fade-image.is-visible {
    opacity: 1;
}

.is-fading {
    opacity: 0;
}

/* Sticky/parallax panel CSS */

.section-wrapper {
    position: relative;
    z-index: 10;
}

.section-wrapper .img-bg .sticky-wrapper {
    position: sticky;
    top: 0;
    margin-left: auto;
    width: 100%;
    height: 100vh;
}

.img-bg {
    position: absolute;
    top: 0;
    height: 100%;
    z-index: 1;
}

.half {
    width: 50%;
}

.sixty {
    width: 60%;
}

.full {
    width: 100%;
    z-index: -1;
}

.full.overlay {
    z-index: 100;
}

.right {
    right: 0;
    left: auto;
}

.left {
    left: 0;
    right: auto;
}

.top {
    top: 0;
    left: 0;
    right: 0;
}

.bottom {
    bottom: 0;
    left: 0;
    right: 0;
}

.section-wrapper .img-bg.top .sticky-wrapper,
.section-wrapper .img-bg.bottom .sticky-wrapper {
    height: 50vh;
}

.section-wrapper .img-bg .sticky-wrapper img {
    transition: opacity 0.8s ease-in-out;
    position: absolute;
    bottom: 0px;
}

.section-wrapper.strech-height .img-bg .sticky-wrapper img {
    overflow: hidden;
}

.section-wrapper.strech-height .img-bg .sticky-wrapper img {
    top: 0;
    height: 100%;
    width: auto;
    right: 0;
    max-width: none;
}

.section-wrapper.strech-height .img-bg.full .sticky-wrapper img {
    height: auto;
    width: 100%;
    max-width: none;
}

.section-wrapper .img-bg .sticky-wrapper img.fade-image {
    opacity: 1;
}

.section-wrapper .img-bg .sticky-wrapper img.is-fading {
    opacity: 0;
}

.section-wrapper .img-bg.full .sticky-wrapper img {
    position: absolute;
    height: 100vh;
    width: auto;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    object-fit: cover;
}

.section-wrapper .img-bg.full.top .sticky-wrapper img,
.section-wrapper .img-bg.full.bottom .sticky-wrapper img {
    height: 50vh;
}

.section-wrapper .img-bg .sticky-wrapper .text-container {
    padding: 50px 0;
    display: flex;
    align-items: center;
    text-align: center;
    height: 100vh;
}

.section-wrapper .img-bg.full.top .sticky-wrapper .text-container {
    height: 50vh;
}

.section-wrapper .img-bg.full.bottom .sticky-wrapper .text-container {
    height: 50vh;
}

.section-wrapper .img-bg .sticky-wrapper .text-wrapper {
    transition: opacity 0.8s ease-in-out;
    opacity: 1;
    width: 100%;
}

.section-wrapper .img-bg.full .sticky-wrapper .text-wrapper {
    max-width: 50%;
    margin: 0 auto;
}

.section-wrapper .img-bg .sticky-wrapper .text-wrapper.is-fading {
    opacity: 0;
}

.overlay.highlight {
    position: absolute;
    bottom: 25px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    left: 0;
    right: 0;
    padding: 0 30px;
}

.overlay.highlight .wp-block-group__inner-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.overlay.highlight p.light-blue {
    width: fit-content;
    max-width: 100%;
    background: var(--color-ubc-medium-blue);
    padding: .15em .35em;
}

.overlay.highlight p {
    width: fit-content;
    max-width: 100%;
    background: var(--color-ubc-blue);
    color: #fff;
    margin-bottom: 0;
    padding: .15em .35em;
}

.overlay-block {
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 101;
    background: #fff;
    display: flex;
    justify-content: center;
    flex-direction: column;
    transition: opacity 0.5s ease-in-out;
}

.wide-container {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.wide-container .wp-block-image {
    margin: 0;
}

.vimeo {
    width: 100%;
    max-width: 900px;
    margin-inline: auto;
    aspect-ratio: 123 / 220;
}

.vimeo iframe {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
}

.vimeo_16_9 {
    aspect-ratio: 16 / 9;
    width: 100%;
}

.vimeo_16_9 iframe {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
}

.mobile-only {
    display: none;
}

@media (max-width: 767px) {
    .mobile-only {
        display: block;
    }

    .section-wrapper .img-bg .sticky-wrapper {
        width: 100%;
        height: 50vh;
        background: #fff;
    }

    .img-bg.half.right,
    .img-bg.full.left {
        left: 0;
        top: 0;
        width: 100%;
        display: none !important;
    }

    .mobile-show .img-bg.half.right,
    .mobile-show .img-bg.full.left {
        display: block !important;
        position: relative;
    }

    .mobile-show .overlay-block.page-title {
        position: relative;
        width: 100%;
        opacity: 1;
    }

    .mobile-show.section-wrapper .img-bg.full .sticky-wrapper img {
        position: relative;
        height: auto;
        transform: none;
        left: 0;
    }
}
