/* New rule for the full-width white background section */
.portfolio-section-bg {
    background-color: #ffffff;
    padding-top: 60px;
    padding-bottom: 60px;
    width: 100%;
}

/* Modified #preview-wrapper to be a centered content container */
#preview-wrapper {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

#container {
    margin: 0 auto;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#gridacord-container {
    display: flex;
    width: 100%;
    flex-grow: 1;
    margin: 0 auto;
    flex-direction: column;
    overflow: hidden;
}

#container .line {
    display: flex;
    width: 100%;
    overflow: hidden;
    outline: 3px solid #fff;
    z-index: 5;
    flex-grow: 1;
    transition: flex-grow 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

#container .item {
    overflow: hidden;
    z-index: 5;
    display: flex;
    transition: opacity 0.3s ease-in-out, flex-grow 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

#container .desktop-item {
    height: 100%;
    outline: 3px solid #fff;
    flex-grow: 1;
}

/* --- GSAP Hover Effect --- */
#container .line.expanded { flex-grow: 7; }
#container .item.expanded { flex-grow: 7; }
/* --- --- */

#container .item.dimmed { opacity: 0.3; }
#container .item a { display: flex; width: 100%; height: 100%; text-decoration: none; }

.placeholder-box {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(10px, 2.2vw, 16px);
    font-weight: bold;
    text-align: center;
    color: #ffffff;
    box-sizing: border-box;
    padding: 5px;
    cursor: pointer;
    background-size: cover;
    background-position: center;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.8);
}

.portfolio-header {
    text-align: center;
    padding: 10px 15px 15px 15px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.portfolio-header h2 {
    margin-top: 0;
    margin-bottom: 10px;
    font-family: 'Work Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(1.4em, 4vw, 1.8em);
}

.portfolio-header p {
    margin-bottom: 15px;
    color: #666;
    font-size: clamp(0.8em, 2.5vw, 0.95em);
}

.filters a {
    padding: 6px 10px;
    margin: 0 5px 5px 5px;
    cursor: pointer;
    border-radius: 4px;
    text-decoration: none;
    color: #555;
    font-weight: 500;
    font-size: clamp(0.85em, 2.5vw, 1em);
    transition: color 0.2s ease, background-color 0.2s ease;
    border: 1px solid transparent;
}

.filters a:hover {
    color: #000;
    background-color: #e9e9e9;
}

.filters a.active {
    color: #007bff;
    font-weight: 700;
    border-bottom: 2px solid #007bff;
}

/* --- LIGHTBOX STYLES (Consolidated) --- */
.custom-lightbox-content {
    padding: 25px;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-height: 100%;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    margin: auto;
}

@keyframes titleWipe {
    0% { clip-path: inset(0 100% 0 0); }
    100% { clip-path: inset(0 0 0 0); }
}

.lightbox-project-title {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(1.6em, 3.5vw, 2.2em);
    font-weight: 900;
    text-align: center;
    margin-bottom: 15px;
    color: #000000;
    width: 100%;
    animation: titleWipe 0.8s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    animation-delay: 0.1s;
    flex-shrink: 0;
}

.lightbox-divider-line {
    width: 100%;
    height: 1px;
    background-color: #000000;
    margin-bottom: 20px;
    opacity: 0;
    animation: fadeInSlideUp 0.5s ease-out forwards;
    animation-delay: 0.3s;
    flex-shrink: 0;
}

.lightbox-image-container {
    width: 100%;
    margin-bottom: 20px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    min-height: 200px; /* Ensures container has a size */
}

.lightbox-image-container img,
.lightbox-image-container video,
.lightbox-image-container .carousel {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 5px;
}

.lightbox-text-container {
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    flex-shrink: 0; /* Prevents this container from shrinking */
    max-height: 140px; /* Adjusted for better content visibility */
    padding-right: 15px; /* For scrollbar */
}

@keyframes fadeInSlideUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.lightbox-project-description {
    font-family: 'Lato', sans-serif;
    font-size: clamp(0.9em, 2.5vw, 1.0em);
    line-height: 1.6;
    color: #333;
    text-align: left;
    opacity: 0;
    animation: fadeInSlideUp 0.6s ease-out forwards;
    animation-delay: 0.5s;
}

.lightbox-project-description + .lightbox-project-description { margin-top: 0.8em; }

/* --- MEDIA QUERIES --- */
#container:not(.mobile-layout) {
    height: 500px;
}

@media (max-width: 900px) {
    #container:not(.mobile-layout) {
        height: calc(90vw * (5/9));
        max-height: 500px;
    }
}

@media (max-width: 767px) {
    .filters a.filter-show-all {
        display: none;
    }
    #container.mobile-layout {
        height: auto;
        min-height: 300px;
    }
    #gridacord-container.mobile-grid {
        display: block;
        overflow-y: auto;
        overflow-x: hidden;
        padding-top: 10px;
    }
    #container .line {
        display: none;
    }
    #gridacord-container.mobile-grid .item.mobile-item {
        width: calc(100% - 20px);
        max-width: 400px;
        margin: 0 auto 15px auto;
        height: auto;
        border: 1px solid #ccc;
        border-radius: 4px;
    }
    #gridacord-container.mobile-grid .item.mobile-item .placeholder-box {
        height: 150px;
        font-size: clamp(0.9em, 3.5vw, 1.1em);
    }
    .portfolio-header h2 { font-size: clamp(1.2em, 4vw, 1.8em); }
    .portfolio-header p { font-size: clamp(0.85em, 2.5vw, 0.95em); }
    .filters a { font-size: clamp(0.8em, 2.5vw, 1em); margin: 0 3px 3px 3px; padding: 5px 8px; }

    .custom-lightbox-content { padding: 15px; }
    .lightbox-project-title { font-size: clamp(1.2em, 3.5vw, 1.8em); }
    .lightbox-text-container { overflow-y: auto; }
}

@media (max-height: 450px) and (orientation: landscape) {
    .portfolio-section-bg {
        padding-top: 20px;
        padding-bottom: 20px;
    }
    #container:not(.mobile-layout) { height: 300px; }
    #container.mobile-layout { max-height: 90vh; overflow-y: auto; }
}