:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #10b981;
    --unified-accent: #caecff;
    --dark: #0f172a;
    --light: #f8fafc;
    --gray: #64748b;
    --gray-light: #e2e8f0;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius: 12px;
    --glass: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --fade-duration: 0.42s;
    --fade-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --fade-shift: 10px;
    color-scheme: light dark;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
    background: #0b1325;
    overscroll-behavior-y: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.5) transparent;
}

@media (max-width: 900px) {
    html {
        scroll-padding-top: 60px;
    }
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    border-radius: 3px;
    background: rgba(99, 102, 241, 0.4);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.65);
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background: linear-gradient(135deg, #0b1325 0%, #1b2f50 100%);
    overflow-x: hidden;
    min-height: 100vh;
    min-height: 100dvh;
    overscroll-behavior-y: none;
    display: flex;
    flex-direction: column;
}

body.is-loading {
    overflow: hidden;
}

body.page-leaving {
    opacity: 0;
    transform: translateY(calc(var(--fade-shift) * -1));
    transition: opacity var(--fade-duration) var(--fade-ease), transform var(--fade-duration) var(--fade-ease);
}

.page-transition-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: #0b1325;
    animation: pageOverlayIn var(--fade-duration) var(--fade-ease) forwards;
    pointer-events: none;
}

@keyframes pageOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pageOverlayOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.container {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 clamp(1.2rem, 4vw, 2.5rem);
}

#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.navbar,
section,
.footer,
.fab-tools,
.page,
.wrap {
    position: relative;
    z-index: 1;
}

.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(11, 19, 37, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    padding: 1.5rem 0;
    padding-top: calc(1.5rem + env(safe-area-inset-top, 0px));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition), opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(-100%);
}

.navbar.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.navbar.navbar-leaving {
    opacity: 0;
    transition: opacity 0.18s ease;
}

.navbar.scrolled {
    padding: 1rem 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo i {
    font-size: 1.8rem;
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
    position: relative;
    padding: 0.5rem 0;
}

.nav-links a:hover {
    color: white;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

.nav-links a:hover::after {
    width: 100%;
}

.language-switch {
    display: flex;
    gap: 0.5rem;
    margin-left: 2rem;
}

.lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    font-family: inherit;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}

.lang-btn:hover,
.lang-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.lang-flag {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.38);
    isolation: isolate;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 600;
    transition: var(--transition);
    border: 2px solid transparent;
    cursor: pointer;
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.btn-outline {
    background: transparent;
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.glass-card {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 2rem;
    transition: var(--transition);
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.fab-tools {
    position: fixed;
    right: 20px;
    bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1003;
}

.fab-btn {
    position: relative;
    width: 46px;
    height: 46px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(14px) saturate(1.4);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    color: rgba(255, 255, 255, 0.85);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    overflow: visible;
    font-size: 1rem;
}

.fab-btn::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(89, 212, 255, 0.2), rgba(16, 185, 129, 0.25));
    opacity: 0;
    transition: opacity 0.35s ease;
    z-index: -1;
    filter: blur(6px);
}

.fab-btn:hover {
    border-color: rgba(99, 102, 241, 0.6);
    background: rgba(99, 102, 241, 0.55);
    color: #fff;
    transform: translateY(-3px) scale(1.06);
    box-shadow: 0 8px 28px rgba(99, 102, 241, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.fab-btn:hover::before {
    opacity: 1;
}

.fab-btn:active {
    transform: translateY(-1px) scale(0.97);
    transition-duration: 0.1s;
}

.fab-btn:focus {
    outline: none;
}

.fab-btn:focus:not(:focus-visible) {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.85);
    transform: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.fab-btn.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px) scale(0.85);
}

.fab-btn.is-spinning i {
    animation: fabSpin 0.6s ease-in-out;
}

@keyframes fabSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.fab-tooltip {
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    white-space: nowrap;
    padding: 5px 12px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.22s ease, transform 0.22s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.fab-btn:hover .fab-tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.fab-progress {
    position: absolute;
    inset: -3px;
    width: calc(100% + 6px);
    height: calc(100% + 6px);
    transform: rotate(-90deg);
    pointer-events: none;
}

.fab-progress-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 2;
}

.fab-progress-bar {
    fill: none;
    stroke: url(#fabGradient);
    stroke: rgba(99, 102, 241, 0.7);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 100.53;
    stroke-dashoffset: 100.53;
    transition: stroke-dashoffset 0.15s ease-out;
}

.fab-top:not(.is-hidden) .fab-progress-bar {
    stroke: rgba(99, 102, 241, 0.65);
}

.reveal-item {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0.6s;
    transition-delay: var(--reveal-delay, 0ms);
    will-change: transform, opacity;
}

.reveal-section.is-visible .reveal-item {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.reveal-section.is-revealed .reveal-item {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: none;
}

.social-card.reveal-item,
.project-card.reveal-item,
.glass-card.reveal-item,
.card.reveal-item,
.feature-card.reveal-item,
.hi-card.reveal-item,
.hi-overview-card.reveal-item,
.doc-card.reveal-item,
.thesis-card.reveal-item {
    transition: opacity 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0.6s, background 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition-delay: var(--reveal-delay, 0ms);
}

.reveal-section.is-revealed .social-card.reveal-item,
.reveal-section.is-revealed .project-card.reveal-item,
.reveal-section.is-revealed .glass-card.reveal-item,
.reveal-section.is-revealed .card.reveal-item,
.reveal-section.is-revealed .feature-card.reveal-item,
.reveal-section.is-revealed .hi-card.reveal-item,
.reveal-section.is-revealed .hi-overview-card.reveal-item,
.reveal-section.is-revealed .doc-card.reveal-item,
.reveal-section.is-revealed .thesis-card.reveal-item {
    opacity: 1;
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 通用卡片进入动画 */
.subpage-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    transition-delay: var(--subpage-delay, 0ms);
}

.subpage-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* 带有边框/背景的卡片组件需要保留hover过渡 */
.card.subpage-reveal,
.glass-card.subpage-reveal,
.feature-card.subpage-reveal,
.hi-card.subpage-reveal,
.hi-overview-card.subpage-reveal,
.doc-card.subpage-reveal,
.thesis-card.subpage-reveal,
.social-card.subpage-reveal,
.project-card.subpage-reveal,
.metric-card-small.subpage-reveal,
.metric-card.subpage-reveal,
.info-card.subpage-reveal,
.note-card.subpage-reveal,
.highlight-card.subpage-reveal,
.case-item.subpage-reveal,
.team-item.subpage-reveal {
    transition: opacity 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
                transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
                background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition-delay: var(--subpage-delay, 0ms);
}

.card.subpage-reveal.is-visible,
.glass-card.subpage-reveal.is-visible,
.feature-card.subpage-reveal.is-visible,
.hi-card.subpage-reveal.is-visible,
.hi-overview-card.subpage-reveal.is-visible,
.doc-card.subpage-reveal.is-visible,
.thesis-card.subpage-reveal.is-visible,
.social-card.subpage-reveal.is-visible,
.project-card.subpage-reveal.is-visible,
.metric-card-small.subpage-reveal.is-visible,
.metric-card.subpage-reveal.is-visible,
.info-card.subpage-reveal.is-visible,
.note-card.subpage-reveal.is-visible,
.highlight-card.subpage-reveal.is-visible,
.case-item.subpage-reveal.is-visible,
.team-item.subpage-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-seq .reveal-item:nth-child(1) { --reveal-delay: 80ms; }
.reveal-seq .reveal-item:nth-child(2) { --reveal-delay: 180ms; }
.reveal-seq .reveal-item:nth-child(3) { --reveal-delay: 280ms; }
.reveal-seq .reveal-item:nth-child(4) { --reveal-delay: 380ms; }
.reveal-seq .reveal-item:nth-child(5) { --reveal-delay: 480ms; }
.reveal-seq .reveal-item:nth-child(6) { --reveal-delay: 580ms; }
.reveal-seq .reveal-item:nth-child(7) { --reveal-delay: 680ms; }

.lang-fade-target {
    transition: opacity var(--fade-duration) var(--fade-ease), transform var(--fade-duration) var(--fade-ease);
    will-change: opacity, transform;
}

.lang-fade-target.is-leaving {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
}

.lang-fade-target.is-entering {
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
    transition: none;
}

.lang-fade-target.is-entering.is-arriving {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: opacity var(--fade-duration) var(--fade-ease), transform var(--fade-duration) var(--fade-ease);
}

.page-entrance {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: #0b1325;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.9s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.9s;
}

.page-entrance.is-done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

@media (max-width: 900px) {
    a,
    button {
        -webkit-tap-highlight-color: transparent;
    }

    .navbar {
        padding: 0.9rem 0;
    }

    .navbar.scrolled {
        padding: 0.72rem 0;
    }

    .nav-container {
        gap: 0.42rem;
        flex-wrap: nowrap;
    }

    .logo {
        font-size: 1rem;
        gap: 0.3rem;
        min-width: 0;
        flex-shrink: 1;
    }

    .logo i {
        font-size: 1.12rem;
    }

    .logo span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .nav-links {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(11, 19, 37, 0.95);
        backdrop-filter: blur(10px);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        z-index: 1001;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.35s ease;
        padding: 0 1rem;
    }

    .nav-links.mobile-open {
        max-height: 400px;
        opacity: 1;
        padding: 1.5rem 1rem;
    }

    .nav-links.mobile-open a {
        padding: 0.8rem 0;
    }

    .mobile-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 999;
    }

    .mobile-overlay.is-visible {
        display: block;
    }

    .mobile-menu-btn {
        display: block;
        margin-left: 0.3rem;
        font-size: 1.22rem;
        flex-shrink: 0;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .language-switch {
        margin-left: auto;
        margin-right: 0.08rem;
        gap: 0.22rem;
    }

    .lang-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 0.3rem;
        justify-content: center;
        border-radius: 999px;
    }

    .lang-btn span {
        display: none;
    }

    .lang-flag {
        width: 26px;
        height: 26px;
    }

    .fab-tools {
        right: 14px;
        bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    }

    .fab-btn {
        width: 46px;
        height: 46px;
        font-size: 0.92rem;
    }

    .fab-tooltip {
        display: none;
    }
}

@media (max-width: 480px) {
    .language-switch {
        gap: 0.25rem;
        margin-left: auto;
        margin-right: 0;
    }

    .lang-btn {
        min-width: 40px;
        min-height: 40px;
        padding: 0.2rem;
    }

    .lang-flag {
        width: 24px;
        height: 24px;
    }

    .fab-btn:active {
        transform: scale(0.92);
        background: rgba(99, 102, 241, 0.7);
        transition-duration: 0.08s;
    }

    .fab-btn.is-hidden {
        transform: translateY(12px) scale(0.85);
        opacity: 0;
        pointer-events: none;
    }

    .glass-card:active {
        transform: scale(0.98);
    }

    .btn:active {
        transform: scale(0.97);
    }
}

.footer {
    background: rgba(11, 19, 37, 0.95);
    color: white;
    padding: 1.8rem 0 1.1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    margin-top: auto;
}

.footer-content {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.2rem;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
}

.footer-logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 0.45rem;
}

.footer-description {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.75rem;
    max-width: 360px;
    font-size: 0.9rem;
}

.footer-social {
    display: flex;
    gap: 0.65rem;
}

.footer-social-link {
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: var(--transition);
}

.footer-social-link:hover {
    background: var(--primary);
    transform: translateY(-3px);
}

.footer-heading {
    font-size: 0.92rem;
    font-weight: 600;
    margin-bottom: 0.45rem;
    color: white;
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.footer-links li {
    margin-bottom: 0;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: white;
    transform: translateY(-1px);
}

.copyright {
    text-align: center;
    padding-top: 0.95rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .footer-content {
        align-items: flex-start;
        gap: 0.8rem;
    }

    .footer-social-link {
        width: 44px;
        height: 44px;
    }

    .copyright {
        flex-direction: column;
        gap: 0.2rem;
    }
}


