/* Universal Box-Sizing */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Base HTML and Body Styles */
html, body {
    height: 100%;
    font-family: 'Montserrat', sans-serif;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Navigation Bar */
.navbar {
    background: #fff;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    position: sticky;
    top: 0;
    z-index: 999; /* Ensures navbar stays on top */
}

.navbar__container {
    display: flex;
    justify-content: space-between;
    height: 80px;
    z-index: 1;
    width: 100%;
    /*max-width: 1300px; /* Added max-width for consistency */
    margin: 0 auto;
    padding: 0 50px;
}

#navbar__logo {
    color: #000;
    display: flex;
    align-items: center;
    cursor: pointer;
    text-decoration: none;
    font-size: 2rem;
    font-weight: 600;
}

.navbar__menu {
    display: flex;
    align-items: center;
    list-style: none;
    text-align: center;
}

.navbar__item {
    height: 80px;
}

.navbar__links {
    color: #757575;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    padding: 0 1rem;
    height: 100%;
    transition: all 0.3s ease;
}

.navbar__links:hover {
    color: #d1d1d1;
}

.navbar__btn {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 1rem;
    width: 100%;
}

.navbar__boutique {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 1rem;
    width: 100%;
}

.button {
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    padding: 10px 20px;
    height: 100%;
    width: 100%;
    border: none;
    outline: none;
    border-radius: 4px;
    background: #000;
    color: white;
    transition: all 0.3s ease;
}

.boutique {
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    padding: 10px 20px;
    height: 100%;
    width: 100%;
    border: none;
    outline: none;
    border-radius: 4px;
    background: #757575;
    color: white;
    transition: all 0.3s ease;
}

.button:hover {
    background: #d1d1d1;
}

.boutique:hover {
    background: #d1d1d1;
}

/* Mobile Navigation Toggle */
@media screen and (max-width: 960px) {
    .navbar__container {
        justify-content: flex-start;
        padding: 0;
    }

    #navbar__logo {
        padding-left: 25px;
    }

    .navbar__menu {
        display: grid;
        justify-content: flex-start;
        grid-template-columns: auto;
        margin: 0;
        width: 100%;
        position: absolute;
        top: -1000px; /* Hide off-screen */
        opacity: 0;
        transition: all 0.5s ease;
        height: 50vh;
        z-index: -1;
        background: #ededed; /* Default background for mobile menu */
    }

    .navbar__menu.active {
        top: 100%; /* Slide down */
        opacity: 1;
        z-index: 99;
        font-size: 1.2rem;
    }

    .navbar__item {
        width: 100%;
    }

    .navbar__links {
        text-align: left;
        padding: 2rem;
        width: 100%;
        display: table;
    }

    #mobile-menu {
        position: absolute;
        top: 20%;
        right: 5%;
        transform: translate(5%, 20%);
    }

    .navbar__btn {
        padding-bottom: 2rem;
    }

    .button {
        width: 80%;
        height: 40px;
        margin: 0 auto; /* Center button in mobile menu */
    }

    .navbar__toggle .bar {
        width: 25px;
        height: 3px;
        margin: 5px auto;
        transition: all 0.3s ease-in-out;
        background: #000;
        display: block;
        cursor: pointer;
    }

    #mobile-menu.is-active .bar:nth-child(2) {
        opacity: 0;
    }

    #mobile-menu.is-active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    #mobile-menu.is-active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
}

/* Main Content Area */
.contenu {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main {
    background-color: #fff;
    position: relative;
    z-index: 1;
    flex: 1; /* Allows main content to grow and push footer down */
    padding-bottom: 20px;
}

.main__container {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Aligns content to the left */
    justify-content: flex-start; /* Aligns content to the top */
    margin: 0 auto;
    min-height: 100vh; /* Ensures minimum height for content area */
    background-color: #fff;
    z-index: 1;
    width: 100%;
    padding: 0 50px; /* Adjusted padding to be flexible */
}

.main__content h1 {
    margin-top: 50px;
}

.main__content h2 {
    font-weight: 500;
    padding: 20px;
}

.main__content p {
    margin-top: 1rem;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: 200;
    color: #000;
    padding: 1rem;
}

/* Project Grid on Homepage/Category Pages */
.main__projects {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    padding: 20px;
}

.project {
    border-radius: 4px;
    overflow: hidden;
    width: 100%;
    height: 100%;
    text-align: left;
    transition: transform 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.project:hover {
    transform: scale(1.05);
}

.project a {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
    height: 100%;
}

.project__image {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.project__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 8px;
}

.project__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
    text-align: left;
}

.project__image:hover .project__overlay {
    opacity: 1;
}

.project__overlay h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.project__overlay p {
    font-size: 1rem;
    margin-bottom: 20px;
}

.project__overlay button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    background-color: #000;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.project__overlay button:hover {
    background-color: #d1d1d1;
}

/* Specific Project Page Layout (e.g., 01_p7.html) */
.project__spec {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Adjusted minmax to be more flexible for smaller screens */
    gap: 30px;
    margin: 0 auto;
    min-height: 75vh; /* Ensures minimum height for content area */
    width: 100%;
    justify-content: flex-start;
    padding: 2rem;
}

.project__spec p {
    grid-column: 1 / -1; /* Text spans all columns */
    margin-bottom: 5px;
    text-align: justify;
    color: #757575;
    max-width: 1500px;
}

.project__spec img {
    width: 100%;
    height: 400px;
    cursor: pointer;
    transition: transform 0.3s ease;
    padding: 0;
    margin: 0;
    object-fit: cover;
    text-align: left;
    position: relative;
}

.project__spec img:hover {
    transform: scale(1.03);
}

.video-preview {
    width: 100%;
    margin: 20px 0;
    display: block;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Image Enlargement Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1001; /* Below the enlarged image, but above page content */
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
}

.overlay.active {
    display: flex; /* Display when active */
}

.project__spec img.enlarged {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    height: 75vh; /* Adjust height for larger screens */
    max-width: 90vw; /* Ensure it fits within viewport width */
    max-height: 90vh; /* Ensure it fits within viewport height */
    z-index: 1002; /* Higher than overlay to be visible */
    object-fit: contain; /* Scales the image to fit without cropping */
}

/* Overlay Navigation Buttons */
.close-btn, .nav-btn {
    position: absolute;
    color: #fff;
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1003; /* Higher than enlarged image to be clickable */
    transition: background-color 0.3s ease;
}

.close-btn {
    top: 100px;
    right: 70px;
    font-size: 2rem;
}

.nav-btn {
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
}

.left-btn {
    left: 70px;
}

.right-btn {
    right: 70px;
}

.close-btn:hover, .nav-btn:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

/* Content specific to "About" or "+" page */
.main__content--text {
    max-width: 1500px;
    text-align: justify;
}

.main__content--text p {
    padding: 10px;
}

.main__content--cv {
    max-width: 1500px;
    text-align: justify;
    margin-top: 1rem;
    margin-bottom: 1rem;
    padding: 10px;
    font-size: 1rem;
}

.main__content--cv p {
    max-width: 1500px;
    text-align: justify;
    margin-top: 1rem;
    margin-bottom: 1rem;
    padding: 10px;
    font-size: 16px;
    font-weight: 300;
}

/* Mobile Responsive Adjustments for Main Content */
@media screen and (max-width: 960px) {
    .main__container {
        display: grid;
        grid-template-columns: auto;
        align-items: center;
        justify-self: center;
        width: 100%;
        margin: 0 auto;
        min-height: auto; /* Allow height to adjust to content on mobile */
        padding: 0 20px; /* Reduced padding for smaller screens */
    }

    .main__content {
        text-align: center;
        margin-bottom: 4rem;
    }

    .main__content h1 {
        font-size: 2.5rem;
        margin-top: 2rem;
    }

    .main__content h2 {
        font-size: 3rem;
    }

    .main__content p {
        margin-top: 1rem;
        font-size: 1rem;
    }
}

@media screen and (max-width: 600px) {
    .main__container {
        padding: 0 10px; /* Even smaller padding for very small screens */
    }

    .main__content h1 {
        font-size: 2rem;
        margin-top: 3rem;
    }

    .main__content h2 {
        font-size: 1.5rem;
    }

    .main__content p {
        margin-top: 2rem;
        font-size: 1rem;
    }

    .main__content--cv {
        text-align: left;
    }

    /* Mobile adjustments for overlay buttons */
    .close-btn {
        top: 20px;
        right: 20px;
    }

    .nav-btn {
        top: auto; /* Reset top positioning */
        bottom: 20px; /* Position at the bottom */
        transform: none; /* Remove translateY */
    }

    .left-btn {
        left: 20px;
    }

    .right-btn {
        right: 20px;
    }
}

/* Footer Section */
.footer__container {
    background-color: #ededed;
    padding: 1rem 50px; /* Consistent horizontal padding */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 2;
    width: 100%;
}

.footer__container h1 { /* Style for "PLAN DU SITE" heading */
    font-weight: 400;
    font-size: 2rem;
    margin-bottom: 20px;
    color: #000;
}

#footer__logo {
    color: #757575;
    display: flex;
    align-items: center;
    cursor: pointer;
    text-decoration: none;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.footer__links {
    width: 100%;
    display: flex;
    justify-content: space-around; /* Distribute links columns with space */
    flex-wrap: wrap; /* Allow columns to wrap on smaller screens */
    padding-bottom: 20px; /* Space above social media section */
}

.footer__links--items {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Align text to the left within each column */
    margin: 10px 20px;
    text-align: left;
    flex: 1 1 auto; /* Allows items to grow/shrink and wrap */
    min-width: 150px; /* Minimum width for each link column */
}

.footer__links--items h2 {
    margin-bottom: 16px;
    color: #757575;
}

.footer__links--items a {
    color: #757575;
    text-decoration: none;
    margin-bottom: 0.5rem;
    transition: 0.3s ease-out;
}

.footer__links--items a:hover {
    color: #d1d1d1;
}

.social__media {
    background-color: #ededed;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.social__media--wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 50px; /* Consistent horizontal padding */
}

.social__icons {
    display: flex; /* Arranges social icons in a row */
    align-items: center;
}

.social__icons--link {
    color: #757575;
    font-size: 24px;
    margin: 10px;
    transition: 0.3s ease-out;
}

.social__icons--link:hover {
    color: #d1d1d1;
}

.website__right {
    color: #757575;
    text-align: center;
    margin-top: 10px;
}

/* Mobile Responsive Adjustments for Footer */
@media screen and (max-width: 960px) {
    .social__media--wrap {
        flex-direction: column;
        padding: 0;
    }

    .social__icons {
        margin-top: 10px;
    }
}

@media screen and (max-width: 600px) {
    .footer__container {
        padding: 1rem 20px; /* Reduced padding for very small screens */
    }

    .footer__links {
        flex-direction: column; /* Stack link columns vertically */
        align-items: center; /* Center stacked columns */
    }

    .footer__links--items {
        margin: 10px 0;
        text-align: center;
        align-items: center; /* Center text within stacked columns */
    }

    .social__media--wrap {
        flex-direction: column;
        align-items: center;
    }

    .social__icons {
        margin-top: 10px;
    }
}