/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4ade80; /* 浅绿色 */
    --secondary-color: #22c55e; /* 绿色 */
    --accent-color: #86efac; /* 更浅的绿色 */
    --light-color: #f0fdf4; /* 很浅的绿色背景 */
    --dark-color: #166534; /* 深绿色 */
    --gray-color: #6b7280;
    --success-color: #22c55e;
    --warning-color: #fbbf24;
    --danger-color: #ef4444;
    --shadow: 0 4px 6px rgba(34, 197, 94, 0.15);
    --shadow-lg: 0 10px 15px rgba(34, 197, 94, 0.2);
    --border-radius: 16px;
    --transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.7;
    color: var(--dark-color);
    background: linear-gradient(135deg, #f0fdf4, #d1fae5);
    min-height: 100vh;
    margin: 0;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    transition: background 0.5s ease;
}

body.dark-mode {
    background: linear-gradient(135deg, #0d1f12, #1a2a1d) !important;
    color: var(--dark-color);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Header styles */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem 0;
    text-align: center;
    box-shadow: var(--shadow);
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    position: relative;
}

.logo {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
}

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 1.2rem;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.moon {
    display: none;
}

.sun {
    display: inline;
}

/* Dark mode adjustments for theme toggle */
@media (prefers-color-scheme: dark) {
    .moon {
        display: inline;
    }
    
    .sun {
        display: none;
    }
}

.dark-mode .moon {
    display: inline;
}

.dark-mode .sun {
    display: none;
}

/* Main content */
.main {
    min-height: calc(100vh - 120px);
}

/* Main content */
.main {
    flex: 1;
    padding: 1rem 0;
}

/* Projects section */
.projects-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem 0 2rem 0;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 2.5rem;
    color: var(--secondary-color);
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background: var(--accent-color);
    margin: 10px auto;
    border-radius: 2px;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
    margin-top: 2rem;
}

.project-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
    border: none;
    background: linear-gradient(145deg, #ffffff, var(--light-color));
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.project-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.05), rgba(34, 197, 94, 0.1));
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
}

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

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

.project-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(34, 197, 94, 0.2), 0 10px 10px -5px rgba(34, 197, 94, 0.1);
}

.project-card.placeholder {
    background: linear-gradient(145deg, #f9fafb, #f0fdf4);
    border: 2px dashed var(--accent-color);
    color: var(--gray-color);
}

.project-icon {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    transition: transform 0.4s ease;
    display: inline-block;
}

.project-card:hover .project-icon {
    transform: scale(1.2) rotate(5deg);
}

.project-title {
    font-size: 1.6rem;
    margin-bottom: 1rem;
    color: var(--dark-color);
    font-weight: 700;
}

.project-description {
    color: var(--gray-color);
    margin-bottom: 1.8rem;
    line-height: 1.7;
    font-size: 1.05rem;
}

.project-link {
    display: inline-block;
    padding: 0.85rem 1.8rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.project-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0%;
    height: 100%;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    transition: all 0.4s ease;
    z-index: -1;
}

.project-card:hover .project-link::before {
    width: 100%;
}

.project-card:hover .project-link {
    transform: scale(1.05);
    box-shadow: 0 10px 20px -5px rgba(34, 197, 94, 0.3);
}

/* Main content */
.main {
    flex: 1;
}

/* Footer */
.footer {
    background: linear-gradient(135deg, var(--secondary-color), var(--dark-color));
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: auto;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.05);
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 20px;
    }

    .header {
        padding: 1.2rem 0;
        margin-bottom: 1.5rem;
    }

    .logo {
        font-size: 1.7rem;
    }

    .projects-section {
        padding: 0.5rem 0 1.5rem 0;
    }

    .section-title {
        font-size: 2rem;
        margin-bottom: 2rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1.8rem;
    }

    .project-card {
        padding: 1.8rem 1.3rem;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.5rem;
    }

    .header {
        padding: 1rem 0;
        margin-bottom: 1.2rem;
    }

    .section-title {
        font-size: 1.8rem;
        margin-bottom: 1.8rem;
    }

    .project-icon {
        font-size: 2.8rem;
    }

    .project-title {
        font-size: 1.3rem;
    }

    .project-description {
        font-size: 0.95rem;
    }

    .project-link {
        padding: 0.65rem 1.3rem;
        font-size: 0.9rem;
    }
}

/* Extra small devices */
@media (max-width: 320px) {
    .header {
        padding: 0.9rem 0;
        margin-bottom: 1rem;
    }

    .section-title {
        font-size: 1.7rem;
    }

    .project-card {
        padding: 1.5rem;
    }

    .project-title {
        font-size: 1.2rem;
    }
}

/* Dark mode class */
.dark-mode {
    --primary-color: #1b5a2e;
    --secondary-color: #154d26;
    --accent-color: #2d663d;
    --light-color: #1a2a1d;
    --dark-color: #a3d9b1;
    --gray-color: #a0aec0;
    --shadow: 0 4px 6px rgba(10, 44, 16, 0.3);
    --shadow-lg: 0 10px 15px rgba(10, 44, 16, 0.4);
}

body.dark-mode {
    background: linear-gradient(135deg, #0d1f12, #1a2a1d) !important;
    color: var(--dark-color);
}

.dark-mode .header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.dark-mode .container {
    background: transparent;
}

.dark-mode .project-card {
    background: linear-gradient(145deg, #1e3a23, #2a4f2f);
    color: var(--dark-color);
    box-shadow: var(--shadow);
}

.dark-mode .project-card.placeholder {
    background: linear-gradient(145deg, #2d2d2d, #3a3a3a);
    border: 2px dashed var(--accent-color);
    color: var(--gray-color);
}

.dark-mode .project-title {
    color: var(--dark-color);
}

.dark-mode .section-title {
    color: var(--dark-color);
}

.dark-mode .footer {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
}

/* Sun and Moon icons for theme toggle */
.sun {
    display: inline;
}

.moon {
    display: none;
}

.dark-mode .sun {
    display: none;
}

.dark-mode .moon {
    display: inline;
}

/* Enhanced animations */
@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
    100% {
        transform: translateY(0px);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.project-card {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
    animation-delay: calc(var(--delay) * 0.1s);
}

.project-card:nth-child(1) { --delay: 1; }
.project-card:nth-child(2) { --delay: 2; }
.project-card:nth-child(3) { --delay: 3; }
.project-card:nth-child(4) { --delay: 4; }

/* Animation for elements when they come into view */
.animate-in {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
}

/* Hero section animation */
.hero-title {
    animation: float 6s ease-in-out infinite;
}

/* Active state for navigation */
.nav-list a.active {
    background-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}