/* ============================================
   3D COVER-FLOW PRODUCT SWITCHER - IAT FUSION
   Cards arranged in 3D space; the active one is
   front-and-center, others tilt/fade to the sides.
   Swap by click, drag, scroll-wheel, swipe, or ←→.
   ============================================ */

.coverflow-section {
    padding: 130px 0 2rem;
    position: relative;
    z-index: 5;
}

.coverflow-stage {
    position: relative;
    height: 460px;
    perspective: 1600px;
    perspective-origin: 50% 55%;
    overflow: hidden;
    border-radius: 28px;
    background:
        radial-gradient(ellipse at 50% 100%,
            rgba(0,0,0,0.45) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 0%,
            rgba(255,255,255,0.04) 0%, transparent 70%);
    cursor: grab;
    outline: none;
    user-select: none;
    -webkit-user-select: none;
}
.coverflow-stage:focus-visible {
    box-shadow: 0 0 0 2px var(--theme-primary, #facc15);
}
.coverflow-stage.dragging { cursor: grabbing; }

.coverflow-track {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    pointer-events: none;
}

/* Hide cards until JS has run its first layout pass.
   Prevents the last DOM card (trucking) from briefly
   covering the stack on page load. */
.coverflow-track:not(.cf-ready) .cf-card {
    opacity: 0 !important;
    transition: none !important;
}

/* ── Individual 3D card ── */
.cf-card {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 280px;
    height: 360px;
    margin: -180px 0 0 -140px;
    transform-style: preserve-3d;
    pointer-events: auto;
    cursor: pointer;
    transition: transform .65s cubic-bezier(.16,1,.3,1),
                opacity   .65s cubic-bezier(.16,1,.3,1),
                filter    .65s cubic-bezier(.16,1,.3,1);
    will-change: transform, opacity;
}

.cf-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 24px;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background:
        linear-gradient(160deg,
            rgba(255,255,255,0.10) 0%,
            rgba(255,255,255,0.02) 50%,
            rgba(0,0,0,0.20) 100%),
        linear-gradient(135deg,
            var(--c1, #1e40af),
            var(--c3, #0f172a) 70%,
            #000);
    border: 1px solid rgba(255,255,255,0.18);
    box-shadow:
        0 30px 60px -15px rgba(0,0,0,0.75),
        inset 0 1px 0 rgba(255,255,255,0.20),
        inset 0 -1px 0 rgba(0,0,0,0.30);
    overflow: hidden;
    isolation: isolate;
    transition: box-shadow .5s ease, border-color .5s ease;
}

/* Iridescent edge */
.cf-card-inner::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: conic-gradient(from 200deg,
        var(--c1, #1e40af),
        var(--c2, #facc15),
        var(--c3, #7f1d1d),
        rgba(255,255,255,.7),
        var(--c1, #1e40af));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    opacity: .6;
    pointer-events: none;
    animation: cfSpin 9s linear infinite;
}

/* Inner aurora */
.cf-glow {
    position: absolute;
    inset: -20%;
    background:
        radial-gradient(ellipse at 30% 20%, var(--c2, #facc15) 0%, transparent 45%),
        radial-gradient(ellipse at 75% 85%, var(--c1, #1e40af) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, var(--c3, #7f1d1d) 0%, transparent 55%);
    filter: blur(35px) saturate(1.4);
    opacity: .55;
    z-index: -1;
    animation: cfDrift 14s ease-in-out infinite alternate;
}

@keyframes cfSpin  { to { transform: rotate(360deg); } }
@keyframes cfDrift {
    from { transform: translate(-3%, -3%) scale(1.05); }
    to   { transform: translate( 4%,  3%) scale(1.15); }
}

/* Card content */
.cf-icon {
    font-size: 4rem;
    color: #fff;
    text-shadow: 0 4px 30px rgba(0,0,0,.5),
                 0 0 40px var(--c2, #facc15);
    margin-bottom: 1.25rem;
    transition: transform .5s cubic-bezier(.16,1,.3,1);
}
.cf-card:hover .cf-icon { transform: translateY(-4px) scale(1.06); }

.cf-name {
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff;
    margin: 0 0 .4rem;
    letter-spacing: -.01em;
    text-shadow: 0 2px 12px rgba(0,0,0,.5);
}

.cf-tag {
    font-size: .9rem;
    color: rgba(255,255,255,0.85);
    margin: 0 0 1.1rem;
    line-height: 1.4;
    max-width: 220px;
}

.cf-chip {
    display: inline-block;
    padding: .35rem .9rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #fff;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.18);
    backdrop-filter: blur(6px);
}

/* Active card emphasis */
.cf-card.is-active .cf-card-inner {
    box-shadow:
        0 40px 90px -20px rgba(0,0,0,0.85),
        0 0 80px var(--c1, #1e40af),
        0 0 140px var(--c2, #facc15),
        inset 0 1px 0 rgba(255,255,255,0.30);
    border-color: rgba(255,255,255,0.35);
}
.cf-card.is-active .cf-card-inner::before { opacity: 1; }
.cf-card.is-active .cf-icon { transform: scale(1.10); }

/* Mirror reflection under each card */
.cf-card::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    top: 100%;
    height: 60%;
    background: linear-gradient(180deg,
        rgba(255,255,255,0.18) 0%,
        rgba(255,255,255,0)   100%);
    -webkit-mask: linear-gradient(180deg, #000, transparent 80%);
            mask: linear-gradient(180deg, #000, transparent 80%);
    transform: scaleY(-1) translateY(100%);
    transform-origin: top;
    border-radius: inherit;
    pointer-events: none;
    opacity: .35;
    filter: blur(1px);
}

/* ── Nav arrows ── */
.cf-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 30;
    width: 56px; height: 56px;
    border-radius: 50%;
    background: rgba(15,23,42,0.55);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.20);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .3s ease;
    touch-action: manipulation;
}
.cf-nav-prev { left: 2rem; }
.cf-nav-next { right: 2rem; }
.cf-nav:hover {
    background: var(--theme-primary, #facc15);
    color: #0f172a;
    transform: translateY(-50%) scale(1.10);
    box-shadow: 0 10px 30px rgba(var(--theme-primary-rgb, 250,204,21), .45);
}
.cf-nav i { font-size: 1.1rem; }

/* ── Floating meta (active label + dots) ── */
.cf-meta {
    position: absolute;
    left: 50%;
    bottom: 1.2rem;
    transform: translateX(-50%);
    z-index: 25;
    text-align: center;
    pointer-events: none;
    width: 90%;
}
.cf-meta-name {
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 14px rgba(0,0,0,.7);
    letter-spacing: -.01em;
    transition: opacity .25s ease;
    display: none;
}
.cf-meta-tag {
    font-size: .85rem;
    color: rgba(255,255,255,.75);
    margin-top: .15rem;
    transition: opacity .25s ease;
}
.cf-meta.swap .cf-meta-name,
.cf-meta.swap .cf-meta-tag { opacity: 0; }

.cf-dots {
    display: inline-flex;
    gap: .5rem;
    margin-top: .85rem;
    pointer-events: auto;
}
.cf-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    border: none;
    cursor: pointer;
    transition: all .3s ease;
}
.cf-dot.active {
    width: 28px;
    border-radius: 4px;
    background: var(--theme-primary, #facc15);
    box-shadow: 0 0 12px rgba(var(--theme-primary-rgb, 250,204,21), .7);
}
.cf-hint {
    margin-top: .6rem;
    font-size: .72rem;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: rgba(255,255,255,.45);
}
.cf-hint i { color: var(--theme-primary, #facc15); margin-right: .35rem; }

/* ── Hide the legacy toggle row (still used by products.js) ── */
.product-toggle-carousel.cf-legacy {
    position: absolute !important;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    border: 0;
    pointer-events: none;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .coverflow-section { padding-top: 120px; }
    .coverflow-stage   { height: 440px; }
    .cf-card           { width: 250px; height: 330px; margin: -165px 0 0 -125px; }
}

@media (max-width: 768px) {
    .coverflow-section { padding: 100px 0 1rem; }
    .coverflow-stage   { height: 430px; border-radius: 16px; }
    .cf-card           { width: 210px; height: 290px; margin: -145px 0 0 -105px; }
    .cf-icon           { font-size: 2.8rem; }
    .cf-name           { font-size: 1.2rem; }
    .cf-tag            { font-size: 0.75rem; }
    .cf-chip           { font-size: 0.65rem; padding: 0.25rem 0.75rem; }
    .cf-nav            { width: 40px; height: 40px; font-size: 0.85rem; }
    .cf-nav-prev       { left: .5rem; }
    .cf-nav-next       { right: .5rem; }
    .cf-meta           { bottom: .85rem; }
    .cf-meta-name      { font-size: 1.3rem; }
    .cf-meta-tag       { font-size: 0.75rem; margin-top: .35rem; }
    .cf-hint           { font-size: 0.65rem; margin-top: .45rem; }
}

@media (max-width: 480px) {
    .coverflow-section { padding: 90px 0 0.5rem; }
    .coverflow-stage   { height: 360px; border-radius: 12px; }
    .cf-card           { width: 170px; height: 232px; margin: -126px 0 0 -85px; }
    .cf-card-inner     { padding: 1rem .9rem; border-radius: 16px; }
    .cf-icon           { font-size: 2rem; margin-bottom: .45rem; }
    .cf-name           { font-size: 1rem; }
    .cf-tag            { display: none; }
    .cf-chip           { font-size: 0.58rem; padding: 0.22rem 0.65rem; }
    .cf-nav            { width: 34px; height: 34px; }
    .cf-dots           { gap: .35rem; }
    .cf-dot            { width: 6px; height: 6px; }
    .cf-meta           { bottom: .55rem; width: 94%; }
    .cf-meta-tag       { font-size: 0.68rem; margin-top: .25rem; }
    .cf-hint           { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .cf-card, .cf-card-inner::before, .cf-glow,
    .cf-meta-name, .cf-meta-tag { animation: none !important; transition: none !important; }
}
