/* ==========================================
   CUSTOM TEAM ELEMENTOR WIDGET
========================================== */

.ctew-team-section {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
    box-sizing: border-box;
}

.ctew-team-grid {
    display: grid;
    grid-template-columns: repeat(
        var(--ctew-columns-desktop, 2),
        minmax(0, 1fr)
    );
    gap: 35px 28px;
}

.ctew-team-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #fff;
}

/* ==========================================
   IMAGE
========================================== */

.ctew-team-image {
    position: relative;
    width: 100%;
    aspect-ratio: var(--ctew-image-ratio, 0.8);
    overflow: hidden;
}

.ctew-team-photo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform .5s ease;
}

/* ==========================================
   DESKTOP HOVER OVERLAY
========================================== */

.ctew-team-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 30px 25px;
    box-sizing: border-box;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, .90) 0%,
        rgba(0, 0, 0, .70) 45%,
        rgba(0, 0, 0, .10) 100%
    );
    opacity: 0;
    visibility: hidden;
    transition: opacity .4s ease, visibility .4s ease;
}

.ctew-team-card:hover .ctew-team-overlay {
    opacity: 1;
    visibility: visible;
}

.ctew-team-card:hover .ctew-team-photo {
    transform: scale(1.06);
}

.ctew-team-name-overlay {
    margin: 0 0 6px;
    color: #fff;
    font-size: 26px;
    line-height: 1.2;
    font-weight: 600;
}

/* ==========================================
   NAME BELOW IMAGE
========================================== */

.ctew-team-name-below {
    display: block;
    margin: 15px 0 0;
    color: #1d3557;
    text-align: center;
    font-size: 26px;
    line-height: 1.2;
    font-weight: 600;
    transition: opacity .3s ease, transform .3s ease;
}

.ctew-team-card:hover .ctew-team-name-below {
    opacity: 0;
    transform: translateY(-5px);
}

/* ==========================================
   DESIGNATION
========================================== */

.ctew-team-designation {
    margin: 0 0 14px;
    color: #e3316d;
    font-size: 15px;
    line-height: 1.4;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* ==========================================
   DESCRIPTION
========================================== */

.ctew-team-description {
    margin: 0;
    color: #fff;
    font-size: 15px;
    line-height: 1.6;
    font-weight: 400;
}

/* Content duplicates are only used on tablet/mobile */
.ctew-team-content {
    display: none;
    min-width: 0;
}

/* ==========================================
   TABLET AND MOBILE
   Image  Name → Designation → Description
========================================== */

@media (max-width: 1024px) {

    .ctew-team-grid {
        grid-template-columns: repeat(
            var(--ctew-columns-tablet, 3),
            minmax(0, 1fr)
        );
    }

    .ctew-team-section {
        padding: 25px 20px;
    }

    .ctew-team-card {
        display: flex;
        flex-direction: column;
        min-width: 0;
        height: auto;
    }

    /* Image stays at the top */
    .ctew-team-card .ctew-team-image {
        display: block;
        position: relative;
        order: 1;
        width: 100%;
        height: auto;
        aspect-ratio: var(--ctew-image-ratio, 0.8);
        overflow: hidden;
    }

    .ctew-team-card .ctew-team-photo {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
        transform: none;
    }

    /* Disable desktop overlay on tablet/mobile */
    .ctew-team-card .ctew-team-overlay {
        display: none;
    }

    /* Show the separate content container */
    .ctew-team-card .ctew-team-content {
        display: flex;
        flex-direction: column;
        order: 2;
        width: 100%;
        min-width: 0;
        height: auto;
        padding: 0;
        margin: 0;
        box-sizing: border-box;
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    /* Name */
    .ctew-team-card .ctew-team-name-below {
        display: block;
        order: 1;
        margin: 12px 0 7px;
        color: #1d3557;
        font-size: 22px;
        line-height: 1.3;
        font-weight: 600;
        text-align: center;
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    /* Designation */
    .ctew-team-card .ctew-team-designation-below {
        display: block;
        order: 2;
        margin: 0 0 8px;
        color: #e3316d;
        font-size: 13px;
        line-height: 1.4;
        font-weight: 600;
        text-align: center;
    }

    /* Description */
    .ctew-team-card .ctew-team-description-below {
        display: block;
        order: 3;
        width: 100%;
        height: 110px;
        max-height: 110px;
        box-sizing: border-box;
        margin: 0;
        padding: 0 8px 0 2px;
        color: #333;
        font-size: 14px;
        line-height: 1.5;
        font-weight: 400;
        text-align: left;
        overflow-y: auto;
        overflow-x: hidden;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .ctew-team-description-below::-webkit-scrollbar {
        width: 5px;
    }

    .ctew-team-description-below::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 10px;
    }

    .ctew-team-description-below::-webkit-scrollbar-thumb {
        background: #999;
        border-radius: 10px;
    }

    .ctew-team-description-below::-webkit-scrollbar-thumb:hover {
        background: #666;
    }

    /* Disable desktop hover animation */
    .ctew-team-card:hover .ctew-team-photo {
        transform: none;
    }

    .ctew-team-card:hover .ctew-team-name-below {
        opacity: 1;
        transform: none;
    }
}

/* ==========================================
   MOBILE
========================================== */

@media (max-width: 767px) {

    .ctew-team-grid {
        grid-template-columns: repeat(
            var(--ctew-columns-mobile, 1),
            minmax(0, 1fr)
        );
    }

    .ctew-team-section {
        padding: 20px 15px;
    }

    .ctew-team-card .ctew-team-name-below {
        font-size: 20px;
        margin: 12px 0 7px;
    }

    .ctew-team-card .ctew-team-designation-below {
        font-size: 12px;
        margin-bottom: 8px;
    }

    .ctew-team-card .ctew-team-description-below {
        height: 110px;
        max-height: 110px;
        font-size: 13px;
        line-height: 1.5;
        padding-right: 8px;
    }
}

/* ==========================================
   SMALL MOBILE
========================================== */

@media (max-width: 480px) {

    .ctew-team-section {
        padding: 20px 15px;
    }

    .ctew-team-card .ctew-team-name-below {
        font-size: 23px;
        margin-top: 12px;
    }

    .ctew-team-card .ctew-team-designation-below {
        font-size: 13px;
        margin-bottom: 8px;
    }

    .ctew-team-card .ctew-team-description-below {
        height: 130px;
        max-height: 130px;
        font-size: 14px;
        line-height: 1.5;
    }
}
/* Equal square images for Team Members Grid */
.ctew-team-grid .ctew-team-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    overflow: hidden;
}

.ctew-team-grid .ctew-team-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}