/*
 * Enhanced 3D Orbiting Carousel Styles
 * Advanced interactions, animations, and visual effects
 */

/* ========================================
   CAROUSEL SECTION
   ======================================== */

.carousel-section {
    position: relative;
    padding: var(--section-padding-y) 0;
    background: linear-gradient(to bottom, #051f0f 0%, #0a0a14 100%);
    overflow: hidden;
}

/* ========================================
   CAROUSEL CONTAINER
   ======================================== */

.carousel-container {
    position: relative;
    width: 100%;
    max-width: 1000px;
    height: 600px;
    margin: 0 auto;
    perspective: 1200px;
    perspective-origin: 50% 50%;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.carousel-container.carousel-dragging {
    cursor: grabbing;
}

/* ========================================
   ORBIT PIVOT & CARDS
   ======================================== */

.orbit-pivot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    transform-style: preserve-3d;
    will-change: transform;
}

.carousel-card {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 220px;
    height: 300px;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    will-change: transform, opacity;
    cursor: pointer;
    transition: opacity 2s ease;
}

.carousel-card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition:
        transform 900ms cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 900ms cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.5),
        0 20px 50px rgba(0, 0, 0, 0.4),
        0 0 80px rgba(201, 162, 39, 0.15);
}

/* Subtle glass border effect */
.carousel-card-inner::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-xl);
    z-index: 1;
    pointer-events: none;
    transition: border-color 2s ease;
}

/* Gradient overlay for depth */
.carousel-card-inner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.08) 0%,
        transparent 40%,
        transparent 60%,
        rgba(0, 0, 0, 0.15) 100%
    );
    border-radius: var(--radius-xl);
    z-index: 2;
    pointer-events: none;
    transition: opacity 2s ease;
}

/* Hover effects - enhanced for mobile touch */
.carousel-card:hover .carousel-card-inner,
.carousel-card:active .carousel-card-inner {
    transform: scale(1.05);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.6),
        0 30px 70px rgba(0, 0, 0, 0.5),
        0 0 100px rgba(201, 162, 39, 0.3),
        0 0 150px rgba(201, 162, 39, 0.2);
}

.carousel-card:hover .carousel-card-inner::before,
.carousel-card:active .carousel-card-inner::before {
    border-color: rgba(201, 162, 39, 0.4);
}

.carousel-card:hover .carousel-card-inner::after,
.carousel-card:active .carousel-card-inner::after {
    opacity: 0.7;
}

/* Pulse animation for click feedback */
@keyframes cardPulse {
    0% {
        transform: scale(1);
        box-shadow:
            0 10px 30px rgba(0, 0, 0, 0.5),
            0 20px 50px rgba(0, 0, 0, 0.4),
            0 0 80px rgba(201, 162, 39, 0.15);
    }
    50% {
        transform: scale(1.12);
        box-shadow:
            0 25px 50px rgba(0, 0, 0, 0.7),
            0 40px 90px rgba(0, 0, 0, 0.6),
            0 0 200px rgba(201, 162, 39, 0.7);
    }
    100% {
        transform: scale(1);
        box-shadow:
            0 10px 30px rgba(0, 0, 0, 0.5),
            0 20px 50px rgba(0, 0, 0, 0.4),
            0 0 80px rgba(201, 162, 39, 0.15);
    }
}

.carousel-card-pulse .carousel-card-inner {
    animation: cardPulse 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Stop pulse animation */
@keyframes stopPulseAnim {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    100% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 0;
    }
}

/* Ripple expand animation */
@keyframes rippleExpand {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0;
    }
}

.carousel-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 1000ms cubic-bezier(0.16, 1, 0.3, 1);
}

.carousel-card:hover .carousel-card-image,
.carousel-card:active .carousel-card-image {
    transform: scale(1.1);
}

.carousel-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(10, 10, 10, 0.9) 0%,
        rgba(10, 10, 10, 0.6) 50%,
        transparent 100%
    );
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity 2s ease;
    z-index: 3;
    border-radius: var(--radius-xl);
}

.carousel-card:hover .carousel-card-overlay,
.carousel-card:active .carousel-card-overlay {
    opacity: 1;
}

.carousel-card-title {
    color: var(--color-white);
    font-family: var(--font-primary);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    text-align: center;
    padding: var(--space-4);
    transform: translateY(20px);
    transition: transform 2s ease;
}

.carousel-card:hover .carousel-card-title,
.carousel-card:active .carousel-card-title {
    transform: translateY(0);
}

/* ========================================
   PARTICLE CANVAS
   ======================================== */

.carousel-particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

/* ========================================
   VISUAL ENHANCEMENTS
   ======================================== */

/* Ambient glow effect */
.carousel-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    background: radial-gradient(
        circle,
        rgba(201, 162, 39, 0.1) 0%,
        rgba(201, 162, 39, 0.05) 30%,
        transparent 70%
    );
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    animation: ambientPulse 4s ease-in-out infinite;
}

@keyframes ambientPulse {
    0%, 100% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* Touch indicator for mobile */
@media (hover: none) and (pointer: coarse) {
    .carousel-container::after {
        content: 'Swipe to rotate • Tap cards';
        position: absolute;
        bottom: -40px;
        left: 50%;
        transform: translateX(-50%);
        color: rgba(255, 255, 255, 0.4);
        font-size: var(--font-size-sm);
        font-family: var(--font-secondary);
        letter-spacing: 0.05em;
        text-align: center;
        pointer-events: none;
        animation: fadeInOut 3s ease-in-out infinite;
    }
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1024px) {
    .carousel-container {
        height: 500px;
        max-width: 800px;
        perspective: 1000px;
    }

    .carousel-card {
        width: 180px;
        height: 250px;
    }
}

@media (max-width: 768px) {
    .carousel-container {
        height: 450px;
        max-width: 600px;
        perspective: 900px;
    }

    .carousel-card {
        width: 160px;
        height: 220px;
    }

    .carousel-card-title {
        font-size: var(--font-size-base);
        padding: var(--space-3);
    }
}

@media (max-width: 480px) {
    .carousel-container {
        height: 400px;
        max-width: 100%;
        perspective: 800px;
        padding: 0 var(--space-2);
    }

    .carousel-card {
        width: 140px;
        height: 190px;
    }

    .carousel-card-inner {
        box-shadow:
            0 8px 20px rgba(0, 0, 0, 0.5),
            0 15px 40px rgba(0, 0, 0, 0.4),
            0 0 60px rgba(201, 162, 39, 0.15);
    }

    .carousel-card-title {
        font-size: var(--font-size-sm);
        padding: var(--space-2);
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .orbit-pivot,
    .carousel-card,
    .carousel-card-inner,
    .carousel-card-image,
    .carousel-card-overlay,
    .carousel-card-title {
        transition: none !important;
        animation: none !important;
    }

    .carousel-container::before,
    .carousel-container::after {
        animation: none !important;
    }

    .carousel-card-pulse .carousel-card-inner {
        animation: none !important;
    }
}

/* Focus styles for keyboard navigation */
.carousel-card:focus {
    outline: 2px solid rgba(201, 162, 39, 0.6);
    outline-offset: 4px;
}

.carousel-card:focus-visible {
    outline: 2px solid rgba(201, 162, 39, 0.8);
}

/* ========================================
   LOADING STATE
   ======================================== */

.carousel-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--color-gray-400);
    z-index: 10;
}

.carousel-loading .spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(201, 162, 39, 0.2);
    border-top-color: rgba(201, 162, 39, 0.8);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-4);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .carousel-container {
        display: none;
    }
}
