/*!
 * foundation26 – Image fader (content-image-fader); imagefader.js sets .is-active
 * © 2026 Atelier 26 AG – part of digiscapes®. All rights reserved. digiscapes® and brandscapes® are registered trademarks.
 */

.image-fader {
    --fader-speed: .75s;
    display: grid;
    grid-template-areas: "stack";
    position: relative;
    width: 100%;
    margin-inline: auto;
}

.image-fader__slide {
    grid-area: stack;
    margin: 0;
    min-width: 0;
    opacity: 0;
    z-index: 0;
}

.image-fader__slide.is-active {
    opacity: 1;
    z-index: 1;
}

/* No fade for the first switch when joining the shared clock */
.image-fader.is-syncing .image-fader__slide {
    transition: none !important;
}

.image-fader .image-wrapper {
    width: 100%;
    height: 100%;
}

.image-fader .image-wrapper img {
    display: block;
    width: 100%;
    height: auto;
}

/* === Aspect Ratio === */
/* --ratio-100 (original): natural height, tallest slide wins */
.image-fader--ratio-11  { aspect-ratio: 1 / 1;  }
.image-fader--ratio-65  { aspect-ratio: 6 / 5;  }
.image-fader--ratio-54  { aspect-ratio: 5 / 4;  }
.image-fader--ratio-85  { aspect-ratio: 8 / 5;  }
.image-fader--ratio-169 { aspect-ratio: 16 / 9; }
.image-fader--ratio-219 { aspect-ratio: 21 / 9; }
.image-fader--ratio-56  { aspect-ratio: 5 / 6;  }
.image-fader--ratio-45  { aspect-ratio: 4 / 5;  }
.image-fader--ratio-58  { aspect-ratio: 5 / 8;  }
.image-fader--ratio-916 { aspect-ratio: 9 / 16; }

.image-fader--ratio-11 .image-wrapper img,
.image-fader--ratio-65 .image-wrapper img,
.image-fader--ratio-54 .image-wrapper img,
.image-fader--ratio-85 .image-wrapper img,
.image-fader--ratio-169 .image-wrapper img,
.image-fader--ratio-219 .image-wrapper img,
.image-fader--ratio-56 .image-wrapper img,
.image-fader--ratio-45 .image-wrapper img,
.image-fader--ratio-58 .image-wrapper img,
.image-fader--ratio-916 .image-wrapper img {
    height: 100%;
    object-fit: cover;
}

/* === Speed === */
.image-fader--speed-101 { --fader-speed: .25s;  }
.image-fader--speed-102 { --fader-speed: 1.25s; }

/* === Styles === */
/* Soft transitions only without reduced motion */

/* Blur fade */
.image-fader--style-3 .image-fader__slide { filter: blur(14px); }
.image-fader--style-3 .image-fader__slide.is-active { filter: blur(0); }

/* Clip to the wrapper radius */
.image-fader .image-wrapper { overflow: hidden; }

@media (prefers-reduced-motion: no-preference) {

    .image-fader--style-1 .image-fader__slide,
    .image-fader--style-2 .image-fader__slide,
    .image-fader--style-3 .image-fader__slide {
        transition: opacity var(--fader-speed) ease-in-out,
                    filter var(--fader-speed) ease-in-out;
    }

    /* Zoom (Ken Burns) */
    .image-fader--style-2 .image-fader__slide.is-active .image-wrapper img {
        animation: imagefaderKenBurns 8s ease-out forwards;
        transform-origin: center center;
    }

    @keyframes imagefaderKenBurns {
        from { transform: scale(1); }
        to   { transform: scale(1.08); }
    }
}
