/* --- BASE GRID LOGIC --- */
.team-grid {
    display: grid;
    gap: 15px;
    width: 100%;
}

.no-cta .team-grid { 
    grid-template-columns: repeat(4, 1fr); 
}

.has-cta .team-grid { 
    grid-template-columns: repeat(5, 1fr); 
}

/* --- RESPONSIVE SCALING --- */

@media (max-width: 1200px) {
    .no-cta .team-grid { grid-template-columns: repeat(3, 1fr); }
    .has-cta .team-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 992px) {
    .no-cta .team-grid { grid-template-columns: repeat(2, 1fr); }
    .has-cta .team-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .team-grid-wrapper .team-grid { 
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important; 
        gap: 10px !important;
    }

    .has-cta .team-card:nth-child(8),
    .has-cta .team-card:nth-child(9) {
        display: none !important;
    }

    .has-cta .team-card.join-card {
        display: block !important;
    }

    .team-name { font-size: 0.8rem; }
    .team-role { font-size: 0.5rem; }
    .join-text { font-size: 0.9rem; }
}

@media (max-width: 480px) {
    .team-grid-wrapper .team-grid { 
        grid-template-columns: 1fr 1fr !important; 
    }
}

/* --- INDIVIDUAL CARD STYLES --- */

/*
 * Square card via padding-top trick (IE9+, iOS 4+).
 * The img is absolutely positioned inside it.
 * object-fit: cover works on iOS 8+ / Safari 7.1+ — fully supported
 * on iPhone 6 and later, including all iPhone 11 Pro (iOS 13+).
 *
 * The previous background-image approach caused blank squares because
 * WordPress (or a security plugin) strips inline style attributes
 * from shortcode output.
 */
.team-card {
    position: relative;
    width: 100%;
    overflow: hidden;
    background-color: #f0f0f0;
}

/* Forces 1:1 square — padding-top % is relative to the element's width */
.team-card::before {
    content: '';
    display: block;
    padding-top: 100%;
}

/*
 * The <img> WordPress outputs is wrapped in a <a> by some themes,
 * so we target both img and any anchor wrapping it.
 */
.team-card > a,
.team-card > img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* Override WP's auto-sizes intrinsic placeholder & height:auto on team cards */
.team-card img {
    position: absolute !important; 
    top: 0 !important; 
    left: 0 !important; 
    width: 100% !important; 
    height: 100% !important;          /* beats WP block library's height:auto */
    object-fit: cover !important; 
    object-position: center center !important; 
    contain-intrinsic-size: auto !important; /* neutralizes the 3000x1500 placeholder */
    -webkit-filter: grayscale(100%);
    filter: grayscale(100%);
    -webkit-transition: -webkit-filter 0.5s ease, -webkit-transform 0.5s ease;
    transition: filter 0.5s ease, transform 0.5s ease;
    display: block;
}

.team-card:hover img {
    -webkit-filter: grayscale(0%);
    filter: grayscale(0%);
    -webkit-transform: scale(1.05);
    transform: scale(1.05);
}

/* Info Overlay */
.team-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1.2rem;
    background: -webkit-linear-gradient(bottom, rgba(0,0,0,0.85), transparent);
    background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
    opacity: 0;
    -webkit-transform: translateY(10px);
    transform: translateY(10px);
    -webkit-transition: opacity 0.4s, -webkit-transform 0.4s;
    transition: opacity 0.4s, transform 0.4s;
    z-index: 2;
    pointer-events: none;
}

.team-card:hover .team-info {
    opacity: 1;
    -webkit-transform: translateY(0);
    transform: translateY(0);
}

/* Typography */
.team-name {
    color: #fff;
    display: block;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    font-weight: bold;
    line-height: 1.2;
}

.team-role {
    color: #ccc;
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Inter', sans-serif;
    margin-top: 4px;
}

/* --- CTA CARD (JOIN CARD) --- */
.join-card {
    background: #156c77;
    text-align: center;
}

.join-card a {
    color: #fff !important;
    text-decoration: none !important;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-justify-content: center;
    justify-content: center;
    -webkit-align-items: center;
    align-items: center;
    padding: 1rem;
    -webkit-transition: background 0.3s ease;
    transition: background 0.3s ease;
}

.join-card:hover a {
    background: rgba(0,0,0,0.1);
}

.join-text {
    font-size: 1.1rem;
    line-height: 1.1;
    margin-bottom: 10px;
    font-family: 'Inter', sans-serif;
}

.join-arrow {
    width: 35px;
    height: 35px;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 50%;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
    font-size: 1.1rem;
    -webkit-transition: -webkit-transform 0.3s ease;
    transition: transform 0.3s ease;
}

.join-card:hover .join-arrow {
    -webkit-transform: translateX(5px);
    transform: translateX(5px);
    border-color: #fff;
}
