.classmates-header-title {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 20px; 
    margin-bottom: 25px; /* extra margin to accommodate tooltip */
}

.classmates-header-title a {
    color: #002A54;
    font-family: Avenir, "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-weight: 500;
    text-decoration: none;
    text-transform: capitalize;
    letter-spacing: 1px;
    transition: color 0.2s;
    display: inline-block;
    font-size: clamp(18px, 2.5vw, 36px);
}

.classmates-header-title a:hover {
    color: #C8323C;
}

/* Standard Tooltip Styles (Dark Grey) */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #555555;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    margin-top: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    text-transform: none;
    letter-spacing: normal;
    font-weight: normal;
    z-index: 1000;
}

[data-tooltip]::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: transparent transparent #555555 transparent;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    margin-top: -4px;
    pointer-events: none;
    z-index: 1000;
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Rep Button Purple Tooltip */
.reps-btn[data-tooltip]::after {
    background: #9554BC;
}

.reps-btn[data-tooltip]::before {
    border-color: transparent transparent #9554BC transparent;
}

.classmates-filter {
    margin-bottom: 30px;
    text-align: center;
}

.classmates-filter form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.classmates-filter input[type="text"],
.classmates-filter select {
    box-sizing: border-box;
    width: 182px;
    height: 37px;
    background: #EFF0F3;
    border: 1px solid #002B57;
    border-radius: 5px;
    padding: 0 14px;
    font-size: 17px;
    font-family: 'Charter', Georgia, serif;
    font-weight: 400;
    line-height: 21px;
    color: #002B57 !important;
    min-width: 182px;
    text-align: center;
}

.classmates-filter select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 44px;
    padding-left: 42px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px 14px;
    text-align: left;
    text-align-last: left;
    -moz-text-align-last: left;
    color: #002B57 !important;
    text-indent: 0;
}

.classmates-filter input[type="text"]:focus,
.classmates-filter select:focus,
.classmates-filter input[type="text"]:hover,
.classmates-filter select:hover {
    outline: none;
    border-color: #EC1C25;
}

.classmates-filter input[type="text"]::placeholder,
.classmates-filter input[type="text"]::-webkit-input-placeholder,
.classmates-filter input[type="text"]:-ms-input-placeholder {
    color: #002B57 !important;
    opacity: 1 !important;
    text-align: center;
    font-family: 'Charter', Georgia, serif;
    font-size: 17px;
}

.classmates-filter button[type="submit"] {
    box-sizing: border-box;
    width: 182px;
    height: 37px;
    background: #002B57;
    color: #ffffff;
    border: 1px solid #002B57;
    border-radius: 5px;
    padding: 0 14px;
    font-size: 17px;
    font-family: 'Charter', Georgia, serif;
    font-weight: 400;
    line-height: 21px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.classmates-filter button[type="submit"]:hover {
    background: #001a36; /* slightly darker on hover */
    color: #ffffff;
}

/* Make dropdown option text smaller than the select label */
.classmates-filter select option {
    font-size: 13px;
    font-family: 'Charter', Georgia, serif;
    color: #002B57;
}

/* Force Any Name input to appear blue, including browser autofill */
.classmates-name-input {
    color: #002B57 !important;
    font-family: 'Charter', Georgia, serif;
}

.classmates-name-input::placeholder {
    color: #002B57 !important;
    opacity: 1 !important;
    text-align: center;
}

input.classmates-name-input:-webkit-autofill,
input.classmates-name-input:-webkit-autofill:hover,
input.classmates-name-input:-webkit-autofill:focus,
input.classmates-name-input:-webkit-autofill:active {
    -webkit-text-fill-color: #002B57 !important;
    box-shadow: 0 0 0px 1000px #FFFFFF inset !important;
}

.classmates-header-title a {
    color: #002A54;
    text-decoration: none;
    font-family: Avenir, "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
    text-transform: capitalize;
    font-size: clamp(18px, 2.5vw, 36px);
    font-weight: 500;
    letter-spacing: 0.02em;
}

.reset-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #7C62FF;
    color: white;
    border: none;
    border-radius: 50%;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.2s;
    cursor: pointer;
}

.reset-btn:hover {
    background: #6248e0;
    color: white;
}

/* Hide the original reps button inside the filter form (we'll place a compact one by the header) */
.classmates-filter .reps-btn { display: none; }

/* Header-placed compact reps button: keep header centered by using inline layout */
.classmates-header-title { position: relative; text-align: center; display: flex; justify-content: center; align-items: center; gap: 12px; }

.reps-btn.header-reps-btn {
    box-sizing: border-box;
    display: inline-flex;
    width: 28px;
    height: 28px;
    margin-left: 12px;
    border: 1px solid #9F50C1;
    background: #ffffff;
    color: #9F50C1;
    font-family: 'Charter', Georgia, serif;
    font-size: 18px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    cursor: pointer;
    vertical-align: middle;
    transition: all 0.12s ease;
    transform: translate(-9px, 1px);
}

.reps-btn.header-reps-btn:hover { border-color: #8a3fb8; }

.reps-btn.header-reps-btn.active {
    background: #9F50C1;
    border-color: #9F50C1;
    color: #ffffff;
}

.rep-badge-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #9554BC;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 13px;
    font-weight: bold;
    margin-top: -2px;
    position: relative;
    top: 2px;
}

.classmates-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 40px 0;
    padding: 20px 0;
}

.classmates-loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    pointer-events: none;
    justify-content: center;
    align-items: center;
}

.classmates-loading.is-visible {
    display: flex;
}

.classmates-loading-wheel {
    width: 36px;
    height: 36px;
    border: 3px solid #EFF0F3;
    border-top-color: #9F50C1;
    border-radius: 50%;
    animation: classmates-spin 0.8s linear infinite;
}

@keyframes classmates-spin {
    to { transform: rotate(360deg); }
}

.classmates-back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #9F50C1;
    background: #ffffff;
    color: #9F50C1;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease, background 0.12s ease, color 0.12s ease;
    box-shadow: 0 2px 8px rgba(0, 42, 84, 0.12);
}

.classmates-back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.classmates-back-to-top:hover {
    background: #9F50C1;
    color: #ffffff;
    border-color: #9F50C1;
}

.classmate-card {
    background: #EFF0F3;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    transition: all 0.3s ease;
    display: grid;
    grid-template-columns: 1fr 160px 160px 1fr;
    gap: 20px;
    padding: 20px 30px;
    align-items: flex-start;
}

.classmate-card:hover {
    transform: none;
    box-shadow: none;
}

.classmate-old-info {
    text-align: right;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    grid-column: 1;
    padding-top: 0;
    max-height: 200px;
    overflow: hidden;
    word-break: break-word;
    line-clamp: 10;
    font-family: 'Charter', Georgia, serif;
    color: #012954;
}

.classmate-old-info h3 {
    margin: 0 0 12px 0;
    font-size: 22px;
    font-weight: 500;
    font-family: 'Charter', Georgia, serif;
    color: #012954;
    line-height: 1.3;
}

.class-year {
    color: #012954;
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 300;
    font-family: 'Charter', Georgia, serif;
    position: relative;
    top: -5px;
}

.old-address {
    color: #012954;
    margin: 0 0 16px 0;
    font-size: 13px;
    line-height: 1.5;
    font-family: 'Charter', Georgia, serif;
    position: relative;
    top: -16px;
}

.activities {
    margin: 16px 0 20px 0;
    font-size: 13px;
    color: #012954;
    text-align: right;
    line-height: 1.5;
    max-width: 300px;
    margin-left: auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-family: 'Charter', Georgia, serif;
    position: relative;
    top: -14px;
}

.activities span {
    display: inline;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    font-weight: normal;
    transition: none;
}

.activities span::after {
    content: ', ';
}

.activities span:last-child::after {
    content: '';
}

.rep-badge {
    display: none; /* Safely hide any lingering old rep badges just in case */
}

/* ── ZOOM IN PLACE: 15% SCALE, NO TEXT OVERLAY ── */
/* Subtle 1.15x zoom without obstructing other content */

/* Yearbook picture - column 2 */
.yearbook-pic-wrap {
    grid-column: 2;
    width: 160px;
    height: 200px;
    overflow: hidden;
    border-radius: 8px;
    cursor: default;
    position: relative;
    z-index: 1;
    transition: z-index 0s 0.25s, transform 0.25s ease, box-shadow 0.25s;
    transform-origin: right center;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.yearbook-pic-wrap:hover {
    z-index: 2;
    transition: z-index 0s 0s, transform 0.25s ease, box-shadow 0.25s;
    transform: scale(2.0);
}

/* NO-ZOOM CLASS - Disables zoom for specific images */
.yearbook-pic-wrap.no-zoom,
.profile-pic-wrap.no-zoom {
    transition: none !important;
}

.yearbook-pic-wrap.no-zoom:hover,
.profile-pic-wrap.no-zoom:hover {
    transform: none !important;
    z-index: 1 !important;
}

.classmate-card .yearbook-pic {
    width: 160px;
    height: 200px;
    object-fit: cover;
    object-position: center top;
    flex-shrink: 0;
    border-radius: 8px;
    border: none;
    display: block;

    filter: grayscale(100%) contrast(1.1) brightness(1.05);
}

/* Gradient overlay label for yearbook */
.yearbook-pic-wrap .pic-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(2, 3, 3, 0.88));
    padding: 20px 8px 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.yearbook-pic-wrap:hover .pic-label {
    opacity: 0;
}

.pic-label span {
    margin: 0;
    color: #ffffff;
    font-size: 10px;
    text-align: center;
    font-family: sans-serif;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    line-height: 1.2;
}

/* Column 4: New/Current Info */
.classmate-new-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    grid-column: 4;
    align-self: start;
    padding-top: 0;
    max-height: 200px;
    overflow: visible;
    word-break: break-word;
    font-family: 'Charter', Georgia, serif;
    color: #012954;
}

/* Column 3: Profile picture */
.profile-pic-wrap {
    grid-column: 3;
    width: 160px;
    height: 200px;
    overflow: hidden;
    border-radius: 8px;
    cursor: default;
    position: relative;
    z-index: 1;
    transition: z-index 0s 0.25s, transform 0.25s ease, box-shadow 0.25s;
    transform-origin: left center;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.profile-pic-wrap:hover {
    z-index: 2;
    transition: z-index 0s 0s, transform 0.25s ease, box-shadow 0.25s;
    transform: scale(2.0);
}

.profile-pic {
    width: 160px;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    border: none;
    align-self: start;
    display: block;

    filter: saturate(1.08) contrast(1.06) brightness(1.02);
}

/* Gradient overlay label for profile */
.profile-pic-wrap .pic-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 42, 84, 0.88));
    padding: 20px 8px 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.profile-pic-wrap:hover .pic-label {
    opacity: 0;
}

/* New info text section */
.classmate-new-info h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 500;
    font-family: 'Charter', Georgia, serif;
    color: #012954;
    line-height: 1.3;
}

.classmate-new-info .about {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #555;
}

.about-tooltip {
    font-size: 14px;
    color: #012954;
    cursor: default;
    font-weight: 500;
}

.about-tooltip[data-tooltip]::after {
    left: 100%;
    top: 50%;
    right: auto;
    transform: translateY(-50%);
    margin-left: -450px;
    margin-top: 0;
    white-space: normal;
    max-width: 300px;
    width: 300px;
}

.about-tooltip[data-tooltip]::before {
    right: 100%;
    left: auto;
    top: 50%;
    transform: translate(48px, -50%);
    margin-right: -2px;
    margin-top: 0;
    border-color: transparent #555555 transparent transparent;
}

.classmate-new-info .contact-info {
    padding: 0;
    border-radius: 0;
    border-left: none;
}

.contact-info p {
    margin: 0 0 8px 0;
    font-size: 14px;
    line-height: 1.5;
    color: #012954;
    font-family: 'Charter', Georgia, serif;
}

.contact-info p:last-child {
    margin-bottom: 0;
}

.contact-info a {
    color: #012954;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.contact-info a:hover {
    color: #FF6464;
    text-decoration: underline;
}

.classmate-new-info .social-links {
    display: flex;
    gap: 16px;
    align-items: center;
}

.social-links a {
    color: #012954;
    font-size: 20px;
    text-decoration: none;
    transition: color 0.2s;
    width: auto;
    height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    background: none;
    padding: 0;
}

.social-links a:hover {
    color: #FF6464;
    background: none;
    transform: none;
}

@media (max-width: 900px) {
    .classmates-wrapper {
        padding: 0 16px;
    }

    .classmates-header-title {
        margin-bottom: 20px;
        text-align: center;
    }

    .classmates-filter {
        margin-bottom: 20px;
    }

    .classmates-filter form {
        align-items: stretch;
        flex-direction: column;
    }

    .classmates-filter input[type="text"],
    .classmates-filter select,
    .classmates-filter button[type="submit"],
    .reps-btn {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .classmates-filter select {
        text-align: left;
    }

    .classmates-filter input[type="text"]::placeholder {
        text-align: left;
    }

    .classmate-new-info .social-links {
        gap: 12px;
        flex-wrap: wrap;
    }
}

/* ── ≤768px: Single fluid mobile layout — no fixed widths ─────────── */
@media (max-width: 768px) {

    .classmates-back-to-top {
        bottom: 16px;
        right: 16px;
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    /* Wrapper */
    .classmates-wrapper {
        padding: 0 clamp(10px, 3vw, 16px);
    }

    /* Grid: remove gap so card borders touch cleanly */
    .classmates-grid {
        gap: 0;
        margin: clamp(16px, 4vw, 28px) 0;
    }

    /* ── Card container ── */
    /* 4-column layout scales with viewport */
    .classmate-card {
        grid-template-columns: 1fr clamp(45px, 14vw, 110px) clamp(45px, 14vw, 110px) 1fr;
        grid-template-rows: auto;
        gap: clamp(6px, 1.5vw, 14px) clamp(6px, 2vw, 16px);
        padding: clamp(10px, 2vw, 18px) clamp(6px, 1.5vw, 14px);
        background: #ffffff;
        border-bottom: 1px solid #d8dce4;
        align-items: flex-start;
    }

    .classmates-grid > .classmate-card:first-of-type {
        border-top: 1px solid #d8dce4;
    }

    /* ── Col 1: old info ── */
    .classmate-old-info {
        grid-column: 1;
        grid-row: 1;
        text-align: right;
        max-height: none;
        overflow: visible;
    }

    /* ── Col 2: yearbook photo ── */
    .yearbook-pic-wrap {
        grid-column: 2;
        grid-row: 1;
        justify-self: center;
        align-self: start;
        min-height: 0;
    }

    /* ── Col 3: profile photo ── */
    .profile-pic-wrap {
        grid-column: 3;
        grid-row: 1;
        justify-self: center;
        align-self: start;
        min-height: 0;
    }

    /* ── Col 4: new info ── */
    .classmate-new-info {
        grid-column: 4;
        grid-row: 1;
        text-align: left;
        max-height: none;
        gap: clamp(2px, 1vw, 8px);
    }

    /* ── Photos: fluid width + aspect ratio, no fixed height ── */
    .classmate-card .yearbook-pic,
    .classmate-card .profile-pic {
        width: clamp(45px, 14vw, 110px);
        height: auto;
        aspect-ratio: 4 / 5;
        max-width: none;
        object-fit: cover;
        object-position: center top;
        background-color: #e2e5eb; /* grey placeholder for broken images */
        transition: none;
        transform: none !important;
    }

    /* ── Disable zoom-in-place hover on mobile ── */
    .yearbook-pic-wrap,
    .profile-pic-wrap {
        cursor: default;
        overflow: hidden;
    }

    .yearbook-pic-wrap:hover,
    .profile-pic-wrap:hover {
        transform: none !important;
        z-index: 1;
    }

    /* Hide overlay on mobile */
    .pic-label {
        opacity: 0 !important;
        display: none;
    }

    /* ── Fluid typography ── */
    .classmate-old-info h3,
    .classmate-new-info h3 {
        font-size: clamp(13px, 3.2vw, 22px);
        margin-bottom: clamp(2px, 0.8vw, 6px);
    }

    .class-year {
        font-size: clamp(11px, 2.8vw, 18px);
        margin-bottom: clamp(2px, 0.8vw, 6px);
        top: 0;
    }

    .activities,
    .old-address,
    .contact-info p {
        font-size: clamp(10px, 2.5vw, 14px);
        margin-bottom: clamp(2px, 0.6vw, 4px);
        top: 0;
    }

    /* ── Reset desktop positioning offsets that cause scattered gaps ── */
    /* Desktop uses position:relative + negative top values to align
       elements against fixed-height photo columns — not needed on mobile */
    .class-year,
    .old-address {
        position: static;
        top: auto;
        margin-top: 0;
    }

    .activities {
        position: static;
        top: auto;
        /* Keep right aligned for 4 column layout */
        text-align: right;
        margin-left: auto;
        max-width: none;
        margin-top: clamp(2px, 0.8vw, 6px);
        margin-bottom: clamp(2px, 0.8vw, 6px);
    }

    /* Tighten the h3 bottom margin — desktop uses 12px which feels loose
       when photos are small and the card is compact */
    .classmate-old-info h3,
    .classmate-new-info h3 {
        margin-bottom: clamp(2px, 0.8vw, 6px);
    }

    .about-tooltip {
        font-size: clamp(11px, 2.8vw, 13px);
    }

    /* ── Social icons ── */
    .classmate-new-info .social-links a {
        font-size: clamp(15px, 4vw, 20px);
    }

    .classmate-new-info .social-links {
        gap: clamp(8px, 2.5vw, 16px);
        flex-wrap: wrap;
    }

    /* ── Filter controls ── */
    .classmates-filter input[type="text"],
    .classmates-filter select,
    .classmates-filter button[type="submit"],
    .reps-btn {
        font-size: clamp(13px, 3.5vw, 15px);
        padding: clamp(8px, 2vw, 10px) clamp(10px, 2.5vw, 14px);
    }

    /* ── Always show contact info (no hover on touch) ── */
    .classmate-new-info .contact-info {
        display: block;
    }

    /* ── About-tooltip: above the element, stays on-screen ── */
    .about-tooltip[data-tooltip]::after {
        left: 0;
        top: auto;
        bottom: 100%;
        right: auto;
        transform: none;
        margin-left: 0;
        margin-top: 0;
        margin-bottom: 6px;
        white-space: normal;
        max-width: calc(100vw - 40px);
        width: auto;
    }

    .about-tooltip[data-tooltip]::before {
        left: 16px;
        top: auto;
        bottom: 100%;
        right: auto;
        transform: none;
        margin-top: 0;
        margin-bottom: -4px;
        border-color: #555555 transparent transparent transparent;
    }
}
