* {
    box-sizing: border-box;
}

@font-face {
    font-family: "Poly Sans";
    src: url("PolySans-Neutral.otf") format("opentype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    background: #fff;
    font-family: "Poly Sans", Arial, sans-serif;
}

.site-header {
    position: fixed;
    z-index: 2147483647;
    inset: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 32px;
    background: transparent;
    font-size: 17px;
    line-height: 1.2;
}

.site-header a {
    color: #000;
    text-decoration: none;
}

@media (pointer: fine) {
    html,
    html *,
    body,
    body * {
        cursor: none !important;
    }

    .custom-cursor {
        position: fixed;
        z-index: 2147483647;
        top: 0;
        left: 0;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: rgb(169 255 81);
        opacity: 0;
        pointer-events: none;
        transform: translate(-50%, -50%) scale(1);
        transition: transform 160ms ease, opacity 120ms ease;
        will-change: left, top, transform;
    }

    .custom-cursor.is-visible {
        opacity: 1;
    }

    .custom-cursor.is-hovering {
        transform: translate(-50%, -50%) scale(1.5);
    }

    .custom-cursor.is-pressed {
        transform: translate(-50%, -50%) scale(2.2);
    }
}

@media (pointer: fine) and (prefers-reduced-motion: reduce) {
    .custom-cursor {
        transition-duration: 1ms;
    }
}

@media (max-width: 760px) {
    .site-header {
        padding-inline: 18px;
        font-size: 14px;
    }
}

.entwurf-seite {
    min-height: 100svh;
    background: #fff;
}

.seitenwahl {
    position: fixed;
    z-index: 10;
    top: 24px;
    right: 30px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    font: 12px/1.2 "Poly Sans", Arial, sans-serif;
}

.seitenwahl a {
    color: #000000;
    opacity: .5;
    text-decoration: none;
}

.seitenwahl a[aria-current="page"] {
    opacity: 1;
}

.grid-seite {
    min-height: 100svh;
    overflow-x: hidden;
    font-family: "Poly Sans", Arial, sans-serif;
}

.projekt-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(20px, 3vw, 42px);
    align-content: center;
    min-height: 100svh;
    padding: clamp(20px, 3vw, 42px);
}

.grid-link {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
}

.grid-karte {
    display: block;
    width: 90%;
    justify-self: center;
    aspect-ratio: 1.5;
    border: 4px solid #d3d3d3;
    border-radius: 20px;
    background: #fff;
    object-fit: cover;
}

.grid-karte.gruen {
    background: #d3d3d3;
}

.grid-transition-overlay {
    position: fixed;
    z-index: 20;
    inset: 0;
    pointer-events: none;
    background: transparent;
}

.grid-transition-overlay .grid-link {
    opacity: 0;
    animation: grid-row-swoosh 760ms cubic-bezier(.2, .75, .25, 1) both;
    animation-delay: 560ms;
}

.grid-transition-overlay .grid-link:nth-child(n + 5):nth-child(-n + 8) {
    animation-delay: 1360ms;
}

.grid-transition-overlay .grid-link:nth-child(n + 9) {
    animation-delay: 2160ms;
}

.grid-transition-running .projektstapel {
    animation: carousel-fade-out 520ms ease both;
}

@keyframes grid-row-swoosh {
    0% { opacity: 0; transform: translateX(110vw) rotate(3deg) scale(.9); }
    78% { opacity: 1; transform: translateX(-14px) rotate(-.4deg) scale(1.01); }
    100% { opacity: 1; transform: translateX(0) rotate(0) scale(1); }
}

.leaving-grid .projekt-grid {
    animation: grid-fade-out 420ms ease forwards;
}

@keyframes grid-fade-out {
    to { opacity: 0; transform: scale(.985); }
}

@media (max-width: 700px) {
    .projekt-grid {
        padding: 20px;
    }

    .grid-karte {
        width: 96%;
        border-width: 3px;
        border-radius: 14px;
    }
}

.scroll-sequenz {
    position: relative;
    height: 190vh;
}

.buehne {
    position: sticky;
    top: 0;
    display: grid;
    width: 100%;
    height: 100vh;
    place-items: center;
}

.bildstapel {
    position: relative;
    width: min(62vw, 720px);
    aspect-ratio: 1.5;
}

.bild {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 10px solid #d3d3d3;
    border-radius: 26px;
    object-fit: cover;
    filter: blur(5px);
    transition: transform 650ms cubic-bezier(.2,.7,.2,1), filter 650ms ease, border-color 650ms ease;
    will-change: transform, filter;
}

.bild-vorne {
    z-index: 3;
    filter: blur(0);
    transform: translate(0, 0) rotate(0);
}

.bild-vorne.bild-pop {
    animation: bild-pop 520ms cubic-bezier(.2,.8,.3,1.2) 280ms both;
}

@keyframes bild-pop {
    0% { transform: translateY(10px) scale(.92); }
    65% { transform: translateY(-5px) scale(1.035); }
    100% { transform: translateY(0) scale(1); }
}

.bild-sortant {
    z-index: 4;
    animation: bild-wischt-weg 700ms cubic-bezier(.45,0,.8,.4) forwards;
}

.bild-einblenden {
    animation: bild-fade-ein 650ms ease-out both;
}

@keyframes bild-wischt-weg {
    0% { z-index: 4; transform: translate(0, 0) rotate(0) scale(1); opacity: 1; filter: blur(0); }
    100% { z-index: 4; transform: translate(12vw, -115vh) rotate(8deg) scale(.72); opacity: 0; filter: blur(8px); }
}

@keyframes bild-fade-ein {
    from { opacity: 0; }
    to { opacity: 1; }
}

.bild-hinten-links {
    z-index: 1;
    transform: translate(-10%, -7%) rotate(-6deg);
}

.bild-hinten-rechts {
    z-index: 2;
    transform: translate(8%, 7%) rotate(5deg);
}

@media (max-width: 600px) {
    .bildstapel {
        width: 68vw;
        aspect-ratio: 0.9;
    }

    .bild {
        border-radius: 18px;
        border-width: 6px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bild {
        transition-duration: 1ms;
    }

    .bild-vorne.bild-pop {
        animation-duration: 1ms;
        animation-delay: 0ms;
    }

    .bild-sortant {
        animation-duration: 1ms;
    }

    .bild-einblenden {
        animation-duration: 1ms;
    }

}

/* Horizontale Projektkarten */
.portfolio-seite {
    height: 100svh;
    overflow: hidden;
    background: #fff;
    font-family: "Poly Sans", Arial, sans-serif;
}

.projektstapel {
    position: relative;
    display: flex;
    align-items: center;
    gap: clamp(22px, 4vw, 54px);
    width: 100%;
    height: 100svh;
    padding-inline: max(24px, calc((100vw - clamp(285px, 42vw, 585px)) / 2));
    overflow-x: auto;
    overflow-y: hidden;
    perspective: 1200px;
    scroll-snap-type: none;
    scroll-padding-inline: max(24px, calc((100vw - clamp(285px, 42vw, 585px)) / 2));
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.leaving-carousel .projektstapel {
    animation: carousel-fade-out 420ms ease forwards;
}

.carousel-arriving .projektstapel {
    animation: carousel-fade-in 650ms ease both;
}

@keyframes carousel-fade-out {
    to { opacity: 0; }
}

@keyframes carousel-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.projektstapel::-webkit-scrollbar {
    display: none;
}

.projektstapel:focus-visible {
    outline: 2px solid #777;
    outline-offset: -6px;
}

.projektkarte {
    flex: 0 0 clamp(285px, 42vw, 585px);
    height: min(28vw, 390px);
    padding: 0;
    border: 10px solid #d3d3d3;
    border-radius: 32px;
    background: #fff;
    object-fit: cover;
    box-shadow: 0 22px 45px rgb(30 18 18 / 18%);
    transform: perspective(1200px) translateY(var(--lift, 0px)) rotateY(var(--tilt, 0deg)) rotateZ(var(--roll, 0deg)) scale(var(--scale, .82));
    transform-origin: center center;
    transition: box-shadow 300ms ease;
    cursor: pointer;
    scroll-snap-align: center;
    scroll-snap-stop: normal;
    will-change: transform;
}

.projektkarte.gruen {
    background: #d3d3d3;
}

@media (max-width: 700px) {
    .projektstapel {
        gap: 20px;
        padding-inline: 9vw;
        scroll-padding-inline: 9vw;
    }

    .projektkarte {
        flex-basis: 82vw;
        height: min(55vw, 360px);
        border-radius: 28px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .leaving-grid .projekt-grid,
    .leaving-carousel .projektstapel,
    .carousel-arriving .projektstapel {
        animation-duration: 1ms;
        animation-delay: 0ms;
    }

    .projektkarte {
        transition-duration: 1ms;
    }

}
