/* Masonry Media Gallery Styles */

.emm-masonry-wrapper {
    position: relative;
    width: 100%;
    margin: 0 auto;
}

.emm-masonry-container {
    position: relative;
    width: 100%;
    margin: 0 auto;
    /* Clearfix for masonry if needed, though Masonry sets height */
    display: block;
    /* Completely hide until Masonry is ready */
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.4s ease, visibility 0s 0.4s;
}

.emm-masonry-container.emm-masonry-ready {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.4s ease, visibility 0s 0s;
}

/* Loading skeleton for items */
.emm-masonry-item:not(.emm-loaded) img,
.emm-masonry-item:not(.emm-loaded) video {
    opacity: 0.3;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.emm-masonry-item {
    box-sizing: border-box;
    /* Spacing is handled dynamically by padding gap and negative margin container */
    opacity: 1;
    transform: none;
}

.emm-grid-sizer {
    /* Width is handled dynamically by Elementor widget code to match items */
    width: 100%;
}

/* Animation removed - was interfering with Masonry height calculations */
/* Items now appear immediately to ensure proper layout */

.emm-masonry-item-inner {
    background: transparent;
    border-radius: var(--emm-border-radius, 0px);
    overflow: hidden;
    box-shadow: var(--emm-box-shadow, none);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    display: flex;
    flex-direction: column;
}

.emm-masonry-item-inner:hover {
    transform: translateY(-5px);
    box-shadow: var(--emm-box-shadow-hover, 0 8px 24px rgba(0, 0, 0, 0.15));
}

/* Image Wrapper */
.emm-image-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #f5f5f5;
}

.emm-image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.emm-masonry-item-inner:hover .emm-image-wrapper img {
    transform: scale(1.05);
}

/* Video Wrapper */
.emm-video-wrapper {
    position: relative;
    width: 100%;
    background: #000;
    min-height: 200px;
}

.emm-video-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.emm-video-wrapper video {
    width: 100%;
    height: auto;
    display: block;
}

/* Video Embed for iframe */
.emm-video-embed {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    /* 16:9 ratio */
    height: 0;
    overflow: hidden;
    background: #000;
}

/* Aspect ratio variations */
.emm-video-embed[data-aspect-ratio="16:9"] {
    padding-bottom: 56.25%;
}

.emm-video-embed[data-aspect-ratio="4:3"] {
    padding-bottom: 75%;
}

.emm-video-embed[data-aspect-ratio="1:1"] {
    padding-bottom: 100%;
}

.emm-video-embed[data-aspect-ratio="9:16"] {
    padding-bottom: 177.78%;
}

.emm-video-embed[data-aspect-ratio="21:9"] {
    padding-bottom: 42.86%;
}

.emm-video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Click to play thumbnail wrapper */
.emm-video-thumbnail-wrapper {
    position: relative;
    width: 100%;
    cursor: pointer;
    overflow: hidden;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 200px;
    aspect-ratio: 16/9;
}

.emm-video-thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.emm-video-thumbnail-wrapper:hover img {
    transform: scale(1.05);
}

/* Overlay for click-to-play */
.emm-video-thumbnail-wrapper .emm-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: background 0.3s ease;
}

.emm-video-thumbnail-wrapper:hover .emm-video-overlay {
    background: rgba(0, 0, 0, 0.5);
}

/* Play button inherits from global .emm-play-button styles */
.emm-video-thumbnail-wrapper:hover .emm-play-button {
    transform: scale(1.1);
    background: #ffffff;
}

/* Loading placeholder for lazy iframes */
.emm-video-embed iframe[data-src]:not([src]) {
    background: linear-gradient(90deg, #1a1a1a 0%, #2a2a2a 50%, #1a1a1a 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Lightbox Trigger */
.emm-lightbox-trigger {
    display: block;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.emm-lightbox-trigger img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

/* Overlay for Lightbox */
.emm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.emm-lightbox-trigger:hover .emm-overlay {
    opacity: 1;
}

.emm-overlay i {
    font-size: 48px;
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

.emm-lightbox-trigger:hover .emm-overlay i {
    transform: scale(1.1);
}

/* Video Overlay - Always visible with play button */
.emm-video-overlay {
    opacity: 1;
    background: rgba(0, 0, 0, 0.3);
}

.emm-lightbox-trigger:hover .emm-video-overlay {
    background: rgba(0, 0, 0, 0.5);
}

/* Play button for videos - using CSS triangle for reliability */
.emm-play-button {
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    position: relative;
}

/* CSS triangle play icon - more reliable than icon fonts */
.emm-play-button::before {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 12px 0 12px 20px;
    border-color: transparent transparent transparent #000;
    margin-left: 4px;
}

/* Fallback for icon font if it exists */
.emm-play-button i {
    font-size: 28px;
    color: #000;
    margin-left: 4px;
    text-shadow: none;
    display: none;
    /* Hide icon font, use CSS triangle instead */
}

.emm-lightbox-trigger:hover .emm-play-button {
    transform: scale(1.1);
    background: #ffffff;
}

/* Title Styles */
.emm-item-title {
    padding: 15px 20px 10px;
}

.emm-item-title h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
}

/* Description Styles */
.emm-item-description {
    padding: 0 20px 20px;
    flex-grow: 1;
}

.emm-item-description p {
    margin: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

/* Loading Indicator */
.emm-loading-indicator {
    text-align: center;
    padding: 40px 20px;
    display: none;
}

.emm-loading-indicator.active {
    display: block;
}

.emm-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 15px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #a1a2a4;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.emm-loading-indicator p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Load More Trigger (invisible element for intersection observer) */
.emm-load-more-trigger {
    height: 1px;
    width: 100%;
    visibility: hidden;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .emm-masonry-container {
        gap: 15px;
    }

    .emm-item-title h3 {
        font-size: 16px;
    }

    .emm-item-description p {
        font-size: 13px;
    }

    .emm-play-button {
        width: 60px;
        height: 60px;
    }

    .emm-play-button i {
        font-size: 24px;
    }
}

@media (max-width: 768px) {
    .emm-masonry-container {
        gap: 12px;
    }

    .emm-item-title {
        padding: 12px 15px 8px;
    }

    .emm-item-description {
        padding: 0 15px 15px;
    }

    .emm-item-title h3 {
        font-size: 15px;
    }

    .emm-item-description p {
        font-size: 12px;
    }

    .emm-play-button {
        width: 50px;
        height: 50px;
    }

    .emm-play-button i {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .emm-masonry-container {
        gap: 10px;
    }

    .emm-masonry-item-inner {
        border-radius: 8px;
    }

    .emm-play-button {
        width: 45px;
        height: 45px;
    }

    .emm-play-button i {
        font-size: 18px;
    }
}