/* Styles specific to the Home page */

body.home, html.home {
    height: 100%;
    margin: 0;
}

/* Slideshow */
.slideshow-container {
    position: relative;
    max-width: 100%;
    margin: auto;
    width: 100%;
    height: 60vh;
    overflow: hidden;
    z-index: 1;
}

.mySlides {
    display: none;
    width: 100%;
    height: 100%;
}

.mySlides img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    vertical-align: middle;
}

.text {
    color: var(--white);
    font-size: 1.5em;
    padding: 20px;
    position: absolute;
    bottom: 30px;
    width: 100%;
    text-align: center;
}

.fade {
    animation-name: fade;
    animation-duration: 1.5s;
}

/* Home page footer */
footer.home {
    position: absolute;
    bottom: 0;
    width: 100%;
    z-index: -1; /* Ensure footer is behind slideshow */
}

/* Slideshow progress indicator */
.slideshow-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 5px;
    width: 0%; /* Start at 0% */
    background-color: var(--secondary-color);
    z-index: 10;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

/* Hero content */
.hero-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    width: 90%;
    max-width: 800px;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    backdrop-filter: blur(5px);
    margin: 0 auto; /* Ensure horizontal centering */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.hero-content h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: white;
}

.hero-content p {
    font-size: 1.3rem;
    margin-bottom: 25px;
    color: white;
}

.cta-button {
    display: inline-block;
    padding: 12px 30px;
    background-color: var(--secondary-color);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid var(--secondary-color);
}

.cta-button:hover {
    background-color: transparent;
    color: var(--secondary-color);
}

.cta-button.secondary {
    background-color: transparent;
    border: 2px solid white;
    color: white;
}

.cta-button.secondary:hover {
    background-color: white;
    color: var(--primary-color);
}

.sustainability-section {
    padding: 100px 0;
    background-color: white;
    position: relative;
    overflow: hidden;
}

.sustainability-section:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(31, 79, 142, 0.05), rgba(5, 213, 148, 0.05));
    z-index: 0;
}

.sustainability-content {
    position: relative;
    z-index: 1;
}

.sustainability-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    margin-top: 40px;
    align-items: center;
}

.sustainability-image {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.sustainability-image img {
    width: 100%;
    height: auto;
    display: block;
}

.sustainability-text {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sustainability-text p {
    font-size: 1.1rem;
    line-height: 1.7;
    padding: 0;
}

.sustainability-list {
    list-style-type: none;
    padding: 0;
    margin-bottom: 30px;
}

.sustainability-list li {
    position: relative;
    padding-left: 30px;
    margin-bottom: 15px;
    line-height: 1.5;
}

.sustainability-list li:before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--secondary-color);
    font-weight: bold;
}

.featured-projects {
    padding: 80px 0;
    background-color: #f8f9fa;
}

.projects-carousel-wrapper {
    position: relative;
    max-width: 1200px;
    margin: 40px auto 0;
    padding: 0;
}

.projects-carousel {
    display: flex !important;
    grid-template-columns: unset !important; /* Remove grid layout */
    flex-wrap: nowrap !important; /* Prevent wrapping into multiple rows */
    overflow-x: auto !important; /* Enable horizontal scrolling */
    scroll-behavior: smooth;
    gap: 20px;
    padding: 0 15px; /* Remove vertical padding, keep horizontal */
    width: 100%;
    scrollbar-width: none; /* Hide scrollbar in Firefox */
    -ms-overflow-style: none; /* Hide scrollbar in IE/Edge */
}

.projects-carousel::-webkit-scrollbar {
    display: none; /* Hide scrollbar in Chrome/Safari */
}

.project-card {
    flex: 0 0 auto !important; /* Don't grow or shrink */
    width: 280px !important; /* Fixed width */
    margin: 0 10px 0 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border: 3px solid rgba(31, 79, 142, 0.3);
    overflow: hidden;
    scroll-snap-align: start;
    transition: border-color 0.3s ease;
}

.project-card:hover {
    border-color: rgba(31, 79, 142, 0.5);
}

.project-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 2;
}

.project-badge.hydro { background-color: rgba(21, 151, 211, 0.85); }
.project-badge.solar { background-color: rgba(255, 187, 0, 0.85); }
.project-badge.landfill { background-color: rgba(76, 175, 80, 0.85); }
.project-badge.water { background-color: rgba(138, 43, 226, 0.85); }

.project-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 160px;
    border-top: 3px solid transparent;
}

.project-card .project-badge.hydro ~ .project-info { border-top-color: rgba(21, 151, 211, 0.7); }
.project-card .project-badge.solar ~ .project-info { border-top-color: rgba(255, 187, 0, 0.7); }
.project-card .project-badge.landfill ~ .project-info { border-top-color: rgba(76, 175, 80, 0.7); }
.project-card .project-badge.water ~ .project-info { border-top-color: rgba(138, 43, 226, 0.7); }

.project-info h3 {
    font-size: 1.2rem;
    margin-top: 0; /* Removes top margin to position directly under image */
    margin-bottom: 10px;
    color: var(--primary-color);
    text-align: left;
}

.project-info p {
    margin-bottom: 15px;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #666;
    flex-grow: 1;
    padding: 0;
    text-align: left;
}

.project-link {
    display: inline-block;
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 5px;
    text-decoration: none;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    align-self: flex-end; /* Positions link at the right */
    margin-top: auto; /* Pushes button to the bottom */
    transition: background-color 0.3s;
}

.project-link:hover {
    background-color: var(--secondary-color);
}

.carousel-button {
    display: flex !important;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.carousel-button.prev { left: 10px !important; }
.carousel-button.next { right: 10px !important; }

.cta-section {
    padding: 150px 0;
    background: linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4)), url('../images/action.png'); /* Fixed path */
    background-size: cover;
    background-position: center;
    position: relative;
}

.cta-content {
    text-align: center;
    color: white;
}

.cta-content h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: white;
}

.cta-content p {
    font-size: 1.2rem;
    margin-bottom: 40px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    color: white;
}

.cta-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

/* Match heights for sustainability and projects sections */
.two-column-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Desktop layout (two columns) with matching heights */
@media (min-width: 992px) {
    .two-column-wrapper {
        flex-direction: row;
    }
    
    .two-column-wrapper .sustainability-section,
    .two-column-wrapper .featured-projects {
        width: 50%;
        padding: 60px 20px;
        height: auto;
        min-height: 600px; /* Set minimum matching height */
        display: flex;
        flex-direction: column;
    }
    
    .sustainability-content,
    .featured-projects .container {
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        height: 100%;
    }
    
    /* Ensure headings have exactly the same spacing */
    .sustainability-content h2,
    .featured-projects h2 {
        margin-top: 0;
        margin-bottom: 30px; /* Use consistent margin for both headings */
        height: 40px; /* Fixed height for headings to ensure alignment */
        line-height: 1.2;
    }
    
    /* Make sure content areas are positioned identically */
    .sustainability-grid,
    .projects-carousel-wrapper {
        flex-grow: 1;
        margin-top: 0;
        height: calc(100% - 70px); /* Account for heading height + margin */
    }
    
    .sustainability-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 30px;
        align-items: stretch;
    }
    
    .sustainability-image,
    .sustainability-text {
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    
    .sustainability-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }
    
    /* Projects carousel wrapper for desktop */
    .projects-carousel-wrapper {
        display: flex;
        flex-direction: column;
        position: relative;
        padding: 0 40px;
        margin: 0; /* Remove all margin */
    }
    
    .projects-carousel {
        flex-grow: 1;
        height: 100%;
        margin: 0; /* Ensure no margin */
        padding-top: 0; /* No top padding */
        padding-bottom: 0; /* No bottom padding */
        padding-left: 15px; /* Only horizontal padding */
        padding-right: 15px; /* Only horizontal padding */
        overflow-y: hidden;
        align-items: flex-start; /* Align items to the top */
    }
    
    .project-card {
        margin: 0; /* Remove all margin */
        min-width: 280px;
        width: 280px;
        max-width: 90%;
    }
    
    /* Two column wrapper specific carousel styles */
    .two-column-wrapper .projects-carousel {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        grid-gap: 20px;
        padding: 0 15px;
        overflow-x: hidden; /* Prevent horizontal scroll */
    }
    
    /* Adjust container width for these sections */
    .two-column-wrapper .container {
        width: 100%;
        max-width: 100%;
        padding: 0 20px;
    }
}

/* Restore full grid on very large screens */
@media (min-width: 1400px) {
    .sustainability-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .slideshow-container {
        height: 50vh;
    }

    /* Maintain centering while adjusting styling */
    .hero-content {
        width: 85%;
        padding: 15px;
        background-color: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(3px);
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
    
    .hero-content h1 {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }
    
    .hero-content p {
        font-size: 0.95rem;
        margin-bottom: 15px;
        line-height: 1.4;
    }

    /* Keep your existing styles for other elements */
    .sustainability-section,
    .featured-projects {
        padding: 60px 0;
    }

    /* Single consolidated definition for projects-carousel in mobile view */
    .projects-carousel {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 15px;
        overflow-x: hidden;
        padding: 0 15px; /* Remove vertical padding, keep horizontal */
        width: 100%;
        margin: 0 auto;
    }
    
    .project-card {
        width: 100%;
        min-width: unset;
        max-width: 320px;
        margin: 0 auto;
        height: auto;
    }
    
    /* Single consolidated definition for carousel wrapper in mobile view */
    .projects-carousel-wrapper {
        padding: 0;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Hide carousel buttons on mobile since we're using grid */
    .carousel-button {
        display: none !important;
    }
    
    /* Fix project info layout */
    .project-info {
        height: auto !important;
        min-height: 120px;
        padding: 15px;
        display: flex;
        flex-direction: column;
    }
}

/* Maintain centering at smallest screens */
@media (max-width: 480px) {
    .hero-content {
        width: 90%;
        padding: 12px;
        background-color: rgba(0, 0, 0, 0.35);
        backdrop-filter: blur(2px);
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
    
    .hero-content h1 {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }
    
    .hero-content p {
        font-size: 0.85rem;
        margin-bottom: 12px;
        line-height: 1.3;
    }
    
    /* Keep your existing small screen styles */
    .cta-button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .hero-content h1 {
        font-size: 1.8rem;
    }

    .hero-content p {
        font-size: 1rem;
        margin-bottom: 20px;
    }

    .cta-button {
        padding: 10px 20px;
        font-size: 0.9rem;
        width: 100%;
    }

    .sustainability-content h2,
    .featured-projects h2,
    .cta-content h2 {
        font-size: 1.8rem;
    }

    /* Even smaller screens */
    .project-link {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    .cta-button {
        width: 90%;
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .projects-carousel {
        grid-template-columns: 1fr;
    }
    
    .project-card {
        max-width: 320px;
        margin: 0 auto;
    }
}