/* --- New Media Grid Styles --- */
.post-media {
    display: grid !important;
    /* Override flex */
    gap: 2px;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 10px;
}

.media-item-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #f0f2f5;
}

.post-media-item {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s;
}

/* 1 Item */
.media-grid-1 {
    grid-template-columns: 1fr;
    max-height: 500px;
}

.media-grid-1 .media-item-wrapper {
    aspect-ratio: 16/9;
}

/* 2 Items */
.media-grid-2 {
    grid-template-columns: 1fr 1fr;
    aspect-ratio: 2/1;
}

/* 3 Items */
.media-grid-3 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    aspect-ratio: 1/1;
}

.media-grid-3 .media-item-wrapper:first-child {
    grid-row: span 2;
}

/* 4+ Items */
.media-grid-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    aspect-ratio: 1/1;
}

/* Overlay for +N */
.more-media-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    pointer-events: none;
}

/* Hover effect */
.post-media:hover .post-media-item {
    transform: scale(1.02);
}

/* Video overlay icon centered */
.video-overlay-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    pointer-events: none;
}

/* Title Section adjustments if needed (mostly inline in PHP for now) */
.post-title-section h3 {
    color: var(--text-color);
}

.dark-mode .post-title-section h3 {
    color: var(--text-color);
}