/* =================================== */
/* ===== 8PT GRID SYSTEM =========== */
/* =================================== */
:root {
    /* Spacing Scale (8pt Grid) */
    --space-0: 0;
    --space-1: 0.5rem;   /* 8px */
    --space-2: 1rem;     /* 16px */
    --space-3: 1.5rem;   /* 24px */
    --space-4: 2rem;     /* 32px */
    --space-5: 2.5rem;   /* 40px */
    --space-6: 3rem;     /* 48px */
    --space-8: 4rem;     /* 64px */
    --space-12: 6rem;    /* 96px */

    /* Micro Spacing (für feine Abstände) */
    --space-0-5: 0.25rem; /* 4px */
    --space-1-5: 0.75rem; /* 12px */
}

/* Basis-Styles (Mobile First) */
body {
    font-family: 'Overpass', sans-serif;
    background-image: url('images/Bg.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-color: #000000; /* Verhindert weißes Flashing */
    color: #E0E0E0;
    overflow-x: hidden;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
    position: relative;
}

/* Vignette effect for sides and bottom */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.4) 100%),
        linear-gradient(to bottom, transparent 70%, rgba(0,0,0,0.6) 100%);
    z-index: 1;
}

/* Ensure content is above vignette */
header, main, footer {
    position: relative;
    z-index: 2;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Fade-in Animationen für Elemente */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-element {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.fade-delay-1 { animation-delay: 0.1s; }
.fade-delay-2 { animation-delay: 0.2s; }
.fade-delay-3 { animation-delay: 0.3s; }
.fade-delay-4 { animation-delay: 0.4s; }

/* =================================== */
/* ===== PRÄZISE FONT STYLES ======= */
/* =================================== */

.nav-link {
    font-family: 'Overpass', sans-serif;
    font-weight: 400; /* regular */
    font-size: 0.8125rem; /* 13px */
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #9CA3AF;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    padding-bottom: var(--space-0-5);
}
.nav-link:hover { color: white; }
.nav-link:focus-visible,
#logo:focus-visible,
#project-play-button:focus-visible,
.swiper-button-prev:focus-visible,
.swiper-button-next:focus-visible,
.swiper-pagination-bullet:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 4px;
}

.nav-link.active {
    color: white;
    font-weight: 700; /* bold */
    border-bottom-color: white;
}

.project-title {
    font-size: 1.25rem; /* 20px */
    font-weight: 700; /* bold */
    text-align: center;
    margin-bottom: 0;
}
.project-description {
    font-size: 1rem; /* 16px */
    font-weight: 400; /* regular */
}
.project-genre {
    font-size: 0.875rem; /* 14px */
    font-weight: 100; /* thin */
}
.project-year {
    font-size: 0.875rem; /* 14px */
    font-weight: 100; /* thin */
}

/* =================================== */
/* ===== SWIPER KARUSSELL STYLES ===== */
/* =================================== */
#carousel-container {
    overflow: visible;
}

.swiper {
    width: 100%;
    height: 100%;
    padding-top: var(--space-0-5);
    padding-bottom: var(--space-1);
    overflow: visible;
}

.swiper-slide {
    background-position: center;
    background-size: cover;
    width: 80%;
    aspect-ratio: 4 / 3;
    max-height: 100%;
    transition: filter 0.4s ease, opacity 0.4s ease;
    overflow: hidden;
    position: relative;
    /* Default: blurred and dimmed */
    filter: blur(2px);
    opacity: 0.5;
    user-select: none;
    -webkit-user-select: none;
}

.swiper-slide.slide-active {
    filter: blur(0px);
    opacity: 1;
    z-index: 10;
    /* Swiper rounding can put the active slide behind its wrapper's hit plane. */
    translate: 0 0 1px;
    overflow: visible; /* Allow 3D model to exceed bounds when zooming */
}

.swiper-slide model-viewer {
    width: 100%;
    height: 100%;
    background: transparent;
    --mv-cursor-grabbing: grabbing;
    --progress-bar-color: transparent;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

/* Inactive slides have border-radius */
.swiper-slide model-viewer {
    border-radius: 0.5rem;
}

@media (pointer: coarse) {
    .swiper-slide model-viewer {
        pointer-events: none;
    }
}

/* The active model is drawn by the larger, passive canvas below. */
.swiper-slide.slide-active model-viewer {
    border-radius: 0;
}

.expanded-model-source {
  opacity: 0;
}

#expanded-model-layer {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 100;
}

#expanded-model-layer[hidden] {
  display: none;
}

#expanded-model-viewer {
  position: absolute;
  pointer-events: none;
  background: transparent;
  opacity: 0;
  --progress-bar-color: transparent;
}

#expanded-model-viewer.is-ready {
  opacity: 1;
}

/* Model Viewer: Lade-Elemente ausblenden */
.swiper-slide model-viewer::part(default-progress-bar) {
    display: none;
}

.swiper-slide model-viewer::part(default-progress-mask) {
    display: none;
}

/* Pfeil-Styling */
.swiper-button-prev, .swiper-button-next {
    width: var(--space-6); /* 48px */
    height: var(--space-6); /* 48px */
    z-index: 30;
    transition: opacity 0.2s ease;
}

.swiper-button-prev::after, .swiper-button-next::after { display: none; }

.swiper-button-prev {
    background-image: url('images/Button_left.svg');
    left: var(--space-1);
}

.swiper-button-next {
    background-image: url('images/Button_right.svg');
    right: var(--space-1);
}

/* Pagination Dots Styling */
.swiper-pagination {
    position: relative !important;
    bottom: auto !important;
    margin-top: var(--space-2);
    z-index: 20;
    transform: scaleX(-1);
}

.swiper-pagination-bullet {
    width: var(--space-1);
    height: var(--space-1);
    background: rgba(255, 255, 255, 0.3);
    opacity: 1;
    transition: all 0.3s ease;
    margin: 0 var(--space-0-5) !important;
}

.swiper-pagination-bullet:hover {
    background: rgba(255, 255, 255, 0.6);
    transform: scale(1.2);
}

.swiper-pagination-bullet-active {
    background: #ffffff;
    width: var(--space-3);
    border-radius: var(--space-0-5);
}

/* =================================== */
/* ===== LAYOUT & FORMAT ===== */
/* =================================== */

#logo {
    width: 100%;
}

#logo img {
    width: 100%;
}

#project-info-block, #no-projects-message {
    position: relative;
    z-index: 25;
    text-align: center;
    width: 80%;
    margin: var(--space-1) auto 0;
}

#project-info-block {
  transition: opacity 0.2s ease;
}

#project-info-block .text-left {
    margin-top: var(--space-2);
}

footer {
    position: relative;
    z-index: 25;
    font-family: 'Overpass', sans-serif;
}

footer p {
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* =================================== */
/* ===== PLAY PAGE LAYOUT ===== */
/* =================================== */

.game-canvas {
    width: 100%;
    /* Absolute Maximalgrößen für große Bildschirme */
    max-width: 1280px;
    max-height: 720px;
    /* Responsive Begrenzung für kleinere Bildschirme */
    height: auto;
}

.play-info {
    margin-top: var(--space-3);
    padding-bottom: var(--space-4);
    width: 100%;
    max-width: 1280px;
}

/* Kleine Bildschirme: Canvas darf nicht zu groß werden */
@media (max-height: 900px) {
    .game-canvas {
        max-height: calc(100vh - 300px);
    }
}

@media (max-height: 700px) {
    .game-canvas {
        max-height: calc(100vh - 250px);
    }

    .play-info {
        margin-top: var(--space-2);
    }
}

@media (max-height: 600px) {
    .game-canvas {
        max-height: calc(100vh - 200px);
    }

    .play-info {
        margin-top: var(--space-1-5);
        font-size: 0.875rem;
    }
}

/* Mobile Portrait: Hochformat Canvas */
@media (max-width: 767px) and (orientation: portrait) {
    .game-canvas {
        max-height: 60vh;
        aspect-ratio: 3 / 4;
    }

    .play-info {
        margin-top: var(--space-2);
    }

    .play-info .project-title {
        font-size: 1rem !important;
    }

    .play-info .project-description {
        font-size: 0.875rem !important;
    }
}

/* =================================== */
/* ===== VIDEOS PAGE LAYOUT ===== */
/* =================================== */

/* Mobile First: Alles gestapelt */
.video-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    width: 100%;
}

.video-cover {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.video-player {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

.video-info {
    padding: 0 var(--space-1);
}

/* Desktop: Cover | Player | Info - alles in einer Reihe, gleiche Höhe */
@media (min-width: 1024px) {
    .video-container {
        flex-direction: row;
        align-items: stretch; /* Gleiche Höhe für alle! */
        gap: var(--space-4);
    }

    .video-cover {
        flex-shrink: 0;
        width: 200px;
        max-width: none;
        margin: 0;
        height: auto; /* Höhe durch Container bestimmt */
    }

    .video-cover img {
        object-fit: contain; /* Bild vollständig sichtbar */
    }

    .video-player {
        flex: 1 1 auto; /* Nimmt verfügbaren Platz */
        min-width: 0;
        aspect-ratio: 16 / 9;
    }

    .video-info {
        flex-shrink: 0;
        width: 250px;
        padding: 0;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }
}

/* =================================== */
/* ===== MEDIA QUERIES ===== */
/* =================================== */

/* Mobile Portrait Optimization */
@media (max-width: 767px) and (orientation: portrait) {
    /* Header kompakter */
    header {
        padding: var(--space-2) !important;
        gap: var(--space-1-5) !important;
    }

    #logo img {
        max-width: 100px !important;
    }

    /* Navigation kompakter */
    nav {
        gap: var(--space-1-5) !important;
    }

    nav .nav-link {
        font-size: 0.6875rem; /* 11px */
        letter-spacing: 0.12em;
        padding-bottom: var(--space-0-5);
    }

    /* 3D Viewer hochformatig */
    .swiper {
        padding-top: var(--space-2);
        padding-bottom: var(--space-2);
    }

    .swiper-slide {
        width: 85%;
        aspect-ratio: 3 / 4; /* Hochformat statt 4/3 Querformat */
    }

    /* Navigation Pfeile anpassen */
    .swiper-button-prev, .swiper-button-next {
        width: var(--space-5);
        height: var(--space-5);
    }

    .swiper-button-prev { left: var(--space-0-5); }
    .swiper-button-next { right: var(--space-0-5); }

    /* Pagination Dots kompakter */
    .swiper-pagination {
        margin-top: var(--space-1);
    }

    .swiper-pagination-bullet {
        width: 6px;
        height: 6px;
        margin: 0 3px !important;
    }

    .swiper-pagination-bullet-active {
        width: var(--space-2);
    }

    /* Project Info Block optimieren */
    #project-info-block {
        width: 90%;
        margin-top: var(--space-3);
        padding: 0 var(--space-2);
    }

    #project-info-block .text-left {
        margin-top: var(--space-2);
    }

    .project-title {
        font-size: 1.125rem; /* 18px */
        margin-bottom: var(--space-1);
    }

    .project-description {
        font-size: 0.9375rem; /* 15px */
        line-height: 1.5;
    }

    .project-genre,
    .project-year {
        font-size: 0.8125rem; /* 13px */
    }

    /* Play Button */
    #project-play-button {
        margin-top: var(--space-2);
        padding: var(--space-1) var(--space-3);
        font-size: 0.875rem;
    }

    /* Footer kompakter */
    footer {
        padding: var(--space-3) var(--space-2) !important;
        margin-top: var(--space-4);
    }

    /* About Sektion optimieren */
    #about {
        padding: var(--space-3) var(--space-2) !important;
    }

    #about p {
        font-size: 0.9375rem;
        line-height: 1.6;
        margin-bottom: var(--space-2) !important;
    }

    /* Play Page wurde oben bereits optimiert */

    /* Videos Page Optimierung */
    .video-container {
        gap: var(--space-2);
    }

    .video-cover {
        max-width: 220px;
    }

    .video-player {
        aspect-ratio: 16 / 9;
    }

    .video-info {
        padding: 0;
    }

    .video-info .project-title {
        font-size: 1rem !important;
        margin-bottom: var(--space-1);
    }

    .video-info .project-description {
        font-size: 0.875rem;
        line-height: 1.4;
    }

    .video-info .project-genre,
    .video-info .project-year {
        font-size: 0.8125rem;
    }
}

/* Medium screens (tablets, small laptops) */
@media (min-width: 768px) {
    .project-title { font-size: 1.25rem; }
    .project-description { font-size: 1rem; }
    .project-genre { font-size: 0.875rem; }
    .project-year { font-size: 0.875rem; }

    .swiper-slide {
        width: 60%;
        aspect-ratio: 16 / 9;
    }

    .swiper-button-prev, .swiper-button-next {
        width: var(--space-6); /* 48px */
        height: var(--space-6); /* 48px */
    }
    #project-info-block .text-left {
        max-width: 50%;
        margin: 0.1em auto 0;
    }
    .swiper-button-prev { left: var(--space-2); }
    .swiper-button-next { right: var(--space-2); }
}

/* Medium laptops (MacBook 13", 14") */
@media (min-width: 1024px) {
    #logo img { max-width: 180px; }

    #works .relative {
        max-width: 560px;
    }

    #project-info-block { max-width: 720px; }

    #project-info-block .text-left {
        max-width: 60%;
        margin: 0.1em auto 0;
    }

    .swiper-slide {
        width: 100%; /* The container is now sized */
    }

    .swiper-button-prev { left: calc(var(--space-5) * -1); }
    .swiper-button-next { right: calc(var(--space-5) * -1); }
}

/* Large laptops and desktops (MacBook 16", iMac) */
@media (min-width: 1440px) {
    #works .relative {
        max-width: 680px;
    }
    #project-info-block { max-width: 680px; }

    #project-info-block .text-left {
        max-width: 100%;
    }
}

/* Extra large screens (QHD, 4K) - only for very large monitors */
@media (min-width: 1920px) {
    #works .relative {
        max-width: 960px;
    }
    #project-info-block { max-width: 960px; }
}

/* Ultra wide / 4K screens */
@media (min-width: 2560px) {
    #works .relative {
        max-width: 1200px;
    }
    #project-info-block { max-width: 1200px; }
}

.description-link {
    color: #60A5FA; /* A light blue color, common for links */
    text-decoration: none; /* Remove default underline */
}

.description-link:hover {
    text-decoration: underline; /* Add underline on hover */
}

/* Keep content accessible at short viewport heights and large text sizes. */
body > header, body > footer { flex-shrink: 0; }
.project-description blockquote { margin-top: 1rem; }
.project-description cite { display: block; text-align: right; font-style: normal; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
}
