.gallery-main-container {
    max-width: 1280px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Fix for position: sticky which is blocked by overflow-x: hidden in style.css */
html,
body {
    overflow-x: clip !important;
}


/* Background Texture matching Design */
main#primary.site-main {
    background-color: #fff !important;
    background-image: url('../images/craft-elegance-bg.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

/* Archive Header BG (Matching Product Archive) */
.archive-header-bg {
    text-align: center;
    padding: 100px 0 50px;
    color: #fff;
    position: relative;
    background-size: cover;
    background-position: top center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    width: 100%;
    margin-bottom: 20px;
}

.archive-header-bg .header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.archive-header-bg .page-title {
    font-family: var(--font-heading);
    font-size: 48px;
    font-weight: 400;
    color: #fff;
    margin-bottom: 10px;
    position: relative;
    display: inline-block;
}

/* Tabs */
.gallery-tabs {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 60px;
}

.gallery-tabs.is-stuck {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.gallery-tab-btn {
    background: transparent;
    border: 1px solid #444;
    padding: 7px 20px;
    font-family: var(--font-body, "Montserrat", sans-serif);
    font-size: 18px;
    color: #2A3234;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.gallery-tab-btn:hover {
    border-color: var(--primary-gold, #cfa15e);
    color: var(--primary-gold, #cfa15e);
}

.gallery-tab-btn.active {
    background: var(--primary-gold, #cfa15e);
    border-color: var(--primary-gold, #cfa15e);
    color: #fff;
    box-shadow: 0 4px 10px rgba(207, 161, 94, 0.3);
}

/* Content Area */
.gallery-content-wrapper {
    position: relative;
    min-height: 400px;
}

.gallery-tab-content {
    display: block;
    /* Always visible for scroll layout */
    opacity: 1;
    padding-bottom: 100px;
    /* Space between sections */
    scroll-margin-top: 180px;
    /* Offset for anchor links */
}

/* Animation removed as they are static */
.gallery-tab-content.active {
    /* No special style needed, handled by scroll */
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    /* Changed from center to allow sticky behavior */
    gap: 60px;
    position: relative;
    /* Context for sticky child if needed */
}

/* Left Column: Info */
.gallery-info {
    flex: 0 0 calc(50% - 30px);
    max-width: calc(50% - 30px);
    position: -webkit-sticky;
    position: sticky;
    top: 120px;
    /* Adjusted offset to clear header safely */
    margin-top: 50px;
    align-self: flex-start;
    height: fit-content;
    z-index: 10;
    will-change: transform;
}

.gallery-title {
    font-family: var(--font-heading, "Playfair Display", serif);
    font-size: 48px;
    font-weight: 400;
    color: #000000;
    margin-bottom: 30px;
    line-height: 1.1;
}

.gallery-description {
    font-family: var(--font-desc, "Montserrat", sans-serif);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.8;
    color: #808080;
    max-width: 100%;
    /* Line Clamping for 8 lines */
    display: -webkit-box;
    -webkit-line-clamp: 8;
    line-clamp: 8;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-description p {
    margin-bottom: 1.5em;
    line-height: 1.7;
}

/* Right Column: Grid Preview */
.gallery-preview {
    flex: 0 0 calc(50% - 30px);
    max-width: calc(50% - 30px);
}

.gallery-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    /* Spacing between grid items */
    width: 100%;
}

.preview-item {
    position: relative;
    border-radius: 8px;
    /* Slightly less rounded than single image */
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    display: block;
}

.preview-item.has-yt-thumb img {
    height: 135%;
    min-height: 135%;
    top: 50%;
    transform: translateY(-50%);
    position: absolute;
}

.preview-item.has-yt-thumb:hover img {
    transform: translateY(-50%) scale(1.05);
}

.preview-item:hover img {
    transform: scale(1.05);
}

/* Large Item (Top) - Spans 2 columns */
.preview-large {
    grid-column: span 2;
    height: 350px;
    /* Adjust height */
}

/* Small Items (Bottom) - Span 1 column */
.preview-small {
    grid-column: span 1;
    height: 200px;
    /* Adjust height */
}

/* Overlay +Count */
.more-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    font-weight: 600;
    z-index: 2;
    transition: background 0.3s;
}

.preview-item:hover .more-overlay {
    background: rgba(0, 0, 0, 0.4);
}

/* Play Icon */
.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 40px;
    z-index: 2;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

/* Mobile Responsive */
@media (max-width: 992px) {
    .gallery-row {
        flex-direction: column;
        gap: 30px;
    }

    .gallery-tab-content {
        padding-bottom: 40px;
    }

    .gallery-info {
        flex: 0 0 100%;
        max-width: 100%;
        text-align: left;
        /* Left align text */
        position: static;
        top: auto;
        height: auto;
        margin-bottom: 20px;
        /* Spacing below description */
    }

    .gallery-description {
        max-width: 100%;
        font-size: 14px;
    }
    
    [dir="rtl"] .gallery-description {
        max-width: 100%;
        font-size: 14px;
        text-align: right;
    }

    /* Correct Selector for Preview Container */
    .gallery-preview {
        flex: 0 0 100%;
        max-width: 100%;
        width: 100%;
    }

    /* Adjust Heights for Mobile */
    .preview-large {
        height: 250px;
        /* Reduced height for mobile */
    }

    .preview-small {
        height: 150px;
        /* Reduced height for mobile */
    }

    .preview-item.single-large-item {
        height: 350px;
    }

    .gallery-title {
        font-size: 30px;
    }
    
    [dir="rtl"] .gallery-title {
        font-size: 30px;
        text-align: right;
    }

    .gallery-tabs {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .archive-header-bg {
        min-height: 200px;
        height: 200px;
        align-items: flex-end;
        padding-bottom: 0;
        margin-bottom: 0;
    }

    .archive-header-bg .page-title {
        font-size: 30px;
        margin-bottom: 20px;
    }

    .gallery-main-container .gmc-breadcrumbs {
        margin-top: 10px !important;
        margin-bottom: 50px !important;
    }
}

/* Lightbox Styles */
.gallery-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
}

.lightbox-content {
    position: relative;
    z-index: 100000;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    z-index: 100001;
}

.lightbox-main-stage {
    flex: 1;
    width: 100%;
    max-width: 1000px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    max-height: max-content;
}

.lightbox-share-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #333;
    border: none;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-share-btn:hover {
    background: #c38f26;
}

.lightbox-share-btn img {
    /*width: 24px;*/
    /*height: 24px;*/
    display: block;
}

.lightbox-media-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-media-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.lightbox-media-container iframe,
.lightbox-media-container video {
    width: 100%;
    height: 100%;
    max-width: 800px;
    max-height: 450px;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.3s;
    font-size: 18px;
    z-index: 100002;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-prev {
    left: -60px;
}

.lightbox-next {
    right: -60px;
}

.lightbox-thumbnails {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    max-width: 90%;
    height: 80px;
    margin-top: 0;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    text-align: center;
    z-index: 10;
}

.lightbox-thumbnails-track {
    display: inline-block;
}

.lightbox-thumb {
    display: inline-block;
    width: 80px;
    height: 60px;
    margin: 0 5px;
    cursor: pointer;
    opacity: 1;
    transition: all 0.3s;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
}

.lightbox-thumb.active {
    border-color: var(--primary-gold, #cfa15e);
}

.lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

body.no-scroll {
    overflow: hidden;
}

@media (max-width: 768px) {
    .lightbox-prev {
        left: 10px;
        z-index: 10;
        background: rgba(0, 0, 0, 0.5);
    }

    .lightbox-next {
        right: 10px;
        z-index: 10;
        background: rgba(0, 0, 0, 0.5);
    }

}

@media (max-width: 768px) {

    .container,
    .gallery-main-container {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    .gallery-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Firefox */
        -ms-overflow-style: none;
        /* IE and Edge */
        padding: 5px 0;
        margin-bottom: 30px !important;
        justify-content: flex-start;
        width: 100%;
    }

    .gallery-tabs::-webkit-scrollbar {
        display: none;
        /* Chrome, Safari, Opera */
    }

    .gallery-tab-btn {
        white-space: nowrap;
        /* Prevent button text from wrapping to multi-line */
        flex-shrink: 0;
        font-size: 16px;
    }

    .gallery-info {
        margin-top: 0;
    }
}