/* =========================================================================
   Team cards + profile popup (2026-11-10): chapter pages, Leadership, Boards.
   Markup: frontend/leadership/member_card + profile_modal + group; chapter tabs in chapters/show.
   Loaded by those pages only (@push('styles')); aws.css stays the common sheet.
   ========================================================================= */
:root {
    --tm-maroon: #a70000;
    --tm-maroon-dark: #4d000e;
    --tm-gold: #ffcb0b;
    --tm-gold-soft: #ffe191;
    --tm-green: #196131;
    --tm-ease: cubic-bezier(.22, .61, .36, 1);
    --tm-hero: radial-gradient(130% 140% at 0% 0%, #b3121f 0%, #7a0016 55%, #4d000e 100%);
    --tm-ring: conic-gradient(from 210deg, #ffcb0b, #fff3c4, #e2a400, #ffe191, #ffcb0b);
}

/* flex, not grid: a short last row stays centred */
.tm-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

.tm-grid > .tm-card { flex: 0 1 216px; }

.tm-featured {
    display: grid;
    justify-items: center;
    gap: 22px;
    margin: 8px 0 34px;
}

.tm-featured--only { margin-bottom: 0; }

/* ---- card ---- */
.tm-card {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 18px 20px;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(167, 0, 0, .09);
    border-radius: 22px;
    box-shadow: 0 12px 30px -22px rgba(60, 0, 15, .55);
    transition: transform .45s var(--tm-ease), box-shadow .45s ease, border-color .3s ease;
}

/* header band behind the photo */
.tm-card::before,
.tm-card::after {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 92px;
    z-index: -1;
}

.tm-card::before { background: linear-gradient(120deg, #7a0016 0%, #a70000 50%, #f15719 100%); }

.tm-card::after {
    background: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .28) 1px, transparent 1.6px) 0 0 / 14px 14px;
    -webkit-mask-image: linear-gradient(to bottom, #000, transparent);
    mask-image: linear-gradient(to bottom, #000, transparent);
}

.tm-card__media {
    position: relative;
    flex-shrink: 0;
    width: 124px;
    height: 124px;
    margin-top: 30px;
    padding: 4px;
    border-radius: 50%;
    background: var(--tm-ring);
    box-shadow: 0 12px 24px -12px rgba(0, 0, 0, .5);
    transition: transform .55s var(--tm-ease);
}

/* a photo that is not cropped to a square yet keeps its top (the face), not its middle */
.tm-card__photo,
.tm-profile__photo img { object-position: 50% 18%; }

.tm-card__photo {
    display: block;
    width: 100%;
    height: 100%;
    border: 3px solid #fff;
    border-radius: 50%;
    object-fit: cover;
    background: #f3efe3;
}

.tm-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-top: 14px;
}

.tm-card__eyebrow {
    font-family: 'Poppins-SemiBold', sans-serif;
    font-size: 11.5px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--tm-gold);
}

.tm-card__name {
    margin: 0;
    font-family: 'Poppins-SemiBold', sans-serif;
    font-size: 15px; /* 2026-11-11: name, role and button one step smaller (user's request) */
    line-height: 1.3;
    color: #1d1d1b;
}

.tm-card__role {
    margin: 0;
    padding: 3px 10px;
    font-family: 'Poppins-Medium', sans-serif;
    font-size: 11.5px;
    line-height: 1.4;
    color: var(--tm-green);
    background: rgba(86, 151, 39, .1);
    border-radius: 14px; /* long roles wrap: a soft box, not a stretched pill */
}

a.tm-card__role {
    position: relative;
    z-index: 2; /* above the card-wide "View profile" hit area */
    text-decoration: none;
    transition: background-color .25s ease, color .25s ease;
}

a.tm-card__role:hover { color: #fff; background: var(--tm-green); }

/* "President, Pennsylvania Chapter": role on the first line, chapter / region on the second */
.tm-role-line { display: block; }
.tm-role-line + .tm-role-line { font-family: 'Poppins-Regular', sans-serif; }

.tm-card__view {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: auto;
    padding: 2px 14px;
    font-family: 'Poppins-Medium', sans-serif;
    font-size: 11.5px;
    color: var(--tm-maroon);
    background: #fff;
    border: 1px solid rgba(167, 0, 0, .25);
    border-radius: 999px;
    transition: background-color .3s ease, color .3s ease, border-color .3s ease;
}

/* the whole card opens the profile */
.tm-card__view::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
    cursor: pointer;
}

.tm-card__view:focus-visible {
    outline: 3px solid var(--tm-gold);
    outline-offset: 2px;
}

.tm-card:hover {
    transform: translateY(-6px);
    border-color: rgba(255, 203, 11, .7);
    box-shadow: 0 26px 46px -26px rgba(60, 0, 15, .65);
}

.tm-card:hover .tm-card__media { transform: scale(1.05) rotate(-2deg); }
.tm-card:hover .tm-card__view { color: #fff; background: var(--tm-maroon); border-color: var(--tm-maroon); }

/* ---- featured card (president): wide maroon hero ---- */
.tm-card--featured {
    flex-direction: row;
    align-items: center;
    gap: 30px;
    width: min(100%, 740px);
    padding: 28px 36px;
    text-align: left;
    color: #fff;
    background: var(--tm-hero);
    border: 0;
    border-radius: 28px;
    box-shadow: 0 32px 60px -32px rgba(77, 0, 14, .85);
}

.tm-card--featured::before {
    inset: -45% -12% auto auto;
    width: 340px;
    height: 340px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 203, 11, .38), transparent 65%);
}

.tm-card--featured::after {
    inset: 0;
    height: auto;
    background-size: 16px 16px;
    -webkit-mask-image: linear-gradient(90deg, transparent 35%, #000);
    mask-image: linear-gradient(90deg, transparent 35%, #000);
}

.tm-card--featured .tm-card__media { width: 172px; height: 172px; margin: 0; padding: 5px; }
.tm-card--featured .tm-card__body { flex: 1; align-items: flex-start; margin: 0; }
.tm-card--featured .tm-card__name { font-family: 'Oswald-Bold', sans-serif; font-size: 30px; letter-spacing: .01em; color: #fff; }
.tm-card--featured .tm-card__role { color: var(--tm-gold-soft); background: rgba(255, 203, 11, .16); }
.tm-card--featured a.tm-card__role:hover { color: var(--tm-maroon-dark); background: var(--tm-gold); }
.tm-card--featured .tm-card__view { margin-top: 10px; color: var(--tm-maroon-dark); background: var(--tm-gold); border-color: var(--tm-gold); }
.tm-card--featured:hover { border-color: transparent; box-shadow: 0 40px 70px -34px rgba(77, 0, 14, .95); }
.tm-card--featured:hover .tm-card__view { color: #7a0016; background: #fff; border-color: #fff; }

/* ---- chapter page tabs ---- */
.chapter-tabs .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 16px;
}

.chapter-tabs__count {
    min-width: 22px;
    padding: 1px 7px;
    font-size: 11.5px;
    line-height: 18px;
    color: var(--tm-green);
    background: #fff;
    border-radius: 999px;
}

.chapter-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 6px 0 18px;
    font-family: 'Oswald-Regular', sans-serif;
    font-size: 22px;
    color: #0f3d1f;
}

.chapter-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(25, 97, 49, .3), transparent);
}

/* ---- profile popup ---- */
body:has(#teamProfileModal.show) .modal-backdrop.show {
    opacity: .6;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.tm-modal .modal-dialog { max-width: 900px; }

.tm-modal.fade .modal-dialog {
    transform: translateY(26px) scale(.97);
    transition: transform .4s var(--tm-ease);
}

.tm-modal.show .modal-dialog { transform: none; }

.tm-modal .modal-content {
    position: relative;
    overflow: hidden;
    border: 0;
    border-radius: 28px;
    box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .6);
}

.tm-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 5;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    color: var(--tm-maroon-dark);
    background: rgba(255, 255, 255, .92);
    border: 0;
    border-radius: 50%;
    box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .4);
    transition: transform .35s var(--tm-ease), background-color .25s ease;
}

.tm-modal__close:hover { background: var(--tm-gold); transform: rotate(90deg); }

.tm-modal__body.is-swap .tm-profile { animation: tm-swap .45s var(--tm-ease); }

@keyframes tm-swap {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

.tm-profile {
    display: grid;
    grid-template-columns: 310px minmax(0, 1fr);
    min-height: 440px;
    font-family: 'Poppins-Regular', 'Segoe UI', Arial, sans-serif;
}


.tm-profile__side {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 44px 26px 32px;
    overflow: hidden;
    text-align: center;
    color: #fff;
    background: var(--tm-hero);
}

.tm-profile__side::before {
    content: '';
    position: absolute;
    top: -90px;
    left: -60px;
    z-index: -1;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 203, 11, .35), transparent 65%);
}

.tm-profile__side::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .12) 1px, transparent 1.6px) 0 0 / 16px 16px;
    -webkit-mask-image: linear-gradient(to top, #000, transparent 70%);
    mask-image: linear-gradient(to top, #000, transparent 70%);
}

.tm-profile__photo {
    width: 196px;
    height: 196px;
    margin-bottom: 14px;
    padding: 5px;
    border-radius: 50%;
    background: var(--tm-ring);
    box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .6);
}

.tm-profile__photo img {
    width: 100%;
    height: 100%;
    border: 4px solid #fff;
    border-radius: 50%;
    object-fit: cover;
}

.tm-profile__name {
    margin: 0;
    font-family: 'Oswald-Bold', sans-serif;
    font-size: 27px;
    line-height: 1.15;
    letter-spacing: .01em;
    color: #fff;
}

.tm-profile__role {
    margin: 0;
    padding: 4px 14px;
    font-family: 'Poppins-Medium', sans-serif;
    font-size: 13.5px;
    color: var(--tm-gold-soft);
    background: rgba(255, 203, 11, .16);
    border-radius: 999px;
}

.tm-profile__role--split { padding: 6px 16px; line-height: 1.45; border-radius: 16px; }

.tm-profile__team {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 4px 0 0;
    font-size: 13px;
    color: rgba(255, 255, 255, .82);
}

.tm-profile__social {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.tm-profile__social a {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    color: #fff;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 50%;
    transition: transform .3s var(--tm-ease), background-color .25s ease, color .25s ease;
}

.tm-profile__social a:hover { color: var(--tm-maroon-dark); background: var(--tm-gold); transform: translateY(-3px); }

.tm-profile__main {
    max-height: min(80vh, 660px);
    padding: 48px 42px 84px;
    overflow-y: auto;
    background: linear-gradient(180deg, #fffdf6, #fff 40%);
}

.tm-profile__section + .tm-profile__section { margin-top: 28px; }

.tm-profile__label {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 14px;
    font-family: 'Poppins-SemiBold', sans-serif;
    font-size: 12px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--tm-maroon);
}

.tm-profile__label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(167, 0, 0, .28), transparent);
}

.tm-profile__bio p {
    margin: 0 0 12px;
    font-size: 15px;
    line-height: 1.8;
    color: #3b3b36;
}

.tm-profile__bio p:first-child::first-letter {
    float: left;
    margin: 6px 10px 0 0;
    font-family: 'Oswald-Bold', sans-serif;
    font-size: 3.2em;
    line-height: .85;
    color: var(--tm-maroon);
}


.tm-profile__roles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tm-profile__roles a,
.tm-profile__roles span {
    display: inline-block;
    padding: 7px 14px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--tm-green);
    text-decoration: none;
    background: rgba(86, 151, 39, .1);
    border-radius: 999px;
    transition: background-color .25s ease, color .25s ease;
}

.tm-profile__roles strong { font-family: 'Poppins-SemiBold', sans-serif; font-weight: normal; }
.tm-profile__roles a:hover { color: #fff; background: var(--tm-green); }

.tm-profile__link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 26px;
    font-family: 'Poppins-Medium', sans-serif;
    font-size: 14px;
    color: var(--tm-maroon);
    text-decoration: none;
}

.tm-profile__link i { transition: transform .3s var(--tm-ease); }
.tm-profile__link:hover i { transform: translateX(4px); }

.tm-modal__nav {
    position: absolute;
    right: 20px;
    bottom: 18px;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px;
    background: #fff;
    border-radius: 999px;
    box-shadow: 0 10px 26px -12px rgba(0, 0, 0, .45);
}

.tm-modal__nav[hidden] { display: none; }

.tm-modal__arrow {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    color: var(--tm-maroon);
    background: #fff;
    border: 1px solid rgba(167, 0, 0, .22);
    border-radius: 50%;
    transition: background-color .25s ease, color .25s ease;
}

.tm-modal__arrow:hover { color: #fff; background: var(--tm-maroon); }

.tm-modal__count {
    min-width: 50px;
    font-family: 'Poppins-Medium', sans-serif;
    font-size: 13px;
    text-align: center;
    color: #5a5a52;
}

/* ---- small screens ---- */
@media (max-width: 767px) {
    .tm-profile { grid-template-columns: 1fr; min-height: 0; }
    .tm-profile__side { padding: 54px 20px 26px; }
    .tm-profile__photo { width: 150px; height: 150px; }
    .tm-profile__main { max-height: none; padding: 26px 22px 96px; }
    .tm-modal__body { overflow-y: auto; }
    .tm-modal__nav { position: fixed; right: auto; left: 50%; bottom: 18px; transform: translateX(-50%); }
}

@media (max-width: 575px) {
    .tm-modal .modal-content { border-radius: 0; }
    .tm-grid { gap: 14px; }
    .tm-grid > .tm-card { flex-basis: calc(50% - 7px); }
    .tm-card { padding: 0 10px 16px; border-radius: 18px; }
    .tm-card::before,
    .tm-card::after { height: 72px; }
    .tm-card__media { width: 96px; height: 96px; margin-top: 22px; }
    .tm-card__name { font-size: 13.5px; }
    .tm-card__role { padding: 2px 9px; font-size: 11px; }
    .tm-card__view { padding: 2px 11px; font-size: 11px; }
    .tm-card--featured { flex-direction: column; gap: 16px; padding: 28px 20px; text-align: center; }
    .tm-card--featured::before { height: 340px; }
    .tm-card--featured::after { height: auto; }
    .tm-card--featured .tm-card__media { width: 140px; height: 140px; }
    .tm-card--featured .tm-card__body { align-items: center; }
    .tm-card--featured .tm-card__name { font-size: 25px; }
    .chapter-tabs .nav-link { padding: 5px 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .tm-card,
    .tm-card__media,
    .tm-modal.fade .modal-dialog,
    .tm-modal__close { transition: none; }
    .tm-card:hover,
    .tm-card:hover .tm-card__media { transform: none; }
    .tm-modal__body.is-swap .tm-profile { animation: none; }
}

/* =========================================================================
   AAA Boards hierarchy (2026-11-20, client's request): level 1 on top, then level 2 and level 3,
   joined by connector lines; each box is a tab that opens the board below (frontend/leadership/index).
   Desktop: one row per level with lines; below 992px: compact grid, only a short stem between rows.
   ========================================================================= */
.bh-tree {
    --bh-gap: 14px;
    --bh-line: #d9b44a;
    margin: 26px auto 6px;
    max-width: 1080px;
}

.bh-row {
    position: relative;
    display: grid;
    grid-template-columns: repeat(var(--n, 1), minmax(0, 1fr));
    gap: var(--bh-gap);
}

.bh-row--1 { max-width: 320px; margin: 0 auto; }
.bh-row--2 { max-width: 860px; margin-left: auto; margin-right: auto; }

/* lines: a stem down from the row above, a bar across this row, a tick down into every box */
.bh-row + .bh-row { margin-top: 44px; }
.bh-row + .bh-row::before,
.bh-row + .bh-row::after,
.bh-row + .bh-row > .bh-node::before {
    content: '';
    position: absolute;
    background: var(--bh-line);
    pointer-events: none;
}
.bh-row + .bh-row::before { top: -44px; left: 50%; width: 2px; height: 22px; margin-left: -1px; }
.bh-row + .bh-row::after {
    top: -22px;
    height: 2px;
    /* from the centre of the first box to the centre of the last one */
    left: calc((100% - (var(--n) - 1) * var(--bh-gap)) / var(--n) / 2);
    right: calc((100% - (var(--n) - 1) * var(--bh-gap)) / var(--n) / 2);
}
.bh-row + .bh-row > .bh-node::before { top: -22px; left: 50%; width: 2px; height: 22px; margin-left: -1px; }

.bh-node {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 74px;
    padding: 12px 10px;
    border: 1.5px solid #ecd28a;
    border-radius: 16px;
    color: var(--tm-maroon-dark);
    background: linear-gradient(180deg, #fffdf5, #fff5d6);
    box-shadow: 0 10px 22px -16px rgba(77, 0, 14, .55);
    text-align: center;
    cursor: pointer;
    transition: transform .3s var(--tm-ease), box-shadow .3s var(--tm-ease), border-color .3s ease, background .3s ease;
}

.bh-name {
    font-family: 'Oswald-Regular', 'Oswald', sans-serif;
    font-size: 15.5px;
    line-height: 1.2;
    letter-spacing: .2px;
}

.bh-node:hover { transform: translateY(-3px); border-color: var(--tm-gold); box-shadow: 0 16px 26px -16px rgba(77, 0, 14, .6); }
.bh-node:focus-visible { outline: 3px solid var(--tm-green); outline-offset: 3px; }

/* the top board stands out even when it is not the open one */
.bh-row--1 .bh-node { min-height: 86px; border: 2px solid var(--tm-gold); background: linear-gradient(160deg, #fff7d6, #ffe08a); }
.bh-row--1 .bh-name { font-size: 19px; }

/* the open board: maroon box, gold text, a notch pointing down at its members */
.bh-node.active {
    border-color: var(--tm-gold);
    color: #fff;
    background: var(--tm-hero);
    box-shadow: 0 16px 30px -14px rgba(77, 0, 14, .75);
}
.bh-node.active::after {
    content: '';
    position: absolute;
    bottom: -7px;
    left: 50%;
    width: 14px;
    height: 14px;
    margin-left: -7px;
    background: #6b0014;
    transform: rotate(45deg);
    border-right: 1.5px solid var(--tm-gold);
    border-bottom: 1.5px solid var(--tm-gold);
}

.bh-panels { margin-top: 18px; padding-top: 6px; border-top: 1px dashed #ead9a6; }

@media (max-width: 991px) {
    .bh-row,
    .bh-row--2 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); max-width: none; }
    .bh-row--1 { grid-template-columns: minmax(0, 1fr); max-width: 300px; }
    .bh-row + .bh-row { margin-top: 30px; }
    .bh-row + .bh-row::after,
    .bh-row + .bh-row > .bh-node::before,
    .bh-node.active::after { display: none; }
    .bh-row + .bh-row::before { top: -26px; height: 22px; }
    .bh-node { min-height: 64px; }
    .bh-name { font-size: 14.5px; }
}

@media (max-width: 575px) {
    .bh-tree { --bh-gap: 10px; margin-top: 18px; }
    .bh-row,
    .bh-row--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bh-row--1 { grid-template-columns: minmax(0, 1fr); }
    .bh-node { padding: 10px 8px; border-radius: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .bh-node { transition: none; }
    .bh-node:hover { transform: none; }
}
