/*
 * M.A.K. Galerie · Immersion V7
 *
 * A measured gallery rhythm, NOT a commercial-page gimmick.
 * Scroll effects are bidirectional and computed from the physical scroll
 * position, including iOS/Android. Image fades are gated by real decode().
 * Layout, article reading order, native scroll and image ratio are unchanged.
 *
 * Without JS this stylesheet never hides content or alters the artwork.
 */

/* Only the two paint properties below change as the scroll progresses.
 * A node is visible normally if JS is disabled, late or throws an error.
 * No transitions: each pixel is determined by current scroll position,
 * so reversing direction reproduces the same intermediate appearance. */
.mak-scroll-scrub .mak-scrub-target {
    opacity: calc(.20 + .80 * var(--mak-scrub-p, 1));
    transform: translate3d(0, calc(40px - 40px * var(--mak-scrub-p, 1)), 0);
    transition: none !important;
}

/* The dominant photograph remains within its layout and fully un-cropped.
 * Optical settling goes from 97.4% to 100%, never beyond natural boundaries
 * or over its caption. Portrait/panorama orientation is unchanged. */
.mak-immersive .mak-desktop-visual .mak-artwork-figure__image,
.mak-immersive .mak-mobile-visual .mak-artwork-figure__image {
    transform: scale(calc(.974 + .026 * var(--mak-hero-p, 0)));
    transform-origin: center center;
}

/* On slow connections the loading plane is a quiet exhibition-white,
   not a spinner. The image becomes visible only once decode() completes. */
.mak-artwork-figure__image {
    position: relative;
    isolation: isolate;
}
.mak-immersive .mak-artwork-figure__image.mak-cover-waiting {
    min-height: 130px;
    background: #f7f7f5;
}
.mak-immersive .mak-artwork-figure__image.mak-cover-waiting::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(105deg, #f6f6f3 28%, #eeeef0 48%, #f6f6f3 68%);
    animation: mak-cover-sheen 1600ms ease-in-out infinite alternate;
    pointer-events: none;
}
.mak-immersive .mak-artwork-figure__image.mak-cover-waiting::after {
    content: "L’ŒUVRE SE DÉVOILE";
    position: absolute;
    z-index: 1;
    bottom: 17px;
    left: 50%;
    transform: translateX(-50%);
    color: #777;
    font-size: 9px;
    font-weight: 650;
    letter-spacing: .16em;
    white-space: nowrap;
    pointer-events: none;
}
.mak-immersive .mak-artwork-figure__image.mak-cover-waiting img {
    opacity: 0;
}
.mak-immersive .mak-artwork-figure__image.mak-cover-ready {
    background: transparent;
}
.mak-immersive .mak-artwork-figure__image.mak-cover-ready img {
    opacity: 1;
    animation: mak-photograph-arrives 420ms cubic-bezier(.15,.72,.23,1) both;
}
.mak-immersive .mak-artwork-figure__image.mak-cover-error {
    min-height: 140px;
    background: #f5f5f3;
}
.mak-immersive .mak-artwork-figure__image.mak-cover-error::after {
    content: "VISUEL TEMPORAIREMENT INDISPONIBLE";
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #777;
    font-size: 10px;
    text-align: center;
    max-width: 90%;
}
.mak-immersive .mak-artwork-figure__image.mak-cover-error img {
    opacity: 0;
}

@keyframes mak-cover-sheen {
    /* Opacity composites cheaply while the browser decodes a large photo.
       Animating gradient position would repaint every frame. */
    from { opacity: .48; }
    to { opacity: 1; }
}
@keyframes mak-photograph-arrives {
    from { opacity: 0; transform: translate3d(0, 16px, 0) scale(.972); }
    to   { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes mak-editorial-arrives {
    from { opacity: 0; transform: translate3d(0, 23px, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes mak-dock-arrives {
    from { opacity: 0; transform: translate3d(0, 24px, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
}
/* All delays are decorative only: reading is never blocked on a loader. */
.mak-intro-motion .mak-navigation {
    animation: mak-editorial-arrives 1100ms cubic-bezier(.17,.65,.25,1) 40ms both;
}
.mak-intro-motion .mak-identity-logo {
    animation: mak-editorial-arrives 1450ms cubic-bezier(.17,.65,.25,1) 180ms both;
}
.mak-intro-motion .mak-identity .mak-artist {
    animation: mak-editorial-arrives 1650ms cubic-bezier(.17,.65,.25,1) 390ms both;
}
.mak-intro-motion .mak-identity .mak-work-title {
    animation: mak-editorial-arrives 1600ms cubic-bezier(.17,.65,.25,1) 720ms both;
}
.mak-intro-motion .mak-identity .mak-work-year,
.mak-intro-motion .mak-identity .mak-work-technique {
    animation: mak-editorial-arrives 1550ms cubic-bezier(.17,.65,.25,1) 910ms both;
}
.mak-intro-motion .mak-dimensions {
    animation: mak-editorial-arrives 1600ms cubic-bezier(.17,.65,.25,1) 1130ms both;
}
.mak-intro-motion .mak-desktop-visual .mak-artwork-caption,
.mak-intro-motion .mak-mobile-visual .mak-artwork-caption {
    animation: mak-editorial-arrives 1300ms cubic-bezier(.17,.65,.25,1) 1020ms both;
}
.mak-intro-motion .mak-contact-dock {
    animation: mak-dock-arrives 1550ms cubic-bezier(.17,.65,.25,1) 1180ms both;
}

/* Contact is a separate dramaturgical moment. The dialog stays centred
 * because only the inner body is translated; never move its fixed box. */
@keyframes mak-dialog-surface {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes mak-dialog-contents {
    from { opacity: 0; transform: translate3d(0, 20px, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
}
.mak-immersive .mak-contact-dialog[open] {
    animation: mak-dialog-surface 920ms ease-out both;
}
.mak-immersive .mak-contact-dialog[open] .mak-dialog-body,
.mak-immersive .mak-contact-dialog[open] .mak-dialog-header {
    animation: mak-dialog-contents 1250ms cubic-bezier(.18,.66,.28,1) both;
}
.mak-immersive .mak-contact-dialog[open] .mak-dialog-body {
    animation-delay: 170ms;
}
.mak-immersive .mak-contact-dialog[open]::backdrop {
    animation: mak-dialog-surface 900ms ease-out both;
}

/* Disabling motion is absolute, including image loader pulses and scroll
 * scrubbed content. Saving data also disables animation through JS. */
@media (prefers-reduced-motion: reduce) {
    .mak-scroll-scrub .mak-scrub-target {
        opacity: 1 !important;
        transform: none !important;
    }
    .mak-intro-motion :is(
        .mak-navigation, .mak-identity-logo, .mak-artist,
        .mak-work-title, .mak-work-year, .mak-work-technique,
        .mak-dimensions, .mak-artwork-caption, .mak-contact-dock
    ),
    .mak-immersive .mak-artwork-figure__image.mak-cover-ready img,
    .mak-immersive .mak-artwork-figure__image.mak-cover-waiting::before,
    .mak-immersive .mak-contact-dialog[open],
    .mak-immersive .mak-contact-dialog[open]::backdrop,
    .mak-immersive .mak-contact-dialog[open] .mak-dialog-body,
    .mak-immersive .mak-contact-dialog[open] .mak-dialog-header {
        animation: none !important;
    }
    .mak-immersive :is(
        .mak-desktop-visual, .mak-mobile-visual
    ) .mak-artwork-figure__image {
        transform: none !important;
    }
}
@media print {
    .mak-scroll-scrub .mak-scrub-target {
        opacity: 1 !important;
        transform: none !important;
    }
    .mak-intro-motion :is(
        .mak-navigation, .mak-identity-logo, .mak-artist,
        .mak-work-title, .mak-work-year, .mak-work-technique,
        .mak-dimensions, .mak-artwork-caption, .mak-contact-dock
    ),
    .mak-immersive .mak-artwork-figure__image.mak-cover-ready img {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    .mak-immersive .mak-artwork-figure__image img { opacity: 1 !important; }
    .mak-immersive .mak-artwork-figure__image::before,
    .mak-immersive .mak-artwork-figure__image::after { content: none !important; }
}
