/**
 * Shared Scroll Carousel (Immersive Apple Style)
 * Usage: Homepage Systems, Parent Category Page
 */

/* Root Container (Optional Wrapper) */
.rx-scroll-root {
    position: relative;
    /* Often has background color or padding in parent */
}

/* Scroll Wrapper (Full Bleed positioning) */
.rx-scroll-wrapper {
    position: relative;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    isolation: isolate;
}

/* Strip Container (The Scrollable Area) */
.rx-scroll-strip-container {
    width: 100%;
    /* Start padding: Align first card with content grid */
    padding-left: max(var(--screen-edge), calc((100vw - var(--content-max)) / 2));
    /* End padding: Minimal, spacer handles the push */
    padding-right: var(--screen-edge);

    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;

    /* Global Snap */
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
}

.rx-scroll-strip-container::-webkit-scrollbar {
    display: none;
}

/* The Flex Strip */
.rx-scroll-strip {
    display: flex;
    gap: 32px;
    padding-block: 50px;
    /* Room for shadow */
}

/* The Card (60vw, 4:3 Ratio) */
.rx-snap-card {
    flex: 0 0 auto;
    width: 52vw;
    height: auto;
    aspect-ratio: 4/3;

    display: block;
    text-decoration: none;
    background: #000;
    border-radius: 12px;
    position: relative;
    overflow: hidden;

    /* Snap Logic */
    scroll-snap-align: center;

    /* Apple High Lift Shadow */
    box-shadow:
        0 20px 40px -4px rgba(0, 0, 0, 0.15),
        0 8px 16px -4px rgba(0, 0, 0, 0.1);

    /* Hover Scale */
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.rx-snap-card:first-child {
    scroll-snap-align: center;
    margin-left: 0;
}

/* Inner Visual */
.rx-card-visual {
    width: 100%;
    height: 100%;
    margin: 0;
    position: relative;
}

.rx-card-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.rx-card-visual::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 50%);
    pointer-events: none;
}

/* Card Content (Bottom Left) */
.rx-card-content {
    position: absolute;
    bottom: 40px;
    left: 40px;
    max-width: 80%;
    z-index: 2;
    padding-right: 20px;
}

.rx-card-title {
    font-size: 32px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: white;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.rx-card-subline {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.4;
    font-weight: 500;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Hover Effects */
@media (hover: hover) {
    .rx-snap-card:hover .rx-card-visual img {
        transform: scale(1.03);
    }
}

/* Spacer (Breath at end) */
.rx-scroll-spacer {
    flex: 0 0 15vw;
    pointer-events: none;
    scroll-snap-align: none;
}

/* Nav Buttons */
.rx-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.25);
    /* Faint Glass */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: rgba(29, 29, 31, 0.5);
    /* Faint Black */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.rx-nav-btn svg {
    width: 42px;
    height: 42px;
}

.rx-nav-btn.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.rx-nav-btn:hover {
    background: rgba(255, 255, 255, 0.6);
    transform: translateY(-50%) scale(1.05);
    border-color: rgba(255, 255, 255, 0.4);
    color: rgba(29, 29, 31, 0.8);
    outline: none;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.rx-nav-btn:active,
.rx-nav-btn:focus {
    background: rgba(255, 255, 255, 0.7) !important;
    color: #1d1d1f !important;
    border-color: rgba(255, 255, 255, 0.6) !important;
    outline: none !important;
    transform: translateY(-50%) scale(0.95);
}

.rx-nav-prev {
    left: var(--screen-edge, 20px);
}

.rx-nav-next {
    right: var(--screen-edge, 20px);
}

/* Mobile */
@media (max-width: 768px) {
    .rx-snap-card {
        width: 78vw;
        /* Fuller width on mobile */
        height: auto;
        border-radius: 12px;
    }

    .rx-card-content {
        bottom: 24px;
        left: 20px;
    }

    .rx-card-title {
        font-size: 24px;
    }

    .rx-nav-btn {
        display: none;
        /* Often hide arrows on touch */
    }

    .rx-scroll-spacer {
        flex: 0 0 10vw;
    }
}
