/* components/value-cards.css — Infinite auto-scrolling carousel of value cards.
 *
 * Loop mechanic: the track holds 16 cards (8 real + 8 exact duplicates).
 * margin-right is used instead of gap so every card occupies an identical
 * footprint (width + margin). This makes translateX(-50%) land precisely at
 * the start of the duplicate set, producing a seamless reset with no jump.
 *
 * No JS. No external libraries. Pure CSS animation.
 */

/* ── Section wrapper — clips the scrolling track ────────────────────────── */
.value-cards-section {
    padding-block: clamp(2.5rem, 4vw, 4rem);
    background-color: var(--color-light);
    overflow: hidden;
}

/* ── Carousel track ──────────────────────────────────────────────────────── */
.value-cards-track {
    display: flex;
    width: max-content;       /* shrink-wraps to sum of all card footprints    */
    animation: carousel-scroll 40s linear infinite;
}

.value-cards-track:hover {
    animation-play-state: paused;
}

@keyframes carousel-scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

/* ── Individual card ─────────────────────────────────────────────────────── */
/* margin-right replaces gap so -50% is always exactly one full set of cards */
.value-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    padding: var(--space-8) var(--space-6);
    width: 280px;
    flex-shrink: 0;
    margin-right: 1.5rem;
    min-height: 220px;
    box-sizing: border-box;
}

/* ── Card background colors — 8n+X repeats the pattern across the duplicate set */
.value-card:nth-child(8n+1) { background-color: var(--color-card-1); }
.value-card:nth-child(8n+2) { background-color: var(--color-card-2); }
.value-card:nth-child(8n+3) { background-color: var(--color-card-3); }
.value-card:nth-child(8n+4) { background-color: var(--color-card-4); }
.value-card:nth-child(8n+5) { background-color: var(--color-card-5); }
.value-card:nth-child(8n+6) { background-color: var(--color-card-6); }
.value-card:nth-child(8n+7) { background-color: var(--color-card-7); }
.value-card:nth-child(8n+8) { background-color: var(--color-card-8); }

/* ── Text ────────────────────────────────────────────────────────────────── */
.value-card__title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--color-dark);
    line-height: 1.3;
    margin: 0 0 var(--space-2) 0;
}

.value-card__subtitle {
    font-size: 1rem;
    color: var(--color-text-muted);
    line-height: 1.55;
    margin: 0;
    max-width: 20ch;
}

/* ── Decorative icon — bottom-right watermark ────────────────────────────── */
.value-card__icon {
    position: absolute;
    bottom: var(--space-4);
    right: var(--space-4);
    width: 88px;
    height: 88px;
    opacity: 0.18;
    color: var(--color-dark);
    pointer-events: none;
}

/* ── Mobile: narrower cards so ~1.2 are visible at once ─────────────────── */
@media (max-width: 560px) {
    .value-card {
        width: 76vw;
        margin-right: 1rem;
        min-height: 0;
    }
}

/* ── Reduced motion: disable animation, show first 4 in a static 2×2 grid ── */
@media (prefers-reduced-motion: reduce) {
    .value-cards-section {
        overflow: visible;
    }

    .value-cards-track {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: clamp(1rem, 2vw, 1.5rem);
        max-width: var(--container-max);
        margin-inline: auto;
        padding-inline: var(--space-6);
        width: auto;
        animation: none;
    }

    .value-card {
        width: auto;
        flex-shrink: unset;
        margin-right: 0;
        min-height: 200px;
    }

    /* Hide cards 5–16: the new cards and the entire duplicate set */
    .value-card:nth-child(n+5) {
        display: none;
    }

    @media (max-width: 560px) {
        .value-cards-track {
            grid-template-columns: 1fr;
        }

        .value-card {
            min-height: 0;
        }
    }
}
