/**
 * Team Section Block
 *
 * Full-width teal section with a title, intro/outro text and a grid of team
 * member cards (four per row). Each card has a "Read more" button that opens a
 * popup with the member's details.
 * Matches child-theme-sections-screenshots/team-section.png and team-popup.png
 */

:root {
    --color-navy: #385d8c;
    --color-pale: #eef3f8;
    --color-teal: #93cddc;
    --color-sky:  #d2eaf0;
    --color-text: #787878;
    --color-white: #ffffff;
}

.team-section {
    background-color: var(--color-teal);
    font-family: 'Roboto', sans-serif;
    padding: 60px 0;
}

.team-section__container {
    max-width: var(--theme-normal-container-max-width, 1290px);
    width: var(--theme-container-width, 100%);
    margin: 0 auto;
    padding: 0 20px;
}

.team-section__title {
    color: var(--color-navy);
    font-weight: 700;
    font-size: 30px;
    line-height: 1.3;
    text-align: center;
    margin: 0 0 24px;
}

.team-section__text {
    color: var(--color-text);
    font-size: 17px;
    line-height: 1.6;
}

.team-section__text p {
    color: inherit;
    margin: 0 0 1em;
}

.team-section__text p:last-child {
    margin-bottom: 0;
}

.team-section__intro {
    text-align: center;
    max-width: 900px;
    margin: 0 auto 50px;
}

.team-section__outro {
    text-align: center;
    max-width: 1000px;
    margin: 50px auto 0;
}

/* ---- Cards grid (four per row) ---- */
.team-section__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    align-items: stretch;
}

.team-card {
    background-color: var(--color-white);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.10);
    display: flex;
    flex-direction: column;
}

.team-card--clickable {
    cursor: pointer;
}

.team-card__image {
    background-color: #e9e9e9;
}

.team-card__image img {
    display: block;
    width: 100%;
    height: 300px;
    object-fit: cover;
    object-position: top center;
}

.team-card__body {
    padding: 24px 26px 30px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.team-card__name {
    color: var(--color-navy);
    font-weight: 700;
    font-size: 22px;
    line-height: 1.2;
    margin: 0 0 8px;
}

.team-card__position {
    color: var(--color-navy);
    font-size: 17px;
    line-height: 1.4;
    margin: 0 0 22px;
}

.team-card__button {
    align-self: flex-start;
    margin-top: auto;
}

/* ---- Buttons (teal secondary, per style guide) ---- */
.team-section .btn,
.team-popup .btn {
    display: inline-block;
    padding: 12px 26px;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.team-section .btn-secondary {
    background-color: var(--color-teal);
    color: var(--color-navy);
}

.team-section .btn-secondary:hover,
.team-section .btn-secondary:focus {
    background-color: var(--color-navy);
    color: var(--color-white);
}

/* ---- Popup ---- */
.team-popup {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.team-popup[hidden] {
    display: none;
}

.team-popup__overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(56, 93, 140, 0.55);
}

.team-popup__dialog {
    position: relative;
    z-index: 1;
    background-color: var(--color-white);
    border-radius: 18px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
    display: flex;
    gap: 40px;
    padding: 45px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.team-popup__close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-teal);
    color: var(--color-white);
    border: none;
    border-radius: 8px;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.team-popup__close:hover,
.team-popup__close:focus {
    background-color: var(--color-navy);
}

.team-popup__image {
    flex: 0 0 42%;
    max-width: 42%;
}

.team-popup__image img {
    display: block;
    width: 100%;
    height: auto;
}

.team-popup__content {
    flex: 1;
    padding-right: 30px;
}

.team-popup__name {
    color: var(--color-navy);
    font-weight: 700;
    font-size: 26px;
    line-height: 1.2;
    margin: 0 0 6px;
}

.team-popup__position {
    color: var(--color-navy);
    font-size: 18px;
    margin: 0 0 22px;
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1023px) {
    .team-section__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 26px;
    }

    .team-section__title {
        font-size: 26px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .team-section {
        padding: 45px 0;
    }

    .team-section__grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .team-section__title {
        font-size: 24px;
    }

    .team-popup__dialog {
        flex-direction: column;
        gap: 24px;
        padding: 40px 24px 28px;
    }

    .team-popup__image,
    .team-popup__content {
        flex: 1 1 auto;
        max-width: 100%;
        padding-right: 0;
    }

    .team-popup__image {
        max-width: 220px;
    }
}
