/* ==========================================================================
   FRONTPAGE SPLIDE — view-scoped overrides for the .splide--view--frontpage
   carousel. Keep selectors scoped so article-page splide (article.css) and
   any other Splide instances are unaffected.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Allow the splide and its slides to shrink below the lead image's
   intrinsic 1200px width. Without this, CSS Grid's default min-width:auto
   on the 1fr column lets the image's natural width push the track (and
   the next arrow) past the viewport on narrower screens.
   -------------------------------------------------------------------------- */
.view-id-frontpage,
.view-id-frontpage .view-content,
.splide--view--frontpage,
.splide--view--frontpage .splide__track,
.splide--view--frontpage .splide__slide {
    min-width: 0;
}

/* --------------------------------------------------------------------------
   Lead image — uniform 8:5 box. The article featured display serves the
   Original Image (any aspect ratio), so object-fit: contain fits the whole
   image inside the box without cropping; off-ratio (e.g. portrait) images get
   letterbox space at the sides.
   -------------------------------------------------------------------------- */
.splide--view--frontpage .splide__slide .image-container > a {
    display: block;
    position: relative;
    aspect-ratio: 8 / 5;
    overflow: hidden;
    border-radius: var(--card-radius);
}

.splide--view--frontpage .splide__slide .image-container > a img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    /* Feather all four edges so the image dissolves softly into the
       background, matching the front-page sections. */
    -webkit-mask-image:
        linear-gradient(to right, transparent 0, #000 3px, #000 calc(100% - 3px), transparent 100%),
        linear-gradient(to bottom, transparent 0, #000 3px, #000 calc(100% - 3px), transparent 100%);
    -webkit-mask-composite: source-in;
    mask-image:
        linear-gradient(to right, transparent 0, #000 3px, #000 calc(100% - 3px), transparent 100%),
        linear-gradient(to bottom, transparent 0, #000 3px, #000 calc(100% - 3px), transparent 100%);
    mask-composite: intersect;
}

/* Subtle edge vignette — faint darkening at the top and bottom edges only,
   image stays bright through the middle. overflow:hidden on the > a clips
   the overlay to the same border-radius.
   Tints toward the nav/footer background color when that theme setting is
   set (--nav-footer-bg, emitted in preprocess_html); falls back to neutral
   black otherwise, so the default look is unchanged. */
.splide--view--frontpage .splide__slide .image-container > a::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        color-mix(in srgb, var(--nav-footer-bg, #000) 9%, transparent) 0%,
        transparent 25%,
        transparent 75%,
        color-mix(in srgb, var(--nav-footer-bg, #000) 11%, transparent) 100%);
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   Bigger, higher-contrast arrows, auto-centered on the IMAGE.
   Splide positions the arrows absolutely inside the position:relative .splide
   root, whose height is image + caption/body — so the vendor top:50% drifts
   downward as the text grows. Instead, give the arrows wrapper the same 8:5
   aspect as the image box and pin it to the top: now top:50% on each arrow
   always lands on the image's vertical center, whatever the text length.
   -------------------------------------------------------------------------- */
.splide--view--frontpage .splide__arrows {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    aspect-ratio: 8 / 5;
    pointer-events: none; /* let clicks fall through to the slide's link… */
    z-index: 2;
}

.splide--view--frontpage .splide__arrow {
    width: 56px;
    height: 56px;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 50%;
    opacity: 1;
    transition: background-color 0.2s ease;
    top: 50%; /* 50% of the 8:5 wrapper above = image center */
    pointer-events: auto; /* …but keep the arrows clickable */
}

.splide--view--frontpage .splide__arrow:hover,
.splide--view--frontpage .splide__arrow:focus {
    background: rgba(0, 0, 0, 0.8);
}

.splide--view--frontpage .splide__arrow:disabled {
    opacity: 0.4;
}

.splide--view--frontpage .splide__arrow svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}

/* --------------------------------------------------------------------------
   Pagination — give the dots breathing room below the slide.
   -------------------------------------------------------------------------- */
.splide--view--frontpage .splide__pagination {
    position: static;
    margin-top: 0.75rem;
    padding: 0;
}

.splide--view--frontpage .splide__pagination__page {
    width: 10px;
    height: 10px;
    margin: 0 4px;
}

.splide--view--frontpage .splide__pagination__page.is-active {
    background: var(--color-primary, #b22234);
    transform: scale(1.1);
}

/* --------------------------------------------------------------------------
   Mobile — smaller but still tappable.
   -------------------------------------------------------------------------- */
@media screen and (max-width: 768px) {
    .splide--view--frontpage .splide__arrow {
        width: 44px;
        height: 44px;
    }

    .splide--view--frontpage .splide__arrow svg {
        width: 22px;
        height: 22px;
    }
}
