/* ITS Recent Posts Widget */

.its-recent-posts {
    display: flex;
    flex-direction: column;
    gap: 50px;
}

.its-recent-posts__item {
    display: flex;
    align-items: flex-start;
    gap: 39px;
}

.its-recent-posts__image {
    flex: 0 0 295px;
    width: 295px;
    height: 295px;
    overflow: hidden;
}

.its-recent-posts__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.its-recent-posts__content {
    flex: 1 1 auto;
    min-width: 0;
}

.its-recent-posts__title {
    margin: 0 0 2px;
    color: var(--color8);
}

/* Parent `.entry-content p { font-size: 1rem }` beats the plain `.h3` class; restore h3 size. */
.its-recent-posts p.its-recent-posts__title.h3 {
    font-size: 2.5em;
    line-height: 1.2;
}

.its-recent-posts__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin: 0 0 14px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--color6);
}

.its-recent-posts__term {
    text-transform: uppercase;
}

.its-recent-posts__excerpt {
    margin: 0 0 18px;
}

.its-recent-posts__more {
    color: inherit;
    text-decoration: underline;
    white-space: nowrap;
}

.its-recent-posts__sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Slider arrows — hidden unless the mobile slider is active */
.its-recent-posts__nav {
    display: none;
}

/* Mobile — stack image above content */
@media (max-width: 767px) {
    .its-recent-posts__item {
        flex-direction: column;
        gap: 14px;
    }

    .its-recent-posts__image {
        flex-basis: auto;
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 16 / 9;
    }
}

/* Mobile slider (Slider on Mobile = Yes) — one post at a time, arrows + swipe */
@media (max-width: 767px) {
    /* Parent style-blocks.css has `div[role="region"] { padding: 0 !important }` (meant for
     * accordions), so this needs the extra attribute selector + !important to keep the gutters. */
    div.its-recent-posts-wrap.its-recent-posts-wrap--mobile-slider[role="region"] {
        position: relative;
        padding: 0 40px !important;
    }

    .its-recent-posts-wrap--mobile-slider .its-recent-posts {
        flex-direction: row;
        gap: 0 !important;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
    }

    .its-recent-posts-wrap--mobile-slider .its-recent-posts::-webkit-scrollbar {
        display: none;
    }

    .its-recent-posts-wrap--mobile-slider .its-recent-posts__item {
        flex: 0 0 100%;
        scroll-snap-align: start;
        align-items: center;
        text-align: center;
    }

    .its-recent-posts-wrap--mobile-slider .its-recent-posts__image {
        aspect-ratio: 3 / 2;
    }

    .its-recent-posts-wrap--mobile-slider .its-recent-posts__title {
        font-size: 26px !important;
        line-height: 1.25;
    }

    .its-recent-posts-wrap--mobile-slider .its-recent-posts__meta {
        justify-content: center;
    }

    .its-recent-posts-wrap--mobile-slider .its-recent-posts__content {
        width: 100%;
    }

    .its-recent-posts-wrap--mobile-slider .its-recent-posts__nav {
        position: absolute;
        /* JS sets --its-rp-arrow-top to the middle of the current slide's image. */
        top: var(--its-rp-arrow-top, 30%);
        transform: translateY(-50%);
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 44px;
        padding: 0;
        background: none;
        border: none;
        color: var(--color8);
        cursor: pointer;
    }

    .its-recent-posts-wrap--mobile-slider .its-recent-posts__nav--prev {
        left: 0;
    }

    .its-recent-posts-wrap--mobile-slider .its-recent-posts__nav--next {
        right: 0;
    }

    /* Same caret shape as the ITS hero slider (assets/img/Caret-*.svg), in currentColor. */
    .its-recent-posts-wrap--mobile-slider .its-recent-posts__nav svg {
        width: 14px;
        height: 23px;
    }

    .its-recent-posts-wrap--mobile-slider .its-recent-posts__nav:focus-visible {
        outline: 2px solid var(--color6);
        outline-offset: 2px;
    }
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
    .its-recent-posts-wrap--mobile-slider .its-recent-posts {
        scroll-behavior: auto;
    }
}
