/* ========================================
   LEADERSHIP ACCORDION BLOCK - V2 Redesign
   Animations restored from original version
   ======================================== */

/* ========================================
   SECTION BASE - FULL HEIGHT
   ======================================== */

.leadership-section-v2 {
    position: relative;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Section Background */
.section-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.section-bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.section-bg-default {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a1628 0%, #0d1f3c 50%, #061122 100%);
}


/* ========================================
   SECTION BORDERS - Gradient Lines
   ======================================== */

.section-border {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    z-index: 10;
}

.section-border--top {
    top: 0;
    background: linear-gradient(to left, rgba(255, 255, 255, 0.3), transparent);
}

.section-border--bottom {
    bottom: 0;
    background: linear-gradient(to right, rgba(255, 255, 255, 0.3), transparent);
}

/* ========================================
   SECTION HEADER - hidden by default
   ======================================== */

.section-header {
    display: none;
}

/* ========================================
   CARDS CONTAINER - FULL HEIGHT
   ======================================== */

.cards-wrapper {
    position: relative;
    z-index: 5;
    display: flex;
    justify-content: center;
    align-items: stretch;
    width: 100%;
    padding: 0;
}

.cards-container {
    display: flex;
    justify-content: center;
    align-items: stretch;
    height: 790px;
    position: relative;
    width: auto;
    max-width: 100%;
    overflow: hidden;
    /* Smooth transition when switching modes */
    transition: width 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

/* When a card is active, switch to full-width flex-grid mode */
.cards-container.has-active {
    width: 100%;
}

/* ========================================
   LEADER CARD - Original animations
   ======================================== */

.leader-card {
    position: relative;
    height: 100%;

    /* Default: auto-width based on image */
    flex: 0 0 auto;

    /* Allow the card to shrink below the image size when in flex mode */
    min-width: 0;

    cursor: pointer;
    /* Smooth transitions for both modes */
    transition: flex 0.6s cubic-bezier(0.25, 1, 0.5, 1),
        width 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    outline: none;
    overflow: hidden;
}

/* In flex-grid mode: equal flex shares for collapsed, 3.5x for active */
.cards-container.has-active .leader-card {
    flex: 1;
}

.cards-container.has-active .leader-card.active {
    flex: 3.5;
}

.leader-card:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 4px;
}

/* ========================================
   CARD DIVIDERS
   ======================================== */

.card-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    z-index: 25;
    pointer-events: none;
}

.card-divider--left {
    left: 0;
}

.card-divider--right {
    right: 0;
}

/* ========================================
   COLLAPSED STATE - Original animations
   ======================================== */

.card-collapsed {
    position: relative;
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    z-index: 5;
    /* ORIGINAL ANIMATION */
    transition: opacity 0.4s ease;
}

.leader-card.active .card-collapsed {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 1;
}

/* Photo - Default: auto-width based on image */
.card-photo {
    height: 100%;
    width: auto;
    object-fit: contain;
    object-position: bottom center;
    display: block;
    /* ORIGINAL ANIMATION */
    transition: filter 0.4s ease, width 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Photo - Flex-grid mode: fill the column (only for non-active cards) */
.cards-container.has-active .leader-card:not(.active) .card-photo {
    width: 100%;
    object-fit: cover;
    object-position: top center;
}

/* Dim inactive cards when one is active */
.cards-container.has-active .leader-card:not(.active) .card-collapsed {
    filter: brightness(0.4);
    transition: filter 0.5s ease, opacity 0.4s ease;
}

.cards-container.has-active .leader-card:not(.active):hover .card-collapsed {
    filter: brightness(0.6);
}

.leader-card:not(.active):hover .card-photo {
    filter: brightness(1.1);
}

/* Hover Gradient Overlay */
.card-hover-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top,
            rgba(6, 43, 114, 0.9) 0%,
            rgba(6, 43, 114, 0.6) 25%,
            rgba(6, 43, 114, 0.3) 45%,
            transparent 65%);
    opacity: 0;
    /* ORIGINAL ANIMATION */
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 5;
}

.leader-card:not(.active):hover .card-hover-overlay {
    opacity: 1;
}

/* Card Info */
.card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 3rem 1.5rem 2rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%);
}

.card-name {
    color: white;
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    line-height: 1.25;
}

.card-position {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8125rem;
    margin: 0;
    line-height: 1.4;
}

/* Expanded Media */
.card-expanded {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    visibility: hidden;
    pointer-events: none;
    z-index: 20;
    width: 100%;
    overflow: hidden;
}

.leader-card.active .card-expanded {
    visibility: visible;
    pointer-events: auto;
}

.leader-card.active {
    cursor: default;
}


/* Video as fullscreen background */
.expanded-video-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.leader-card.active .expanded-video-bg {
    opacity: 1;
}

/* Gradient overlay for text readability */
.expanded-overlay {
    position: absolute;
    inset: 0;
    z-index: 3;
    background: linear-gradient(to right,
            transparent 0%,
            rgba(0, 0, 0, 0) 20%,
            rgba(0, 0, 0, 0.3) 40%,
            rgba(0, 0, 0, 0.6) 70%,
            rgba(0, 0, 0, 0.9) 100%);
    pointer-events: none;
}

/* Expanded Details - overlays on video */
.expanded-details {
    position: relative;
    z-index: 5;
    flex: 1;
    padding: 3rem;
    margin-left: 40%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.expanded-header {
    margin-bottom: 1.5rem;
}

.expanded-name {
    color: white;
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 800;
    margin: 0 0 1rem 0;
    line-height: 1.1;
}

.expanded-divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(to right, #3b82f6 0%, rgba(59, 130, 246, 0.3) 40%, rgba(255, 255, 255, 0.15) 100%);
    margin-bottom: 1rem;
}

.expanded-position {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Expanded Bio - Scrollable */
.expanded-bio {
    flex: 1;
    overflow-y: auto;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    line-height: 1.7;
    padding-right: 1rem;
    max-height: 320px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.expanded-bio::-webkit-scrollbar {
    width: 4px;
}

.expanded-bio::-webkit-scrollbar-track {
    background: transparent;
}

.expanded-bio::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.expanded-bio p {
    margin: 0 0 1rem 0;
}

.expanded-bio p:last-child {
    margin-bottom: 0;
}

/* ========================================
   RESPONSIVE - LARGE SCREENS
   ======================================== */

@media (min-width: 1600px) {
    .leader-card.active {
        flex: 0 0 900px;
    }
}

/* ========================================
   RESPONSIVE - TABLET
   ======================================== */

@media (max-width: 1200px) {
    .leader-card.active {
        /* Reduce the dominance on smaller screens */
        flex: 3;
    }

    .expanded-details {
        padding: 2rem;
    }
}

/* ========================================
   RESPONSIVE - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .leadership-section-v2 {
        min-height: auto;
        padding: 3rem 0;
    }

    .cards-wrapper {
        padding: 0 1rem;
        overflow-x: auto;
        height: auto;
    }

    .cards-container {
        flex-direction: column;
        height: auto;
        width: 100%;
    }

    .leader-card {
        height: 100px;
        flex: none;
        width: 100%;
    }

    .card-collapsed {
        flex-direction: row;
        justify-content: flex-start;
    }

    .card-photo {
        height: 100%;
        width: auto;
    }

    .card-info {
        position: relative;
        background: transparent;
        padding: 1rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .card-divider {
        display: none;
    }

    .leader-card.active {
        flex: none;
        height: 600px;
        width: 100%;
    }

    .card-photo {
        object-fit: cover;
        object-position: center 20%;
    }

    .card-expanded {
        position: relative;
        flex-direction: column;
    }

    .expanded-overlay {
        background: linear-gradient(to bottom,
                transparent 0%,
                rgba(10, 22, 40, 0.7) 30%,
                rgba(10, 22, 40, 0.95) 60%,
                rgba(10, 22, 40, 1) 100%);
    }

    .expanded-details {
        margin-left: 0;
        padding: 1.5rem;
    }

    .expanded-bio {
        max-height: 200px;
    }
}

/* ========================================
   REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {

    .leader-card,
    .card-photo,
    .card-hover-overlay,
    .card-collapsed,
    .card-expanded,
    .expanded-video-bg,
    .expanded-overlay,
    .expanded-details {
        transition: none;
    }
}