/* Main introduction section */
.team-intro {
    width: 100%;
    margin: 0;
    padding: 4rem 0;
    background: linear-gradient(to bottom, #043160 0%, #1a4e86 70%, #b5d1f3 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

/* Bottom gradient to eliminate visual break */
.team-intro::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(to bottom, transparent, #f8f9fa);
    pointer-events: none;
}

.intro-content {
    display: flex;
    align-items: center;
    max-width: 1200px;
    width: 100%;
    padding: 0 2rem;
    gap: 3rem;
}

.intro-image {
    width: 300px;
    height: 300px;
    border-radius: 20px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: transparent;
    flex-shrink: 0;
}

.intro-image img {
    max-width: 100%;
    height: auto;   
    object-fit: contain;
    border-radius: 8px;
    display: block;
}
.intro-text {
    flex: 1;
    color: white;
}

.intro-text h2 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.intro-text p {
    font-size: 1.2rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    opacity: 0.95;
}

/* Section titles */
.section-title {
    font-size: 2.5rem;
    font-weight: bold;
    text-align: center;
    margin: 5rem 0 3rem 0;
    color: #043160;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 100px;
    height: 4px;
    background: linear-gradient(90deg, #3a88db, #043160);
    margin: 0.5rem auto;
    border-radius: 2px;
}

/* Team grid layout - max 3 cards per row, always centered */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 320px));
    gap: 2.5rem;
    margin: 3rem auto 4rem auto;
    justify-content: center;
    max-width: 1200px;
    padding: 0 2rem;
}

/* Individual team card - narrower with thicker blue border */
.team-card {
    position: relative;
    width: 100%;
    max-width: 320px;
    height: 480px;
    cursor: pointer;
    perspective: 1000px;
    margin: 0 auto; /* Center each card */
}

.team-card:hover .card-inner {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3); 
    border-radius: 15px;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
}

.team-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    border: 10px solid #043160;
    background: #043160;
}

/* Front side of card */
.card-front {
    display: flex;
    flex-direction: column;
}

/* Back side of card with scroll */
.card-back {
    color: white;
    transform: rotateY(180deg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: justify;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* Webkit scrollbar styling */
.card-back::-webkit-scrollbar {
    width: 6px;
}

.card-back::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.card-back::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.card-back::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 15px;
}

.member-image-container {
    position: relative;
    width: 100%;
    height: 320px; 
    overflow: hidden;
    border-radius: 10px 10px 0 0;
    flex-shrink: 0;
}

.member-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.5s ease;
}

.member-image-hover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.member-image-container:hover .member-image-hover {
    opacity: 1;
    
}

/* Reduced info section - MAX 100px as requested */
.member-info {
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(5px);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    height: 130px; 
    border-radius: 0 0 10px 10px;
    overflow: hidden;
}

/* Clickable member name with LinkedIn link styling */
.member-name {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.3rem;
    line-height: 1.1;
}

.member-name a {
    color: #043160;
    text-decoration: none;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.member-name a:hover {
    color: #3a88db;
    text-shadow: 0 1px 3px rgba(58, 136, 219, 0.3);
}

.member-role {
    font-size: 0.85rem;
    color: #3a88db;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.2;
    margin: 0;
    display: block;
}

.member-slogan {
    font-size: 0.80rem;
    color: black;
    font-style: italic;
    letter-spacing: 0.3px;
    line-height: 1;
    margin: 5px;
    display: block;
}

.member-bio {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 0;
    text-align: justify;
    hyphens: auto;
}

/* Introduction sections for PIs and Mentor */
.pi-intro-section,
.mentor-intro-section {
    width: 100%;
    margin: 3rem 0 2rem 0;
    padding: 1.5rem 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 50%, #dee2e6 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 3px solid #043160;
    border-bottom: 3px solid #043160;
}

/* Mentor section with different colors */
.mentor-intro-section {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 50%, #fdcb6e 100%);
}

.intro-content-small {
    display: flex;
    align-items: center;
    max-width: 1000px;
    width: 100%;
    padding: 0 2rem;
    gap: 2rem;
}

.intro-icon {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid #043160;
    background: linear-gradient(45deg, #ffffff, #f8f9fa);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.icon-emoji {
    font-size: 3rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.intro-text-small {
    flex: 1;
    color: #333;
}

.intro-text-small h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #043160;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.intro-text-small p {
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0;
    color: #495057;
    text-align: justify;
}

/* Responsive design */
@media (max-width: 1200px) {
    .team-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 320px));
        max-width: 1000px;
        gap: 2rem;
    }
}

@media (max-width: 900px) {
    .team-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 350px));
        max-width: 800px;
        gap: 2rem;
        padding: 0 1rem;
    }
    
    .team-card {
        max-width: 350px;
        height: 460px;
    }

    .member-image-container {
        height: 300px;
    }
}

@media (max-width: 768px) {
    .intro-content {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
    }

    .intro-image {
        width: 150px;
        height: 150px;
    }

    .intro-text h2 {
        font-size: 2.5rem;
    }

    .pi-intro-section,
    .mentor-intro-section {
        padding: 2rem 0;
        margin: 2rem 0 1.5rem 0;
    }

    .intro-content-small {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
        padding: 0 1rem;
    }

    .intro-icon {
        width: 100px;
        height: 100px;
    }

    .icon-emoji {
        font-size: 2.5rem;
    }

    .intro-text-small h3 {
        font-size: 1.6rem;
    }

    .intro-text-small p {
        font-size: 1rem;
        text-align: center;
    }

    .section-title {
        font-size: 2rem;
    }

    .team-grid {
        grid-template-columns: 1fr;
        max-width: 380px;
        gap: 2rem;
        padding: 0 1rem;
    }

    .team-card {
        max-width: 380px;
        height: 450px;
    }

    .member-image-container {
        height: 350px;
    }

    .member-info {
        padding: 0.8rem;
        max-height: 100px;
        min-height: 80px;
    }

    .member-name {
        font-size: 1.1rem;
        margin-bottom: 0.3rem;
    }

    .member-role {
        font-size: 0.8rem;
    }

    .card-back {
        padding: 1.5rem;
    }

    .member-bio {
        font-size: 0.95rem;
    }

    /*per scazzi foto su mobile */
    .member-image-hover {
        opacity: 0;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        transition: opacity 0.4s ease;
    }
    
    .team-card.photo-changed .member-image {
        opacity: 0;
    }
    
    .team-card.photo-changed .member-image-hover {
        opacity: 1;
    }
    /* FINE DELLE RIGHE DA AGGIUNGERE ↑ */
}

@media (max-width: 480px) {
    .intro-icon {
        width: 80px;
        height: 80px;
    }

    .icon-emoji {
        font-size: 2rem;
    }

    .intro-text-small h3 {
        font-size: 1.4rem;
    }
}