/* ============================================
   Nik Behrendt – Work / Portfolio Page
   ============================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: #0a0a0a;
    color: #ffffff;
    font-family: 'Montserrat', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* --- Header --- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background: linear-gradient(to bottom, rgba(10,10,10,0.9) 0%, rgba(10,10,10,0) 100%);
    padding: 20px 0;
    transition: background 0.3s ease;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.back-link {
    display: flex;
    align-items: center;
    color: rgba(255,255,255,0.5);
    transition: color 0.3s ease;
    margin-right: 12px;
}

.back-link:hover {
    color: #ffffff;
}

.logo img {
    height: 30px;
    width: auto;
    filter: brightness(0) invert(1);
}

/* --- Main --- */
.portfolio-main {
    padding-top: 100px;
}

/* --- Portfolio Section --- */
.portfolio-section {
    margin-bottom: 80px;
    overflow: hidden;
}

/* --- Section Heading --- */
.section-heading {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px 20px;
}

.section-heading h2 {
    font-size: clamp(60px, 10vw, 140px);
    font-weight: 700;
    letter-spacing: 10px;
    text-transform: uppercase;
    color: #ffffff;
    line-height: 1;
    opacity: 0.9;
}

/* --- Carousel --- */
.carousel-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    margin-top: -20px;
    cursor: grab;
}

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

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

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

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

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

.card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.project-card:hover .card-image img {
    transform: scale(1.05);
}

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

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

.card-title {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #ffffff;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    z-index: 2;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.project-card:hover .card-title {
    opacity: 1;
    transform: translateY(0);
}

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

.play-icon svg {
    width: 22px;
    height: 22px;
    margin-left: 3px;
}

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

.project-card:hover .play-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

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

/* --- Lightbox --- */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

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

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    z-index: 1001;
    padding: 10px;
    transition: color 0.3s ease, transform 0.3s ease;
}

.lightbox-close:hover {
    color: #ffffff;
    transform: scale(1.1);
}

/* --- Lightbox Navigation --- */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    z-index: 1001;
    padding: 20px;
    transition: color 0.3s ease;
}

.lightbox-nav:hover {
    color: #ffffff;
}

.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; }

.lightbox-nav.hidden {
    display: none;
}

.lightbox-content {
    width: 90%;
    max-width: 1100px;
    aspect-ratio: 16 / 9;
}

.lightbox-video {
    width: 100%;
    height: 100%;
}

.lightbox-video iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* --- Section Navigation --- */
.section-nav {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99;
    display: flex;
    gap: 4px;
    background: rgba(10,10,10,0.8);
    backdrop-filter: blur(10px);
    padding: 4px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.08);
    opacity: 1;
    pointer-events: auto;
}

.nav-pill {
    display: inline-block;
    flex-shrink: 0;
    padding: 6px 18px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.5);
    border-radius: 16px;
    transition: color 0.3s ease, background 0.3s ease;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
}

.nav-pill:hover {
    color: rgba(255,255,255,0.8);
}

.nav-pill.active {
    color: #ffffff;
    background: rgba(255,255,255,0.1);
}

/* --- Footer --- */
.site-footer {
    padding: 60px 40px;
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.site-footer p {
    font-size: 12px;
    font-weight: 300;
    color: rgba(255,255,255,0.4);
    letter-spacing: 1px;
}

/* --- Scroll to Top --- */
.scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    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);
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top:hover {
    background: rgba(255,255,255,0.2);
}

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

    .section-heading h2 {
        font-size: clamp(50px, 8vw, 100px);
    }
}

@media (max-width: 778px) {
    .project-card {
        width: calc(100vw / 2);
    }

    .section-heading {
        padding: 0 20px 15px;
    }

    .header-inner {
        padding: 0 20px;
    }

    .site-footer {
        padding: 40px 20px;
    }

    .lightbox-prev { left: 5px; padding: 15px; }
    .lightbox-next { right: 5px; padding: 15px; }
}

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

    .section-heading h2 {
        font-size: clamp(40px, 12vw, 70px);
        letter-spacing: 5px;
    }

    .portfolio-section {
        margin-bottom: 50px;
    }

    .card-title {
        opacity: 1;
        transform: translateY(0);
        font-size: 11px;
    }

    .card-overlay {
        opacity: 1;
    }

    .section-nav {
        top: 65px;
        gap: 2px;
        padding: 3px;
    }
    .nav-pill {
        padding: 6px 14px;
        font-size: 10px;
        letter-spacing: 0.8px;
        white-space: nowrap;
    }
}
