@import url('reset.css');

/* CSS Variables */
:root {
    --primary-color: #ff3d71;
    --secondary-color: #79eee6;
    --text-color: #333;
    --sec-text-color: #fff;
    --font-family: Arial, sans-serif;
    --background-color: #ffffff;

    /* New Section Background Colors */
    --section-bg1: #ffffff; /* white */
    --section-bg2: #ffd0dc; /* light gray */
    --section-bg3: #79eee6; /* light gray */
}

/* Base Styles */
body {
    font-family: var(--font-family);
    color: var(--text-color);
    background-color: var(--background-color);
    line-height: 1.6;
}

/* Fixed Header Styles */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: var(--primary-color);
    color: var(--sec-text-color);
    text-align: center;
    z-index: 900;
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Main Wrapper - Add Padding to Avoid Header Overlap */
.wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1rem 1rem;
}

/* Alternating Section Background Colors */
section:nth-child(odd) {
    background-color: var(--section-bg1);
}

section:nth-child(even) {
    background-color: var(--section-bg2);
}

/* Individual Section Margins to Accommodate Header */
#portfolio, #weekly-tasks {
    margin-top: 6rem;
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center; /* 居中对齐 */
    padding: 0;
    margin: 0;
    gap: 1rem; /* 设置统一的间距 */
}

nav ul li a {
    text-decoration: none;
    color: #fff;
    padding: 0.5rem 1rem; /* 统一内边距 */
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

/* Hover and Active States */
nav a:hover {
    background-color: var(--secondary-color);
    color: var(--text-color);
}

nav a:active {
    background-color: var(--sec-text-color);
    color: var(--primary-color);
}



/* Adjust margin for header when navigating */
#welcome, #portfolio, #tasks {
    scroll-margin-top: 6rem;
}

/* Full-Screen Sections */
section {
    min-height: 70vh;
    padding: 6rem 2rem 2rem 2rem;
    margin-bottom: 2rem;
    background-color: var(--background-color);
    border-bottom: solid 1px gray;
}

#welcome h2 {
    font-size: 2.5rem;
    margin-bottom: 0.2rem;
    text-align: center;
}

#welcome h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

#welcome img {
    width: 100%;
    height: auto;
    margin: 1rem 0;
}

#welcome article {
    text-align: center;
}

/* Portfolio Gallery */
.gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem; /* 调整图片之间的间距 */
    padding: 0 2rem; /* 添加两侧的间距，避免图片贴边 */
}

.portfolio-item img {
    width: 100%; /* 让图片自适应父容器的宽度 */
    height: auto; /* 保持图片比例 */
    border-radius: 8px; /* 圆角效果 */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.portfolio-item img:hover {
    transform: scale(1.05); /* 鼠标悬停时放大图片 */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.portfolio-item p {
    text-decoration: none;
    color: var(--text-color);
    font-weight: bold;
    font-size: 1rem;
    margin-top: 0.2rem;
    text-align: center;
}

.project-description {
    max-width: 50%; /* 限制宽度为屏幕的二分之一 */
    line-height: 1.6; /* 设置行高以增加可读性 */
    margin: 1rem 0; /* 添加上下边距 */
    word-wrap: break-word; /* 确保长单词会自动换行 */
}



/* Weekly Tasks List */
.tasks-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 三列布局 */
    gap: 10rem; /* 项目间距 */
    justify-items: center;
    text-align: center;
}

.task {
    display: flex;
    flex-direction: column; /* 垂直排列 */
    align-items: center; /* 水平居中对齐 */
    justify-content: center; /* 垂直居中对齐 */
    gap: 1rem; /* 图片和文字间距 */
}

.task img {
    width: 100%; /* 图片宽度 */
    max-width: 450px; /* 最大宽度 */
    height: auto; /* 保持比例 */
    display: block;
    margin: auto;
    border-radius: 8px; /* 圆角效果 */
    transition: transform 0.3s ease, box-shadow 0.3s ease; /* 悬停动画 */
}

.task img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(255, 61, 113, 0.5); /* 添加红色半透明阴影 */
}

.task a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: bold;
    font-size: 1rem;
    margin-top: 0.2rem;
    text-align: center;
}

footer {
    background: var(--secondary-color);
    color: white;
    text-align: center;
    padding: 1rem;
    width: 100%;
    margin: 0;
    position: relative;
    left: 0;
    bottom: 0;
    box-sizing: border-box;
    border: none;
}

/* Responsive Styles */
@media (max-width: 600px) {
    .gallery {
        grid-template-columns: 1fr;
    }

    .tasks-list {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 601px) and (max-width: 900px) {
    .gallery {
        grid-template-columns: repeat(2, 1fr);
    }

    .tasks-list {
        grid-template-columns: repeat(2, 1fr);
    }
}
