/* ================================
   CardStack product slab carousel
   ================================ */

.cardstack-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 680px;
    margin: 2rem 0;
    perspective: 1700px;
    perspective-origin: 50% 44%;
    overflow: hidden;
    isolation: isolate;
    background:
        linear-gradient(90deg, var(--secondary-color) 0%, rgba(245, 245, 240, 0) 10%, rgba(245, 245, 240, 0) 90%, var(--secondary-color) 100%),
        linear-gradient(180deg, var(--secondary-color) 0%, rgba(245, 245, 240, 0) 14%, rgba(245, 245, 240, 0) 86%, var(--secondary-color) 100%),
        radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.62), rgba(207, 230, 246, 0.9) 48%, rgba(207, 230, 246, 0.72) 100%);
}

.cardstack-container::before {
    content: '';
    position: absolute;
    inset: 7% 0 0;
    background:
        radial-gradient(ellipse at 50% 86%, rgba(45, 52, 54, 0.16), transparent 54%),
        linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.22));
    pointer-events: none;
    z-index: 0;
}

.cardstack-stage {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
    transform: translateZ(0);
}

.cardstack-card {
    position: absolute;
    width: 360px;
    height: 520px;
    cursor: pointer;
    transform-style: preserve-3d;
    transform-origin: center center;
    backface-visibility: hidden;
    transition:
        transform 0.92s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.92s cubic-bezier(0.16, 1, 0.3, 1),
        filter 0.92s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, opacity, filter;
}

.cardstack-card::after {
    content: '';
    position: absolute;
    top: 12px;
    right: -10px;
    width: 18px;
    height: calc(100% - 24px);
    border-radius: 0 14px 14px 0;
    background: linear-gradient(90deg, rgba(122, 139, 148, 0.34), rgba(255, 255, 255, 0.3));
    filter: blur(0.2px);
    opacity: 0.45;
    transform: translateZ(-8px);
    pointer-events: none;
}

.cardstack-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 18px;
    background: #e8edf0;
    border: 1px solid rgba(255, 255, 255, 0.68);
    box-shadow:
        0 26px 58px rgba(45, 52, 54, 0.22),
        0 8px 20px rgba(45, 52, 54, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.72);
    transition:
        box-shadow 0.92s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.92s cubic-bezier(0.16, 1, 0.3, 1);
}

.cardstack-card.active .cardstack-card-inner {
    transform: translateZ(18px);
    box-shadow:
        0 42px 86px rgba(45, 52, 54, 0.3),
        0 16px 34px rgba(45, 52, 54, 0.17),
        inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.cardstack-slab-image {
    position: relative;
    z-index: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.02);
    transition: transform 0.92s cubic-bezier(0.16, 1, 0.3, 1);
}

.cardstack-card.active .cardstack-slab-image {
    transform: scale(1.045);
}

.cardstack-slab-shine {
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(112deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0) 52%, rgba(247, 243, 239, 0.26) 100%);
    pointer-events: none;
    opacity: 0.82;
    transition:
        opacity 0.92s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.92s cubic-bezier(0.16, 1, 0.3, 1);
}

.cardstack-card.active .cardstack-slab-shine {
    opacity: 1;
    transform: translateX(8px);
}

.cardstack-container.is-turning .cardstack-slab-shine {
    transform: translateX(18px) skewX(-8deg);
}

.cardstack-container.is-turning .cardstack-card-inner {
    box-shadow:
        0 34px 78px rgba(45, 52, 54, 0.24),
        0 12px 30px rgba(45, 52, 54, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.cardstack-card-content {
    position: absolute;
    z-index: 3;
    left: 14px;
    right: 14px;
    bottom: 14px;
    padding: 0.85rem 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: 14px;
    background: rgba(247, 243, 239, 0.96);
    color: var(--primary-color);
    box-shadow:
        0 14px 32px rgba(45, 52, 54, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.cardstack-card.active .cardstack-card-content {
    opacity: 0;
    visibility: hidden;
}

.cardstack-floating-info {
    position: absolute;
    z-index: 6;
    padding: 0.85rem 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 14px;
    background: #f7f3ef;
    color: var(--primary-color);
    box-shadow:
        0 18px 42px rgba(45, 52, 54, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
    pointer-events: auto;
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    transition: box-shadow 0.25s ease;
}

.cardstack-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.38rem;
}

.cardstack-card-category,
.cardstack-card-origin {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.cardstack-card-category {
    color: var(--accent-color);
    font-weight: 700;
}

.cardstack-card-origin {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.cardstack-card-content h3,
.cardstack-floating-info h3 {
    margin: 0 0 0.55rem;
    color: var(--primary-color);
    font-size: 1.25rem;
    line-height: 1.25;
}

.cardstack-card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--primary-color);
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
    transition: gap 0.25s ease, color 0.25s ease;
}

.cardstack-floating-info .cardstack-card-link {
    position: relative;
    z-index: 1;
}

.cardstack-card-link:hover {
    gap: 0.75rem;
    color: var(--accent-color);
}

.cardstack-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    margin-top: 1.6rem;
}

.cardstack-nav-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(45, 52, 54, 0.12);
    background: rgba(255, 255, 255, 0.74);
    color: var(--primary-color);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 28px rgba(45, 52, 54, 0.13);
    backdrop-filter: blur(10px);
    transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
    flex-shrink: 0;
}

.cardstack-nav-btn:hover {
    background: var(--bg-white);
    transform: translateY(-2px) scale(1.06);
    box-shadow: 0 16px 32px rgba(45, 52, 54, 0.18);
}

.cardstack-view-all {
    padding: 10px 24px;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.62);
    backdrop-filter: blur(10px);
}

.cardstack-dots {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    justify-content: center;
    margin-top: 1.35rem;
}

.cardstack-dot {
    width: 9px;
    height: 9px;
    border: 0;
    border-radius: 999px;
    background: rgba(45, 52, 54, 0.18);
    cursor: pointer;
    padding: 0;
    transition: width 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.cardstack-dot:hover {
    transform: scale(1.18);
    background: rgba(74, 144, 226, 0.6);
}

.cardstack-dot.active {
    width: 30px;
    background: var(--accent-color);
}

.cardstack-spotlight {
    position: absolute;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.16;
    pointer-events: none;
    z-index: 0;
}

.cardstack-spotlight.top {
    top: -140px;
    left: 50%;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(255, 255, 255, 0.9), transparent 68%);
}

.cardstack-spotlight.bottom {
    bottom: -170px;
    right: 8%;
    background: radial-gradient(circle, rgba(74, 144, 226, 0.48), transparent 68%);
}

@media (prefers-reduced-motion: reduce) {
    .cardstack-card,
    .cardstack-card-inner,
    .cardstack-slab-image,
    .cardstack-slab-shine,
    .cardstack-dot,
    .cardstack-nav-btn {
        transition-duration: 1ms !important;
        animation-duration: 1ms !important;
    }
}

@media screen and (max-width: 768px) {
    .cardstack-container {
        height: 540px;
        margin: 1.5rem 0;
    }

    .cardstack-card {
        width: 300px;
        height: 430px;
    }

    .cardstack-card-content {
        left: 10px;
        right: 10px;
        bottom: 10px;
        padding: 0.75rem;
    }

    .cardstack-card-content h3 {
        font-size: 1.05rem;
    }

    .cardstack-floating-info {
        padding: 0.75rem;
    }

    .cardstack-floating-info h3 {
        font-size: 1.05rem;
    }

    .cardstack-card-meta {
        gap: 0.45rem;
    }

    .cardstack-card-origin {
        display: none;
    }

    .cardstack-nav {
        gap: 0.8rem;
        flex-wrap: wrap;
    }

    .cardstack-nav-btn {
        width: 40px;
        height: 40px;
        font-size: 0.95rem;
    }

    .cardstack-view-all {
        width: 100%;
        order: 3;
        margin-top: 0.6rem;
    }
}

@media screen and (max-width: 480px) {
    .cardstack-container {
        height: 455px;
        margin: 1rem 0;
    }

    .cardstack-card {
        width: 235px;
        height: 345px;
    }

    .cardstack-card-content {
        padding: 0.65rem;
    }

    .cardstack-card-content h3 {
        font-size: 0.92rem;
    }

    .cardstack-floating-info {
        padding: 0.65rem;
    }

    .cardstack-floating-info h3 {
        font-size: 0.92rem;
    }

    .cardstack-card-category,
    .cardstack-card-link {
        font-size: 0.72rem;
    }
}
