/* Reels Grid Layout */
.aivah-rg-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Fallback */
    gap: 20px;
    box-sizing: border-box;
    width: 100%;
}

.aivah-rg-item {
    position: relative;
    box-sizing: border-box;
    width: 100%;
}

/* Individual Vertical Card (Explicit Height) */
.aivah-rg-card-inner {
    position: relative;
    width: 100%;
    height: 520px; /* Explicit height for Desktop */
    background-color: #000000;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.aivah-rg-cover-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.aivah-rg-item:hover .aivah-rg-cover-image {
    transform: scale(1.05);
}

/* Overlay Hover Dimmer */
.aivah-rg-overlay-hover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    transition: background-color 0.3s ease;
    z-index: 2;
}

.aivah-rg-item:hover .aivah-rg-overlay-hover {
    background-color: rgba(0, 0, 0, 0.4);
}

.aivah-rg-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0.8;
    z-index: 3;
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease;
    pointer-events: none;
    width: 50px;
    height: 50px;
}

.aivah-rg-play-icon img {
    width: 100%;
    height: 100%;
    display: block;
}

.aivah-rg-item:hover .aivah-rg-play-icon {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Metadata Styling */
.aivah-rg-meta-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 40px 20px 20px 20px;
    box-sizing: border-box;
    z-index: 3;
    background: linear-gradient(0deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.aivah-rg-title {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 5px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.3;
}

.aivah-rg-subtitle {
    font-size: 12px;
    color: #cccccc;
    margin: 0 0 5px 0;
    font-weight: 400;
}

.aivah-rg-details {
    font-size: 11px;
    color: #999999;
    display: flex;
    gap: 6px;
    align-items: center;
}

.aivah-rg-details .dot {
    color: #00e5ff;
    font-weight: bold;
}

/* Inline Play Video Object */
.aivah-rg-video-inline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    object-fit: cover;
    background-color: #000000;
}

/* Lightbox Modal styling */
.aivah-rg-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.aivah-rg-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.aivah-rg-lightbox-close {
    position: absolute;
    top: 30px;
    right: 35px;
    color: #ffffff;
    font-size: 44px;
    font-weight: 200;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease, transform 0.2s ease;
    z-index: 10;
}

.aivah-rg-lightbox-close:hover {
    color: #00e5ff;
    transform: scale(1.1);
}

.aivah-rg-lightbox-content {
    position: relative;
    width: 90%;
    max-width: 440px; /* Optimized vertical aspect ratio constraints for vertical Reels */
    height: 82%;
    max-height: 800px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aivah-rg-lightbox-content video,
.aivah-rg-lightbox-content iframe {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #000000;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

/* Responsive Responsive Heights */
@media (max-width: 1024px) {
    .aivah-rg-card-inner {
        height: 440px;
    }
}

@media (max-width: 767px) {
    .aivah-rg-card-inner {
        height: 320px;
    }
}