html, body { 
    margin: 0; 
    background: #000; 
    font-family: "Roboto Mono", monospace;
    font-weight: 200;
    font-style: normal;
}

html {
    overflow-x: clip;
    scrollbar-width: thin;
    scrollbar-color: #d3d3d3 #000;
}

html::-webkit-scrollbar {
    width: 14px;
}

html::-webkit-scrollbar-track {
    background: #000;
}

html::-webkit-scrollbar-thumb {
    background: #d3d3d3;
    border: 3px solid #000;
    border-radius: 7px;
}

:root {
    --bar-height: 55px;
    --top-safe-area: env(safe-area-inset-top, 0px);
    --bottom-safe-area: env(safe-area-inset-bottom, 0px);
    --topbar-height: calc(var(--bar-height) + var(--top-safe-area));
    --bottombar-height: calc(var(--bar-height) + var(--bottom-safe-area));
    --overview-height: calc(100svh - var(--topbar-height) - var(--bottombar-height));
    --project-circle-size: clamp(22px, 6.25vw, 64px);
    --project-info-width: calc((100vw - 7 * var(--gap)) / 3 + var(--gap) - 0.8vw);
}

.topbar,
.bottombar {
    position: fixed; 
    z-index: 10; 
    box-sizing: border-box;
    height: var(--topbar-height);
    background: #000;
    color: #fff;
    font: 200 14px "Roboto Mono", monospace;
}

.topbar {
    inset: 0 0 auto; 
    padding: var(--top-safe-area) 20px 0;
    display: flex; 
    align-items: center; 
    justify-content: space-between; 

}

.topbar {
    isolation: isolate;
}

.bottombar {
    inset: auto 0 0;
    height: var(--bottombar-height);
    padding: 0 20px var(--bottom-safe-area);
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.about-body .bottombar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.about-body .bottombar button {
    justify-self: start;
}

.bottombar button {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: color .18s ease;
}

.language-option {
    transition: color .18s ease;
}

.language-option.is-active,
.language-option:hover {
    color: #919191;
}

.footer-name {
    margin-left: auto;
}

.footer-name--center {
    position: static;
    margin-left: 0;
    transform: none;
    text-align: center;
}

.about-body .footer-name {
    min-width: 0;
    margin-left: 0;
    overflow-wrap: anywhere;
}

.about-body .footer-name:not(.footer-name--center) {
    text-align: right;
}

a.footer-name {
    color: inherit;
    text-decoration: none;
    transition: color .18s ease;
}

a.footer-name:hover {
    color: #919191;
}

.topbar button { 
    position: relative;
    z-index: 2;
    padding: 0; 
    border: 0; 
    background: none; 
    color: inherit; 
    font: inherit; 
    cursor: pointer; 
    transition: color .18s ease;
}

.topbar button:hover {
    color: #919191;
}

.topbar-link {
    position: relative;
    z-index: 2;
    color: inherit;
    font: inherit;
    text-decoration: none;
    transition: color .18s ease;
}

.topbar-link:hover {
    color: #919191;
}

main { 
    position: relative; 
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%; 
    height: calc(100vh - var(--topbar-height) - var(--bottombar-height));
    height: calc(100svh - var(--topbar-height) - var(--bottombar-height));
    min-height: 0;
    margin: var(--topbar-height) 0 0;
    padding: 0;
    overflow: hidden;
}

body:not(.project-open):not(.about-body) {
    overflow: hidden;
}

body:not(.project-open):not(.about-body) main {
    position: fixed;
    inset: var(--topbar-height) 0 var(--bottombar-height);
    height: auto;
    margin: 0;
}

body.about-body {
    overflow-x: clip;
    overflow-y: auto;
}

body.project-open main { 
    display: block;
    height: auto;
    min-height: 0;
    padding: 0 0 24px;
}

canvas { 
    display: block; 
}

canvas.is-project-hovered {
    cursor: pointer;
}

body.project-open canvas {
    cursor: default;
}

body.project-open canvas.is-project-hovered {
    cursor: pointer;
}

.row-shades { 
    position: absolute; 
    z-index: 2; 
    top: 50%;
    height: calc(var(--project-circle-size) * 9.4);
    left: 0; 
    width: 100%; 
    transform: translateY(-50%);
    pointer-events: none; 
}

body.project-open .row-shades { 
    display: none; 
}

.project-info {
    position: fixed;
    z-index: 20;
    right: 40px;
    bottom: calc(var(--bottombar-height) + 18px);
    display: none;
    align-items: flex-end;
    overflow: hidden;
    border-radius: calc(var(--project-circle-size) / 2);
    background: #000;
}

body.project-open .project-info {
    display: flex;
}

.project-description {
    box-sizing: border-box;
    width: 0;
    min-width: 0;
    max-width: calc(100vw - 96px);
    max-height: var(--project-circle-size);
    overflow: hidden;
    scrollbar-width: none;
    padding-right: 0;
    background: transparent;
    color: #fff;
    opacity: 0;
    visibility: hidden;
    transition: width .65s cubic-bezier(.22,1,.36,1), max-height .65s cubic-bezier(.22,1,.36,1), padding .65s cubic-bezier(.22,1,.36,1), opacity .3s ease-out, visibility 0s linear .65s;
}

.project-description::-webkit-scrollbar {
    display: none;
}

.project-description p {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 25px;
    opacity: 0;
    transition: opacity .35s ease-out;
    font: 200 14px/1.5 "Roboto Mono", monospace;
    white-space: pre-line;
}

body.project-description-open .project-description {
    width: calc(var(--project-info-width) - var(--project-circle-size) - var(--gap));
    max-height: min(60vh, 480px);
    overflow: auto;
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
    padding-left: 8px;
}

body.project-description-open .project-description p {
    opacity: 1;
    transition-delay: .30s;
}

.project-info-toggle {
    display: grid;
    height: var(--project-circle-size);
    width: var(--project-circle-size);
    flex: none;
    place-items: center;
    box-sizing: border-box;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #000;
    color: #ffffff;
    font: 200 clamp(14px, 3.91vw, 40px)/1 "Roboto Mono", monospace;
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: transform .18s ease, background-color .18s ease, color .18s ease;
}

.project-info-toggle:hover {
    color:#919191;
}

.project-info-toggle span {
    display: grid;
    place-items: center;
    width: 1em;
    height: 1em;
    line-height: 1;
    transition: transform .25s ease;
}

body.project-description-open .project-info-toggle span {
    transform: rotate(45deg);
}

@media (max-width: 600px) {
    :root {
        --project-info-width: calc(100vw - 32px);
        --project-circle-size: 56px;
    }

    .project-info {
        right: 16px;
        bottom: 50px;
    }

    .project-info-toggle {
        width: var(--project-circle-size);
        height: var(--project-circle-size);
        display: grid;
        place-items: center;
        border: 0;
        border-radius: 50%;
        padding: 0;
        margin: 0;
        font-size: 25px;
    }
    
    .project-info-toggle span {
        font-size: 35px;
        font-weight: 200;
        line-height: 1;
        text-align: center;
    }

    .project-description p {
        font-size: 12px;
    }

    .project-description {
        max-width: var(--project-info-width);
    }

    body.project-description-open .project-description {
        width: calc(var(--project-info-width) - var(--project-circle-size) - var(--gap));
        max-height: 55vh;
    }

}

@media (prefers-reduced-motion: reduce) {
    .project-description {
        transition-duration: .01ms;
        transition-delay: 0s;
    }

    .project-description p {
        transition-duration: .01ms;
    }
}

.project-title { 
    color: #fff;
    font: inherit;
    opacity: 0;
    white-space: nowrap;
    transition: opacity .18s ease, color .18s ease;
    pointer-events: none; 
}

.project-title.is-visible { 
    opacity: 1; 
}

.project-title.is-selected { 
    opacity: 1; 
    pointer-events: auto;
    cursor: pointer;
}

.project-title.is-selected:hover {
    color: #fff;
}

/* Handy: schmalere Leiste, Projektname darf auf zwei Zeilen umbrechen */
@media (max-width: 700px) {
    :root {
        --bar-height: 40px;
        --overview-height: calc(100svh - max(var(--topbar-height), 60px) - var(--bottombar-height));
    }

    .topbar {
        padding: var(--top-safe-area) 16px 0;
        font-size: 12px;
        flex-wrap: wrap;
        padding-top: 10px;
        padding-bottom: 50px;
    }

    body:not(.project-open):not(.about-body) main {
        inset-block-start: max(var(--topbar-height), 60px);
    }

    body.project-open main {
        margin-top: max(var(--topbar-height), 60px);
    }

    .bottombar {
        padding-right: 16px;
        padding-left: 16px;
        font-size: 12px;
    }
    
    .project-title {
        width: 100%;
        margin-top: 6px;
        white-space: normal;
        text-align: center;
        font-size: 12px;
        line-height: 1.15;
        padding-bottom: 20px;
    }
}

@media (min-width: 701px) {
    .project-title {
        z-index: 1;
        position: absolute;
        left: 50%; 
        top: 50%;
        transform: translate(-50%, -50%);
    }
}

/* =========================================================
   PROJEKT-RASTER
   Jede Projekt-Seite = <section class="project-grid" data-project="NUMMER">
   darin Zeilen <div class="row h-m"> mit Bildern <figure class="c2">
   ========================================================= */

:root {
    --gap: 1.5vw;     /* Abstand zwischen den Bildern und Rand ums Raster */
    --h-xs: 31.5vw;      /* Zeilenhöhe extra klein */
    --h-s: 33vw;      /* Zeilenhöhe klein  */
    --h-m: 45vw;      /* Zeilenhöhe mittel */
    --h-mml: 49vw;      /* Zeilenhöhe mittel mittel gross */
    --h-ml: 54vw;     /* Zeilenhöhe mittel gross  */
    --h-l: 63vw;      /* Zeilenhöhe gross  */
}

/* Container: bleibt versteckt, bis JS ihn aktiviert (.is-active) */
.project-grid {
    display: none;
    flex-direction: column;
    gap: var(--gap);
    padding: 0 var(--gap) calc(var(--gap) + var(--bottombar-height)) var(--gap);
    background: #000000;
}

body.project-grid-visible .project-grid.is-active {
    display: flex;
}

/* Eine Zeile = 6 gleich breite Spalten */
.project-grid .row {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: var(--gap);
}

/* Zeilenhöhe: class="row h-m" */
.h-xs { height: var(--h-xs); }
.h-s { height: var(--h-s); }
.h-m { height: var(--h-m); }
.h-mml { height: var(--h-mml); }
.h-ml {height: var(--h-ml); }
.h-l { height: var(--h-l); }

/* Bildbreite in Spalten: class="c4" = 4 von 6 Spalten (Summe pro Zeile = 6) */
.c1 { grid-column: span 1; }
.c2 { grid-column: span 2; }
.c3 { grid-column: span 3; }
.c4 { grid-column: span 4; }
.c5 { grid-column: span 5; }
.c6 { grid-column: span 6; }

/* Bild füllt den Rahmen immer komplett (wird bei Bedarf beschnitten) */
.project-grid figure {
    margin: 0;
    overflow: hidden;
    background: #a2a2a2;
}

.project-grid figure img,
.project-grid figure video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Handy: alle Bilder untereinander, Höhe ergibt sich aus dem Seitenverhältnis */
@media (max-width: 700px) {
    :root { --gap: 2.5vw; }

    .project-grid .row {
        grid-template-columns: minmax(0, 1fr);
        height: auto;
    }

    .project-grid .row figure {
        grid-column: span 1;
        aspect-ratio: 3 / 2;     /* Querformat */
    }

    .project-grid .row figure.hoch {
        aspect-ratio: 2 / 3;     /* Hochformat: class="c2 hoch" */
    }

    .project-grid[data-project="4"] .row figure {
        aspect-ratio: 1 / 1;     /* Quadrat */
    }

    .project-grid[data-project="4"] .row {
        display: contents;
    }

    .project-grid[data-project="4"] .row:nth-child(1) figure:nth-of-type(1) { order: 1; }
    .project-grid[data-project="4"] .row:nth-child(1) figure:nth-of-type(2) { order: 2; }
    .project-grid[data-project="4"] .row:nth-child(2) figure:nth-of-type(2) { order: 3; }
    .project-grid[data-project="4"] .row:nth-child(2) figure:nth-of-type(1) { order: 4; }
    .project-grid[data-project="4"] .row:nth-child(3) figure:nth-of-type(1) { order: 5; }
    .project-grid[data-project="4"] .row:nth-child(3) figure:nth-of-type(2) { order: 6; }
    .project-grid[data-project="4"] .row:nth-child(4) figure:nth-of-type(2) { order: 7; }
    .project-grid[data-project="4"] .row:nth-child(4) figure:nth-of-type(1) { order: 8; }
    .project-grid[data-project="4"] .row:nth-child(5) figure:nth-of-type(1) { order: 9; }
    .project-grid[data-project="4"] .row:nth-child(5) figure:nth-of-type(2) { order: 10; }
    .project-grid[data-project="4"] .row:nth-child(6) figure:nth-of-type(1) { order: 11; }

    .project-grid[data-project="6"] .row figure.hoch {
        aspect-ratio: 9 / 16;
    }

    .project-grid[data-project="6"] figure video {
        object-fit: contain;
    }
}

.about-page {
    display: block;
    height: auto;
    box-sizing: border-box;
    min-height: 100svh;
    margin: 0;
    padding: var(--topbar-height) 0 calc(var(--bottombar-height) + 24px);
    overflow: visible;
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 20px;
    row-gap: 0;
    margin: 0 20px;
}

.about-portrait {
    grid-column: 1 / 3;
    position: relative;
    overflow: hidden;
    aspect-ratio: .76;
    background: #a2a2a2;
}

.about-description {
    grid-column: 3 / 5;
    color: #fff;
    font: 200 14px/1.5 "Roboto Mono", monospace;
}

.about-description p {
    margin: 0 0 1.5em;
}

.about-description p:last-child {
    margin-bottom: 0;
}

.about-details {
    --about-details-width: calc(200% + 20px);
    --about-details-offset-x: 0px;
    --about-details-column-gap: 20px;
    --about-details-top-gap: 4em;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: var(--about-details-width);
    column-gap: var(--about-details-column-gap);
    margin-top: var(--about-details-top-gap);
    margin-left: var(--about-details-offset-x);
    color: #fff;
    font: 200 14px/1.5 "Roboto Mono", monospace;
}

.about-details h2 {
    margin: 0 0 0.5em;
    font: inherit;
}

.about-languages {
    --language-level-gap: 30px;
}

.about-languages dl {
    display: grid;
    grid-template-columns: max-content max-content;
    column-gap: var(--language-level-gap);
    margin: 0;
}

.about-languages dl div,
.about-software ul {
    margin: 0;
}

.about-languages dl div {
    display: contents;
}

.about-languages dt,
.about-languages dd {
    margin: 0;
}

.about-software ul {
    padding: 0;
    list-style: none;
}

.about-drawing {
    height: var(--h-l);
    margin-top: 20px;
}

.about-drawing figure {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

.about-drawing img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.about-portrait-image {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: none;
}

.about-portrait-hover {
    opacity: 0;
}

.about-portrait:hover .about-portrait-hover {
    opacity: 1;
}

.about-portrait:hover .about-portrait-base {
    opacity: 0;
}

@media (max-width: 700px) {
    .about-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .about-portrait,
    .about-description,
    .about-details {
        grid-column: 1 / -1;
    }

    .about-description,
    .about-details {
        font-size: 12px;
    }

    .about-description {
        margin-top: 3em;
    }

    .about-details {
        --about-details-width: 100%;
        --about-details-offset-x: 0px;
    }
}

@media (max-width: 420px) {
    .about-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .about-details {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .about-portrait-image {
        transition-duration: .01ms;
    }
}
