/*
 Theme Name:   Por Escrito
 Theme URI:    https://porescrito.org
 Description:  Custom Child Theme for Por Escrito - Divi with ACF Fragmentos and Revistas.
 Author:       Sergio Luna
 Author URI:   https://sled.design
 Template:     Divi
 Version:      1.0.0
 Text Domain:  sled-divi-child
*/

@import url("../Divi/style.css");

/* ==========================================================================
   Custom Post Type: Fragmentos
   ========================================================================== */
.fragmento-video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    max-width: 100%;
    background: #000;
    margin-bottom: 30px;
}

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

.fragmento-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 50px;
    padding: 30px 0;
    border-top: 1px solid #eeeeee;
}

.fragmento-nav-link a {
    font-weight: bold;
    color: #2ea3f2;
    text-decoration: none;
}

.fragmento-archive-btn {
    background: #333;
    color: #fff !important;
    padding: 10px 20px;
    border-radius: 3px;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 1px;
}

.sled-grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columns for better spacing in Divi */
    gap: 30px;
    margin-top: 30px;
}

.sled-image {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.sled-image img {
    display: block;
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.sled-image:hover img {
    transform: scale(1.1);
}

.play-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.sled-image:hover .play-overlay {
    opacity: 1;
}

.sled-title {
    font-size: 16px;
    margin-top: 15px;
    line-height: 1.4;
    font-weight: 600;
}

.sled-load-more {
    background-color: #282828;
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.sled-load-more:hover {
    background-color: #282828;
}

/* Force the Theme Builder Footer to stay in the normal document flow */
#main-footer,
.et_pb_section_0_tb_footer.et_pb_section, 
.et_pb_section_1_tb_footer.et_pb_section {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    z-index: 99 !important;
    clear: both !important;
}

/* Ensure the main content area pushes the footer down */
#main-content {
    display: block !important;
    width: 100% !important;
    min-height: 600px; /* Adjust based on your design */
    padding-bottom: 50px;
}



@media (max-width: 767px) {
    .sled-grid-container { grid-template-columns: 1fr; }
}

/* 1. Prevent Theme Builder Footer from sticking to top */
.et_pb_section_0_tb_footer.et_pb_section, 
.et_pb_section_1_tb_footer.et_pb_section {
    position: relative !important;
    top: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 10 !important;
}

/* 2. Fix the grid responsiveness */
@media (max-width: 980px) {
    #sled-grid-fragmento {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 479px) {
    #sled-grid-fragmento {
        grid-template-columns: 1fr !important;
    }
}

/* 3. Play Button Overlay Styles */
.play-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: 0.3s;
}
.sled-image:hover .play-overlay { opacity: 1; }
.play-overlay span { color: #fff; font-size: 40px; }