/* Global Styles */
:root {
    --primary-yellow: #feca2f;
    /* Illustration matching yellow */
    --warning-stripe: #1a1a1a;
    --sky-top: #4fc3f7;
    --sky-bottom: #e1f5fe;
    --city-color: #7f8c8d;
    --road-color: #34495e;
    --text-shadow-color: rgba(0, 0, 0, 0.2);
}

body,
html {
    height: 100%;
    margin: 0;
    overflow: hidden;
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(to bottom, var(--sky-top) 0%, var(--sky-bottom) 100%);
}

/* Typography */
.main-title {
    font-weight: 900;
    font-size: 4rem;
    color: #fff;
    text-transform: uppercase;
    text-shadow: 2px 4px 6px var(--text-shadow-color);
    letter-spacing: 2px;
}

.sub-title {
    font-weight: 700;
    font-size: 1.5rem;
    color: #fff;
    opacity: 0.9;
    margin-bottom: 0;
    text-shadow: 1px 2px 3px var(--text-shadow-color);
}

.animate-fade-in {
    animation: fadeInDown 1s ease-out forwards;
    position: relative;
    z-index: 100;
    /* margin-bottom removed */
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Warning Tape */
.warning-tape {
    position: fixed;
    left: 0;
    width: 100%;
    height: 30px;
    background: repeating-linear-gradient(45deg,
            var(--primary-yellow),
            var(--primary-yellow) 20px,
            var(--warning-stripe) 20px,
            var(--warning-stripe) 40px);
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    animation: scrollTape 20s linear infinite;
}

.warning-tape.top {
    top: 0;
}

.warning-tape.bottom {
    bottom: 0;
}

@keyframes scrollTape {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 1000px 0;
    }
}

/* Main Container */
.main-container {
    height: 100vh;
    width: 100%;
    position: relative;
    /* Use flex-start to allow custom top spacing */
    justify-content: flex-start !important;
    padding-top: 15vh;
    /* Push down from top */
}

/* Construction Scene */
.construction-scene {
    position: absolute;
    bottom: 30px;
    /* Above bottom tape */
    width: 100%;
    height: 60vh;
    pointer-events: none;
}

/* Clouds */
.cloud {
    background: #fff;
    position: absolute;
    border-radius: 50px;
}

.cloud::after,
.cloud::before {
    content: '';
    position: absolute;
    background: inherit;
    border-radius: 50%;
}

.cloud-1 {
    width: 120px;
    height: 40px;
    top: 10%;
    left: -150px;
    animation: moveCloud 35s linear infinite;
}

.cloud-1::after {
    width: 50px;
    height: 50px;
    top: -25px;
    left: 20px;
}

.cloud-1::before {
    width: 40px;
    height: 40px;
    top: -15px;
    right: 20px;
}

.cloud-2 {
    width: 100px;
    height: 35px;
    top: 20%;
    left: -120px;
    animation: moveCloud 45s linear infinite 5s;
    opacity: 0.8;
}

.cloud-2::after {
    width: 40px;
    height: 40px;
    top: -20px;
    left: 15px;
}

.cloud-3 {
    width: 150px;
    height: 50px;
    top: 15%;
    left: -200px;
    animation: moveCloud 40s linear infinite 15s;
    opacity: 0.9;
}

.cloud-3::after {
    width: 60px;
    height: 60px;
    top: -30px;
    left: 30px;
}

@keyframes moveCloud {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(120vw);
    }
}

/* Parallax City */
.parallax-container {
    position: absolute;
    bottom: 100px;
    /* Aligned with top of road */
    left: 0;
    width: 100%;
    height: 50vh;
    /* Occupy bottom half area */
    z-index: 1;
    pointer-events: none;
    overflow: visible;
}

.parallax-layer {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 110%;
    /* Extra width for movement */
    min-width: 1200px;
    /* Ensure it covers wide screens */
    height: auto;
    display: block;
    transition: transform 0.1s ease-out;
}

.layer-back {
    z-index: 1;
    opacity: 0.8;
}

.layer-middle {
    z-index: 2;
}

.layer-front {
    z-index: 3;
}

/* Road */
.road {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 100px;
    background: var(--road-color);
    z-index: 10;
    border-top: 5px solid #2c3e50;
}

.road-lines {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 8px;
    background: repeating-linear-gradient(to right, #ccc 0, #ccc 120px, transparent 120px, transparent 240px);
    transform: translateY(-50%);
    border: none;

}

/* Sand Pile */
.sand-pile {
    position: absolute;
    bottom: 95px;
    left: 30%;
    width: 350px;
    height: auto;
    z-index: 15;
    /* Behind excavator (z-index: 20) */
    pointer-events: none;
}

/* Excavator */
.excavator-container {
    position: absolute;
    bottom: 80px;
    left: 20%;
    width: 400px;
    /* Container for full extension */
    height: 300px;
    z-index: 20;
    pointer-events: none;
    transform-origin: bottom center;
    animation: rumble 2s ease-in-out infinite;
}

.excavator-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.track-img {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200px;
    height: auto;
    z-index: 1;
}

.excavator-body-group {
    position: absolute;
    bottom: 55px;
    /* Sits on tracks */
    left: 20px;
    width: 160px;
    height: auto;
    z-index: 2;
}

.body-img {
    width: 100%;
    height: auto;
    display: block;
    position: relative;
    z-index: 5;
    /* Body in front */
}

.arm1-group {
    position: absolute;
    top: -50px;
    right: -110px;
    width: 140px;
    height: auto;
    z-index: 10;
    /* In front */
    transform-origin: 5% 90%;
    transform: rotate(30deg);
    animation: arm1Move 6s ease-in-out infinite;
}

/* Arm images */

.arm1-img {
    width: 100%;
    height: auto;
    display: block;
}

.arm2-group {
    position: absolute;
    top: 0px;
    right: -30px;
    width: 75px;
    height: auto;
    z-index: -1;
    /* Behind arm1 */
    transform-origin: 5% 10%;
    transform: rotate(0deg);
    /* More forward */
    animation: arm2Move 8s ease-in-out infinite;
}

.arm2-img {
    width: 100%;
    height: auto;
    display: block;
}

.bucket-img {
    position: absolute;
    bottom: -20px;
    right: 0px;
    width: 50px;
    height: auto;
    z-index: 5;
    transform-origin: 15% 15%;
    transform: rotate(-10deg);
    /* More forward */
    animation: bucketMove 6s ease-in-out infinite;
}

/* Updated Animations - Subtle movement */
@keyframes arm1Move {

    0%,
    100% {
        transform: rotate(30deg);
    }

    50% {
        transform: rotate(35deg);
    }

    /* Very subtle */
}

@keyframes arm2Move {

    0%,
    100% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(5deg);
    }

    /* Very subtle */
}

@keyframes bucketMove {

    0%,
    100% {
        transform: rotate(-10deg);
    }

    50% {
        transform: rotate(-5deg);
    }

    /* Very subtle */
}

@keyframes dirtPile {

    0%,
    20% {
        opacity: 0;
        transform: scaleY(0);
    }

    25% {
        opacity: 1;
        transform: scaleY(0.5);
    }

    /* Digging creates pile */
    45% {
        transform: scaleY(1);
    }

    55% {
        opacity: 1;
        transform: scaleY(1) translateX(20px);
    }

    /* Being moved/dumped? */
    80% {
        opacity: 0;
    }
}


/* Dump Truck */
.truck-container {
    position: absolute;
    bottom: 95px;
    left: 55%;
    width: 300px;
    /* Define container size to help positioning */
    height: auto;
    z-index: 25;
    animation: driveTruck 12s linear infinite;
}

.truck-body-img {
    width: 100%;
    height: auto;
    display: block;
    position: relative;
    z-index: 2;
    /* Body above backend wheels if any, but usually we place wheels on top or bottom depending on art. Let's assume wheels on top for cutout art */
}

.truck-wheel {
    position: absolute;
    bottom: 0;
    /* Adjust based on image baselines */
    width: 110px;
    /* Increased size */
    height: 110px;
    z-index: 1;
    /* Behind body? or in front? Usually cutouts have wheel arches, so wheels go behind. If pure side view, maybe front. Let's try z-index 1 (behind) first, or maybe just align bottom.
                   Actually, user sent "truck.png" and "wheel.png". Usually this means sticking wheels 'on' the truck. Let's try z-index 3 (front) so they are visible. */
    z-index: 3;
    animation: spinWheels 12s linear infinite;
}

.wheel-rear {
    left: 25px;
    /* Adjusted for larger wheel */
    /* Guessing rear position */
    bottom: -35px;
    /* Lowered to align axle */
    /* Hanging slightly below body */
}

.wheel-front {
    right: 30px;
    /* Adjusted for larger wheel */
    /* Guessing front position */
    bottom: -35px;
}

@keyframes driveTruck {
    0% {
        transform: translateX(-150vw);
    }

    35% {
        transform: translateX(0);
    }

    65% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(150vw);
    }
}

@keyframes spinWheels {
    0% {
        transform: rotate(0deg);
    }

    35% {
        transform: rotate(720deg);
    }

    65% {
        transform: rotate(720deg);
    }

    100% {
        transform: rotate(1440deg);
    }
}


/* Crane in Background */
.crane-container {
    position: absolute;
    bottom: 100px;
    right: 10%;
    /* Move slightly right */
    width: 400px;
    /* Wider area for the long arm */
    height: 450px;
    z-index: 5;
    opacity: 0.95;
    pointer-events: none;
}

.crane-tower-img {
    position: absolute;
    bottom: 0;
    right: 80px;
    /* Align tower to the right side where the hinge is */
    width: auto;
    height: 300px;
    z-index: 1;
}

.crane-arm-group {
    position: absolute;
    bottom: 290px;
    /* Sit right on top of tower (300px height - overlap) */
    right: 25px;
    /* Align pivot point with tower */
    width: 320px;
    /* Full length of arm */
    height: 150px;
    /* Space for hanging weight */
    z-index: 2;
    transform-origin: 80% 15%;
    /* Pivot point near the tower connection (right side) */
    animation: swingCrane 8s ease-in-out infinite alternate;
}

.crane-arm-img {
    position: absolute;
    top: 168px;
    right: -55;
    width: 100%;
    height: auto;
    display: block;
}

/* The Cable */
.crane-cable {
    position: absolute;
    top: 35px;
    /* Start from under the arm */
    left: 40px;
    /* Position on the long left side of arm */
    width: 2px;

}

.crane-weight-img {
    position: absolute;
    bottom: -352px;
    /* Relative to cable bottom */
    left: -20px;
    /* Center on cable */
    width: 40px;
    height: auto;
}

/* Animations */
@keyframes swingCrane {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(3deg);
    }

    /* Subtle sway */
}

@keyframes extendCable {
    0% {
        height: 60px;
    }

    100% {
        height: 140px;
    }

    /* Cable moves up and down */
}

/* Responsiveness */
@media (max-width: 768px) {
    .main-title {
        font-size: 2.5rem;
    }

    .sub-title {
        font-size: 1.2rem;
    }

    .construction-scene {
        transform: scale(0.7);
        transform-origin: bottom center;
        width: 142.8%;
        /* Compensate for scale(0.7) */
        left: -21.4%;
    }
}