/* Cinematic Hero Engine */
:root {
    --cine-height-desktop: 440px;
    --cine-height-mobile: 400px;
    --cine-bg: #000;
    --cine-text: #fff;
    --cine-accent: #d4af37;
}

.hero-cinematic-wrapper {
    position: relative;
    width: 100%;
    max-width: 640px;
    /* Constrain width on large screens */
    height: var(--cine-height-desktop);
    background: var(--cine-bg);
    border-radius: 20px;
    /* Consistent with other hero elements */
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    contain: content;
    border: 1px solid #222;
    /* FIX: Force Safari/Chrome to respect border-radius during child transforms */
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
    transform: translateZ(0);
}

/* Layers */
.cine-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layer-ui {
    z-index: 10;
    pointer-events: none;
    /* Let clicks pass through effectively */
}

/* 1. Map / Source Layer */
.layer-map {
    z-index: 1;
    opacity: 0;
    background-size: cover;
    background-position: center;
    transform: scale(1.1);
    transition: opacity 1s ease, transform 8s ease-out;
}

.layer-map.visible {
    opacity: 1;
    transform: scale(1);
}

.map-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Input Typing */
.input-simulation {
    background: rgba(0, 0, 0, 0.85);
    padding: 15px 30px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    gap: 15px;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    transform: translateY(20px);
    opacity: 0;
    transition: opacity 0.5s ease;
    /* Move it down slightly so it doesn't conflict with top caption if centered high */
    margin-top: 20px;
}

.input-simulation.playing {
    animation: slideUpFade 0.1s ease-out forwards;
}

.input-text {
    font-family: monospace;
    font-size: 1.2rem;
    color: var(--cine-accent);
    min-width: 10px;
    border-right: 2px solid var(--cine-accent);
    white-space: nowrap;
    overflow: hidden;
}

/* 2. Scanner */
.layer-process {
    z-index: 2;
    pointer-events: none;
}

.scanner-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent, var(--cine-accent), transparent);
    background-size: 100% 200%;
    opacity: 0;
    transform: translateY(-100%);
}

.scanner-line.scanning {
    animation: scanMove 1s ease-in-out;
}

/* 3. Art Layer */
.layer-art {
    z-index: 3;
    pointer-events: none;
}

.art-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.1);
    transition: filter 0.8s ease, transform 0.8s ease;
}

.art-image.reveal {
    animation: artFadeReveal 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Download Icon */
.download-icon-overlay {
    position: absolute;
    z-index: 5;
    font-size: 3rem;
    /* Slightly smaller icon to fit in circle */
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    /* Dark semi-transparent background */
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: scale(0.5);
    backdrop-filter: blur(5px);
}

.download-icon-overlay.animate {
    animation: bounceIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* 4. Merch Layer */
.layer-merch {
    z-index: 6;
    opacity: 0;
    transition: opacity 1s ease;
    background: #000;
}

.layer-merch.visible {
    opacity: 1;
}

.merch-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.9;
    transform: scale(1.05);
    animation: slowPan 10s alternate infinite;
}

@keyframes slowPan {
    from {
        transform: scale(1.05) translate(0, 0);
    }

    to {
        transform: scale(1.1) translate(-2%, -2%);
    }
}


.layer-product {
    z-index: 4;
    pointer-events: none;
    display: none;
}

/* Captions - Moved to Top */
.cine-caption {
    position: absolute;
    top: 30px;
    /* MOVED TO TOP */
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 10;
    pointer-events: none;
}

.caption-text {
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 8px 24px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    display: inline-block;
    opacity: 0;
    transform: translateY(-20px);
    /* Slide down from top */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.caption-text.visible {
    opacity: 1;
    transform: translateY(0);
}


/* Keyframes */
@keyframes slideUpFade {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scanMove {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }

    15% {
        opacity: 0.6;
    }

    85% {
        opacity: 0.6;
    }

    100% {
        transform: translateY(100%);
        opacity: 0;
    }
}

@keyframes artFadeReveal {
    0% {
        opacity: 0;
        transform: scale(1.05);
        filter: blur(20px) brightness(1.2);
    }

    100% {
        opacity: 1;
        transform: scale(1);
        filter: blur(0) brightness(1);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }

    60% {
        opacity: 1;
        transform: scale(1.1);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Mobile */
@media (max-width: 768px) {
    .hero-cinematic-wrapper {
        height: var(--cine-height-mobile);
        border-radius: 20px;
        /* Consistent radius with desktop */
        flex: 0 0 auto;
        /* Prevent collapse on mobile */
    }

    .download-icon-overlay {
        font-size: 3.5rem;
    }

    .cine-caption {
        top: 20px;
        padding: 0 20px;
    }

    .caption-text {
        font-size: 0.9rem;
        padding: 6px 16px;
    }

    .input-simulation {
        padding: 10px 20px;
        width: 90%;
        max-width: 320px;
        margin-top: 10px;
    }

    .input-text {
        font-size: 1rem;
    }
}