/* === DISCOVER CINEMATIC TRANSITION SYSTEM === */
/* Fullscreen immersive discover viewport with cinematic fade & 3D cards */

/* Hide the old discover section completely when cinematic is loaded */
#discover-section {
    display: none !important;
}

/* ── State: When discover is active, fade out ALL homepage elements ── */
.homepage-view.discover-active .mobile-logo-top,
.homepage-view.discover-active .desktop-center-box,
.homepage-view.discover-active .search-form-container,
.homepage-view.discover-active .app-shortcuts-section,
.homepage-view.discover-active #discover-toggle-btn,
.homepage-view.discover-active .desktop-main-header,
.homepage-view.discover-active .mobile-main-header {
    opacity: 0;
    transform: translateY(-30px) scale(0.96);
    filter: blur(8px);
    pointer-events: none;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0, 1),
                transform 0.7s cubic-bezier(0.4, 0, 0, 1),
                filter 0.6s cubic-bezier(0.4, 0, 0, 1);
}

/* Ensure background is never affected */
.homepage-view.discover-active {
    background-size: 100% 100% !important;
    background-position: center !important;
    overflow: hidden !important;
    height: 100vh !important;
    max-height: 100vh !important;
}

/* ── Discover Cinematic Viewport ── */
#discover-cinematic-viewport {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 500;
    display: none;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

#discover-cinematic-viewport.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    animation: discoverViewportIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#discover-cinematic-viewport.leaving {
    animation: discoverViewportOut 0.6s cubic-bezier(0.4, 0, 0, 1) forwards;
}

@keyframes discoverViewportIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}
@keyframes discoverViewportOut {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* ── Three.js Canvas Background (disabled — cards only) ── */
#discover-three-canvas {
    display: none !important;
}

/* ── Discover Cinematic Header Bar ── */
.discover-cinematic-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 2rem;
    z-index: 10;
    background: linear-gradient(180deg, rgba(10, 10, 26, 0.7) 0%, transparent 100%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.discover-cinematic-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-logo, 'Orbitron', sans-serif);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, #c084fc, #00d9ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.discover-cinematic-title i {
    font-size: 1.1rem;
    color: #00d9ff;
    filter: drop-shadow(0 0 6px rgba(0, 217, 255, 0.5));
}

.discover-cinematic-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.discover-ctrl-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.discover-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(0, 217, 255, 0.5);
    color: #00d9ff;
    transform: scale(1.08);
    box-shadow: 0 0 16px rgba(0, 217, 255, 0.2);
}

.discover-ctrl-btn.loading i {
    animation: spin 0.8s linear infinite;
}

/* ── 3D Horizontal Card Carousel ── */
.discover-carousel-track {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 0 4rem;
    width: 100%;
    height: calc(100vh - 100px);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
    /* Hide scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.discover-carousel-track::-webkit-scrollbar {
    display: none;
}

.discover-carousel-track:active {
    cursor: grabbing;
}

/* ── Individual 3D Card ── */
.discover-3d-card {
    flex: 0 0 auto;
    width: 340px;
    min-height: 420px;
    scroll-snap-align: center;
    perspective: 1200px;
    transform-style: preserve-3d;
    position: relative;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.discover-3d-card:first-child {
    margin-left: calc(50vw - 170px);
}

.discover-3d-card:last-child {
    margin-right: calc(50vw - 170px);
}

.discover-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 20px;
    overflow: hidden;
    background: rgba(20, 20, 40, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-style: preserve-3d;
    display: flex;
    flex-direction: column;
}

/* Holographic light sweep */
.discover-card-inner::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        105deg,
        transparent 40%,
        rgba(255, 255, 255, 0.04) 45%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.04) 55%,
        transparent 60%
    );
    transition: left 0.7s ease;
    z-index: 20;
    pointer-events: none;
}

.discover-3d-card:hover .discover-card-inner::before {
    left: 100%;
}

/* Ambient glow on hover */
.discover-3d-card:hover .discover-card-inner {
    border-color: rgba(0, 217, 255, 0.3);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(138, 43, 226, 0.15),
        0 0 80px rgba(0, 217, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Light reflection edge */
.discover-card-inner::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    z-index: 10;
}

/* Card Image */
.discover-3d-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    position: relative;
    z-index: 1;
}

.discover-3d-card-image-placeholder {
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.15), rgba(0, 217, 255, 0.08));
    position: relative;
    z-index: 1;
}

.discover-3d-card-image-placeholder i {
    font-size: 3rem;
    opacity: 0.3;
    color: rgba(255, 255, 255, 0.5);
}

/* Image overlay gradient */
.discover-3d-card-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(180deg, transparent 50%, rgba(20, 20, 40, 0.95) 100%);
    z-index: 2;
    pointer-events: none;
}

/* Card Content */
.discover-3d-card-body {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex: 1;
    position: relative;
    z-index: 3;
}

.discover-3d-card-category {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 700;
    color: #00d9ff;
    text-shadow: 0 0 10px rgba(0, 217, 255, 0.3);
}

.discover-3d-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.35;
    color: #f0f0f0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.discover-3d-card-snippet {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.discover-3d-card-footer {
    padding: 0.9rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.4);
    position: relative;
    z-index: 3;
}

.discover-3d-card-footer i {
    color: rgba(0, 217, 255, 0.6);
}

/* ── Card Entrance Animation ── */
.discover-3d-card {
    opacity: 0;
    transform: translateY(60px) rotateX(8deg) scale(0.9);
}

.discover-3d-card.card-visible {
    animation: cardEntrance 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardEntrance {
    0% {
        opacity: 0;
        transform: translateY(60px) rotateX(8deg) scale(0.9);
    }
    50% {
        opacity: 0.7;
    }
    100% {
        opacity: 1;
        transform: translateY(0) rotateX(0deg) scale(1);
    }
}

/* ── Parallax Depth Layers ── */
.discover-3d-card[data-depth="near"] {
    transform-origin: center bottom;
}
.discover-3d-card[data-depth="mid"] {
    transform-origin: center center;
}
.discover-3d-card[data-depth="far"] {
    transform-origin: center top;
}

/* ── Ambient Light Pulse on card edges ── */
@keyframes ambientPulse {
    0%, 100% {
        box-shadow:
            0 8px 32px rgba(0, 0, 0, 0.4),
            0 0 0 1px rgba(255, 255, 255, 0.05),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    50% {
        box-shadow:
            0 8px 32px rgba(0, 0, 0, 0.4),
            0 0 20px rgba(138, 43, 226, 0.08),
            0 0 0 1px rgba(255, 255, 255, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.12);
    }
}

.discover-3d-card.card-visible .discover-card-inner {
    animation: ambientPulse 4s ease-in-out infinite;
    animation-delay: calc(var(--card-index, 0) * 0.5s);
}

/* ── Loading & Empty States ── */
.discover-cinematic-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    height: 100%;
    width: 100%;
    position: absolute;
    z-index: 5;
}

.discover-cinematic-loading i {
    font-size: 2.5rem;
    color: #00d9ff;
    filter: drop-shadow(0 0 12px rgba(0, 217, 255, 0.4));
    animation: pulse 1.5s ease-in-out infinite;
}

.discover-cinematic-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
    position: absolute;
    z-index: 5;
    width: 100%;
    height: 100%;
    text-align: center;
}

.discover-cinematic-empty i {
    font-size: 3rem;
    opacity: 0.4;
}

/* ── Scroll Hint ── */
.discover-scroll-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    animation: scrollHintPulse 2s ease-in-out infinite;
    pointer-events: none;
}

.discover-scroll-hint i {
    font-size: 1rem;
    animation: scrollArrowBounce 1.5s ease-in-out infinite;
}

@keyframes scrollHintPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

@keyframes scrollArrowBounce {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(6px); }
}

/* ── Mobile Responsive ── */
@media (max-width: 767px) {
    .discover-cinematic-header {
        padding: 1rem 1.25rem;
    }
    
    .discover-cinematic-title {
        font-size: 1rem;
    }
    
    .discover-carousel-track {
        gap: 1.25rem;
        padding: 0 1.5rem;
    }
    
    .discover-3d-card {
        width: 300px;
        min-height: 380px;
    }
    
    .discover-3d-card:first-child {
        margin-left: calc(50vw - 150px);
    }
    
    .discover-3d-card:last-child {
        margin-right: calc(50vw - 150px);
    }
    
    .discover-ctrl-btn {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .discover-3d-card {
        width: 280px;
        min-height: 360px;
    }
    
    .discover-3d-card:first-child {
        margin-left: calc(50vw - 140px);
    }
    
    .discover-3d-card:last-child {
        margin-right: calc(50vw - 140px);
    }
    
    .discover-3d-card-image,
    .discover-3d-card-image-placeholder,
    .discover-3d-card-image-overlay {
        height: 160px;
    }
}

/* ── Tablet ── */
@media (min-width: 768px) and (max-width: 991px) {
    .discover-3d-card {
        width: 320px;
    }
}

/* Large desktop - slightly bigger cards */
@media (min-width: 1400px) {
    .discover-3d-card {
        width: 380px;
        min-height: 460px;
    }
    
    .discover-3d-card:first-child {
        margin-left: calc(50vw - 190px);
    }
    
    .discover-3d-card:last-child {
        margin-right: calc(50vw - 190px);
    }
    
    .discover-carousel-track {
        gap: 2.5rem;
    }
}
