/* Homepage and Archive Styles - Reduced !important usage where possible, added lazy loading suggestion */
/* Use higher specificity or theme hooks to avoid !important if feasible */
.posts-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
    background: #000;
}

.gallery-item {
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease;
    position: relative;
}

.gallery-item:hover {
    transform: scale(1.05);
}

.gallery-video {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.gallery-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M8 5v14l11-7z"/></svg>') no-repeat center;
    background-size: contain;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.play-icon:hover {
    opacity: 1;
}

.gallery-item-title {
    padding: 10px;
    font-size: 1em;
    text-align: center;
    background: #000000;
    margin: 0;
}

.gallery-item-title a {
    color: #FFFFFF;
    text-decoration: none;
    font-weight: 700;
}

.gallery-item-title a:hover {
    color: #FFF;
}

/* ========== PAGINATION FIX ========== */
.pagination {
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 20px;
    margin: 20px auto;
    visibility: visible !important;
    background: transparent;
    font-family: Arial, sans-serif;
    flex-wrap: wrap;          /* Wrap on small screens */
    max-width: 100%;          /* Prevent overflow */
    clear: both;              /* Clear floats to avoid layout shifts */
}

.pagination a {
    color: #FFFFFF;           /* White text */
    background: transparent;
    text-decoration: none;
    padding: 10px 15px;
    border: 2px solid #FFFFFF; /* White border */
    border-radius: 5px;
    font-size: 1em;
    font-weight: bold;
    line-height: 1.2;
    transition: all 0.3s ease;
    display: inline-block !important;
    visibility: visible !important;
}

.pagination a:hover {
    background-color: #FFFFFF; /* White background on hover */
    color: #000000;            /* Black text on hover */
    border-color: #FFFFFF;
}

.pagination .current {
    background-color: #FFFFFF; /* White background for current */
    color: #000000;            /* Black text for current */
    padding: 10px 15px;
    border: 2px solid #FFFFFF;
    border-radius: 5px;
    font-size: 1em;
    font-weight: bold;
    display: inline-block !important;
    visibility: visible !important;
}

.pagination .nav-links {
    display: flex !important;
    gap: 15px !important;
    visibility: visible !important;
    flex-wrap: wrap !important;   /* Wrap links inside */
    justify-content: center;      /* Center wrapped items */
}
/* ========== END PAGINATION FIX ========== */

/* Single Post Page Styles - Leverage Bootstrap classes from template, fix sidebar width/position/shift */
/* Removed custom flex/grid on .container to avoid conflicts with Bootstrap .row */
/* Ensured main content doesn't shift left by setting proper widths; made sidebar wider (33%) and sticky only on desktop */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: #000;
}

.content-with-sidebar { /* From template PHP */
    /* Let Bootstrap handle flex via .row */
}

.main-content { /* col-lg-8 in template */
    background: #000000;
    padding: 20px;
    border-radius: 8px;
}

.sidebar { /* col-lg-4 in template */
    background: #000;
    padding: 20px;
    border-radius: 0px;
    min-height: 500px; /* Reserve space to prevent shifts */
}

@media (min-width: 992px) { /* lg breakpoint for Bootstrap */
    .main-content {
        flex: 0 0 66.666%; /* Wider main (col-lg-8 equivalent) */
        max-width: 66.666%;
    }
    .sidebar {
        flex: 0 0 33.333%; /* Less skinny sidebar (col-lg-4 equivalent, but adjusted for balance) */
        max-width: 33.333%;
        position: sticky;
        top: 20px; /* Stick to top on scroll */
        align-self: flex-start;
    }
}

@media (max-width: 991px) {
    .main-content, .sidebar {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .sidebar {
        position: static; /* No sticky on mobile */
    }
}

.widget {
    margin-bottom: 0px;
}

.widget-title {
    color: #FFFFFF;
    font-size: 1.2em;
    margin-bottom: 10px;
    border-bottom: 2px solid #fff;
    padding-bottom: 5px;
}

.widget a {
    color: #FFFFFF;
    text-decoration: none;
}

.widget a:hover {
    color: #FFF;
}

.entry-header {
    margin-bottom: 20px;
}

.entry-title {
    color: #FFFFFF;
    font-size: 2em;
    font-weight: bold;
}

.entry-content {
    color: #FFFFFF;
    font-size: 1em;
    line-height: 1.6;
}

/* Override Streamit Defaults for Archives */
.archive .posts-gallery, .post-type-archive-videos .posts-gallery {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.archive .gallery-video, .post-type-archive-videos .gallery-video, .archive .gallery-img, .post-type-archive-videos .gallery-img {
    height: 200px;
    width: 100%;
}

/* Responsive Design - Stack on mobile */
@media (max-width: 768px) {
    .posts-gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    .gallery-video, .gallery-img {
        height: 150px;
    }
    .play-icon {
        width: 40px;
        height: 40px;
    }
    .pagination a, .pagination .current {
        padding: 8px 12px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .posts-gallery {
        grid-template-columns: 1fr;
    }
    .pagination a, .pagination .current {
        padding: 6px 10px;
        font-size: 0.8em;
    }
}

/* wp-content/themes/streamit/custom-styles.css */
/* Add your custom styles here */
/* Added aspect-ratio to prevent video shifts */
.video-embed,
.video-player {
    max-width: 100%;
    margin-bottom: 20px;
    position: relative;
    aspect-ratio: 16 / 9; /* Reserves space; adjust if not 16:9 */
    overflow: hidden;
}

.video-embed video,
.video-player video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-error {
    color: WHITE;
    font-style: italic;
}

/* Fallback for older browsers */
@supports not (aspect-ratio: 16 / 9) {
    .video-embed,
    .video-player {
        padding-bottom: 56.25%; /* 16:9 */
        height: 0;
    }
}