/* Team page */

/* the team in centered rows, so a short last row never hangs to one side */
.team--rows { display: flex; flex-wrap: wrap; justify-content: center; margin-top: 0; }
.team--rows > .person { flex: 0 1 100%; }

/* each card opens that person's profile; the whole card is the button */
.person__open { display: none; }
.js-profiles .person__open {
    display: inline-flex; align-items: center; margin-top: 12px; padding: 0; border: 0; background: none; cursor: pointer;
    font: 600 14px/1.3 "Poppins", sans-serif; color: var(--sage-dark);
    text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: 4px;
}
.js-profiles .person__open::after { content: ""; position: absolute; inset: -10px; z-index: 3; border-radius: 18px; }
.js-profiles .person__open:focus-visible { outline: none; }
.js-profiles .person__open:focus-visible::after { outline: 3px solid var(--indigo); outline-offset: 2px; }
.js-profiles .person__bio { display: none; }
.person__bio p { margin-top: 10px; font-size: 16px; }
.person__teaser { margin-top: 8px; font-size: 15px; line-height: 1.55; color: var(--charcoal);
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; } /* every card the same: three lines */
.person__open > span { margin-left: .35em; }
.person .arch__win img { transition: transform .5s var(--ease); }
.js-profiles .person:hover .arch__win img { transform: scale(1.1); }
.js-profiles .person:hover .person__open { text-decoration-color: var(--sage-dark); }

/* the profile panel */
.profile { padding: 0; border: 0; background: transparent; width: min(1000px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); overflow: visible; }
.profile:focus, .profile:focus-visible { outline: none; }
.profile::backdrop { background: rgba(51, 51, 51, .72); backdrop-filter: blur(3px); }
.profile-open { overflow: hidden; }
.profile__card {
    position: relative; display: grid; grid-template-columns: 330px 1fr; gap: 48px; align-items: start;
    max-height: calc(100dvh - 32px); overflow: auto; overscroll-behavior: contain;
    padding: 48px 52px 0; background: var(--white); border-radius: 26px;
    box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .55);
}
.profile[open] .profile__card { animation: profile-in .32s var(--ease); }
@keyframes profile-in { from { opacity: 0; transform: translateY(16px); } }
.profile__photo { position: sticky; top: 0; width: 100%; }
.profile__x {
    position: absolute; right: 16px; top: 16px; z-index: 4; width: 44px; height: 44px; border-radius: 50%;
    border: 2px solid var(--sage); background: var(--white); color: var(--charcoal); font-size: 26px; line-height: 1; cursor: pointer;
}
.profile__x:hover { border-color: var(--sage-dark); }
.profile__count { font: 600 13px/1.3 "Poppins", sans-serif; letter-spacing: .16em; text-transform: uppercase; color: var(--indigo); }
.profile__name { margin-top: 8px; font: 700 clamp(30px, 3.6vw, 44px)/1.05 "Poppins", sans-serif; letter-spacing: -.025em; color: var(--sage-dark); }
.profile__role { margin-top: 8px; font: 600 15px/1.4 "Poppins", sans-serif; color: var(--indigo); }
.profile__bio { margin-top: 22px; padding-top: 22px; border-top: 2px solid var(--gold); }
.profile__bio p + p { margin-top: 14px; }
/* previous / next stay in reach at the bottom of the panel, however long the bio */
.profile__nav { position: sticky; bottom: 0; z-index: 2; display: flex; justify-content: space-between; gap: 12px; margin-top: 30px; padding: 18px 0 28px; background: var(--white); border-top: 1px solid var(--pale-grey); }
.profile__step {
    min-height: 46px; padding: 0 20px; border: 2px solid var(--olive-dark); border-radius: 999px; background: var(--white);
    font: 600 14px/1 "Poppins", sans-serif; color: var(--olive-dark); cursor: pointer; transition: background-color .2s, color .2s;
}
.profile__step:hover { background: var(--olive-dark); color: var(--white); }
.profile__x:focus-visible, .profile__step:focus-visible { outline: 3px solid var(--indigo); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
    .profile[open] .profile__card { animation: none; }
    .person .arch__win img { transition: none; }
}

/* phones: portrait beside the name, role and teaser */
@media (max-width: 639px) {
    .team--rows { gap: 38px; }
    .team--rows > .person { display: grid; grid-template-columns: min(128px, 36%) 1fr; column-gap: 24px; align-content: start; }
    .team--rows .arch { grid-row: 1 / 6; width: 100%; margin: 0; align-self: start; }
    .team--rows .arch::after { inset: -8px -8px 16px 16px; }
    .team--rows h3 { margin-top: 0; font-size: 20px; }
    .team--rows .person__bio { grid-column: 1 / -1; }
    .person__teaser { font-size: 14.5px; }
}
@media (min-width: 640px) {
    .team--rows > .person { flex-basis: calc((100% - 30px) / 2); max-width: 420px; }
}
@media (min-width: 1100px) {
    .team--rows > .person { flex-basis: calc((100% - 90px) / 4); }
}

/* phones and small tablets: the profile is a full-screen sheet that slides up */
@media (max-width: 759px) {
    .profile { width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; }
    .profile__card { grid-template-columns: 1fr; gap: 0; height: 100dvh; max-height: 100dvh; border-radius: 0; padding: 0 24px; }
    .profile[open] .profile__card { animation-name: profile-up; }
    @keyframes profile-up { from { transform: translateY(60px); opacity: 0; } }
    .profile__photo { position: relative; width: 170px; margin: 0 auto 26px; }
    .profile__x { position: fixed; right: 14px; top: 14px; }
    /* a soft white strip at the top so the close button never sits on the text */
    .profile__card::before { content: ""; position: sticky; top: 0; z-index: 3; display: block; height: 72px; margin: 0 -24px; background: linear-gradient(var(--white) 70%, rgba(255, 255, 255, 0)); pointer-events: none; }
    .profile__nav { position: sticky; bottom: 0; margin: 30px -24px 0; padding: 14px 24px calc(14px + env(safe-area-inset-bottom)); background: var(--white); box-shadow: 0 -12px 24px -18px rgba(51, 51, 51, .35); }
}
