/* =========================================
   MEDIA SPLIT LAYOUT
   ========================================= */

body.media-body-split {
    margin: 0;
    overflow: hidden;
    /* No global scroll */
    background: #000;
    font-family: 'Inter', sans-serif;
}

#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.5;
}

/* Split Container - Adjusted for Sidebar Nav */
/* The standard nav (.modern-nav) is a fixed left column approx 80-100px wide. */
.split-container {
    display: flex;
    width: 100%;
    height: 100vh;
    background: #000;
    padding-left: 0;
    /* Offset removed */
    box-sizing: border-box;
    /* Include padding in width! */
}

/* Panels */
.panel {
    position: relative;
    flex: 1;
    /* Start equal */
    height: 100%;
    transition: flex 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
    cursor: pointer;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.panel:last-child {
    border-right: none;
}

/* Inactive State: Hover Effect */
.panel:hover {
    flex: 1.5;
    /* Grow slightly */
}

.split-container:hover .panel:not(:hover):not(.active) {
    opacity: 0.6;
    /* Dim others */
}

/* Background Image */
.panel-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.5s;
    opacity: 0.6;
}

.panel:hover .panel-bg {
    transform: scale(1.05);
    opacity: 0.8;
}

/* Cover Content (Centered Title) */
.panel-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2;
    transition: opacity 0.5s ease, transform 0.5s ease;
    padding: 20px;
    text-align: center;
}

.panel-id {
    font-family: 'Space Grotesk', monospace;
    font-size: 0.8rem;
    color: var(--color-gold, #d4af37);
    margin-bottom: 20px;
    opacity: 0.8;
    border: 1px solid rgba(212, 175, 55, 0.3);
    padding: 5px 10px;
    border-radius: 20px;
}

.panel-title {
    font-family: 'Outfit', sans-serif;
    font-size: 3rem;
    /* Responsive override below */
    font-weight: 800;
    color: #fff;
    margin: 0;
    letter-spacing: -1px;
    text-transform: uppercase;
    white-space: nowrap;
}

.panel-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: #aaa;
    margin-top: 10px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.panel:hover .panel-subtitle {
    opacity: 1;
    transform: translateY(0);
}

.panel-btn {
    margin-top: 30px;
    font-family: 'Space Grotesk', monospace;
    font-size: 0.7rem;
    color: #fff;
    border-bottom: 1px solid var(--color-gold, #d4af37);
    padding-bottom: 5px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s ease 0.1s;
}

.panel:hover .panel-btn {
    opacity: 1;
    transform: translateY(0);
}

/* =========================================
   ACTIVE STATE (Expanded)
   ========================================= */

.panel.active {
    flex: 20;
    /* DOMINATE screen space */
    cursor: default;
    border-right: none;
}

.panel.active .panel-bg {
    opacity: 0.2;
    /* Fade bg to focus on content */
    transform: scale(1.1);
    filter: blur(20px);
    /* Blur background */
}

/* Hide Cover when Active */
.panel.active .panel-cover {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50px);
}

/* Hide others */
.panel.hidden {
    flex: 0;
    border: none;
}

/* =========================================
   INNER CONTENT (Hidden by default)
   ========================================= */

.panel-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    padding: 100px 40px 40px 40px;
    /* Top padding for header */
}

.panel.active .panel-content {
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.5s ease 0.5s;
    /* Delay until expanded */
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 20px;
}

.content-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    color: #fff;
    margin: 0;
}

.close-btn {
    position: absolute;
    bottom: 120px;
    /* Above bottom nav */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.close-btn:hover {
    background: #fff;
    color: #000;
    transform: translateX(-50%) scale(1.1);
}

/* Gallery Grid */
.gallery-grid {
    flex: 1;
    overflow-y: auto;
    /* Internal Scroll */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding-right: 10px;
}

/* Custom Scrollbar */
.gallery-grid::-webkit-scrollbar {
    width: 6px;
}

.gallery-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.gallery-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.g-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px;
    transition: transform 0.3s;
}

.g-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.08);
}

.g-img {
    width: 100%;
    height: 200px;
    background-size: cover;
    background-position: center;
    margin-bottom: 10px;
    border-radius: 2px;
}

.g-info {
    font-family: 'Space Grotesk', monospace;
    font-size: 0.8rem;
    color: #aaa;
}

.g-dl {
    display: inline-block;
    padding: 5px 10px;
    border: 1px solid #444;
    color: var(--color-gold, #d4af37);
    font-size: 0.7rem;
    margin-top: 5px;
    cursor: pointer;
}

/* =========================================
   ASPECT RATIO STANDARDIZATION
   ========================================= */

/* Default / Landscape Mode Grid */
.gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    align-content: start;
    /* Prevent stretch */
}

/* Portrait Mode Grid Override */
.portrait-mode {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

/* Image Container */
.g-img {
    width: 100%;
    height: auto;
    /* Determine height by aspect ratio */
    background-size: cover;
    /* Background fallback */
    background-position: center;
    margin-bottom: 10px;
    border-radius: 4px;
    overflow: hidden;
    /* For img tag */
    background: #0f1219;
    /* Loading background */
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Force Landscape Aspect Ratio (16:9) */
.gallery-grid:not(.portrait-mode) .g-img {
    aspect-ratio: 16 / 9;
}

/* Force Portrait Aspect Ratio (9:16) */
.portrait-mode .g-img {
    aspect-ratio: 9 / 16;
}

/* Img Tag Styling (New Standard) */
.g-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.g-item:hover .g-img img {
    transform: scale(1.1);
}

/* Responsive */
@media (max-width: 768px) {
    .split-container {
        flex-direction: column;
        padding-left: 0;
    }

    .panel-title {
        font-size: 1.5rem;
    }

    .panel.active {
        flex: 10;
    }

    .panel:hover {
        flex: 2;
    }

    .gallery-grid {
        padding-bottom: 50px;
    }
}

/* =========================================
   LIGHTBOX STYLES
   ========================================= */

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    /* Above everything */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2001;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

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

.lightbox-img-wrapper {
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #000;
}

.lightbox-img {
    display: block;
    max-width: 80vw;
    max-height: 70vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

.lightbox-caption {
    margin-top: 20px;
    text-align: center;
    color: #fff;
    max-width: 600px;
}

.lightbox-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    color: var(--color-gold, #d4af37);
    margin: 0 0 10px 0;
}

.lightbox-desc {
    font-family: 'Space Grotesk', monospace;
    font-size: 0.9rem;
    color: #aaa;
    line-height: 1.5;
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.lightbox-close:hover {
    opacity: 1;
    color: var(--color-gold, #d4af37);
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .lightbox-img {
        max-width: 95vw;
        max-height: 60vh;
    }

    .lightbox-title {
        font-size: 1.2rem;
    }

    .lightbox-desc {
        font-size: 0.8rem;
    }
}