/* ==========================================================================
   1. RESET & CORE VARIABLES
   ========================================================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --nav-padding: 30px;
    --hp-top: 140px;      
    --bottom-padding: 30px;
    --gap: 15px;
    --border-radius: 6px;
    --easing: cubic-bezier(0.16, 1, 0.3, 1);
    --light-grey: #f4f4f4;
    --dark-grey: #1a1a1a;
    /* Scrollbar Variables */
    --sb-track: #f1f1f1;
    --sb-thumb: #abb2bf;
    --sb-size: 20px;
}

/* 2. GLOBAL SMOOTHING & SCROLLBARS */
html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body, html {
    width: 100%; height: 100%; 
    font-family: 'DM Sans', sans-serif;
    transition: background-color 0.7s ease;
}

/* Custom Scrollbar Styles (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: var(--sb-size);
    height: var(--sb-size);
}

::-webkit-scrollbar-track {
    background: var(--sb-track);
    border-radius: 100px;
}

::-webkit-scrollbar-thumb {
    background-color: var(--sb-thumb);
    border-radius: 100px;
    border: 6px solid var(--sb-track);
}

::-webkit-scrollbar-thumb:hover { background-color: #7f8c8d; }

/* Firefox Support */
* {
    scrollbar-width: auto;
    scrollbar-color: var(--sb-thumb) var(--sb-track);
}

body.mode-traditional { background-color: #ffffff; color: #000000; }
body.mode-ai { background-color: #0a0a0a; color: #ffffff; }

a { color: inherit; text-decoration: underline; transition: opacity 0.3s ease; }
a:hover { opacity: 0.6; }

/* ==========================================================================
   3. NAVIGATION
   ========================================================================== */
nav {
    position: fixed; top: var(--nav-padding); left: var(--nav-padding); 
    right: var(--nav-padding); display: flex; justify-content: space-between; 
    align-items: center; z-index: 500;
}

.nav-left, .nav-right { display: flex; align-items: center; gap: 10px; }

.brand-pill {
    padding: 10px 22px; border-radius: 100px; font-size: 13px; font-weight: 500;
    cursor: pointer; transition: 0.6s var(--easing); background: var(--light-grey); color: #000;
    text-decoration: none !important;
}
body.mode-ai .brand-pill { background: var(--dark-grey); color: #fff; }

.sub-navigation { display: flex; align-items: center; margin-right: 10px; }
.trad-filters, .ai-filters { display: flex; gap: 12px; align-items: center; }
body.mode-ai .trad-filters { display: none; }
body.mode-traditional .ai-filters { display: none; }

.filter-btn {
    background: none; border: none; font-family: inherit; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.05em; color: #999; cursor: pointer; transition: color 0.3s ease;
}
body.mode-traditional .filter-btn.active { color: #000; }
body.mode-ai .filter-label { color: #666; font-size: 11px; text-transform: uppercase;}

.mode-toggle {
    background: var(--light-grey); padding: 4px; border-radius: 100px;
    display: flex; position: relative; width: 80px; justify-content: space-between; cursor: pointer;
}
body.mode-ai .mode-toggle { background: var(--dark-grey); }
.toggle-bg {
    position: absolute; top: 4px; left: 4px; width: 36px; height: 28px;
    background: #fff; border-radius: 100px; z-index: 1; transition: transform 0.4s var(--easing);
}
body.mode-ai .toggle-bg { transform: translateX(36px); background: #333; }
.mode-icon { width: 36px; height: 28px; display: flex; align-items: center; justify-content: center; position: relative; z-index: 2; color: #999; }
.mode-icon.active { color: #000; }
body.mode-ai .mode-icon.active { color: #fff; }

/* ==========================================================================
   4. HOMEPAGE - HORIZONTAL STRIP
   ========================================================================== */
main.horizontal-scroll { 
    height: 100vh; width: 100vw; overflow-x: auto; white-space: nowrap; 
}
main.horizontal-scroll::-webkit-scrollbar { height: var(--sb-size); }

.project-strip { 
    display: inline-flex; height: 100%; 
    padding-top: var(--hp-top); padding-bottom: var(--bottom-padding); 
}

.project-item { display: inline-block; height: 100%; margin-right: var(--gap); flex-shrink: 0; transition: 0.6s var(--easing); }
.project-item.hidden { width: 0; margin-right: 0; opacity: 0; visibility: hidden; pointer-events: none; }

.media-wrapper { 
    height: 100%; 
    border-radius: var(--border-radius); 
    overflow: hidden; 
    display: block; 
}
img, video { height: 100%; width: auto; display: block; object-fit: cover; border-radius: var(--border-radius); }

/* ==========================================================================
   5. PROJECT PAGE - CAROUSEL
   ========================================================================== */
.carousel-container {
    height: 100vh; width: 100vw; display: flex; align-items: center;
    justify-content: center; position: relative; overflow: hidden;
}

.carousel-item {
    position: absolute; top: var(--hp-top); bottom: var(--bottom-padding);
    left: var(--nav-padding); right: var(--nav-padding);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity 0.5s var(--easing); gap: var(--gap);
}
.carousel-item.active { opacity: 1; visibility: visible; pointer-events: auto; }

.double-media { display: flex; height: 100%; gap: var(--gap); width: auto; }

.media-col { 
    height: 100%; 
    display: flex; 
    align-items: center; 
    position: relative; 
    border-radius: var(--border-radius); 
    overflow: hidden; 
}

.carousel-item img, .carousel-item video,
.media-col img, .media-col video {
    height: 100%; width: auto; max-width: 100%;
    object-fit: contain; border-radius: var(--border-radius);
}

.carousel-nav-left, .carousel-nav-right { position: absolute; top: 0; height: 100%; width: 50%; z-index: 10; }
.carousel-nav-left { left: 0; cursor: w-resize; }
.carousel-nav-right { right: 0; cursor: e-resize; }

/* ==========================================================================
   6. OVERLAYS
   ========================================================================== */
.overlay {
    position: fixed; inset: 0; background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(50px); -webkit-backdrop-filter: blur(50px);
    z-index: 2000; display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.6s ease;
}
.overlay.active { opacity: 1; pointer-events: auto; }
body.mode-ai .overlay { background: rgba(0, 0, 0, 0.5); }

.close-btn {
    position: fixed; top: 30px; left: 30px; background: var(--light-grey);
    border: none; padding: 10px 22px; border-radius: 100px; font-size: 12px;
    z-index: 2100; cursor: pointer; color: #000;
}
body.mode-ai .close-btn { background: var(--dark-grey); color: #fff; }

.overlay-content { max-width: 750px; text-align: center; padding: 40px; }
.overlay-content p { 
    font-size: 1.8rem; 
    line-height: 1.4; 
    color: inherit; 
}

.naked-speaker { position: absolute; bottom: 20px; right: 20px; cursor: pointer; z-index: 100; opacity: 0.7; }

/* ==========================================================================
   7. MOBILE
   ========================================================================== */
@media (max-width: 768px) {
    ::-webkit-scrollbar { display: none; }
    * { scrollbar-width: none; }

    .sub-navigation { display: none !important; }
    nav { top: 20px; left: 20px; right: 20px; }

    .overlay-content p { font-size: 1.1rem; } 
    
    .carousel-item.active {
        display: block; 
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
        text-align: center;
    }

    .double-media { 
        flex-direction: column; 
        width: 100%;
        height: auto;
        gap: 60px; 
    }

    .media-col { 
        height: calc(100vh - 160px); 
        width: 100%; 
        display: flex; 
        align-items: center;
        justify-content: center;
        border-radius: var(--border-radius);
        overflow: hidden !important; 
        -webkit-mask-image: -webkit-radial-gradient(white, black);
    }

    /* ROUNDING FIX FOR ALL MEDIA (SINGLE & DOUBLE) */
    .media-col img, .media-col video,
    .carousel-item.active > img, .carousel-item.active > video {
        width: auto;      
        height: auto;
        max-width: 100%;
        max-height: 70vh; /* Keeps single images from being too big */
        object-fit: contain;
        border-radius: var(--border-radius) !important;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        margin: 0 auto;
    }
    
    /* Extra margin for single images to clear nav */
    .carousel-item.active > img, .carousel-item.active > video {
        margin-top: 100px;
        margin-bottom: 40px;
    }
}