@font-face {
    font-family: "Slussen Mono";
    src: url("../css/slussen-mono-light.otf") format("opentype");
    font-weight: 300;
    font-style: normal;
}

:root {
    color-scheme: light;
    --project-count: 8; /* Anzahl der Spalten im gemeinsamen Raster aller Seiten. */
    --page-gutter: 0.75rem;
    --column-gap: var(--page-gutter);
    --ink: #302927;
    --paper: #fff;
    --header-height: 5.5rem;
    --footer-height: 5.5rem;
    --font-primary: "Slussen Mono", sans-serif;
    --schriftgroesse: clamp(0.75rem, 0.9vw, 0.875rem);
    /* Maximale Rahmenbreite für 3:2 innerhalb der verfügbaren Fensterhöhe. */
    --project-frame-limit: calc((100svh - var(--header-height) - var(--page-gutter) - var(--page-gutter) - 2rem) * 1.5);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    min-height: 100svh;
    margin: 0;
    display: grid;
    grid-template-rows: var(--header-height) minmax(0, 1fr) var(--footer-height);
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-primary);
    font-weight: 300;
    font-style: normal;
    font-size: var(--schriftgroesse);
    padding: var(--page-gutter);
}

/* Die Ladefläche erscheint nur, wenn JavaScript sie während des Ladens einschaltet. */
.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    place-items: center;
    padding: var(--page-gutter);
    background: var(--paper);
    opacity: 1;
    transition: opacity 180ms ease, visibility 180ms ease;
}

html.is-loading .loading-screen { display: grid; }
html.is-loading body { overflow: hidden; }
.loading-screen.is-hidden { opacity: 0; visibility: hidden; }

.loading-screen__content {
    display: grid;
    gap: 0.5rem;
    width: min(22rem, 80vw);
    justify-items: center;
    text-align: center;
}

.loading-screen__text,
.loading-screen__percent { margin: 0; }

.loading-screen__track {
    display: block;
    width: 100%;
    height: 0.1rem;
    appearance: none;
    border: 0;
    background: color-mix(in srgb, var(--ink) 15%, transparent);
}

.loading-screen__track::-webkit-progress-bar { background: color-mix(in srgb, var(--ink) 15%, transparent); }
.loading-screen__track::-webkit-progress-value { background: var(--ink); }
.loading-screen__track::-moz-progress-bar { background: var(--ink); }

@media (prefers-reduced-motion: reduce) {
    .loading-screen { transition: none; }
}

html, body {
  overscroll-behavior: none;
}

.body {
    grid-template-rows: var(--header-height) minmax(0, 1fr) var(--footer-height);
}

.page-grid {
    width: 100%;
    align-self: center;
    margin-inline: auto;
    display: grid;
    grid-template-columns: 1fr repeat(var(--project-count), 2fr) 1fr;
    column-gap: var(--column-gap);
}

.site-header {
    min-height: var(--header-height);
    align-items: start;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.site-header a {
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
    transition: opacity 180ms ease;
}

.site-header a:hover,
.site-header a:focus-visible,
.project-text:hover,
.project-text:focus-visible,
.contact-link:hover,
.contact-link:focus-visible,
.slide-number:hover,
.slide-number:focus-visible { opacity: 0.65; }

.project-text { transition: opacity 180ms ease; }

/* Die Navigation sitzt an den äusseren Kanten des dynamischen Rasters. */
.name { grid-column: 1; justify-self: start; }
.projects { grid-column: 2; justify-self: end; }

.project-viewer {
    position: relative;
    min-height: 0;
    grid-template-rows: max-content;
    align-items: center;
    align-content: center;
    row-gap: 0.5rem;
}

.slide-pagination {
    grid-column: -1 / -3;
    grid-row: 1 / span 1;
    margin: 0;
    justify-self: end;
    align-self: end;
}

.project-text {
    grid-column: 1 / -3;
    grid-row: 1 / span 1;
    align-self: start;
    justify-self: start;
    color: inherit;
    cursor: default;
    text-decoration: none;
}

.project-format {
    grid-column: 1 / span 2;
    grid-row: 1 / span 1;
    align-self: end;
    justify-self: start;
    margin: 0;
    cursor: default;
}

.project-viewer > .slide-pagination {
    position: static;
    grid-column: -2 / -1;
    align-self: end;
    justify-self: end;
    display: flex;
    flex-wrap: nowrap;
    justify-content: end;
    gap: 0.35em;
    white-space: nowrap;
    cursor: default;
}

.slide-number {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: opacity 180ms ease;
}

.project-card {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    max-width: calc((100svh - var(--header-height) - var(--footer-height) - var(--page-gutter) - var(--page-gutter) - 2rem) * 0.6667);
    height: auto;
    aspect-ratio: 2 / 3;
    display: grid;
    place-items: center;
    z-index: 0;
    color: #786b68;
    text-align: center;
    text-decoration: none;
}

.project-card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform-origin: center center;
    transition: transform 280ms ease;
}

.project-card:hover img,
.project-card:focus-visible img {
    transform: scale(1.5);
}

.project-card:hover,
.project-card:focus-visible {
    z-index: 2;
}

.project-card:focus-visible { outline: none; }

body.has-gallery-cursor,
body.has-gallery-cursor * { cursor: none !important; }

.gallery-cursor {
    position: fixed;
    z-index: 1001;
    display: none;
    color: var(--ink);
    font-family: var(--font-primary);
    font-size: 2rem;
    line-height: 1;
    pointer-events: none;
    transform: translate(-50%, -50%);
}

body.has-gallery-cursor .gallery-cursor { display: block; }

.gallery-hint {
    position: absolute;
    top: calc(100% + var(--column-gap));
    left: 50%;
    z-index: 900;
    width: max-content;
    max-width: calc(100vw - var(--page-gutter) - var(--page-gutter));
    color: var(--ink);
    font-size: var(--schriftgroesse);
    font-weight: inherit;
    text-align: center;
    pointer-events: none;
    transform: translateX(-50%);
}

/* Bei Tastaturbedienung soll nur die fokussierte Karte aktiv bleiben. */
body:has(.project-card:focus-visible) .project-card:hover:not(:focus-visible) {
    z-index: 0;
}

body:has(.project-card:focus-visible) .project-card:hover:not(:focus-visible) img {
    transform: none;
}

body:has(.project-card:focus-visible) .project-card:hover:not(:focus-visible) .project-title {
    bottom: calc(100% + var(--column-gap));
    opacity: 0;
}

.project-title {
    position: absolute;
    bottom: calc(100% + var(--column-gap));
    left: 50%;
    width: 150%;
    transform: translateX(-50%);
    z-index: 1;
    padding: 0.35rem 0.5rem 0;
    background: var(--paper);
    color: var(--ink);
    font-size: var(--schriftgroesse);
    white-space: normal;
    text-align: center;
    line-height: 1.2;
    opacity: 0;
    transition: bottom 280ms ease, opacity 280ms ease;
}

.project-card:hover .project-title,
.project-card:focus-visible .project-title {
    bottom: calc(125% + var(--column-gap));
    opacity: 0.65;
}

.tone-1 {
    grid-column: 2;
}

.tone-1, .tone-7 { background: #f0e3e1; }
.tone-2, .tone-8 { background: #eee8e4; }
.tone-3, .tone-9 { background: #e9e2de; }
.tone-4, .tone-10 { background: #f1e8e5; }
.tone-5 { background: #eae4e1; }
.tone-6 { background: #f2e9e7; }

.project-image {
    position: relative;
    --swiper-wrapper-transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
    grid-column: 3 / -3;
    grid-row: 1 / span 1;
    width: 100%;
    display: grid;
    margin: 0;
    justify-self: center;
}

/* Das Hochformat bleibt so hoch wie ein Querformat 3:2 und sitzt mittig. */
.project-image.project-image--portrait {
    width: min(44.444%, calc(var(--project-frame-limit) * 4 / 9));
    aspect-ratio: 2 / 3;
}

.project-image.project-image--landscape {
    width: min(100%, var(--project-frame-limit));
    aspect-ratio: 3 / 2;
}

/* Die Folie darf ihre Bildhöhe aus dem Bildverhältnis berechnen. */
.project-image .swiper-slide { height: 100% !important; width: 100% !important; }

.image-placeholder {
    width: 100%;
    height: auto;
}

.project-image--portrait .swiper,
.project-image--landscape .swiper,
.project-image--portrait .image-placeholder {
    width: 100%;
    height: 100%;
}

.project-image--portrait .image-placeholder {
    background: #f0e3e1;
}

.project-image--portrait .project-image__media,
.project-image--landscape .project-image__media {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-image--portrait video.project-image__media {
    object-fit: cover;
    object-position: center;
    background: #f0e3e1;
}

.project-copy {
    grid-area: 1 / 1;
    width: 100%;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    overflow: auto;
    margin: 0;
    background: color-mix(in srgb, var(--paper) 90%, transparent);
    color: var(--ink);
    text-align: left;
    line-height: 1.5;
    opacity: 0;
    visibility: hidden;
    transition: opacity 180ms ease, visibility 180ms ease;
}

.project-copy h1,
.project-copy p { max-width: 50%; }
.project-copy h1 { margin: 0; font-size: inherit; font-weight: 400; }
.project-copy p { margin: 0; }

body.project-page:has(.project-text:hover) .project-copy {
    opacity: 1;
    visibility: visible;
}

.project-page{
    height: 100vh;
}

.image-placeholder span {
    padding: 0.6rem 0.8rem;
    border: 1px solid currentColor;
}

.site-footer {
    min-height: var(--footer-height);
    align-items: end;
}

.project-year {
    grid-column: -1 / -3;
    grid-row: 1 / span 1;
    justify-self: end;
    align-self: start;
    margin: 0;
    cursor: default;
}

.contact-link {
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
    transition: opacity 180ms ease;
}

.contact-link__email { display: none; }

.contact-link:hover .contact-link__label,
.contact-link:focus-visible .contact-link__label { display: none; }

.contact-link:hover .contact-link__email,
.contact-link:focus-visible .contact-link__email { display: inline; }

@media (max-width: 700px) {
    :root {
        --header-height: 5rem;
        --footer-height: 5rem;
    }

    .project-image {
        grid-column: 2 / -2;
        width: min(100%, var(--project-frame-limit));
    }

    .project-copy {
        line-height: 1.35;
    }

    .project-title { top: 0.4rem; bottom: auto; }

}

@media (max-height: 700px) {
    .project-title { top: 0.4rem; bottom: auto; }
}

@media (prefers-reduced-motion: reduce) {
    .project-title { transition: none; }
}


.swiper {
    grid-area: 1 / 1;
}
