/* ==============================
 TEAM PAGE STYLES
============================== */

/* ==============================
 TEAM GRID OVERVIEW
============================== */
.team-grid {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 4rem 5rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2.5rem;
}

.grid-athlete-card {
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    min-width: 0;
}

.grid-athlete-card:hover {
    transform: translateY(-6px);
}

.grid-athlete-photo {
    width: 100%;
    aspect-ratio: 3 / 4;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), 0 0 25px rgba(1, 74, 89, 0.15);
    position: relative;
    overflow: hidden;
    margin-bottom: 1rem;
    transition: box-shadow 0.3s ease;
    border-radius: 12px;
}

.grid-athlete-card:hover .grid-athlete-photo {
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.5), 0 0 35px rgba(121, 44, 77, 0.3);
}

.grid-athlete-photo::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(1, 74, 89, 0.15) 0%, transparent 50%);
    z-index: 1;
    pointer-events: none;
}

.grid-athlete-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: contrast(1.05) brightness(0.95);
}

.grid-athlete-name {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.6rem;
    line-height: 1.0;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
    overflow-wrap: break-word;
    word-break: break-word;
    font-weight: 400;
}

.grid-athlete-role {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-faint);
    font-weight: 600;
}

/* Hide detailed cards - they're used as data source for modal */
.team-container {
    display: none;
}

.athlete-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.athlete-header {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 3rem;
    margin-bottom: 2.5rem;
}

/* ==============================
 ATHLETE MODAL
============================== */
.athlete-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 20, 30, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 300;
    padding: 2rem;
    overflow-y: auto;
}

.athlete-modal.is-active {
    opacity: 1;
    pointer-events: auto;
}

body.modal-open {
    overflow: hidden;
}

.modal-content {
    max-width: 1200px;
    width: 100%;
    background: linear-gradient(135deg, rgba(0, 49, 70, 0.98) 0%, rgba(3, 30, 40, 0.95) 100%);
    border-radius: 16px;
    padding: 3rem;
    position: relative;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8), 0 0 60px rgba(121, 44, 77, 0.3);
    margin: auto;
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: var(--red-light);
    border: none;
    color: var(--text-primary);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s ease;
    z-index: 10;
    font-weight: 700;
}

.modal-close:hover {
    background: var(--red-dark);
}

.modal-athlete-header {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.modal-athlete-photo {
    width: 100%;
    aspect-ratio: 3 / 4;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 30px rgba(1, 74, 89, 0.2);
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.modal-athlete-photo::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(1, 74, 89, 0.15) 0%, transparent 50%);
    z-index: 1;
    pointer-events: none;
}

.modal-athlete-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: contrast(1.05) brightness(0.95);
}

.modal-athlete-details {
    display: flex;
    flex-direction: column;
}

.modal-athlete-name {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 4rem;
    line-height: 0.88;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 2rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    font-weight: 400;
}

.modal-social-links {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.modal-athlete-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem 2rem;
}

.modal-athlete-gallery {
    margin-top: 2rem;
}

.modal-race-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

/* ==============================
 ATHLETE LEFT COLUMN
============================== */
.athlete-left {
    display: flex;
    flex-direction: column;
}

.athlete-headshot {
    width: 100%;
    aspect-ratio: 3 / 4;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 30px rgba(1, 74, 89, 0.2);
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.athlete-headshot::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(1, 74, 89, 0.15) 0%, transparent 50%);
    z-index: 1;
    pointer-events: none;
}

.athlete-headshot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    filter: contrast(1.05) brightness(0.95);
}

.headshot-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--text-faint);
    text-transform: uppercase;
}

.athlete-name-row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.athlete-name {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 4rem;
    line-height: 0.88;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 400;
}

.athlete-details {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.athlete-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem 2rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.info-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.info-value {
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 300;
    color: var(--text-muted);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ==============================
 SOCIAL LINKS
============================== */
.social-links {
    display: flex;
    gap: 0.75rem;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-faint);
    transition: color 0.3s;
}

.social-link:hover {
    color: var(--red-light);
}

.social-link svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* ==============================
 ATHLETE GALLERY
============================== */
.athlete-gallery {
    width: 100%;
}

.race-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

.gallery-image {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.35);
    position: relative;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    border-radius: 10px;
}

.gallery-image:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 25px rgba(121, 44, 77, 0.25);
}

.gallery-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(123, 63, 240, 0.1) 0%, transparent 50%);
    z-index: 1;
    pointer-events: none;
}

.gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    filter: contrast(1.05) brightness(0.95);
}

body.lightbox-open {
    overflow: hidden;
}

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 20, 30, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
    z-index: 400;
    padding: 3rem 6rem;
}

.lightbox.is-active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    overflow: hidden;
}

.lightbox-image {
    max-width: 100%;
    max-height: calc(90vh - 5rem);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 14px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);
    display: block;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.lightbox-caption {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-faint);
    text-align: center;
    max-width: 100%;
    transition: opacity 0.2s ease;
}

/* Carousel nav arrows */
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 20, 30, 0.6);
    border: 2px solid rgba(121, 44, 77, 0.4);
    color: var(--text-primary);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.4rem;
    font-weight: 700;
    width: 3.2rem;
    height: 3.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 0;
    transition: all 0.2s ease;
    z-index: 10;
    backdrop-filter: blur(8px);
    line-height: 1;
}

.lightbox-prev {
    left: -5rem;
}

.lightbox-next {
    right: -5rem;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(121, 44, 77, 0.3);
    border-color: rgba(121, 44, 77, 0.9);
    transform: translateY(-50%) scale(1.08);
}

.lightbox-counter {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: var(--red-light);
    border: none;
    color: var(--text-primary);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s ease;
    z-index: 10;
    font-weight: 700;
}

.lightbox-close:hover {
    background: var(--red-dark);
}

@media (max-width: 768px) {
    .lightbox {
        padding: 2rem;
    }

    .lightbox-image {
        max-height: calc(90vh - 3rem);
    }

    .lightbox-close {
        top: 1.5rem;
        right: 1.5rem;
    }
}

@media (max-width: 520px) {
    .lightbox {
        padding: 1.5rem;
    }

    .lightbox-image {
        max-height: calc(90vh - 2.5rem);
        border-radius: 12px;
    }

    .lightbox-close {
        top: 1rem;
        right: 1rem;
    }
}

.gallery-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--text-faint);
    text-transform: uppercase;
}

/* ==============================
 RESPONSIVE
============================== */
@media (max-width: 1024px) {
    .team-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }

    .modal-athlete-header {
        grid-template-columns: 240px 1fr;
        gap: 2.5rem;
    }

    .modal-race-gallery {
        grid-template-columns: repeat(3, 1fr);
    }

    .race-gallery {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .team-grid {
        padding: 2rem 1.5rem 3rem;
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    .modal-content {
        padding: 3.5rem 1.5rem 2rem;
    }

    .modal-close {
        top: 1.25rem;
        right: 1.25rem;
    }

    .modal-athlete-header {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .modal-athlete-photo {
        max-width: 240px;
        margin: 0 auto;
    }

    .modal-athlete-name {
        font-size: 1.8rem;
        text-align: center;
        line-height: 1.1;
        padding: 0 0.5rem;
    }

    .modal-social-links {
        justify-content: center;
    }

    .modal-athlete-info {
        gap: 1rem;
    }

    .modal-race-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .race-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .gallery-image {
        aspect-ratio: 5 / 4;
    }
}

@media (max-width: 520px) {
    .team-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-athlete-name {
        font-size: 1.1rem;
    }

    .modal-content {
        padding: 3rem 1rem 1.5rem;
    }

    .modal-close {
        top: 1rem;
        right: 1rem;
    }

    .modal-athlete-photo {
        max-width: 200px;
    }

    .modal-athlete-name {
        font-size: 1.5rem;
        line-height: 1.15;
        padding: 0 0.25rem;
    }

    .modal-athlete-info {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem 1rem;
    }

    .info-item {
        min-width: 0;
    }

    .info-value {
        font-size: 0.95rem;
    }

    .modal-race-gallery {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .race-gallery {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .gallery-image {
        aspect-ratio: 4 / 3;
    }
}
