/*
Plugin Name: YouTube Post Field & Grid
Description: Stylesheet for the YouTube Post Field & Grid plugin.
*/

/* --- 1. General Responsive Video Container (Used by both shortcodes) --- */
.ypf-video-container,
.ypf-video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    max-width: 100%;
}

.ypf-video-container iframe,
.ypf-video-container object,
.ypf-video-container embed,
.ypf-video-wrapper iframe,
.ypf-video-wrapper object,
.ypf-video-wrapper embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}


/* --- 2. Recent Posts Grid Styling --- */
.ypf-recent-posts-grid {
    display: grid;
    gap: 20px; /* Space between grid items */
    margin-bottom: 30px;
    list-style: none; /* Remove list bullets if used in a list context */
    padding: 0;
}

/* Column Definitions (Desktop) */
.ypf-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}
.ypf-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}
.ypf-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Single Card Styling */
.ypf-grid-item {
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}
.ypf-grid-item:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
}

/* Thumbnail/Video Wrapper */
.ypf-thumbnail-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
}
.ypf-thumbnail-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures images fill the space */
}
.ypf-thumbnail-wrapper a {
     display: block;
}

/* Content Details */
.ypf-content-details {
    padding: 15px;
    flex-grow: 1; /* Ensures cards are same height */
    display: flex;
    flex-direction: column;
}
.ypf-content-details h3 {
    margin-top: 0;
    font-size: 1.2em;
    line-height: 1.4;
    margin-bottom: 5px;
}
.ypf-content-details h3 a {
    text-decoration: none;
    color: #333;
}
.ypf-meta {
    font-size: 0.85em;
    color: #666;
    margin-top: auto; /* Pushes meta to the bottom */
}
.ypf-placeholder-wrapper {
    background-color: #f8f8f8;
    color: #ccc;
    text-align: center;
    line-height: 100px;
    height: 100px;
    font-size: 1.2em;
}

/* --- 3. Responsiveness (Mobile First) --- */

/* Tablets */
@media (max-width: 992px) {
    .ypf-cols-3, .ypf-cols-4 {
        grid-template-columns: repeat(2, 1fr); /* 3 & 4 columns drop to 2 */
    }
}

/* Mobile Phones */
@media (max-width: 576px) {
    .ypf-recent-posts-grid {
        grid-template-columns: 1fr; /* All grids drop to 1 column */
    }
}