/* Media Gallery Marquee Styles */
.media-gallery-marquee-column {
    will-change: transform;
}

/* Left column - scrolls up (bottom to top) */
.media-gallery-marquee-up {
    bottom: 0;
    animation: mediaGalleryScrollUp 30s linear infinite;
}

/* Right column - scrolls down (top to bottom) */
.media-gallery-marquee-down {
    top: 0;
    animation: mediaGalleryScrollDown 30s linear infinite;
}

@keyframes mediaGalleryScrollUp {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(50%);
    }
}

@keyframes mediaGalleryScrollDown {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(-50%);
    }
}

/* Pause animation on hover */
.media-gallery-marquee:hover .media-gallery-marquee-column {
    animation-play-state: paused;
}

/* Gallery Image Popup Modal Styles */
.gallery-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-popup-overlay.show {
    display: flex;
    opacity: 1;
}

.gallery-popup-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

@media (min-width: 768px) {
    .gallery-popup-content {
        width: auto;
        height: auto;
        min-height: 100%;
    }
}

.gallery-popup-inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

@media (min-width: 768px) {
    .gallery-popup-inner {
        width: auto;
        height: auto;
        background: transparent;
    }
}

.gallery-popup-gradient-top {
    position: absolute;
    top: 0;
    width: 100%;
    height: 257px;
    z-index: 10;
    background: linear-gradient(0deg, rgba(139, 111, 71, 0) 0%, rgba(139, 111, 71, 0.52) 40.5%, var(--color-gold-dark) 100%);
}

@media (min-width: 768px) {
    .gallery-popup-gradient-top {
        display: none;
    }
}

.gallery-popup-gradient-bottom {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 346px;
    z-index: 10;
    background: linear-gradient(rgba(139, 111, 71, 0) 0%, rgba(139, 111, 71, 0.52) 40.5%, var(--color-gold-dark) 100%);
}

@media (min-width: 768px) {
    .gallery-popup-gradient-bottom {
        display: none;
    }
}

.gallery-popup-close {
    position: absolute;
    top: 57px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    width: 62px;
    height: 62px;
    min-width: 62px;
    min-height: 62px;
    max-width: 62px;
    max-height: 62px;
    background: var(--color-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    transition: transform 0.3s ease;
}

@media (min-width: 768px) {
    .gallery-popup-close {
        position: relative;
        top: 0;
        left: 0;
        transform: none;
        margin-bottom: 48px;
    }
}

@media (min-width: 1280px) {
    .gallery-popup-close {
        margin-bottom: 32px;
    }
}

.gallery-popup-close:hover {
    transform: scale(1.1);
}

@media (min-width: 768px) {
    .gallery-popup-close:hover {
        transform: scale(1.1);
    }
}

.gallery-popup-close i {
    color: white;
    font-size: 24px;
    position: relative;
    z-index: 10;
}

.gallery-popup-image-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-popup-image,
#gallery-popup-video {
    width: auto;
    height: auto;
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 16px;
}

@media (min-width: 768px) {

    .gallery-popup-image,
    #gallery-popup-video {
        border-radius: 32px;
        max-width: 90vw;
    }
}

@media (min-width: 1100px) {

    .gallery-popup-image,
    #gallery-popup-video {
        max-width: 1049px;
    }
}

.gallery-media-wrapper {
    position: relative;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-popup-actions {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    z-index: 20;
    pointer-events: none;
    /* Let clicks pass through container area */
}

.gallery-popup-actions>* {
    pointer-events: auto;
    /* Re-enable clicks on buttons */
}

@media (min-width: 768px) {
    .gallery-popup-actions {
        flex-direction: row;
        width: 100%;
        bottom: 0;
        right: 0;
        justify-content: flex-end;
        padding: 14px 22px;
        align-items: center;
    }
}

.gallery-popup-share-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-popup-share-buttons {
    position: absolute;
    display: flex;
    gap: 12px;
    z-index: 30;
    /* Mobile: Column expanding upwards */
    flex-direction: column;
    bottom: 100%;
    top: auto;
    /* Ensure it doesn't default to top:0 */
    left: 50%;
    transform: translateX(-50%);
    padding-bottom: 16px;
    width: max-content;
}

.gallery-popup-share-buttons.hidden {
    display: none !important;
}

/* Share buttons animation */
.gallery-popup-share-buttons:not(.hidden) .gallery-popup-share-btn {
    opacity: 0;
    animation: slideFadeIn 0.3s forwards;
}

.gallery-popup-share-buttons:not(.hidden) .gallery-popup-share-btn:nth-child(1) {
    animation-delay: 0.05s;
}

.gallery-popup-share-buttons:not(.hidden) .gallery-popup-share-btn:nth-child(2) {
    animation-delay: 0.1s;
}

.gallery-popup-share-buttons:not(.hidden) .gallery-popup-share-btn:nth-child(3) {
    animation-delay: 0.15s;
}

.gallery-popup-share-buttons:not(.hidden) .gallery-popup-share-btn:nth-child(4) {
    animation-delay: 0.2s;
}

.gallery-popup-share-buttons:not(.hidden) .gallery-popup-share-btn:nth-child(5) {
    animation-delay: 0.25s;
}

@keyframes slideFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.9);
    }

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

@media (min-width: 768px) {
    .gallery-popup-share-buttons {
        /* Desktop: Row expanding leftwards */
        flex-direction: row;
        bottom: auto;
        left: auto;
        top: 50%;
        width: auto;
        right: 100%;
        transform: translateY(-50%);
        padding-bottom: 0;
        padding-right: 16px;
    }

    @keyframes slideFadeIn {
        from {
            opacity: 0;
            transform: translateX(10px) scale(0.9);
        }

        to {
            opacity: 1;
            transform: translateX(0) scale(1);
        }
    }
}

.gallery-popup-share-btn {
    opacity: 1;
    /* Reset default opacity */
    position: static;
    /* Remove absolute positioning from radial menu */
    transform: none;
}

.gallery-popup-icon-btn {
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
    max-width: 52px;
    max-height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    position: relative;
}

@media (min-width: 768px) {
    .gallery-popup-icon-btn {
        width: 62px;
        height: 62px;
        min-width: 62px;
        min-height: 62px;
        max-width: 62px;
        max-height: 62px;
    }
}

.gallery-popup-icon-btn:hover {
    transform: scale(1.1);
}

.gallery-popup-icon-btn i {
    color: white;
    font-size: 16px;
    position: relative;
    z-index: 10;
}

@media (min-width: 768px) {
    .gallery-popup-icon-btn i {
        font-size: 24px;
    }
}

.gallery-image-clickable {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.gallery-image-clickable:hover {
    transform: scale(1.05);
}

.fade-in {
    animation: fadeIn 0.3s ease forwards;
    opacity: 0;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}