/*
    Coaches grid - about-us.html only.

    Deliberately scoped to the .about_* classes used by the coaches grid on
    about-us.html. The .coaches_home_* grid used on index.html and
    italy-swim-technique-camp.html is a separate thing and is not touched here.
*/

.about_container {
    --coach_blue: #008bf0;
    --coach_navy: #1F2240;
    --coach_border: #e6e6e6;
    --coach_muted: #6b7280;
    --coach_body: #3a3f4a;

    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    /* every row the same height, so no card is left short */
    grid-auto-rows: 1fr;
    gap: 22px;

    width: calc(100% - 40px);
    max-width: 1020px;
    margin: auto;
    padding: 0;

    /* the old carousel leftovers */
    overflow-x: visible;
    white-space: normal;
    text-align: left;
    font-family: 'Ubuntu', sans-serif;
}


/* Card */

.about_card {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    /* inline display:none on the hidden coaches still wins over this */

    width: auto;
    margin: 0;
    padding: 0;
    overflow: hidden;

    background-color: #fff;
    border: 1px solid var(--coach_border);
    border-radius: 16px;
    transition: transform .2s ease, box-shadow .2s ease;
}
.about_card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(31, 34, 64, 0.10);
}

.about_sub_cotainer {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    padding-top: 12px;
}

.about_image {
    display: block;
    box-sizing: border-box;
    /* Inset by 12px so the white card shows as a narrow polaroid frame */
    width: calc(100% - 24px);
    margin: 0 auto;
    /* Fixed height rather than aspect-ratio: every column is the same width,
       so the crop is consistent and cannot be driven by the source image's
       own proportions */
    height: 320px;
    object-fit: cover;
    /* faces sit above centre in a standing portrait */
    object-position: center 22%;
    border: 1px solid #ececec;
    border-radius: 8px;
}

.about_title {
    margin: 0;
    padding: 18px 20px 0;
    font-size: 19px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--coach_navy);
}

.about_subtitle {
    margin: 0;
    padding: 4px 20px 0;
    font-size: 13.5px;
    font-weight: 400;
    line-height: 1.3;
    color: var(--coach_muted);
}

.about_body {
    flex: 0 0 auto;
    width: auto;
    margin: 0;
    padding: 12px 20px 18px;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.55;
    color: var(--coach_body);
}

/*
    The clamp only applies once coaches.js has run and added the "Read more"
    button. With JavaScript off the full bios stay readable, just in
    uneven-height cards.
*/
.coach_enhanced .about_body {
    /* Fixed to seven lines, so the bio length can never drive the card height */
    height: calc(15px * 1.55 * 7);
    padding-bottom: 0;
    overflow: hidden;
}
.coach_enhanced .about_card.coach_is_clipped .about_body {
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 34px), transparent 100%);
            mask-image: linear-gradient(to bottom, #000 calc(100% - 34px), transparent 100%);
}

.coach_foot {
    flex: 0 0 auto;
    /* pinned to the bottom, so a name that wraps to two lines cannot
       knock the button out of line with the other cards */
    margin: 14px 20px 18px;
    margin-top: auto;
    display: flex;
    align-items: center;
    height: 30px;
    padding-top: 14px;
    border-top: 1px solid #f1f1f1;
}

.coach_read_more {
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--coach_blue);
    background-color: transparent;
    border: 0;
    /* Padded so the hover tint reads as a button hugging the text; the
       negative margin keeps the text itself aligned with the bio above */
    padding: 6px 10px;
    margin-left: -10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color .18s ease;
}
/* Makes the whole card the click target, while keeping one tab stop */
.coach_read_more::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}
.about_card:hover .coach_read_more {
    background-color: rgba(0, 139, 240, 0.10);
}


/* Profile popup */

.coach_modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    background-color: rgba(31, 34, 64, 0.45);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    animation: coach_fade .18s ease;
}
.coach_modal[hidden] {
    display: none;
}

/*
    Portrait full-bleed down the left, the reading column on the right.
    The photo is a grid track rather than a padded image, so it runs to the
    card's own edges.
*/
.coach_modal_card {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    max-width: 760px;
    max-height: 84vh;
    display: grid;
    grid-template-columns: 42% 58%;
    /* minmax(0,1fr) lets the row shrink below its content, so a long bio
       scrolls inside the pane instead of stretching past max-height */
    grid-template-rows: minmax(0, 1fr);
    /* min() so a short window can never push the card past its max-height */
    min-height: min(380px, 84vh);
    padding: 0;
    overflow: hidden;
    text-align: left;
    background-color: #fff;
    border-radius: 18px;
    box-shadow: 0 12px 44px rgba(31, 34, 64, 0.30);
    animation: coach_pop .2s ease;
}
/* Falls back to a single column if a coach has no photo */
.coach_modal_card.coach_no_photo {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
}

.coach_modal_photo {
    display: block;
    box-sizing: border-box;
    /* Inset like the grid cards, so the white card frames the photo */
    margin: 12px;
    width: calc(100% - 24px);
    height: calc(100% - 24px);
    min-height: 0;
    object-fit: cover;
    object-position: center 18%;
    border: 1px solid #ececec;
    border-radius: 8px;
}

.coach_modal_pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    padding: 28px 30px;
}

.coach_modal_eyebrow {
    flex: 0 0 auto;
    margin: 0 0 9px;
    /* leaves room for the close button */
    padding-right: 34px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--coach_blue);
}
.coach_modal_name {
    flex: 0 0 auto;
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.18;
    letter-spacing: -0.01em;
    color: var(--coach_navy);
}
.coach_modal_role {
    flex: 0 0 auto;
    margin: 5px 0 0;
    font-size: 14.5px;
    font-weight: 400;
    color: var(--coach_muted);
}
.coach_modal_rule {
    flex: 0 0 auto;
    height: 1px;
    margin: 17px 0;
    background-color: #eef0f2;
}

.coach_modal_body {
    /* Fade heights, switched on by coaches.js only when there is actually
       content hidden in that direction */
    --coach_fade_top: 0px;
    --coach_fade: 0px;

    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    margin: 0;
    font-size: 15.5px;
    font-weight: 400;
    line-height: 1.65;
    color: var(--coach_body);
    -webkit-overflow-scrolling: touch;

    -webkit-mask-image: linear-gradient(to bottom,
        transparent 0,
        #000 var(--coach_fade_top),
        #000 calc(100% - var(--coach_fade)),
        transparent 100%);
            mask-image: linear-gradient(to bottom,
        transparent 0,
        #000 var(--coach_fade_top),
        #000 calc(100% - var(--coach_fade)),
        transparent 100%);
}
.coach_modal_body.coach_more_above {
    --coach_fade_top: 40px;
}
.coach_modal_body.coach_more_below {
    --coach_fade: 46px;
}

.coach_modal_close {
    position: absolute;
    z-index: 2;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
    border: 0;
    background-color: #f4f4f5;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color .2s ease;
}
.coach_modal_close:hover {
    background-color: #e7e7e9;
}
.coach_modal_close svg {
    width: 17px;
    height: 17px;
    display: block;
}

@keyframes coach_fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes coach_pop {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to   { opacity: 1; transform: none; }
}


/* sft.css clears outlines globally, so put focus rings back for keyboard users */
.about_container :focus-visible,
.coach_modal :focus-visible {
    outline: 2px solid var(--coach_blue);
    outline-offset: 2px;
}


@media only screen and (max-width: 980px) {
    .about_container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-width: 700px;
    }
}

@media only screen and (max-width: 640px) {
    .about_container {
        grid-template-columns: minmax(0, 1fr);
        max-width: 360px;
        gap: 18px;
    }
    .coach_modal {
        padding: 14px;
    }
    /*
        Too narrow for two columns: the portrait becomes a fixed banner across
        the top and the bio scrolls beneath it, so the photo never eats the
        screen on a phone.
    */
    .coach_modal_card {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr);
        min-height: 0;
        max-height: 88vh;
    }
    .coach_modal_photo {
        margin: 12px 12px 0;
        width: calc(100% - 24px);
        height: 200px;
    }
    .coach_modal_pane {
        padding: 18px 20px 20px;
    }
    .coach_modal_name {
        font-size: 21px;
    }
    .coach_modal_rule {
        margin: 14px 0;
    }
    .coach_modal_body {
        font-size: 15.5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .about_card {
        transition: none;
    }
    .about_card:hover {
        transform: none;
    }
    .coach_modal,
    .coach_modal_card {
        animation: none;
    }
}
