/* --- General Setup --- */
body {
    margin: 0;
    /* Dark background color from the image */
    color: #ffffff;
}

/* --- Section Container --- */
.upcoming-projects {
    width: 100%;
    padding: 50px 20px 80px 20px;
    box-sizing: border-box;
    text-align: center;
    background-color: #1C1C1C;
    font-family: 'Oswald', sans-serif;

}

/* --- Section Title --- */
.section-title {
    font-size: 2.5rem;
    /* Large, bold text */
    letter-spacing: 0.2rem;
    /* Spacing between letters */
    margin-bottom: 40px;
    text-transform: uppercase;
}

/* --- Poster Grid --- */
.poster-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    /* Allows items to wrap to the next line on smaller screens */
    gap: 50px;
    /* Space between posters */
}

/* --- Hover Rule (FIX #2: Increased Specificity) --- */
/* --- Replace it with this --- */
.upcoming-projects.in-view .poster-item:hover {
    transform: scale(1.1); /* This will now work */
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}

/* --- REPLACE THE OLD RULE WITH THESE TWO --- */

/* --- Individual Posters --- */
/* --- Replace with this --- */
.poster-item {
    width: 100%;
    max-width: 280px;
    border-radius: 15px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    aspect-ratio: 2 / 3;
    background-color: #111;
    
    /* Starting state for the animation */
    opacity: 0;
    transform: scale(1);

    /* NEW: This transition now controls BOTH scroll and hover animations */
    transition: transform 0.4s ease-out, 
                opacity 0.4s ease-out, 
                box-shadow 0.3s ease;
}

/* --- Image inside the poster item --- */
.poster-item img {
    display: block;
    width: 100%;
    
    /* --- CHANGE THIS LINE --- */
    height: 100%; /* Force the image to fill the container's height */
    
    border-radius: 12px;

    /* --- ADD THIS LINE --- */
    object-fit: cover; /* This is the magic! It makes the image cover the area without stretching */
}

/* ONLY apply the gradient tint to poster-item with class 'tinted' */
.poster-item.tinted::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(268.58deg, #000000 0.93%, rgba(255, 255, 255, 0) 95%);
    pointer-events: none;
    border-radius: 12px;
}


/* --- Responsive Design --- */

/* For tablets */
@media (max-width: 1200px) {
    .poster-item {
        max-width: 240px;
        /* Slightly smaller posters for smaller desktops */
    }
}

@media (max-width: 768px) {
    .section-title {
        font-size: 2rem;
        margin-bottom: 30px;
    }

    .poster-grid {
        gap: 20px;
    }

    .poster-item {
        max-width: 200px;
        /* Further reduce poster size */
    }
}

/* For mobile phones */
@media (max-width: 480px) {
    .upcoming-projects {
        padding: 30px 15px;
    }

    .section-title {
        font-size: 1.5rem;
        margin-bottom: 20px;

    }

    .poster-grid {
        /* On very small screens, you might prefer a 2x2 grid */
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .poster-item {
        max-width: 100%;
        /* Allow posters to fill the grid column */
    }
}

/*animation*/
/* --- Animations for the "Upcoming Projects" Section --- */

/* --- Replace them with this new block --- */

/* This rule defines the END state for the scroll-in animation */
.upcoming-projects.in-view .poster-item {
    opacity: 1;
    transform: scale(1);
}

/* These rules use transition-delay to stagger the effect */
.upcoming-projects.in-view .poster-item:nth-child(1) {
    transition-delay: 0.1s;
}
.upcoming-projects.in-view .poster-item:nth-child(2) {
    transition-delay: 0.2s;
}
.upcoming-projects.in-view .poster-item:nth-child(3) {
    transition-delay: 0.3s;
}
.upcoming-projects.in-view .poster-item:nth-child(4) {
    transition-delay: 0.4s;
}
.upcoming-projects.in-view .poster-item:nth-child(5) {
    transition-delay: 0.5s;
}