/* ========== CSS Variables ========== */
:root {
    --primary: #1a56db;
    --primary-light: #3b82f6;
    --primary-dark: #1e40af;
    --accent: #60a5fa;
    --bg: #ffffff;
    --bg-soft: #f0f4ff;
    --bg-card: #ffffff;
    --text: #1f2937;
    --text-light: #6b7280;
    --text-white: #ffffff;
    --border: #e5e7eb;
    --shadow: 0 4px 24px rgba(26, 86, 219, 0.08);
    --shadow-hover: 0 8px 40px rgba(26, 86, 219, 0.14);
    --radius: 12px;
    --max-width: 1200px;
    --nav-height: 64px;
    --transition: 0.25s ease;
    --transition-slow: 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ========== Keyframes ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}

@keyframes avatarPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(26, 86, 219, 0.4); }
    50%      { box-shadow: 0 0 0 10px rgba(26, 86, 219, 0); }
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes borderGlow {
    0%, 100% { border-color: var(--border); }
    50%      { border-color: var(--primary-light); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    40%      { transform: translateY(-10px); }
    60%      { transform: translateY(-4px); }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0; }
}

@keyframes waveMove {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

@keyframes splashIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes splashOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-60px);
    }
}

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

/* ========== Reset & Base ========== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* ========== Splash Screen ========== */
.splash {
    position: fixed;
    inset: 0;
    background: #ffffff;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: splashIn 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.splash.out {
    animation: splashOut 0.6s cubic-bezier(0.55, 0, 1, 0.45) both;
}

.splash-text {
    font-size: 3.2rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 3px;
    text-align: center;
}

/* ========== Scroll Progress Bar ========== */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary-light));
    z-index: 1001;
    width: 0%;
    transition: width 0.1s linear;
}

/* ========== Back to Top ========== */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--text-white);
    border: none;
    cursor: pointer;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(26, 86, 219, 0.35);
    z-index: 999;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: opacity var(--transition), transform var(--transition);
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    animation: bounce 2s ease-in-out infinite;
}

.back-to-top:hover {
    background: var(--primary-dark);
    animation: none;
    transform: scale(1.1);
}

/* ========== Scroll Reveal ========== */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered delays */
.delay-1 { transition-delay: 0.05s; }
.delay-2 { transition-delay: 0.15s; }
.delay-3 { transition-delay: 0.25s; }
.delay-4 { transition-delay: 0.35s; }
.delay-5 { transition-delay: 0.45s; }

/* ========== Navigation ========== */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: transparent;
    backdrop-filter: none;
    border-bottom: 1px solid transparent;
    z-index: 1000;
    display: flex;
    align-items: center;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.nav.scrolled {
    border-bottom-color: var(--border);
    box-shadow: 0 2px 20px rgba(26, 86, 219, 0.08);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
}

.nav-inner {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 1px;
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-links a {
    color: var(--text);
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
}

.nav-links a::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    transform: scaleX(0);
    transition: transform var(--transition);
}

.nav-links a:hover::after {
    transform: scaleX(1);
}

/* Mobile menu toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: var(--transition);
}

/* ========== Hero ========== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #1a56db 0%, #3b82f6 40%, #60a5fa 100%);
    color: var(--text-white);
    text-align: center;
    padding: calc(var(--nav-height) + 48px) 24px 48px;
}

.hero-inner {
    max-width: 720px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: 2px;
    animation: fadeInUp 0.8s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.hero .subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 32px;
    animation: fadeInUp 0.8s 0.2s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.hero .btn {
    display: inline-block;
    padding: 14px 36px;
    border: 2px solid var(--text-white);
    border-radius: 50px;
    color: var(--text-white);
    font-weight: 600;
    font-size: 1rem;
    transition: all var(--transition);
    animation: fadeInUp 0.8s 0.4s cubic-bezier(0.22, 0.61, 0.36, 1) both, pulse 2.5s 1.5s ease-in-out infinite;
}

.hero .btn:hover {
    background: var(--text-white);
    color: var(--primary);
    animation: none;
}

/* ========== Sections ========== */
.section {
    padding: 96px 24px;
}

.section-header {
    text-align: center;
    margin-bottom: 64px;
}

.section-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 12px;
}

.section-header p {
    color: var(--text-light);
    font-size: 1.05rem;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
}

/* ========== About ========== */
.about {
    background: var(--bg);
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    color: var(--text-light);
    font-size: 1.05rem;
    line-height: 1.9;
}

.about-content .line {
    display: block;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.about-content .line.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ========== Stats ========== */
.stats {
    background: var(--bg-soft);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 24px;
    max-width: 700px;
    margin: 0 auto;
}

.stat-card {
    text-align: center;
    padding: 28px 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
}

/* ========== Typewriter Cursor ========== */
.typewriter-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: var(--text-white);
    vertical-align: text-bottom;
    margin-left: 2px;
    animation: blink 0.8s step-end infinite;
}

/* ========== 3D Card Tilt ========== */
.card-3d {
    transform-style: preserve-3d;
    perspective: 800px;
    transition: transform 0.1s ease-out;
}

/* ========== Departments ========== */
.depts {
    background: var(--bg-soft);
}

.dept-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
}

.dept-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 32px;
    text-align: center;
    transition: all var(--transition-slow);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.dept-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transform: scaleX(0);
    transition: transform var(--transition-slow);
}

.dept-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-light);
}

.dept-card:hover::before {
    transform: scaleX(1);
}

.dept-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 24px;
    background: var(--bg-soft);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    animation: float 3s ease-in-out infinite;
    transition: transform var(--transition);
}

.dept-card:nth-child(1) .dept-icon { animation-delay: 0s; }
.dept-card:nth-child(2) .dept-icon { animation-delay: 0.5s; }
.dept-card:nth-child(3) .dept-icon { animation-delay: 1s; }

.dept-card:hover .dept-icon {
    animation: none;
    transform: scale(1.1);
}

.dept-card h3 {
    font-size: 1.3rem;
    color: var(--primary-dark);
    margin-bottom: 8px;
}

.dept-card p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* ========== Members ========== */
.members {
    background: var(--bg);
}

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

.member-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    transition: all var(--transition-slow);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.member-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    background: linear-gradient(135deg, transparent 60%, rgba(26, 86, 219, 0.03));
    pointer-events: none;
    transition: opacity var(--transition-slow);
    opacity: 0;
}

.member-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-light);
}

.member-card:hover::after {
    opacity: 1;
}

.member-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: var(--text-white);
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    transition: transform var(--transition-slow), box-shadow var(--transition-slow);
}

.member-card:hover .member-avatar {
    transform: scale(1.1);
    animation: avatarPulse 1.5s ease-out;
}

.member-card h3 {
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 4px;
}

.member-card .role {
    font-size: 0.85rem;
    color: var(--primary-light);
    font-weight: 500;
    margin-bottom: 8px;
}

.member-card .dept-tag {
    display: inline-block;
    font-size: 0.75rem;
    background: var(--bg-soft);
    color: var(--primary);
    padding: 2px 12px;
    border-radius: 50px;
    margin-bottom: 12px;
}

.member-card .projects {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 16px;
    line-height: 1.6;
}

.member-links {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.member-links a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary);
    padding: 6px 14px;
    border: 1px solid var(--primary);
    border-radius: 50px;
    transition: all var(--transition);
}

.member-links a:hover {
    background: var(--primary);
    color: var(--text-white);
}

/* GitHub icon (inline SVG via emoji or ligature) */
.member-links a::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z'%3E%3C/path%3E%3C/svg%3E") center / contain no-repeat;
}

/* ========== Wave Divider ========== */
.wave-divider {
    display: block;
    width: 200%;
    height: 80px;
    margin-bottom: -2px;
    animation: waveMove 8s linear infinite;
}

.wave-wrap {
    overflow: hidden;
    line-height: 0;
    background: var(--bg);
}

.wave-wrap svg {
    display: block;
    width: 100%;
}

/* ========== Footer ========== */
.footer {
    background: var(--primary-dark);
    color: rgba(255, 255, 255, 0.75);
    text-align: center;
    padding: 32px 24px;
    font-size: 0.9rem;
}

.footer span {
    color: var(--text-white);
    font-weight: 600;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(10px);
        flex-direction: column;
        align-items: center;
        padding: 24px;
        gap: 20px;
        transform: translateY(-120%);
        transition: transform var(--transition);
        border-bottom: 1px solid var(--border);
    }

    .nav-links.open {
        transform: translateY(0);
    }

    .nav-toggle {
        display: flex;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero .subtitle {
        font-size: 1rem;
    }

    .section {
        padding: 64px 20px;
    }

    .section-header h2 {
        font-size: 1.6rem;
    }

    .dept-grid {
        grid-template-columns: 1fr;
    }

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

    .splash-text {
        font-size: 2rem;
        letter-spacing: 1px;
    }
}
