/**
 * News Block — Carousel / Conveyor Mode
 *
 * Visual language (round buttons, clip-path chevron cut-out, smooth
 * translateX transition) is deliberately copied from the footer's
 * certification ticker (see footer.css "CONVEYOR BELT SYSTEM") for
 * consistency across the site. The mechanics differ because this carousel
 * is bounded (a fixed set of articles + an optional "Find More" card) rather
 * than an infinite auto-scrolling loop, so navigation is click-to-advance
 * with edge-aware hide/show rather than the ticker's hover-zone reveal.
 *
 * @package SOEC_Theme
 * @version 1.0.0
 */

/* Reset the grid layout used by the non-carousel News Block — the carousel
   lays its cards out in a flex track instead (see .news-carousel-track). */
.news-block-wrapper.news-carousel-active {
    display: block;
    position: relative;
}

.news-carousel-viewport {
    overflow: hidden;
    position: relative;
    width: 100%;
    /* padding + matching negative margin are applied inline per-block (see
       news-block.php render()), sized to that block's shadow_strength setting,
       so card box-shadows have room to fall outside the card without being
       clipped by this overflow:hidden — while the viewport's own footprint in
       the page layout stays exactly the same as if there were no padding at all. */
}

.news-carousel-track {
    display: flex;
    transition: transform 0.5s ease;
    will-change: transform;
}

.news-carousel-slide {
    flex: 0 0 calc((100% - (var(--carousel-visible, 3) - 1) * var(--carousel-gap, 16px)) / var(--carousel-visible, 3));
    margin-right: var(--carousel-gap, 16px);
    min-width: 0; /* allow cards to shrink instead of overflowing on narrow viewports */
}

.news-carousel-slide:last-child {
    margin-right: 0;
}

/* The card markup inside a slide is identical .split-card/.news-card markup
   used elsewhere — just let it fill its slide instead of a grid cell. */
.news-carousel-slide .split-card {
    width: 100%;
    height: 100%;
}

/* ===== "Find More Articles" card — same footprint as a real article card ===== */
.news-find-more-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    height: 100%;
    min-height: 220px;
    border-radius: var(--radius-lg, 12px);
    text-decoration: none;
    text-align: center;
    padding: 2rem 1.5rem;
    transition: all var(--transition-base, 0.2s ease);
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.1));
}

.news-find-more-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover, 0 8px 20px rgba(0, 0, 0, 0.15));
}

.news-find-more-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
}

.news-find-more-label {
    font-weight: 600;
    font-size: 1.05rem;
}

/* ===== Carousel controls — copied from footer.css .ticker-control ===== */
.news-carousel-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: var(--radius-round, 50%);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: var(--z-content, 10);
    transition: all var(--transition-base, 0.2s ease);
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.15));
    overflow: hidden;
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

/* Unlike the footer ticker (an infinite loop where arrows fade in on hover),
   these are functional prev/next controls for real content — they hide
   entirely (rather than just dim) once there's nothing further that way. */
.news-carousel-control.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.news-carousel-control:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.08);
    box-shadow: var(--shadow-hover, 0 6px 16px rgba(0, 0, 0, 0.2));
}

.news-carousel-control-left {
    left: -8px;
}

.news-carousel-control-right {
    right: -8px;
}

/* Arrow cut-out effect using clip-path — identical shape to the footer ticker */
.news-carousel-control::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: rgba(27, 81, 55, 0.85); /* forest-green, matches theme's primary accent */
    clip-path: polygon(40% 0%, 40% 35%, 100% 35%, 100% 65%, 40% 65%, 40% 100%, 0% 50%);
}

.news-carousel-control-right::before {
    clip-path: polygon(60% 0%, 60% 35%, 0% 35%, 0% 65%, 60% 65%, 60% 100%, 100% 50%);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .news-carousel-slide {
        flex-basis: calc((100% - var(--carousel-gap, 16px)) / 2);
    }
}

@media (max-width: 600px) {
    .news-carousel-slide {
        flex-basis: 100%;
    }

    .news-carousel-control-left {
        left: 4px;
    }

    .news-carousel-control-right {
        right: 4px;
    }
}
