/* ============================================
   Hero Component
   Includes truck intro animation & video bg
   ============================================ */

.hero {
    position: relative;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-bg-dark);
    overflow: hidden;
}

/* --- Video Background Carousel --- */
.hero__video-wrap {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.hero__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1.2s ease-in-out;
}

.hero__video--active {
    opacity: 1;
}

.hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(15, 23, 42, 0.88) 0%,
        rgba(15, 23, 42, 0.65) 50%,
        rgba(15, 23, 42, 0.8) 100%
    );
    z-index: 1;
}

/* --- Truck Intro Animation --- */
.hero__truck-intro {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.hero__truck-svg {
    position: absolute;
    width: 320px;
    height: auto;
    opacity: 0;
    transform: translateX(-120vw) scaleX(-1);
    color: rgba(255, 255, 255, 0.9);
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
}

/* Truck animation sequence */
.hero--animating .hero__truck-svg {
    animation: truckDriveIn 1s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards,
               truckDump 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 1.4s forwards,
               truckDriveOut 0.8s cubic-bezier(0.55, 0, 1, 0.45) 2.4s forwards;
}

/* Truck bed tilt */
.hero__truck-bed {
    transform-box: fill-box;
    transform-origin: 100% 100%;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hero--animating .hero__truck-bed {
    animation: bedTilt 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 1.4s forwards,
               bedReturn 0.4s ease 2.1s forwards;
}

/* Wheels spin */
.hero__truck-wheel {
    transform-box: fill-box;
    transform-origin: center center;
}

.hero--animating .hero__truck-wheel {
    animation: wheelSpin 1s linear 0.3s forwards,
               wheelSpinOut 0.8s linear 2.4s forwards;
}

@keyframes truckDriveIn {
    0% {
        opacity: 0;
        transform: translateX(-120vw) scaleX(-1);
    }
    10% {
        opacity: 1;
    }
    100% {
        opacity: 1;
        transform: translateX(0) scaleX(-1);
    }
}

@keyframes truckDump {
    0%, 100% {
        transform: translateX(0) scaleX(-1);
    }
    40% {
        transform: translateX(0) translateY(-5px) scaleX(-1);
    }
}

@keyframes truckDriveOut {
    0% {
        opacity: 1;
        transform: translateX(0) scaleX(-1);
    }
    90% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateX(120vw) scaleX(-1);
    }
}

@keyframes bedTilt {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(35deg); }
}

@keyframes bedReturn {
    0% { transform: rotate(35deg); }
    100% { transform: rotate(0deg); }
}

@keyframes wheelSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(720deg); }
}

@keyframes wheelSpinOut {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-720deg); }
}

/* --- Hero Content (text that gets "dumped") --- */
.hero__content {
    position: relative;
    z-index: 2;
    max-width: var(--container-max);
    padding: 0 var(--container-padding);
    text-align: center;
}

/* Title lines animate in like being dropped */
.hero__title {
    font-size: var(--font-size-7xl);
    font-weight: var(--font-weight-black);
    color: var(--color-text-white);
    line-height: var(--line-height-tight);
    margin-bottom: var(--space-xl);
}

.hero__title-line {
    display: block;
    opacity: 0;
    transform: translateY(-40px) scale(1.05);
}

.hero--animating .hero__title-line:nth-child(1) {
    animation: textDrop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 1.7s forwards;
}

.hero--animating .hero__title-line:nth-child(2) {
    animation: textDrop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 1.9s forwards;
}

.hero__title-line:first-child {
    color: var(--color-primary-light);
}

@keyframes textDrop {
    0% {
        opacity: 0;
        transform: translateY(-40px) scale(1.05);
    }
    60% {
        opacity: 1;
        transform: translateY(4px) scale(0.99);
    }
    80% {
        transform: translateY(-2px) scale(1.005);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Subtitle & buttons fade in after text drop */
.hero__subtitle {
    font-size: var(--font-size-xl);
    color: rgba(255, 255, 255, 0.8);
    max-width: 600px;
    margin: 0 auto var(--space-2xl);
    line-height: var(--line-height-relaxed);
    opacity: 0;
    transform: translateY(20px);
}

.hero--animating .hero__subtitle {
    animation: fadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 2.4s forwards;
}

.hero__actions {
    display: flex;
    gap: var(--space-lg);
    justify-content: center;
    flex-wrap: wrap;
    opacity: 0;
    transform: translateY(20px);
}

.hero--animating .hero__actions {
    animation: fadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 2.6s forwards;
}

@keyframes fadeUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- After intro is done, settle everything --- */
.hero--intro-done .hero__title-line,
.hero--intro-done .hero__subtitle,
.hero--intro-done .hero__actions {
    opacity: 1;
    transform: none;
    animation: none;
}

/* --- Subtle scroll hint at bottom of hero --- */
.hero__scroll-hint {
    position: absolute;
    bottom: 2rem;
    left: 0;
    right: 0;
    margin: 0 auto;
    z-index: 2;
    opacity: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    width: fit-content;
}

.hero--animating .hero__scroll-hint {
    animation: fadeUp 0.5s ease 3.2s forwards;
}

.hero__scroll-hint span {
    font-size: var(--font-size-xs);
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.hero__scroll-arrow {
    width: 20px;
    height: 20px;
    border-right: 2px solid rgba(255, 255, 255, 0.4);
    border-bottom: 2px solid rgba(255, 255, 255, 0.4);
    transform: rotate(45deg);
}

.hero__scroll-arrow-wrap {
    animation: scrollBounce 2s ease-in-out infinite 3.5s;
}

@keyframes scrollBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .hero__title {
        font-size: var(--font-size-4xl);
    }

    .hero__subtitle {
        font-size: var(--font-size-base);
    }

    .hero__actions {
        flex-direction: column;
        align-items: center;
    }

    .hero__actions .btn {
        width: 100%;
        max-width: 300px;
    }

    .hero__truck-svg {
        width: 180px;
    }
}
