/* ============================================
   Nik Behrendt – Work / Portfolio
   (Basis-Styles kommen aus base.css)
   ============================================ */

body { overflow-x: hidden; }

/* --- Main --- */
.portfolio-main {
    padding-top: calc(var(--header-h) + 76px);
}

.portfolio-section {
    margin-bottom: 96px;
    overflow: hidden;
    scroll-margin-top: calc(var(--header-h) + 70px);
}

.section-heading {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 var(--content-pad) 16px;
    display: flex;
    align-items: baseline;
    gap: 24px;
}

.section-heading h2 {
    font-size: clamp(56px, 9vw, 130px);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1;
    color: var(--white);
}

.section-heading .section-count {
    font-size: var(--fs-xs);
    font-weight: 400;
    letter-spacing: var(--track-caps);
    text-transform: uppercase;
    color: var(--white-40);
    white-space: nowrap;
}

/* --- Carousel --- */
.carousel-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    cursor: grab;
    overscroll-behavior-x: contain;
}

.carousel-wrapper:active { cursor: grabbing; }

.carousel { overflow: hidden; padding: 12px 0 20px; }

.carousel-track {
    display: flex;
    gap: 0;
    will-change: transform;
}

/* --- Project Card --- */
.project-card {
    flex-shrink: 0;
    width: calc(100vw / 3);
    position: relative;
    display: block;
    overflow: hidden;
    background: #111;
}

.card-image {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    overflow: hidden;
}

.card-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s var(--ease-out), filter 0.5s ease;
    filter: brightness(0.92);
}

.project-card:hover .card-image img,
.project-card:focus-visible .card-image img {
    transform: scale(1.05);
    filter: brightness(1);
}

.card-overlay {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 65%;
    background: linear-gradient(to top, rgba(10,10,10,0.85) 0%, rgba(10,10,10,0.35) 45%, rgba(10,10,10,0) 100%);
    pointer-events: none;
    opacity: 0.85;
    transition: opacity 0.4s ease;
}

.project-card:hover .card-overlay,
.project-card:focus-visible .card-overlay { opacity: 1; }

.card-title {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 18px 20px;
    font-size: var(--fs-sm);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--white);
    opacity: 0.85;
    transform: translateY(0);
    transition: opacity 0.4s ease;
    z-index: 2;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
    line-height: 1.4;
}

.project-card:hover .card-title,
.project-card:focus-visible .card-title { opacity: 1; }

/* Rolle / Kunde / Jahr – wird gezeigt, sobald Text drinsteht */
.card-meta {
    display: block;
    margin-top: 4px;
    font-size: var(--fs-xs);
    font-weight: 400;
    letter-spacing: 0.16em;
    color: var(--white-55);
}

.card-meta:empty { display: none; }

/* Externer Link: Badge oben rechts (JOYN / SKY / INSTAGRAM) */
.card-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 3;
    padding: 6px 10px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--white-85);
    background: rgba(10,10,10,0.6);
    border: 1px solid var(--white-12);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 2px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}

.card-badge svg { width: 10px; height: 10px; }

/* --- Play Icon --- */
.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.85);
    width: 60px;
    height: 60px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.5s var(--ease-out), background 0.3s ease;
    z-index: 3;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    pointer-events: none;
}

.play-icon svg { width: 20px; height: 20px; margin-left: 3px; }
.play-icon.external svg { width: 18px; height: 18px; margin-left: 0; }

.project-card:hover .play-icon,
.project-card:focus-visible .play-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    background: rgba(255,255,255,0.14);
}

.project-card[data-youtube],
.project-card[data-mp4] { cursor: pointer; }

/* --- Lightbox --- */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.96);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s;
}

.lightbox.active { opacity: 1; visibility: visible; }

.lightbox-close {
    position: absolute;
    top: max(12px, env(safe-area-inset-top, 0px));
    right: 12px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white-70);
    z-index: 1001;
    transition: color 0.3s ease, transform 0.3s ease;
}

.lightbox-close:hover { color: var(--white); transform: rotate(90deg); }

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white-55);
    z-index: 1001;
    border-radius: 50%;
    transition: color 0.3s ease, background 0.3s ease;
}

.lightbox-nav:hover { color: var(--white); background: var(--white-12); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-nav.hidden { visibility: hidden; pointer-events: none; }

.lightbox-content {
    width: min(90vw, calc((100vh - 140px) * 16 / 9), 1200px);
    aspect-ratio: 16 / 9;
    background: #000;
    box-shadow: 0 30px 80px rgba(0,0,0,0.6);
    transform: scale(0.96);
    transition: transform 0.5s var(--ease-out);
}

.lightbox.active .lightbox-content { transform: scale(1); }

.lightbox-video { width: 100%; height: 100%; }
.lightbox-video iframe, .lightbox-video video { width: 100%; height: 100%; border: none; display: block; background: #000; }

.lightbox-caption {
    position: absolute;
    left: 50%;
    bottom: max(24px, env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    max-width: 90vw;
    text-align: center;
    font-size: var(--fs-xs);
    letter-spacing: var(--track-caps);
    text-transform: uppercase;
    color: var(--white-55);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.lightbox-caption .lb-count { color: var(--white-40); margin-right: 12px; }

/* --- Section Navigation (Pills) --- */
.section-nav {
    position: fixed;
    top: calc(var(--header-h) + 12px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 99;
    display: flex;
    gap: 2px;
    background: rgba(10,10,10,0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 4px;
    border-radius: 999px;
    border: 1px solid var(--white-06);
}

.nav-pill {
    display: inline-block;
    flex-shrink: 0;
    padding: 11px 18px;
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.18em;
    color: var(--white-55);
    border-radius: 999px;
    transition: color 0.3s ease, background 0.3s ease;
    text-transform: uppercase;
    white-space: nowrap;
    line-height: 1;
}

.nav-pill:hover { color: var(--white-85); }
.nav-pill.active { color: var(--white); background: var(--white-12); }

/* --- Scroll to Top --- */
.scroll-top {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    right: 24px;
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--white-12);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, background 0.3s ease;
    z-index: 50;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.scroll-top.visible { opacity: 1; visibility: visible; }
.scroll-top:hover { background: rgba(255,255,255,0.18); }

/* --- Sections: Fade-In --- */
.portfolio-section { opacity: 0; transform: translateY(30px); transition: opacity 0.8s ease, transform 0.8s var(--ease-out); }
.portfolio-section.visible { opacity: 1; transform: translateY(0); }

/* --- Responsive --- */
@media (max-width: 1024px) {
    .project-card { width: calc(100vw / 2.4); }
}

@media (max-width: 778px) {
    .portfolio-main { padding-top: calc(var(--header-h) + 66px); }
    .portfolio-section { margin-bottom: 56px; scroll-margin-top: calc(var(--header-h) + 60px); }
    .section-heading { padding: 0 var(--content-pad) 10px; gap: 6px; flex-direction: column; align-items: flex-start; }
    .section-heading h2 { font-size: clamp(46px, 16vw, 84px); letter-spacing: 0.04em; }

    /* Mobil: natives Scrollen mit Snap statt Auto-Marquee (JS schaltet um) */
    .carousel-wrapper {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        scroll-padding-left: var(--content-pad);
        cursor: default;
    }
    .carousel-wrapper::-webkit-scrollbar { display: none; }
    .carousel { overflow: visible; padding: 6px 0 14px; }
    .carousel-track { width: max-content; transform: none !important; padding: 0 var(--content-pad); gap: 12px; }
    .project-card { width: 78vw; scroll-snap-align: start; }
    .card-title { font-size: var(--fs-xs); letter-spacing: 0.1em; padding: 14px; }
    .card-overlay, .card-title { opacity: 1; }
    .play-icon { opacity: 0.9; transform: translate(-50%, -50%) scale(0.85); width: 48px; height: 48px; }
    .card-badge { top: 10px; right: 10px; padding: 5px 8px; }

    .section-nav { top: calc(var(--header-h) + 10px); }
    .nav-pill { padding: 10px 14px; letter-spacing: 0.12em; }

    /* Lightbox mobil: Video volle Breite, Pfeile unter dem Video statt drauf */
    .lightbox-content { width: 100vw; }
    .lightbox-nav {
        top: auto;
        bottom: calc(64px + env(safe-area-inset-bottom, 0px));
        transform: none;
        background: var(--white-06);
        border: 1px solid var(--white-12);
    }
    .lightbox-prev { left: calc(50% - 72px); }
    .lightbox-next { right: calc(50% - 72px); }
    .lightbox-caption { bottom: calc(136px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 480px) {
    .project-card { width: 84vw; }
}

@media (prefers-reduced-motion: reduce) {
    .carousel-track { transform: none !important; }
    .portfolio-section { opacity: 1; transform: none; }
}
