:root {

    --team-image-w: 300px;
    --team-text-w: 500px;
    --team-text-h: 350px;
}

/* Mobile-first: Base styles for mobile */
.team-slider {
    display: flex;
    flex-direction: column;
    width: 100vw;
    max-width: 100vw;
    align-items: stretch;
    overflow-x: auto;
    gap: 0;
    scroll-behavior: smooth;
    min-width: 0;
    height: auto;
    box-sizing: border-box;
    padding-bottom: 10px;
    cursor: pointer;
}

.team-slider-item-with-bio {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 100vw;
    max-width: 100vw;
    flex: unset !important;
    box-sizing: border-box;
    background: #fff;
    border-radius: 12px;
    /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); */
    margin-right: 0;
    margin-left: 0;
    transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible;
    height: auto;
}

.team-slider-item-with-bio.active {
    /* Mobile keeps the same sizing as base */
    min-width: 100vw;
    max-width: 100vw;
    flex: unset !important;
}

.team-slider-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100vw;
    flex: 0 0 100vw;
    height: 300px;
    border-bottom: 5px solid transparent;
    flex-shrink: 0;
    margin-right: 0;
    position: relative;
}

.team-slider-item img {
    width: 95%;
    height: 95%;
    object-fit: cover;
    border-radius: 12px 0 0 12px;
    /* transition: box-shadow 0.3s; */
}

.team-slider-text {
    visibility: hidden;
    display: none;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    width: 100vw;
    min-width: 0;
    max-width: 100vw;
    padding: 16px 10px;
    opacity: 1;
    transform: translateY(40px);
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    height: auto;
    box-sizing: border-box;
    position: relative;
}

.team-slider-text.hide {
    opacity: 0;
    transform: translateY(40px);
    pointer-events: none;
    display: none;
}

.team-slider-text.show {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    width: 100vw;
    min-width: 0;
    max-width: none;
    height: auto;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    box-sizing: border-box;
    background: #ffffff;
    color: var(--grey-900, #222);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.team-slider-wrapper .fa-solid {
    font-weight: 900;
    font-size: 30px;
    display: flex;
    justify-content: right;
}

/* Close button inside the text block */
.team-slider-text .team-slider-text-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.08);
    color: #111;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    z-index: 6;
    padding: 0;
}

.team-slider-text.show .team-slider-text-close {
    display: flex;
}

.team-slider-text .team-slider-text-close:hover,
.team-slider-text .team-slider-text-close:focus {
    background: rgba(0, 0, 0, 0.14);
    outline: none;
    /* box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.16); */
    color: #fff;
}

.team-slider-text .team-slider-text-close::before {
    content: '';
    position: absolute;
    inset: -6px;
}

/* Typography inside the text block */
.team-slider-text.show h4,
.team-slider-text h4 {
    font-size: 30px;
    line-height: 1.12;
    margin: 0 0 8px 0;
    color: var(--grey-900, #222);
    font-weight: 700;
    text-align: left;
}

.team-slider-text .role {
    font-size: 20px;
    line-height: 1.25;
    margin: 0 0 10px 0;
    color: var(--grey-700, #666);
    text-align: left;
}

.team-slider-text .bio {
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    color: var(--grey-700, #666);
    max-height: calc(470px - 140px);
    overflow: auto;
    text-align: left;
    max-width: 650px;
}

.team-slider-text.show .carousel-lastname {
    display: block;
    text-transform: uppercase;
    font-size: 30px;
    letter-spacing: 0.02em;
    margin-bottom: 2px;
    color: var(--grey-900, #222);
}

.team-slider-text.show .carousel-firstname {
    display: inline-block;
    font-size: 20px;
    font-weight: 400;
    margin-left: 8px;
    color: var(--grey-800, #444);
}

.team-slider-text.show,
.team-slider-text.show .bio {
    word-wrap: break-word;
    overflow-wrap: break-word;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    hyphens: auto;
}

.team-slider-text.show p {
    margin: 0 0 12px 0;
}

.team-slider-text.show::-webkit-scrollbar {
    width: 8px;
}

.team-slider-text.show::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.08);
    border-radius: 4px;
}

.team-slider-title h3 {
    text-transform: uppercase;
    font-size: 30px;
    font-weight: 400;
    color: black;
    padding-left: 10%;
    padding-right: 10%;
    margin-top: 1em;
    margin-bottom: 2em;
}

/* Desktop styles for 768px and up */
@media (min-width: 768px) {
    .team-slider {
        flex-direction: row;
        width: 100vw;
        max-width: 100vw;
    }

    .team-slider-item-with-bio {
        flex-direction: row;
        min-width: var(--team-image-w);
        max-width: var(--team-image-w);
        flex: 0 0 var(--team-image-w);
    }

    .team-slider-item-with-bio.active {
        min-width: calc(var(--team-image-w) + var(--team-text-w));
        max-width: calc(var(--team-image-w) + var(--team-text-w));
        flex: 0 0 calc(var(--team-image-w) + var(--team-text-w));
    }

    .team-slider-item {
        width: var(--team-image-w);
        flex: 0 0 var(--team-image-w);
        height: var(--team-text-h);
    }

    .team-slider-text {
        display: flex;
        width: calc(var(--team-text-w) - 40px);
        min-width: calc(var(--team-text-w) - 40px);
        max-width: var(--team-text-w);
        padding: 24px 20px;
        transform: translateX(100px);
    }

    .team-slider-text.hide {
        transform: translateX(100px);
        display: flex;
    }

    .team-slider-text.show {
        transform: translateX(0);
        min-width: 40vw;
        height: var(--team-text-h);
    }

    .team-slider-wrapper .fa-solid {
        position: absolute;
        right: 30px;
    }
}

@media (min-width: 1024px) {
    .team-slider-text.show {
        width: 40vw;
    }
}