:root {
    --team-bg: #121212;
    --team-bg-deep: #0a0a0a;
    --team-gold: #FFD700;
    --team-gold-dark: #FFAA00;
    --team-muted: #cccccc;
    --team-faint: #777777;
    --team-card: rgba(24, 24, 24, 0.76);
    --team-line: rgba(255, 215, 0, 0.2);
    --team-shadow: 0 16px 38px rgba(0, 0, 0, 0.38);
}

body.team-page {
    background-color: #121212;
}

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1001;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--team-gold), var(--team-gold-dark));
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.68);
    transition: width var(--motion-normal) var(--ease-standard);
}

#particles-js {
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0.48;
    pointer-events: none;
}

.team-shell {
    position: relative;
    z-index: 2;
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 126px 0 92px;
}

.team-title,
.team-panel,
.apply-section {
    opacity: 0;
    transform: translateY(18px);
}

body.team-ready .team-title {
    animation: teamRise 720ms var(--ease-decelerate) 80ms both;
}

body.team-ready .team-panel {
    animation: teamPanelIn 680ms var(--ease-decelerate) 220ms both;
}

body.team-ready .apply-section {
    animation: teamPanelIn 680ms var(--ease-decelerate) 360ms both;
}

.team-hero {
    max-width: 900px;
    margin: 0 auto 34px;
    text-align: center;
}

.team-title,
.team-section-title {
    margin: 0;
    color: var(--team-gold);
    font-family: 'Baby Doll', cursive, sans-serif;
    font-weight: 400;
    line-height: 0.96;
    text-shadow: 0 0 18px rgba(255, 215, 0, 0.64), 0 10px 34px rgba(0, 0, 0, 0.48);
}

.team-title {
    font-size: clamp(2.7rem, 7vw, 5rem);
}

.team-section-title {
    font-size: clamp(2rem, 5vw, 3.2rem);
    text-align: center;
}

.team-panel {
    position: relative;
    overflow: visible;
}

.team-panel {
    padding: 0;
    margin-bottom: 1.7rem;
}

.apply-section {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 12px;
    background: rgba(18, 18, 18, 0.7);
    backdrop-filter: blur(8px);
    box-shadow: none;
    width: min(820px, 100%);
    margin: 3.2rem auto 0;
    padding: clamp(1.8rem, 4vw, 2.8rem) clamp(1rem, 4vw, 2.4rem);
    text-align: center;
}

.apply-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 18%;
    right: 18%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.24), transparent);
}

.apply-section .team-section-title {
    text-shadow: none;
}

.team-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.65rem;
    margin-bottom: 1.45rem;
}

.filter-btn,
.action-btn,
.apply-button,
.form-submit {
    min-height: 44px;
    border: 1px solid rgba(255, 215, 0, 0.28);
    border-radius: 999px;
    color: var(--team-gold);
    background: rgba(255, 215, 0, 0.07);
    font: inherit;
    cursor: pointer;
    text-decoration: none;
    transition:
        transform var(--motion-normal) var(--ease-standard),
        border-color var(--motion-normal) var(--ease-standard),
        background var(--motion-normal) var(--ease-standard),
        color var(--motion-fast) var(--ease-standard),
        box-shadow var(--motion-normal) var(--ease-standard);
    touch-action: manipulation;
}

.filter-btn,
.action-btn,
.apply-button,
.form-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.74rem 1.05rem;
}

.filter-btn:hover,
.action-btn:hover,
.apply-button:hover,
.form-submit:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 215, 0, 0.42);
    background: rgba(255, 215, 0, 0.14);
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22), 0 0 14px rgba(255, 215, 0, 0.16);
}

.filter-btn.active {
    border-color: rgba(255, 215, 0, 0.62);
    color: #121212;
    background: linear-gradient(135deg, var(--team-gold), var(--team-gold-dark));
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.28);
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
    gap: 1rem;
}

.team-member {
    position: relative;
    overflow: hidden;
    cursor: default;
    border: 1px solid rgba(255, 215, 0, 0.16);
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)),
        rgba(10, 10, 10, 0.48);
    transition:
        opacity var(--motion-normal) var(--ease-standard),
        transform var(--motion-normal) var(--ease-standard),
        border-color var(--motion-normal) var(--ease-standard),
        box-shadow var(--motion-normal) var(--ease-standard);
}

.team-member:hover {
    transform: none;
    border-color: rgba(255, 215, 0, 0.16);
    box-shadow: none;
}

.team-member.is-hidden {
    display: none;
}

.member-image {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-bottom: 1px solid rgba(255, 215, 0, 0.18);
    background: #050505;
}

.member-info {
    padding: 1rem;
}

.member-name {
    margin: 0 0 0.7rem;
    color: var(--team-gold);
    font-family: 'Baby Doll', cursive, sans-serif;
    font-size: 1.6rem;
    font-weight: 400;
    line-height: 1;
}

.member-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    min-height: 34px;
}

.member-description {
    margin-top: 0.95rem;
    padding: 0.72rem 0.8rem;
    border-left: 2px solid rgba(255, 215, 0, 0.34);
    border-radius: 0 8px 8px 0;
    background: rgba(255, 215, 0, 0.045);
}

.member-bio {
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.92rem;
    line-height: 1.45;
}

.role-tag {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0.3rem 0.72rem;
    border: 1px solid rgba(255, 215, 0, 0.22);
    border-radius: 999px;
    color: var(--team-gold);
    background: rgba(255, 215, 0, 0.08);
    font-size: 0.84rem;
}

.member-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    margin-top: 1rem;
}

.action-btn {
    border-radius: 8px;
    padding-inline: 0.7rem;
}

.apply-section {
    padding: clamp(1.5rem, 4vw, 2.6rem);
    text-align: center;
}

.apply-text {
    max-width: 680px;
    margin: 1rem auto 1.45rem;
    color: var(--team-muted);
    font-size: clamp(1rem, 2vw, 1.12rem);
    line-height: 1.58;
}

.apply-button,
.form-submit {
    border-color: rgba(255, 215, 0, 0.56);
    color: #121212;
    background: linear-gradient(135deg, var(--team-gold), var(--team-gold-dark));
}

.team-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: #090909;
    isolation: isolate;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--motion-normal) var(--ease-standard);
}

/* The shared shell positions direct body children for stacking; the hidden modal must stay out of document flow. */
body.team-page > .team-modal {
    position: fixed;
}

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

.modal-content {
    position: relative;
    width: min(800px, 100%);
    max-height: min(88vh, 760px);
    overflow: auto;
    padding: clamp(1.2rem, 3vw, 2rem);
    border: 1px solid rgba(255, 215, 0, 0.36);
    border-radius: 12px;
    background: linear-gradient(180deg, #211f12 0%, #151515 22%, #121212 100%);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.54), 0 0 24px rgba(255, 215, 0, 0.12);
    transform: translateY(16px) scale(0.98);
    transition: transform var(--motion-normal) var(--ease-decelerate);
}

.team-modal.active .modal-content {
    transform: translateY(0) scale(1);
}

.close-modal {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255, 215, 0, 0.28);
    border-radius: 50%;
    color: var(--team-gold);
    background: rgba(255, 215, 0, 0.08);
    cursor: pointer;
    font-size: 1.7rem;
    line-height: 1;
}

.form-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1.3rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--team-gold);
    font-family: 'Baby Doll', cursive, sans-serif;
    font-size: 1.16rem;
}

.form-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.8rem;
    border: 1px solid rgba(255, 215, 0, 0.26);
    border-radius: 8px;
    color: #ffffff;
    background: #222222;
    font: inherit;
    transition:
        border-color var(--motion-normal) var(--ease-standard),
        box-shadow var(--motion-normal) var(--ease-standard),
        background var(--motion-normal) var(--ease-standard);
}

.form-input:focus {
    outline: none;
    border-color: var(--team-gold);
    background: #292929;
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.13);
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.42);
}

textarea.form-input {
    resize: vertical;
    min-height: 120px;
}

.form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.2rem;
}

.form-submit[disabled] {
    cursor: wait;
    opacity: 0.74;
}

.form-note {
    margin: 0;
    color: rgba(204, 204, 204, 0.82);
}

@keyframes teamRise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes teamPanelIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.998);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 760px) {
    .team-shell {
        width: min(100% - 24px, 1180px);
        padding-top: 108px;
    }

    .team-grid,
    .form-columns {
        grid-template-columns: 1fr;
    }

    .team-filters,
    .form-footer {
        display: grid;
        grid-template-columns: 1fr;
    }

    .filter-btn,
    .apply-button,
    .form-submit {
        width: 100%;
    }

    .member-actions {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .team-title,
    .team-panel,
    .apply-section {
        opacity: 1;
        transform: none;
        animation: none !important;
    }
}
