/**
 * Demo Showcase Component Styles
 *
 * Video preview grid showcasing demoscene productions.
 * Replaces the old spotlights image grid.
 */

@layer components.spotlights {
    /* ========================================
       Demo Showcase Grid
       ======================================== */
    .demo-showcase {
        /* Component-scoped variables */
        --spotlight-overlay-gradient: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
        --spotlight-play-icon: rgba(255, 255, 255, 0.9);
        --spotlight-play-bg: rgba(0, 0, 0, 0.5);

        display: grid;
        grid-template-columns: 1fr;
        gap: var(--space-3);
        margin-block-start: var(--space-4);
    }

    /* ========================================
       Individual Demo Item
       ======================================== */
    .demo-showcase__item {
        position: relative;
        display: block;
        border-radius: var(--radius-md);
        overflow: hidden;
        background-color: var(--color-bg);
        transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    }

    .demo-showcase__item:hover {
        transform: scale(1.02);
        box-shadow: var(--shadow-lg);
        text-decoration: none;
    }

    .demo-showcase__item:focus-visible {
        outline: 2px solid var(--color-primary);
        outline-offset: 2px;
    }

    /* ========================================
       Video Styling
       ======================================== */
    .demo-showcase__item video {
        display: block;
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        object-fit: cover;
    }

    /* ========================================
       Title Overlay
       ======================================== */
    .demo-showcase__title {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        padding: var(--space-2) var(--space-3);
        background: var(--spotlight-overlay-gradient);
        color: var(--color-text-bright);
        font-family: var(--font-heading);
        font-size: var(--text-sm);
        font-weight: var(--font-weight-bold);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        text-align: center;
    }

    /* Play icon overlay on hover */
    .demo-showcase__item::after {
        content: "\f04b"; /* FontAwesome play icon */
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0.8);
        font-size: 2rem;
        color: var(--spotlight-play-icon);
        background: var(--spotlight-play-bg);
        width: 3rem;
        height: 3rem;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding-left: 4px; /* Visual centering for play icon */
        opacity: 0;
        transition: opacity var(--transition-fast), transform var(--transition-fast);
    }

    .demo-showcase__item:hover::after {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    /* ========================================
       Container Query Responsive Layout
       ======================================== */

    /* Container queries for demo showcase within half-section */
    @container half-section (min-width: 350px) {
        .demo-showcase {
            grid-template-columns: repeat(2, 1fr);
        }

        /* Make first item span full width for emphasis */
        .demo-showcase__item:first-child {
            grid-column: 1 / -1;
        }
    }

    @container half-section (min-width: 500px) {
        .demo-showcase {
            gap: var(--space-4);
            margin-block-start: 0;
        }
    }

    /* ========================================
       Viewport Fallbacks
       (for browsers without container query support)
       ======================================== */
    @supports not (container-type: inline-size) {
        @media (min-width: 500px) {
            .demo-showcase {
                grid-template-columns: repeat(2, 1fr);
            }

            .demo-showcase__item:first-child {
                grid-column: 1 / -1;
            }
        }

        @media (min-width: 1000px) {
            .demo-showcase {
                margin-block-start: 0;
                gap: var(--space-4);
            }
        }
    }

    /* ========================================
       Reduced Motion: Pause videos
       ======================================== */
    @media (prefers-reduced-motion: reduce) {
        .demo-showcase__item video {
            /* Video will show poster image instead */
        }

        .demo-showcase__item:hover {
            transform: none;
        }

        .demo-showcase__item::after {
            opacity: 1;
            transform: translate(-50%, -50%) scale(1);
        }
    }
}
