/* Reset & Base */
:root {
    --bg-color: #ffffff;
    /* White BG */
    --text-primary: #000000;
    /* Black Text */
    --text-secondary: rgba(0, 0, 0, 0.6);
    --glass-bg: rgba(240, 240, 240, 0.85);
    /* Light glass */
    --glass-border: rgba(0, 0, 0, 0.1);
    --accent-glow: rgba(0, 0, 0, 0.1);
    --transition-speed: 0.6s;
    --font-heading: "Helvetica Neue", "Helvetica", "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-body: "Helvetica Neue", "Helvetica", "PingFang SC", sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-weight: 300;
    /* Was 100 */
    overflow: hidden;
    /* Prevent scrolling on main page */
    height: 100vh;
    width: 100vw;
    -webkit-font-smoothing: antialiased;
}

/* Canvas Background */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    /* Let clicks pass through */
}

/* Core Container (Centered Content) */
.core-container {
    position: relative;
    z-index: 10;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* Move up from center */
    padding-top: 15vh;
    /* Fixed offset from top */
    align-items: center;
    text-align: center;
    pointer-events: none;
    /* Allow interaction with canvas if needed, but here mostly for layout */
}

.core-container>* {
    pointer-events: auto;
    /* Re-enable clicks on text/buttons */
}

/* Typography */
.brand-title {
    font-size: 2.2rem;
    letter-spacing: 0.25em;
    font-weight: 300;
    /* Reduced from 800 to 300 (Light) */
    margin-bottom: 0.5rem;
    text-shadow: none;
    /* Remove glow in light mode for sharpness */
}

.brand-subtitle {
    font-size: 1rem;
    /* Was 0.8rem */
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    margin-bottom: 4rem;
    font-weight: 400;
    /* Was 300 */
}

.slogan-container {
    margin-bottom: 3rem;
    /* Reduced from 5rem to pull cards up */
    animation: fadeIn 2s ease-out;
}

.slogan-cn {
    font-size: 3.8rem;
    /* Increased from 2.8rem */
    letter-spacing: 0.4em;
    /* Slightly tighter spacing for large text */
    font-weight: 900;
    /* Extra Bold */
    margin-bottom: 1rem;
    color: #2b7de0;
    /* Revert to solid blue */
    /* Remove 3D shadows */
    text-shadow: none;
    transform: none;
}

.slogan-en {
    font-size: 1.1rem;
    /* Was 0.9rem */
    letter-spacing: 0.35em;
    color: var(--text-secondary);
    font-weight: 400;
    /* Was 200 */
    text-transform: uppercase;
}

/* Navigation & Buttons */
.gateway-nav {
    display: flex;
    gap: 3rem;
    margin-top: 1rem;
    /* Reduced from 4rem */
}

.ghost-btn {
    background: rgba(255, 255, 255, 0.9);
    /* Card Background */
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
    width: 220px;
    /* Fixed width for card look */
    height: 140px;
    /* Taller */
    padding: 0;
    /* Centered with flex */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    font-family: var(--font-body);
    font-size: 1.2rem;
    /* Larger text */
    font-weight: 600;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    backdrop-filter: blur(10px);
    text-decoration: none;
    border-radius: 12px;
    /* Rounded corners */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    /* Subtle shadow */
}

.ghost-btn:hover {
    background: #ffffff;
    border-color: #dba632;
    /* Dark Orange */
    /* Text color remains unchanged */
    transform: translateY(-10px);
    /* Lift up more */
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Footer */
.main-footer {
    position: fixed;
    bottom: 2rem;
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 10;
    color: rgba(0, 0, 0, 0.6);
    /* Dark grey footer */
    font-size: 0.9rem;
    /* Was 0.7rem */
    letter-spacing: 0.15em;
    font-weight: 400;
}

.footer-sub {
    font-size: 0.75rem;
    /* Was 0.6rem */
    margin-top: 0.5rem;
    opacity: 0.8;
    /* Was 0.6 */
    font-weight: 300;
}

/* Slide-in Panels */
/* Slide-in Panels -> Full Page Overlay */
.slide-panel {
    position: fixed;
    top: 0;
    right: -100vw;
    /* Hidden completely right */
    width: 100vw;
    /* Full Screen */
    height: 100vh;
    background: #ffffff;
    /* Solid white for focus (was glass) */
    z-index: 100;
    transition: right var(--transition-speed) cubic-bezier(0.16, 1, 0.3, 1);
    /* Ease out quart */
    padding: 6rem 0;
    /* Vertical padding only, horiz handled by container */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow-y: auto;
    /* Allow global panel scroll */
}

/* Elegant Scrollbar within Panel */
.slide-panel::-webkit-scrollbar {
    width: 6px;
}

.slide-panel::-webkit-scrollbar-track {
    background: transparent;
}

.slide-panel::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.slide-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.4);
}

.slide-panel.active {
    right: 0;
}

/* Layer 3: Detail Panel (Page on top of Page) */
.detail-layer {
    z-index: 200;
    background: #ffffff;
    width: 100vw;
    /* Full Screen */
    right: -100vw;
}

.detail-layer.active {
    right: 0;
}

/* Content Container for Readability */
.panel-content {
    width: 100%;
    max-width: 1200px;
    /* Max readable width */
    margin: 0 auto;
    /* Center horizontally */
    padding: 0 4rem;
    /* Inner spacing */
}

/* Close Button Position Constraint */
.close-btn {
    position: fixed;
    /* Stick to screen */
    top: 2rem;
    right: 4rem;
    z-index: 150;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.close-btn:hover {
    opacity: 1;
}

.back-btn {
    position: absolute;
    top: 2rem;
    left: 4rem;
    /* Left aligned for back */
    right: auto;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    opacity: 0.6;
    transition: all 0.3s;
    cursor: pointer;
}

.back-btn:hover {
    opacity: 1;
    border-color: #000;
}

/* Clickable Cards */
.clickable {
    cursor: pointer;
    transition: transform 0.3s ease, border-color 0.3s ease;
    border-left: 2px solid transparent;
    padding-left: 0;
}

.clickable:hover {
    transform: translateX(10px);
    border-left: 2px solid #2b7de0;
    /* Match Slogan Blue */
    padding-left: 1rem;
}



/* --- Detail View Tabs --- */
.detail-tabs {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
}

.tab-btn {
    padding: 0.5rem 1rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    color: #888;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: #000;
}

.tab-btn.active {
    color: #444;
    border-bottom: 2px solid #000;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.tab-pane.active {
    display: block;
}

.tab-list-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 1rem;
    color: #555;
    line-height: 1.6;
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {

    /* Tablet / Smaller Laptops */
    .brand-title {
        font-size: 1.8rem;
    }

    .slogan-cn {
        font-size: 3rem;
    }

    .gateway-nav {
        gap: 1.5rem;
    }

    .ghost-btn {
        width: 180px;
        height: 120px;
        font-size: 1rem;
    }

    /* Panel Navigation - Tablet */
    .panel-nav {
        padding: 1rem 3rem;
    }

    .nav-brand {
        font-size: 1.1rem;
    }

    .nav-links {
        gap: 1.5rem;
    }

    .nav-item {
        font-size: 0.8rem;
    }

    .panel-content {
        padding: 3.5rem 3rem;
    }
}

@media (max-width: 768px) {

    /* Mobile Landscape / Small Tablets */
    .core-container {
        padding-top: 10vh;
        height: auto;
        min-height: 100vh;
        padding-bottom: 8rem;
        /* Increased space for footer and last button */
        overflow-y: auto;
        /* Allow scrolling on small screens if needed */
    }

    .brand-title {
        font-size: 1.5rem;
        margin-top: 2rem;
    }

    .slogan-cn {
        font-size: 2rem;
        letter-spacing: 0.2em;
        /* Reduce spacing to fit */
        line-height: 1.2;
        margin: 0 1rem 1rem 1rem;
    }

    .slogan-container {
        margin-bottom: 2rem;
    }

    /* Stack buttons vertically */
    .gateway-nav {
        flex-direction: column;
        gap: 1.5rem;
        margin-top: 0;
        width: 100%;
        align-items: center;
    }

    .ghost-btn {
        width: 80%;
        /* Full width cards */
        max-width: 320px;
        height: 80px;
        /* Shorter cards */
        font-size: 1.1rem;
    }

    /* Adjust Footer */
    .main-footer {
        position: relative;
        /* Release from fixed */
        margin-top: 3rem;
        bottom: auto;
        padding-bottom: 2rem;
    }

    /* Slide Panel covers full screen */
    .slide-panel {
        width: 100%;
        right: -100%;
        padding: 2rem;
    }

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

    /* Panel Navigation - Responsive */
    .panel-nav {
        padding: 1rem 2rem;
        flex-wrap: wrap;
    }

    .nav-brand {
        font-size: 1rem;
    }

    .nav-links {
        gap: 1rem;
        font-size: 0.8rem;
    }

    .nav-item {
        font-size: 0.75rem;
    }

    .close-icon {
        font-size: 1.5rem;
        margin-left: 1rem;
    }

    .back-btn {
        left: 2rem;
        font-size: 0.85rem;
    }
}


/* Smart Navigation within Panels */
.panel-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 4rem;
    /* Reduced vertical padding (was 1.5rem) */
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 500;
    /* Ensure it stays on top of any content */
    background: #ffffff;
    /* Ensure opaque */
}

/* ... existing styles ... */

.slide-panel {
    /* ... existing props ... */
    padding: 0;
    /* Remove padding from container, let nav and content handle it */
    /* ... */
}

/* Content Container */
.panel-content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 4rem;
    /* Specific padding for content: Top 4rem acts as spacer from nav */
}

.nav-brand {
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: 0.1em;
    color: #000;
    cursor: pointer;
}

.back-action {
    color: #dba632;
    /* Orange to indicate action */
    transition: transform 0.3s;
}

.back-action:hover {
    transform: translateX(-5px);
    /* Slide left hint */
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-item {
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s;
}

.nav-item:hover,
.nav-brand:hover {
    color: #000;
}

.nav-item.active {
    color: #dba632 !important;
    /* Force override */
    font-weight: 700;
    border-bottom: 2px solid #dba632;
    padding-bottom: 4px;
}

.close-icon {
    font-size: 1.8rem;
    font-weight: 300;
    line-height: 1;
    margin-left: 2rem;
    cursor: pointer;
}

/* Hide old close buttons if any remain */
.close-btn {
    display: none;
}

.panel-content h2 {
    font-size: 2rem;
    letter-spacing: 0.2em;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-label {
    font-size: 1.2rem;
    /* Smaller than main H2 */
    font-weight: 400;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.05);
    /* Subtle pill bg */
    padding: 2px 10px;
    border-radius: 4px;
    vertical-align: middle;
}

.panel-subtitle {
    color: var(--text-secondary);
    margin-bottom: 3rem;
    font-style: italic;
    font-family: serif;
    /* Contrast font */
}

/* Panel Content Text */
.panel-content p {
    font-size: 1rem;
    line-height: 1.8;
    /* Increased line spacing */
    margin-bottom: 2rem;
    /* More breathing room */
    color: var(--text-secondary);
}

/* Rich Project Card Styling */
.rich-card {
    padding: 2.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    padding-left: 1.5rem;
    /* Indent for hover bar */
}

.proj-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.proj-category {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #dba632;
    /* Highlight Category */
    text-transform: uppercase;
}

.proj-badge {
    background: #dba632;
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    margin-left: 0.5rem;
    letter-spacing: 0.05em;
    transform: translateY(-1px);
    display: inline-block;
}

.proj-code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: monospace;
    color: var(--text-secondary);
}

.proj-title-cn {
    font-size: 1.4rem;
    font-weight: 600;
    color: #000;
    margin-bottom: 0.3rem;
    line-height: 1.4;
}

.proj-title-en {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
    font-style: italic;
}

.proj-separator {
    height: 1px;
    width: 40px;
    background: #dba632;
    /* Orange accent line */
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* --- Network Panel Styles --- */
.network-section h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 2rem;
    letter-spacing: 0.1em;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 1rem;
}

.lab-intro p {
    font-size: 1.1rem;
    line-height: 1.8;
    max-width: 800px;
    margin-bottom: 1rem;
}

.intro-cn {
    font-weight: 400;
    color: #000;
}

.intro-en {
    font-weight: 300;
    font-family: serif;
    font-style: italic;
    color: var(--text-secondary);
}

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

.expert-card {
    padding: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    background: #fafafa;
    transition: transform 0.3s;
}

.expert-card:hover {
    transform: translateY(-5px);
    background: #fff;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.expert-name {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.expert-title {
    font-size: 0.9rem;
    color: #dba632;
    font-weight: 600;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.expert-affil {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.partner-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.partner-chip {
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--text-primary);
    border: 1px solid transparent;
}


.proj-focus {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.proj-focus strong {
    color: var(--text-primary);
    font-weight: 600;
}


/* Lists and Content in Panel */
.link-list {
    list-style: none;
}

.link-list li {
    margin-bottom: 1.5rem;
}

.link-list a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 300;
    border-bottom: 1px solid transparent;
    transition: all 0.3s;
}

.link-list a:hover {
    border-bottom-color: var(--text-primary);
    padding-left: 10px;
}

/* Utility Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Overlay Mask for when panel is open */
.overlay-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-speed);
}

.overlay-mask.active {
    opacity: 1;
    pointer-events: auto;
}

/* === Enhanced Responsive Design === */

/* Small Mobile Devices (Portrait) */
@media (max-width: 480px) {
    .brand-title {
        font-size: 1.2rem;
        letter-spacing: 0.15em;
    }

    .slogan-cn {
        font-size: 1.5rem;
        letter-spacing: 0.1em;
        margin: 0 0.5rem 0.5rem 0.5rem;
    }

    .slogan-en {
        font-size: 0.8rem;
        letter-spacing: 0.2em;
    }

    .core-container {
        padding-bottom: 10rem;
        /* Extra space for small screens to prevent cutoff */
    }

    .gateway-nav {
        margin-bottom: 3rem;
        /* Additional spacing before footer */
    }

    body {
        overflow-y: auto;
        /* Allow scrolling on small screens */
        height: auto;
        min-height: 100vh;
    }

    .ghost-btn {
        width: 90%;
        height: 70px;
        font-size: 1rem;
    }

    .panel-content {
        padding: 2rem 1.5rem;
    }

    .panel-nav {
        padding: 1rem 1.5rem;
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .nav-links {
        gap: 1rem;
        flex-wrap: wrap;
    }

    .close-icon {
        margin-left: 0;
        position: absolute;
        top: 1rem;
        right: 1.5rem;
    }

    .rich-card {
        padding: 1.5rem 1rem;
    }

    .proj-title-cn {
        font-size: 1.2rem;
    }

    .proj-title-en {
        font-size: 0.9rem;
    }

    .partner-chip {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }

    .back-btn {
        left: 1.5rem;
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}

/* Medium Tablets (Portrait) */
@media (min-width: 481px) and (max-width: 768px) {
    .panel-content {
        padding: 3rem 2rem;
    }

    .panel-nav {
        padding: 1rem 2rem;
    }

    .rich-card {
        padding: 2rem 1.5rem;
    }
}

/* Large Tablets and Small Laptops */
@media (min-width: 769px) and (max-width: 1024px) {
    .panel-content {
        padding: 3.5rem 3rem;
    }

    .panel-nav {
        padding: 1rem 3rem;
    }
}

/* Very Large Screens */
@media (min-width: 1920px) {
    .panel-content {
        max-width: 1600px;
    }

    .brand-title {
        font-size: 2.8rem;
    }

    .slogan-cn {
        font-size: 4.5rem;
    }

    .ghost-btn {
        width: 260px;
        height: 160px;
        font-size: 1.3rem;
    }
}

/* Landscape Mobile Devices */
@media (max-height: 500px) and (orientation: landscape) {
    .core-container {
        padding-top: 5vh;
    }

    .slogan-cn {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }

    .slogan-container {
        margin-bottom: 1rem;
    }

    .gateway-nav {
        flex-direction: row;
        gap: 1rem;
    }

    .ghost-btn {
        width: 150px;
        height: 60px;
        font-size: 0.9rem;
    }

    .main-footer {
        position: relative;
        margin-top: 2rem;
    }
}

/* Print Styles */
@media print {

    .overlay-mask,
    .close-btn,
    .back-btn,
    .panel-nav,
    #bg-canvas {
        display: none !important;
    }

    .slide-panel {
        position: static;
        width: 100%;
        height: auto;
    }

    .panel-content {
        padding: 0;
        max-width: 100%;
    }
}

/* === Hamburger Menu === */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
}

.hamburger-menu span {
    width: 100%;
    height: 3px;
    background-color: #000;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Navigation Dropdown */
@media (max-width: 768px) {
    .hamburger-menu {
        display: flex;
        margin-left: auto;
    }

    .panel-nav {
        position: relative;
    }

    .nav-links {
        position: absolute;
        top: 100%;
        right: 0;
        background: #ffffff;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        border-radius: 0 0 8px 8px;
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
        gap: 0.8rem;
        min-width: 200px;
        display: none;
        z-index: 1000;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-item {
        width: 100%;
        padding: 0.5rem 1rem;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .nav-item:last-child {
        border-bottom: none;
    }

    .close-icon {
        position: static;
        margin-left: 0;
        text-align: right;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        margin-top: 0.5rem;
    }
}

@media (max-width: 480px) {
    .hamburger-menu {
        width: 26px;
        height: 20px;
    }

    .hamburger-menu span {
        height: 2px;
    }

    .nav-links {
        min-width: 180px;
        padding: 0.8rem;
    }

    .nav-item {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }
}

/* =========================================
   🚀 AGENTIC DESIGN UPGRADE: PREMIUM MOBILE EXPERIENCE
   ========================================= */

/* 1. Safe Area Adaptation (The Professional Way) */
:root {
    --sat: env(safe-area-inset-top);
    --sab: env(safe-area-inset-bottom);
    --sal: env(safe-area-inset-left);
    --sar: env(safe-area-inset-right);
}

/* Ensure body respects safe areas natively */
body {
    padding-left: var(--sal);
    padding-right: var(--sar);
}

/* 2. Premium Touch Feedback (Mobile Interactions) */
@media (hover: none) {

    .ghost-btn:active,
    .expert-card:active,
    .project-card:active,
    .nav-item:active,
    .clickable:active {
        transform: scale(0.98);
        background-color: rgba(0, 0, 0, 0.02);
        transition: transform 0.1s;
    }
}

/* 3. Immersive Fullscreen Mobile Menu (Replacing the Dropdown) */
@media (max-width: 768px) {

    /* Menu Button Styling (Refined) */
    .hamburger-menu {
        z-index: 2000;
        /* Ensure above absolutely everything */
        position: relative;
        width: 40px;
        height: 40px;
        display: flex;
        justify-content: center;
        align-items: center;
        margin-right: -10px;
        /* Optical alignment */
    }

    .hamburger-menu span {
        position: absolute;
        height: 2px;
        width: 24px;
        background-color: #000;
        transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    }

    .hamburger-menu span:nth-child(1) {
        transform: translateY(-7px);
    }

    .hamburger-menu span:nth-child(2) {
        opacity: 1;
    }

    .hamburger-menu span:nth-child(3) {
        transform: translateY(7px);
    }

    /* Active State (X Icon) */
    .hamburger-menu.active span:nth-child(1) {
        transform: rotate(45deg);
        background-color: #000;
    }

    .hamburger-menu.active span:nth-child(2) {
        opacity: 0;
        transform: translateX(10px);
    }

    .hamburger-menu.active span:nth-child(3) {
        transform: rotate(-45deg);
        background-color: #000;
    }

    /* The Fullscreen Overlay */
    .nav-links {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(255, 255, 255, 0.98);
        /* Slight transparency for glass feel */
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        z-index: 1500;

        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;

        opacity: 0;
        pointer-events: none;
        transform: scale(0.95);
        transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);

        /* Reset Box Model */
        box-shadow: none;
        border-radius: 0;
        padding-bottom: max(2rem, var(--sab));
        /* Safe Area aware */
    }

    .nav-links.active {
        opacity: 1;
        pointer-events: auto;
        transform: scale(1);
    }

    /* Staggered Menu Items */
    .nav-item {
        font-size: 1.6rem;
        /* Large, clickable text */
        font-weight: 300;
        letter-spacing: 0.15em;
        color: #000;
        text-transform: uppercase;
        margin: 1.5rem 0;
        width: auto;
        border-bottom: none;
        padding: 0;
        position: relative;
        opacity: 0;
        transform: translateY(20px);
        transition: opacity 0.4s ease, transform 0.4s ease;
    }

    /* Decoration for Menu Items */
    .nav-item::after {
        content: '';
        display: block;
        width: 0;
        height: 2px;
        background: #dba632;
        margin: 8px auto 0;
        transition: width 0.3s ease;
    }

    .nav-item.active::after,
    .nav-item:active::after {
        width: 100%;
    }

    /* Staggered Animation Delay for Menu Items */
    .nav-links.active .nav-item:nth-child(1) {
        transition-delay: 0.1s;
        opacity: 1;
        transform: translateY(0);
    }

    .nav-links.active .nav-item:nth-child(2) {
        transition-delay: 0.15s;
        opacity: 1;
        transform: translateY(0);
    }

    .nav-links.active .nav-item:nth-child(3) {
        transition-delay: 0.2s;
        opacity: 1;
        transform: translateY(0);
    }

    .nav-links.active .nav-item:nth-child(4) {
        display: none;
    }

    /* Hide close icon in fullscreen menu, use toggle button */

    /* Add a brand mark inside the menu */
    .nav-links::before {
        content: 'HCPA LAB';
        font-size: 0.9rem;
        letter-spacing: 0.3em;
        font-weight: 800;
        color: rgba(0, 0, 0, 0.2);
        position: absolute;
        top: max(2rem, var(--sat));
        left: 50%;
        transform: translateX(-50%);
    }

    /* Copyright inside menu */
    .nav-links::after {
        content: '© 2026 Digital Humanities Lab';
        font-size: 0.7rem;
        color: rgba(0, 0, 0, 0.3);
        position: absolute;
        bottom: max(2rem, var(--sab));
        font-family: var(--font-body);
    }
}

/* 4. Refined Padding for Huawei/Android Edge-to-Edge */
@media (max-width: 768px) {
    .core-container {
        /* Use safe area + generous padding */
        padding-bottom: calc(6rem + var(--sab));
    }

    .main-footer {
        /* Ensure footer respects bottom safe area */
        padding-bottom: max(2rem, var(--sab));
    }
}

/* =========================================
   🛡️ AGENTIC SELF-CORRECTION: STABILITY & COMPATIBILITY
   ========================================= */

/* 1. Hide redundant close icon in fullscreen menu using class selector (Safer) */
@media (max-width: 768px) {
    .nav-links.active .close-icon {
        display: none !important;
    }
}

/* 2. Fix Grid Overflow on Small Screens (Expert & Project Cards) */
@media (max-width: 480px) {
    .expert-grid {
        /* On small screens, force 1 column, fit container */
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .expert-card {
        padding: 1.2rem;
        /* Save space */
    }

    .panel-content {
        /* Ensure no horizontal scroll caused by padding */
        padding-left: 1.5rem;
        padding-right: 1.5rem;
        width: 100%;
        box-sizing: border-box;
    }
}

/* 3. Text Justification Optimization for Bilingual Names */
.partner-chip {
    /* Stabilize height for mixed CJK/Latin */
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    line-height: 1.4;
}

/* 4. Disable User Select on UI Elements for App-like feel */
.nav-brand,
.nav-item,
.ghost-btn,
.tab-btn {
    -webkit-user-select: none;
    user-select: none;
}

/* =========================================
   🔧 AGENTIC REPAIR: INTERACTION & ADAPTABILITY
   ========================================= */

/* 1. Hamburger Menu Touch Target Fix */
.hamburger-menu {
    cursor: pointer;
    /* Increase touch target without changing visual size */
    padding: 10px;
    margin: -10px;
    /* Counteract padding */
    box-sizing: content-box;
}

/* Ensure nothing covers the button */
.panel-nav {
    position: sticky;
    top: 0;
    z-index: 500;
}

/* 2. Fluid Typography (Smart Scaling) */
/* Replace static pixel sizes with clamp() */
@media (max-width: 768px) {
    .brand-title {
        font-size: clamp(1.2rem, 4vw, 1.8rem);
    }

    .panel-content h2 {
        font-size: clamp(1.4rem, 5vw, 2rem);
    }

    .proj-title-cn {
        font-size: clamp(1.1rem, 4vw, 1.4rem);
    }
}

/* 3. Sub-Menu (Tabs) Adaptation: Horizontal Scroll Pattern */
/* This is cleaner than a 2nd hamburger menu on mobile */
@media (max-width: 768px) {
    .detail-tabs {
        display: flex;
        flex-wrap: nowrap;
        /* Prevent stacking/wrapping */
        overflow-x: auto;
        /* Enable horizontal scroll */
        -webkit-overflow-scrolling: touch;
        /* Smooth scroll on iOS */
        gap: 0;
        /* Let padding handle spacing */
        margin: 1.5rem -2rem;
        /* Bleed to edges */
        padding: 0 2rem;
        /* Content padding */
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);

        /* Hide Scrollbar */
        scrollbar-width: none;
        /* Firefox */
        -ms-overflow-style: none;
        /* IE */
    }

    .detail-tabs::-webkit-scrollbar {
        display: none;
        /* Chrome/Safari */
    }

    .tab-btn {
        flex: 0 0 auto;
        /* Don't shrink */
        padding: 0.8rem 1.2rem;
        font-size: 0.95rem;
        /* Readable text size */
        white-space: nowrap;
        /* Keep text on one line */
    }

    /* Visual Hint for Scroll */
    .detail-tabs::after {
        content: '';
        display: block;
        padding-right: 2rem;
        /* Spacer at end */
    }

    /* Adjust Detail Panel Content Spacing */
    .panel-content {
        padding-left: 2rem;
        padding-right: 2rem;
        overflow-x: hidden;
        /* Prevent page sway */
    }
}

/* 4. Enhanced Visual Cues for Scrollable Tabs */
@media (max-width: 768px) {
    .tab-btn {
        background: #f5f5f5;
        border-radius: 20px;
        margin-right: 8px;
        border-bottom: none;
        /* Remove desktop style */
        color: #666;
    }

    .tab-btn.active {
        background: #dba632;
        color: #fff;
        border-bottom: none;
        font-weight: 600;
    }
}

/* =========================================
   🌐 NETWORK SECTION TYPOGRAPHY & LAYOUT
   ========================================= */

.network-section {
    margin-top: 4rem;
}

.section-separator {
    margin: 4rem 0 0 0;
    width: 60px;
    background: #dba632;
    height: 2px;
    /* Ensure visibility */
}

/* Titles */
.network-section-title {
    font-size: clamp(1.6rem, 5vw, 2rem);
    /* Increased from 1.4-1.8 */
    margin-bottom: 0.8rem;
    color: #dba632;
    font-weight: 700;
}

.network-section-subtitle {
    font-style: italic;
    color: #999;
    margin-bottom: 2.5rem;
    font-size: clamp(1rem, 3vw, 1.1rem);
    /* Increased from 0.9 */
}

/* Expert Chips */
.expert-chip {
    font-size: clamp(1rem, 3.5vw, 1.1rem);
    /* Increased from 0.85-1.0 */
    padding: 0.7rem 1.2rem;
    background: #fafafa;
    display: inline-flex;
    align-items: baseline;
    gap: 0.6rem;
    line-height: 1.5;
}

.expert-en {
    color: #888;
    font-size: 0.9em;
    /* Slightly larger relative size */
    font-weight: 400;
}

/* Start Category Styles */
.network-category {
    margin-top: 3.5rem;
}

.network-category-title {
    font-size: clamp(1.3rem, 4.5vw, 1.6rem);
    /* Increased from 1.1-1.3 */
    margin-bottom: 0.8rem;
    color: var(--text-primary);
    border-left: 5px solid #dba632;
    padding-left: 15px;
    line-height: 1.3;
    font-weight: 600;
}

.network-category-subtitle {
    font-style: italic;
    color: #aaa;
    margin-bottom: 2rem;
    padding-left: 18px;
    font-size: 1rem;
    /* Increased from 0.9 */
}

.network-subcategory {
    margin-bottom: 2.5rem;
}

.network-subcategory-title {
    font-size: clamp(1.15rem, 4vw, 1.3rem);
    /* Increased from 1.0-1.1 */
    margin-bottom: 1.2rem;
    color: #dba632;
    padding-left: 18px;
    font-weight: 600;
}

/* Mobile Tweaks */
@media (max-width: 768px) {
    .network-section {
        margin-top: 2.5rem;
        /* Tighter spacing */
    }

    .section-separator {
        margin-top: 2.5rem;
    }

    .expert-chip {
        padding: 0.4rem 0.8rem;
        /* Compact padding */
        width: 100%;
        /* Full width cards on mobile for better readability */
        box-sizing: border-box;
        justify-content: space-between;
        /* Limit space between CN/EN */
        border-radius: 4px;
        /* Optional visual enhance */
    }

    .network-category-title {
        border-left-width: 3px;
    }
}

/* Network Intro Text */
.lab-intro p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.intro-cn {
    font-size: clamp(1rem, 3.5vw, 1.2rem);
    color: var(--text-primary);
    text-align: justify;
}

.intro-en {
    font-size: clamp(0.9rem, 3vw, 1rem);
    color: #666;
    text-align: justify;
}
/* Fix for iPhone/Android Safe Area at bottom of Panels */
@media (max-width: 768px) {
    .panel-content {
        /* Add significant bottom padding to clear Home Indicator */
        padding-bottom: calc(6rem + env(safe-area-inset-bottom));
    }
}
