/* --- Modal Container & Backdrop --- */
.project-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none; /* Hidden by default - toggled via JS to 'flex' */
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px); /* Modern frosted glass effect */
}

/* Background overlay to capture clicks for closing */
.modal-overlay {
    position: absolute;
    inset: 0;
}

/* --- UI Elements: Close Button --- */
.modal-close-btn {
    position: absolute;
    top: 40px;
    right: 40px;
    width: 45px;
    height: 45px;
    background: #fff;
    border: 2px solid #e1e1e1;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: transform 0.2s ease-in-out;
}

.modal-close-btn:hover {
    transform: scale(1.1);
}

/* --- Layout: Navigation & Swiper Wrapper --- */
.modal-nav-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 40px;
    max-width: 770px; /* Aligned with project image proportions */
    width: 95%;
    z-index: 5;
    width: max-content;
}

/* Navigation Arrows (Custom Swiper Buttons) */
.nav-arrow {
    width: 50px;
    height: 50px;
    background: #005A8C; /* Dark blue from design */
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: background 0.3s, opacity 0.3s;
}

.nav-arrow:hover {
    background: #0077B5;
}

.nav-arrow.swiper-button-lock {
    opacity: 0.3;
    cursor: not-allowed;
}

.nav-arrow.swiper-button-lock ~ .modal-main-card {
    margin: 0 auto;
}

.nav-arrow.swiper-button-disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* --- Main Slide Card Structure --- */
.modal-main-card {
    flex-grow: 1;
    border-radius: 30px;
    padding: 0;
    position: relative;
    /* overflow: visible; */ /* Required to allow the Info Overlay to overflow the bottom */
    width: 630px;
    max-width: 100%;
}

/* Image Wrapper */
.modal-image-container {
    position: relative;
    width: 100%;
    height: 630px; /* Fixed height to match design proportions */
    background: transparent;
}

.modal-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 15px; /* Subtle rounding for the image itself */
    height: 400px;
}

/* --- Content: Floating Info Overlay --- */
.modal-info-overlay {
    position: absolute;
    bottom: 125px; /* Positions the card partially over the image bottom */
    left: 25px;
    right: 25px;
    background: #fff;
    border-radius: 15px;
    padding: 20px 20px 80px 20px; /* Large bottom padding for the blue accent border */
    text-align: right;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    border-bottom: 2px #358FAF solid; /* Bottom highlight color */
    z-index: 2;
    min-height: 220px;
}

.modal-title {
    margin: 0 0 15px 0;
    font-size: 20px;
    font-weight: 700;
    color: #373536;
}

.modal-description p {
    margin: 0;
    font-size: 18px;
    line-height: 1.6;
    color: #373536;
    font-weight: 400;
}

/* --- Mobile & Tablet Refinements --- */

@media (max-width: 1024px) {
    .modal-nav-container {
        gap: 20px;
    }
}

@media (max-width: 768px) {
    /* Move arrows to the bottom or overlay them */
    .modal-nav-container {
        flex-direction: column; /* Stack arrows below if needed, or keep as is */
        gap: 15px;
        max-width: 90%;
        margin: 0 auto;
    }

    /* 1. Close Button - Smaller and moved for thumb reach */
    .modal-close-btn {
        top: 20px;
        right: 20px;
        width: 35px;
        height: 35px;
    }

    /* 2. Image Container - Adjust height for mobile aspect ratio */
    .modal-image-container {
        height: 350px;
        aspect-ratio: auto;
    }

    /* 3. Info Overlay - The "Floating" Card */
    .modal-info-overlay {
        position: relative; /* Switch from absolute to relative to prevent overlapping text */
        bottom: 50px; /* Pull it up slightly over the image */
        left: 10px;
        right: 10px;
        margin: 0 auto -40px auto; /* Negative margin to pull content below */
        padding: 20px 15px 40px 15px;
        min-height: auto;
        width: calc(100% - 20px);
    }

    .modal-title {
        font-size: 18px;
        margin-bottom: 10px;
    }

    .modal-description p {
        font-size: 15px;
        line-height: 1.4;
    }

    /* 4. Navigation Arrows - Move to bottom row */
    .nav-arrow {
        position: absolute;
        top: 0;
        bottom: 0;
        margin: auto;
        transform: translateY(-50%);
        z-index: 20;
        width: 40px;
        height: 40px;
    }

    .project-swiper-prev { right: 10px; }
    .project-swiper-next { left: 10px; }
    
    /* Hide arrows on very small screens if using swiper touch gestures */
    /* .nav-arrow { display: none; } */
}

/* Landscape Mode Fix */
@media (max-height: 500px) {
    .modal-image-container {
        height: 200px;
    }
    .modal-info-overlay {
        bottom: 20px;
        min-height: auto;
    }
}