/*
 * Recent Blog Posts carousel
 * Markup: template-parts/recent-posts-carousel.php
 *
 * Built on the theme's Webflow slider (w-slider). Webflow groups slides into
 * "pages" by the mask width, so setting each slide to 1/3 (or 1/2) width shows
 * multiple cards per view and the arrows/dots page through them in groups.
 */

.recent-posts-section {
    padding: 50px 99px 60px;
    background-color: #fff;
}

.recent-posts-wrapper {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.recent-posts-wrapper .header-div {
    max-width: none;
    margin-bottom: 30px;
}

/* ---------- Slider shell (overrides Webflow defaults) ---------- */

.recent-posts-slider.w-slider {
    height: auto;
    padding: 0 64px 50px;
    background: transparent;
    text-align: left;
}

.recent-posts-mask.w-slider-mask {
    height: auto;
    margin: 0 -12px;
}

.recent-post-slide.w-slide {
    width: 33.3333%;
    height: auto;
    padding: 0 12px;
    box-sizing: border-box;
}

/* ---------- Card ---------- */

.recent-post-card {
    position: relative;
    display: block;
    overflow: hidden;
    color: #fff;
    text-decoration: none;
    background-color: #1f3d66;
}

.recent-post-card:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

.recent-post-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

/* Fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 1 / 1) {
    .recent-post-image {
        height: 0;
        padding-top: 100%;
    }
}

.recent-post-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    transform: scale(1);
    transition: transform 600ms ease;
}

.recent-post-card:hover .recent-post-image img,
.recent-post-card:focus-visible .recent-post-image img {
    transform: scale(1.08);
}

.recent-post-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 30px 28px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.15) 45%, rgba(0, 0, 0, 0.15) 60%, rgba(0, 0, 0, 0.6) 100%);
    transition: background-color 300ms ease;
}

.recent-post-card:hover .recent-post-overlay {
    background-color: rgba(60, 111, 185, 0.25);
}

.recent-post-title {
    margin: 0;
    color: #fff;
    font-family: Montserrat, sans-serif;
    font-size: 22px;
    line-height: 1.35em;
    font-weight: 600;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recent-post-link {
    display: inline-flex;
    align-items: center;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* CSS-drawn arrow: a line with a chevron head */
.recent-post-arrow {
    position: relative;
    display: inline-block;
    width: 28px;
    height: 2px;
    margin-left: 12px;
    background-color: #fff;
    transition: width 300ms ease;
}

.recent-post-arrow:after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0;
    width: 8px;
    height: 8px;
    border-top: 2px solid #fff;
    border-right: 2px solid #fff;
    transform: translateY(-50%) rotate(45deg);
}

.recent-post-card:hover .recent-post-arrow,
.recent-post-card:focus-visible .recent-post-arrow {
    width: 40px;
}

/* ---------- Arrows ---------- */

/* Width matters: Webflow derives its paging edge from the right arrow's width. */
.recent-posts-arrow.w-slider-arrow-left,
.recent-posts-arrow.w-slider-arrow-right {
    top: 0;
    bottom: 50px; /* matches the slider's bottom padding so arrows center on the cards */
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #3c6fb9;
    color: #fff;
    font-size: 18px;
    transition: background-color 200ms ease;
}

.recent-posts-arrow.w-slider-arrow-left {
    left: 0;
}

.recent-posts-arrow.w-slider-arrow-right {
    right: 0;
}

.recent-posts-arrow.w-slider-arrow-left:hover,
.recent-posts-arrow.w-slider-arrow-right:hover,
.recent-posts-arrow.w-slider-arrow-left:focus-visible,
.recent-posts-arrow.w-slider-arrow-right:focus-visible {
    background-color: #000;
}

.recent-posts-arrow.w-slider-arrow-left:focus-visible,
.recent-posts-arrow.w-slider-arrow-right:focus-visible {
    outline: 3px solid #333;
    outline-offset: 2px;
}

/* ---------- Dots ---------- */

.recent-posts-nav.w-slider-nav {
    height: auto;
    padding-top: 0;
    bottom: 5px;
}

.recent-posts-nav .w-slider-dot {
    width: 12px;
    height: 12px;
    background-color: rgba(60, 111, 185, 0.25);
}

.recent-posts-nav .w-slider-dot.w-active {
    background-color: #3c6fb9;
}

/* ---------- Responsive ---------- */

@media screen and (max-width: 1080px) {
    .recent-posts-section {
        padding: 50px;
    }

    .recent-post-title {
        font-size: 19px;
    }
}

@media screen and (max-width: 991px) {
    .recent-post-slide.w-slide {
        width: 50%;
    }
}

@media screen and (max-width: 767px) {
    .recent-posts-section {
        padding: 40px 20px;
    }

    .recent-posts-slider.w-slider {
        padding: 0 0 50px;
    }

    .recent-posts-mask.w-slider-mask {
        margin: 0 -8px;
    }

    .recent-post-slide.w-slide {
        padding: 0 8px;
    }

    /* Swipe + dots on small screens; keep arrows tucked over the cards */
    .recent-posts-arrow.w-slider-arrow-left,
    .recent-posts-arrow.w-slider-arrow-right {
        width: 40px;
        height: 40px;
        font-size: 15px;
        background-color: rgba(60, 111, 185, 0.85);
    }

    .recent-posts-arrow.w-slider-arrow-left {
        left: 8px;
    }

    .recent-posts-arrow.w-slider-arrow-right {
        right: 8px;
    }

    .recent-post-overlay {
        padding: 24px 22px;
    }
}

@media screen and (max-width: 600px) {
    .recent-post-slide.w-slide {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .recent-post-image img,
    .recent-post-arrow,
    .recent-post-overlay {
        transition: none;
    }
}
