/* =========================================================================
   CORE CAROUSEL LAYOUT & FOCAL POINT STYLES
   ========================================================================= */

.team-carousel-outer {
    position: relative;
    width: 100%; 
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 35px;
    padding: 0;
    overflow: hidden; 
}

.team-carousel-heading {
    text-align: center;
    margin-bottom: 30px;
    margin-top: 20px;
    color: var(--color-primary);
    font-family: var(--font-secondary);
    font-size: 1.6em;
    text-transform: uppercase;
}

.team-carousel {
    display: flex;      
    flex-wrap: nowrap;  
    gap: 20px;          
    padding: 20px 0;
}

.team-card {
    flex: 0 0 auto; 
    width: 300px; 
    text-align: center;
    cursor: pointer;
    transition: transform 0.5s ease, opacity 0.5s ease, filter 0.5s ease; 
    padding: 0;
    border-radius: 25px; 
    box-sizing: border-box;
    position: relative; 
}

.team-card .card-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.team-card-img {
    display: block;
    width: 85%;
    height: 300px; 
    object-fit: cover; 
    border: 5px solid var(--color-quaternary, #dddddd); 
    border-radius: 25px; 
    margin-bottom: 10px;
    box-sizing: border-box;
    transition: none; 
    position: relative; 
    z-index: 2; 
}

.team-card:not(.is-active) {
    filter: grayscale(100%) brightness(0.7); 
    opacity: 0.8;
    cursor: default;
}

.team-card.is-active {
    filter: none;
    opacity: 1;
    transform: scale(1.05); 
}

.team-card.no-transition {
    transition: none !important;
}

/* =========================================================================
   ARROW STYLING
   ========================================================================= */

.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 60px;      
    height: 60px;
    display: flex; 
    justify-content: center;
    align-items: center; 
    padding: 0;
    background: none; 
    color: #000; 
    border: none;
    font-size: 60px;
    line-height: 1; 
    cursor: pointer;
    transition: opacity 0.3s;
    left: 10px; 
}

.carousel-arrow.right { 
    right: 10px; 
    left: auto;
}

/* =========================================================================
   MODAL OVERLAY AND CONTENT STYLING (Corrected)
   ========================================================================= */

/* Full-screen overlay (HIDDEN by default) */
.team-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85); 
    z-index: 9999; 
    
    /* Use display to hide/show */
    display: none; 
    
    justify-content: center; 
    align-items: center; 
    
    padding: 20px; 
    box-sizing: border-box; 
    
    /* Opacity transition for the background fade-in effect */
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* State when Modal is OPEN (Controlled by JS adding 'is-open' class) */
.team-modal-overlay.is-open {
    /* Use flex to show and center the content */
    display: flex;

    /* Fade the background in */
    opacity: 1;
}

/* Modal Content Box */
.team-modal-overlay .team-modal {
    background-color: var(--color-quaternary); 
    border-radius: var(--rounded-corners, 15px); 
    max-width: 800px; 
    width: 95%; 
    padding: 30px; 
    position: relative;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    box-sizing: border-box; 
    margin: 20px auto; 
    border: 5px solid var(--color-quaternary);
    max-height: 90vh; 
    display: flex;
    flex-direction: column;
    
    /* Animate the modal box itself */
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.team-modal-overlay.is-open .team-modal {
    transform: scale(1);
}

/* Close Button */
.team-modal-overlay .team-modal-close {
    position: absolute;
    z-index: 10001; 
    top: 5px;
    right: 5px; 
    color: var(--color-secondary, #000); 
    font-size: 50px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    background: none;
    border: none;
}

/* Inner content container for scrolling */
.team-modal-content {
    flex-grow: 1; 
    max-height: 100%; 
    overflow-y: auto; 
}

.team-modal-overlay .modal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0; 
}

.team-modal-overlay .modal-header img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%; 
    margin: 0 0 15px 0; 
    display: block;
}

.team-modal-overlay .team-modal-content h3 { 
    font-family: var(--font-secondary, 'Lora', serif);
    font-size: 1.8em;
    margin: 5px 0 0 0;
}

.team-modal-overlay .team-modal-content h4 {
    font-size: 1em;
}

.team-modal-overlay .team-modal-content p, 
.team-modal-overlay .team-modal-content ul {
    font-family: var(--font-secondary, 'Lora', serif);
    line-height: 1.6;
    margin-bottom: 15px;
    text-align: left;
    list-style-position: outside; 
    padding-left: 0; 
}

/* Card Text Styling */
.card-inner h3 {
    font-size: 1.2em;
    margin-bottom: 0px;
}

.card-inner h4 {
    font-size: 0.9em;
    margin-top: 5px;
    padding-left: 20px;
    padding-right: 20px;
}

/* =========================================================================
   SCROLL LOCKING
   ========================================================================= */
html.modal-is-open-no-scroll,
body.modal-is-open-no-scroll {
    overflow: hidden !important; 
}

/* =========================================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================================= */

@media (max-width: 768px) {
    .team-card {
        width: 45%; 
    }
    .carousel-arrow {
        left: 5px;
    }
    .carousel-arrow.right {
        right: 5px;
        left: auto;
    }
    .team-modal-overlay .team-modal {
        padding: 15px; 
    }
    .team-modal-overlay .modal-header img {
        width: 100px;
        height: 100px;
    }
    .team-card-img {
        width: 100%; /* Make image fill the card on mobile */
        height: 200px;
    }
}