/* ==========================================================================
   Seitenübergänge: Inhalt fährt nach unten aus, auf der neuen Seite nach oben ein
   --------------------------------------------------------------------------
   Chrome/Edge (126+) und Safari (18.2+): native View Transitions. Links bleiben
   normale Links (Strg/Cmd-Klick, Zurück-Button, Vorladen funktionieren).
   Andere Browser (z. B. Firefox): Ausfahren per js/llp.js (.llp-leaving),
   Einfahren per CSS (.llp-enter, gesetzt vom Inline-Script im <head>).
   ========================================================================== */

:root {
    --llp-out-duration: 0.32s;
    --llp-in-duration: 0.65s;
    --llp-out-ease: cubic-bezier(0.55, 0, 0.85, 0.35);  /* beschleunigt nach unten */
    --llp-in-ease: cubic-bezier(0.16, 1, 0.3, 1);       /* bremst weich ab */
    --llp-out-distance: min(30vh, 260px);
    --llp-in-distance: min(22vh, 180px);
}

@media (prefers-reduced-motion: no-preference) {
    @view-transition {
        navigation: auto;
    }
}

/* Inhaltsblock der Unterseiten (genau eine <section> pro Seite) */
body.about section,
body.services section,
body.jobs section,
body.contact section,
body.imprint section,
body.privacy section {
    view-transition-name: llp-content;
}

/* Hintergrund, Header, Navigation: weiches Überblenden */
::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.5s;
    animation-timing-function: ease-in-out;
}

/* Alter Inhalt fährt an seiner Position aus, neuer an seiner ein */
::view-transition-group(llp-content),
::view-transition-group(llp-content-out) {
    animation: none;
}
::view-transition-old(llp-content),
::view-transition-old(llp-content-out) {
    animation: llp-content-out var(--llp-out-duration) var(--llp-out-ease) both;
}
::view-transition-new(llp-content) {
    animation: llp-content-in var(--llp-in-duration) var(--llp-in-ease) var(--llp-out-duration) both;
}

@media (prefers-reduced-motion: no-preference) {
    /* Einfahren ohne native View Transition (Direktaufruf, Firefox …) */
    html.llp-enter body.about section,
    html.llp-enter body.services section,
    html.llp-enter body.jobs section,
    html.llp-enter body.contact section,
    html.llp-enter body.imprint section,
    html.llp-enter body.privacy section {
        animation: llp-content-in var(--llp-in-duration) var(--llp-in-ease) both;
    }

    /* Ausfahren ohne native View Transition (Firefox …) */
    html.llp-leaving body.about section,
    html.llp-leaving body.services section,
    html.llp-leaving body.jobs section,
    html.llp-leaving body.contact section,
    html.llp-leaving body.imprint section,
    html.llp-leaving body.privacy section {
        animation: llp-content-out var(--llp-out-duration) var(--llp-out-ease) both;
    }
}

@keyframes llp-content-in {
    from {
        opacity: 0;
        transform: translateY(var(--llp-in-distance));
    }
    40% {
        opacity: 1;
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes llp-content-out {
    from {
        opacity: 1;
        transform: none;
    }
    30% {
        opacity: 1;
    }
    to {
        opacity: 0;
        transform: translateY(var(--llp-out-distance));
    }
}
