/* ==========================================================================
   --- css/pages/team-media.css (Responsive Roster & Viewport Adjustments) ---
   ========================================================================== */

/* --- GLOBAL MOBILE VIEWPORT & FIXED CANVAS STABILITY --- */
@media (max-width: 1200px) {
    /* Lock canvas viewport wrapper permanently so mobile URL bar collapse never shifts background */
    .canvas-viewport-wrapper {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100% !important;
        height: -webkit-fill-available !important;
        height: 100dvh !important;
        -webkit-transform: translateZ(0) !important;
        transform: translateZ(0) !important;
        will-change: transform !important;
        pointer-events: none !important;
        overflow: hidden !important;
    }

    #dot-globe-canvas {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        -webkit-transform: translateZ(0) !important;
        transform: translateZ(0) !important;
    }
}

/* --- TABLET & MEDIUM DESKTOPS (1200px to 769px) --- */
@media (max-width: 1200px) {
    .fixed-nav {
        padding: 1.5rem 2rem;
        gap: 1.5rem;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }

    /* Prevent Language Selector from colliding over the Logo */
    .brand-lockup {
        display: flex;
        align-items: center;
        gap: 1rem;
        flex-shrink: 0;
    }

    /* Position Relative Anchor: Guarantees the CSS chevron arrow stays locked inside the box */
    .lang-selector-box {
        position: relative !important;
        display: inline-flex !important;
        align-items: center !important;
        margin-left: 0.25rem !important;
        margin-right: 4rem !important;
    }

    /* Universal Horizontal Scroll Container for Navigation */
    .nav-links {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        align-items: center !important;
        gap: 1.75rem !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scroll-behavior: smooth !important;
        -webkit-overflow-scrolling: touch !important;
        white-space: nowrap !important;
        padding-right: 3.5rem !important;
        padding-bottom: 0.25rem !important;
        max-width: calc(100vw - 280px);

        /* Hide scrollbars */
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;

        /* Smooth Right-Side Fade Gradient Mask */
        -webkit-mask-image: linear-gradient(to right, #000 0%, #000 80%, transparent 100%) !important;
        mask-image: linear-gradient(to right, #000 0%, #000 80%, transparent 100%) !important;
    }

    .nav-links::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }

    /* Prevent any link text from stacking vertically */
    .nav-links a {
        flex: 0 0 auto !important;
        white-space: nowrap !important;
        font-size: 0.75rem !important;
        letter-spacing: 0.15em !important;
    }

    .bio-grid-matrix {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }

    #collaborators-grid-stage {
        padding: 6rem 2.5rem;
    }

    .stage-header-lockup {
        margin-right: 15vw;
    }
}

/* --- MOBILE LANDSCAPE & SMALL TABLETS (768px and below) --- */
@media (max-width: 768px) {
    .fixed-nav {
        padding: 1.25rem 1.5rem 1rem 1.5rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.85rem;
        width: 100%;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }

    .fixed-nav.scrolled {
        padding: 1rem 1.5rem 0.85rem 1.5rem;
    }

    .brand-lockup {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .lang-selector-box {
        position: relative !important;
        display: inline-flex !important;
        align-items: center !important;
        margin-left: 0.25rem !important;
        margin-right: 0.25rem !important;
    }

    .nav-links {
        width: 100% !important;
        max-width: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        align-items: center !important;
        gap: 1.5rem !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scroll-behavior: smooth !important;
        -webkit-overflow-scrolling: touch !important;
        white-space: nowrap !important;
        padding-right: 2.5rem !important;
        padding-bottom: 0.35rem !important;

        scrollbar-width: none !important;
        -ms-overflow-style: none !important;

        -webkit-mask-image: linear-gradient(to right, #000 0%, #000 75%, transparent 100%) !important;
        mask-image: linear-gradient(to right, #000 0%, #000 75%, transparent 100%) !important;
    }

    .nav-links::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }

    .nav-links a {
        flex: 0 0 auto !important;
        font-size: 0.72rem !important;
        letter-spacing: 0.15em !important;
        white-space: nowrap !important;
    }

    #globe-projection-stage {
        padding: 7.5rem 1.5rem 2.5rem 1.5rem;
        justify-content: flex-end;
        height: 100dvh;
        min-height: 100dvh;
    }

    .stage-header-lockup {
        margin-top: 0;
        margin-right: 0;
        margin-bottom: 2rem;
        text-align: right;
        padding: 0 1rem;
        width: 100%;
    }

    .matrix-status-trace {
        margin-right: 0;
        text-align: right;
        display: block;
        font-size: 0.62rem;
        margin-bottom: 0.5rem;
    }

    .stage-header-lockup h1 {
        font-size: 1.65rem;
        letter-spacing: 0.14em;
        line-height: 1.35;
    }

    .bio-grid-matrix {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* --- MOBILE PORTRAIT (480px and below) --- */
@media (max-width: 480px) {
    .fixed-nav {
        padding: 1rem 1.25rem 0.75rem 1.25rem;
        gap: 0.7rem;
    }

    .logo {
        font-size: 1.35rem;
        letter-spacing: 0.25em;
    }

    .lang-selector-box {
        position: relative !important;
        display: inline-flex !important;
        align-items: center !important;
        margin-left: 0.25rem !important;
        margin-right: 4rem !important;
    }

    .nav-links {
        gap: 1.25rem !important;
        padding-right: 2rem !important;
        -webkit-mask-image: linear-gradient(to right, #000 0%, #000 72%, transparent 100%) !important;
        mask-image: linear-gradient(to right, #000 0%, #000 72%, transparent 100%) !important;
    }

    .nav-links a {
        font-size: 0.68rem !important;
    }

    #globe-projection-stage {
        padding: 6.5rem 1rem 2rem 1rem;
        height: 100dvh;
        min-height: 100dvh;
    }

    .stage-header-lockup h1 {
        font-size: 1.4rem;
        letter-spacing: 0.12em;
        line-height: 1.3;
    }

    #collaborators-grid-stage {
        padding: 4.5rem 1rem;
    }

    .workspace-section-title {
        font-size: 1.2rem;
        letter-spacing: 0.1em;
        margin-bottom: 2rem;
        text-align: center;
    }

    .card-front, .card-back {
        padding: 1.5rem;
        gap: 1.25rem;
    }

    .card-meta-lockup h3,
    .card-name {
        font-size: 1.15rem;
    }

    .card-description {
        font-size: 0.8rem;
        line-height: 1.5;
    }

    .back-bio-text {
        font-size: 0.75rem;
        margin-bottom: 1.25rem;
        padding: 0;
    }

    .social-link-btn {
        padding: 0.65rem 0.85rem;
    }

    .social-icon {
        font-size: 1rem;
        width: 24px;
        margin-right: 0.5rem;
    }

    .social-name {
        font-size: 0.75rem;
    }
    
    .bio-node-card {
        min-height: 420px;
    }
}

/* --- HIGH-DPI & SHORT LANDSCAPE SCREENS --- */
@media (max-height: 700px) and (orientation: landscape) {
    .fixed-nav {
        padding: 0.75rem 1.5rem;
    }

    #globe-projection-stage {
        padding-top: 5.5rem;
        height: 100dvh;
        min-height: 100dvh;
    }

    .stage-header-lockup {
        margin-bottom: 1rem;
    }

    .stage-header-lockup h1 {
        font-size: 1.35rem;
    }
}