/* --- Positioning for the Slider Layout --- */

.slider-container {
    padding: 0;
    position: relative;
    margin-bottom: 20px; 
}

.main-slider {
    width: 100%;
    height: 500px; 
    margin-bottom: 15px;
}

.main-slider .swiper-slide {
    position: relative;
    overflow: visible ;
}

.main-slider .slide-link-wrapper,
.main-slider .slide-video-wrapper {
    display: block;
    width: 70%;
    height: 100%;

    /* Image-specific styles */
    object-fit: cover;
    background-size: cover;
    background-position: center center;

    /* Video-specific styles */
    position: relative; /* This is essential */
    background-color: #000; /* Fallback for video */
}

.main-slider .slide-text-box {
    position: absolute;
    top: 50%;
    left: 63%;
    width: 45%;
    height: 100%;
    z-index: 10;
    transform: translate(-20%, -50%);
    display: flex;
    align-items: center;
    
}

.main-slider .slide-text-box .post-content {
    background-color: var( --color-white);
    padding: 5%;
    width: 100%;
    height: 90%;
    display: flex;
    flex-direction: column;
    box-shadow: -5px 5px 15px rgba(0,0,0,0.25);
    overflow:hidden; /* Hide any final pixel overflow */
}

/* --- Text Styling (Desktop) --- */
.main-slider .post-content h3.tp {
    margin-bottom: .5rem;
    font-weight: 500;
    font-size: 1.7em;
    line-height: 1.25;
    font-family: LabGrotesque-Black, ZonaPro-ExtraBold;
}
.main-slider .post-content h3.tp a {
    color: var( --color-light-dark);
    text-decoration: none;
    transition: color 0.3s ease;
}
.main-slider .post-content h3.tp a:hover {
    color: var(--color-red);
}

.main-slider .post-content .tp.opacity-75.post-content {
    font-size: 1.2em;
    line-height: 1.4;
    margin-bottom: 15px;
    opacity: 0.8;
    background-color: transparent;
    box-shadow: none;
    padding: 0;
    color: var( --color-light-dark);
    text-overflow: ellipsis;
  
}

.main-slider .post-content .post-tag a {
    color:  var( --color-light-dark);
    transition: color 0.3s ease;
}
.main-slider .post-content .post-tag a:hover {
    color: var(--color-red);
}

.main-slider .post-content .ic-time {
    font-size: 1.1em;
    color: rgb(106, 106, 106);
}

.main-slider .post-content .ic-pencil {
    font-size: 1.1em;
    color: var( --color-light-dark);
    margin-top: auto;
    display: flex;
    align-items: center;
}
.main-slider .post-content .ic-pencil a {
    color: var( --color-light-dark);
    text-decoration: none;
}
.main-slider .post-content .ic-pencil .newsroom-link {
    color: var( --color-light-dark);
    /* margin-left: 2%; */
    font-weight: bold;
    transition: color 0.3s ease;
}
.main-slider .post-content .ic-pencil .newsroom-link:hover {
    color: var(--color-red);
}

/* --- Thumbs Slider Styles --- */
 .thumbs-slider {
    height: 150px;
    box-sizing: border-box;
    margin-top: 15px;
    /* Hide the slider by default to prevent the "flash" of unstyled content. */
    opacity: 0;
    visibility: hidden; /* Add visibility for a more robust hiding mechanism */
    /* Add a smooth transition for when the slider appears. */
    transition: opacity 0.4s ease-in-out, visibility 0.4s ease-in-out;
}

/*  This rule targets the slider only AFTER Swiper.js has initialized it. */
 .thumbs-slider.swiper-initialized {
    /* Once the slider is ready, make it visible. */
    opacity: 1;
    visibility: visible;
}
.thumbs-slider .swiper-slide {
    opacity: 0.7;
    cursor: pointer;
    transition: opacity 0.3s ease;
}
.thumbs-slider .swiper-slide:hover,
.thumbs-slider .swiper-slide-thumb-active {
    opacity: 1;
}
.thumbs-slider .thumb-content {
    width: 100%;
    height: 100%;
    border-left: 4px solid transparent;
    transition: border-color 0.3s ease;
    padding-left: 5px;
}
.thumbs-slider .swiper-slide-thumb-active .thumb-content {
    border-left-color: var(--color-red);
}
.thumbs-slider .thumb-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.thumbs-slider .thumb-image-wrapper img,
.thumbs-slider .thumb-image-wrapper .no-thumb-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: var( --color-extra-light-grey);
}
.thumbs-slider .thumb-title-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    color: var( --color-white);
    display: flex;
    justify-content:flex-start;
    text-align: left;
    padding: 8px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.3s ease, background-color 0.3s ease;
}
.thumbs-slider .swiper-slide:hover .thumb-title-overlay {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.6);
    color: var( --color-white);
}
/*  styles for the ACTIVE thumbnail */
.thumbs-slider .swiper-slide-thumb-active .thumb-title-overlay {
    opacity: 1;
    background-color: var(  --color-extra-light-grey);
    color: var( --color-light-dark);
}

.thumbs-slider .thumb-title-overlay p {
    margin: 0;
    font-size: 1em;
    font-weight: bold;
    line-height: 1.3;
}
/* The new excerpt class */
.main-slider .post-content .tp-excerpt {
    font-size: 1.2em;
    line-height: 1.4;
    opacity: 0.8;
    color: var( --color-light-dark);
    /* This element will grow/shrink, so margin is applied here */
    margin-bottom: 5px; 
    flex: 1; /* Allows the element to grow and shrink */
    min-height: 0; /* Crucial fix for flexbox overflow */
    overflow: hidden; /* Hides the text that doesn't fit */
}
.main-slider .post-content > *:not(.tp-excerpt) {
     flex-shrink: 0;
    }

/* --- Added 4-Column Related News Styles --- */
.related-news-container {
    margin-top: auto;
    margin-bottom: 5px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
   
    
}
/* The related news container should not shrink */
.main-slider .post-content .related-news-container {
    max-height: 150px;
    overflow-y:auto;
    flex-shrink: 0;
}
.related-news-container h4 {
    display: flex;
    align-items: center;
    font-size: min(max(14px, 2.2135416667vw), 16px);
    font-family: "LabGrotesque-Black", "ZonaPro-ExtraBold";
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
}

.related-news-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /*  2 equal columns */
    gap: 15px; /* Space between the columns */
    border-left: 2px solid var(--color-red);
    padding-left: min(max(7px, 0.8854166667vw), 17px);
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
}

.related-post-item-text-only a {
    font-size: 1em;
    line-height: 1.1;
    font-weight: 500;
    font-family: "LabGrotesque-Black", "ZonaPro-ExtraBold";
    color: var( --color-light-dark);
    text-decoration: none;
    transition: color 0.3s ease;
    
}

.related-post-item-text-only a:hover {
    color:var(--color-red);
} 

/* The author block is pushed to the bottom */
.main-slider .post-content .author-block {
    margin-top: 0; /* This is the most important part! */
    flex-shrink: 0; /* Prevents this block from shrinking */
    padding-top: 15px; /* Add padding to give it space from content above */
}
/*  Styles for the second related post item */

.related-news-grid .related-post-item-text-only:nth-child(2) {
    background-color: #eeeeee; /* A slightly  grey */
    border-left: 2px solid var(--color-red);
    padding-left: min(max(7px, 0.8854166667vw), 17px);
}
/*
 * VIDEO PLAYER STYLES
 */

.swiper-youtube-player,
.mobile-youtube-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; 
}

.swiper-youtube-player iframe,
.mobile-youtube-player iframe {
    width: 100%;
    height: 100%;
}

/* * This ensures the clickable link overlay still
 * sits on top of the desktop video.
 */
.main-slider .slide-video-wrapper .slide-link-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2; /* Sits on top of the video player */
}

/* Styles the clickable link overlay on top of the video */
.main-slider .slide-video-wrapper .slide-link-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2; /* Sits on top of the video player */
}

/* Styles the clickable link overlay on top of the video */
.main-slider .slide-video-wrapper .slide-link-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2; /* Sits on top of the video */
}

/*
 * MOBILE VIDEO PLAYER STYLES
 */

.mobile-video-container {
    position: relative;
    width: 100%;
    /* 16:9 aspect ratio */
    aspect-ratio: 16 / 9; 
    background-color: #000;
    overflow: hidden;
}

.mobile-video-container .video-thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.mobile-video-container .video-play-button-mobile {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
}

/* The "play" triangle */
.mobile-video-container .video-play-button-mobile::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 55%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 20px solid #fff;
}

.mobile-video-container:hover .video-play-button-mobile {
    transform: translate(-50%, -50%) scale(1.1);
}

.mobile-video-container .mobile-youtube-player {
    /* Hide player until it's ready */
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* * This class is added by JS on click 
 */

.mobile-video-container.video-is-playing .mobile-youtube-player {
    /* Show the player */
    display: block;
}

.mobile-video-container.video-is-playing .video-thumbnail-overlay,
.mobile-video-container.video-is-playing .video-play-button-mobile {
    /* Hide the thumbnail and play button */
    display: none;
}
/* --- END: Added Related News Styles --- */


/* =================================================================== */
/* --- Responsive Logic --- */
/* =================================================================== */

/* By default, hide the mobile list */
.mobile-article-list {
    display: none;
}

/* --- For Laptops/Large Tablets --- */
@media (max-width: 1199.98px) {
    .main-slider {
        height: 650px;
        margin-bottom: 180px;
        overflow: visible;
    }
    .main-slider .slide-link-wrapper,
    .main-slider .slide-video-wrapper {
        width: 100%;
        height: 80%;
    }
    .main-slider .slide-text-box {
        top: 100%;
        left: 50%;
        width: 80%;
        height: 70%;
        transform: translate(-50%, -60%);
    }
  .main-slider .slide-text-box .post-content{
    height:auto;
    width:100%;
  }

    .main-slider .post-content h3.tp {
        font-size: 1.3em;
        font-family: 'LabGrotesque-Bold';
    }
    .main-slider .post-content .tp.opacity-75.post-content {
        font-size: 1.1em;
        line-height: 1.5;
    }
    .main-slider .post-content h3.tp a:hover {
    color:var(--color-red);
    }

    .main-slider .post-content .related-news-container {
    max-height: 250px;
    overflow-y:auto;
    flex-shrink: 0;
}
}

/* --- For Mobile phones --- */
@media (max-width: 767.98px) {
    /* On mobile, hide the slider and show the simple list */
    .slider-container {
        display: none;
    }
    .mobile-article-list {
        display: flex;
        flex-direction: column;
        gap: 30px;
    }

   .mobile-article-list .post-content {
        display:block;
    }

    /* Styling for the mobile article list items */
    .mobile-article-item {
        border-bottom: 1px solid var(--color-light-grey);
        padding-bottom: 20px;
    }
    .mobile-article-item:last-child {
        border-bottom: none;
    }
    .mobile-article-image {
        display: block;

    }
    .mobile-article-image img {
        width: 100%;
        height: auto;
    }
    .mobile-article-item .post-content {
        padding: 5%;
        /* Ensure the inner post-content div for the excerpt has correct styling */
        background-color: #f3f3f3;
        box-shadow: none;
    }
    .mobile-article-item .post-content h3.tp a {
        font-size: 1em;
        line-height: 1.1;
        color: var( --color-light-dark);
    }
    .mobile-article-item .post-content h3.tp  {
        font-family: 'LabGrotesque-Bold';
        line-height: 1.2;

    }
    .mobile-article-item .post-content h3.tp a:hover {
        line-height: 1.1;
        color:var(--color-red);
    }
    /* Styles for the mobile excerpt and author */
    .mobile-article-item .post-content .tp.opacity-75.post-content {
        font-size: 15px;
        line-height: 1.5;
        color: var( --color-light-dark);
        padding: 0;
    }
    .mobile-article-item .post-content .ic-pencil {
        margin-top: 15px;
    }
    .mobile-article-item .post-content .author-block  {
        margin-top:15px;
    }
     .mobile-article-item .related-news-grid {
        display: grid;
        gap: 15px;
        border-left: 2px solid var(--color-red);
        font-weight: 500;
    }
    .mobile-article-item .related-news-grid.cols-1 {
        grid-template-columns: 1fr; /* One column layout */
    }
    .mobile-article-item .related-news-grid.cols-2 {
        grid-template-columns: repeat(2, 1fr); /* Two column layout */
    }
    .mobile-article-item .related-post-item-text-only:nth-child(2) {
        background-color: transparent; /* Reset desktop style */
        border-left: 2px solid var(--color-red);
    }
}