/* 样式表文件 styles.css */

/* 全局设置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    color: #333;
}

h1, h2 {
    font-family: 'Playfair Display', serif;
    opacity: 0;
    animation: fadeInText 3s ease-out forwards;
}

h1 {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #f39c12; /* 金色字体 */
}

h2 {
    font-size: 2.5rem;
    color: #fff;
    margin-top: 2rem; /* 确保与上一段落有两行的距离 */
}

/* Header 样式 */
header {
    width: 100%;
    padding: 20px 25px; /* 缩窄导航栏的宽度 */
    background-color: #111;
    position: sticky; /* 设置为 sticky */
    top: 0; /* 固定在页面顶部 */
    z-index: 1000; /* 确保导航栏位于最上方 */
}

nav {
    display: flex;
    justify-content: center; /* 居中对齐所有菜单项 */
    align-items: center;
    width: 100%;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 50px;
}

nav ul li {
    position: relative;
}

nav ul li a {
    color: #fff8f8;
    text-decoration: none;
    font-weight: 600;
    font-size: 17px;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
}

nav ul li a i {
    margin-right: 8px;
}

nav ul li a:hover {
    color: #f39c12;
}

/* 下拉菜单部分 */
nav .dropdown {
    position: relative;
}

nav .dropdown .dropdown-content {
    display: none;
    position: absolute;
    background-color: #111;
    width: 200px;  /* 设置下拉菜单的宽度 */
    top: 100%;  /* 确保下拉菜单出现在菜单项下方 */
    left: 50%;
    transform: translateX(-50%);  /* 使下拉菜单水平居中 */
    border-radius: 8px;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);  /* 添加阴影效果 */
    z-index: 1000;
}

nav .dropdown:hover .dropdown-content {
    display: block;
}

nav .dropdown .dropdown-content a {
    color: #fff;
    padding: 10px 20px;
    text-decoration: none;
    display: block;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

nav .dropdown .dropdown-content a:hover {
    background-color: #f39c12;  /* 鼠标悬停时，背景颜色变为金色 */
}

/* Home 页面样式 */
#home {
    height: 100vh;
    display: flex;
    justify-content: flex-start;  /* 使内容左对齐 */
    align-items: center;
    flex-direction: row;
    position: relative;
    padding: 0 10px;
    background: linear-gradient(45deg, #6a00ff, #ee0979, #ffef00, #00c6ff);
    background-size: 400% 400%;
    animation: gradientAnimation 15s ease infinite;
}

#home .home-content {
    max-width: 60%; /* 让文本区域最大宽度不超过60% */
    margin-left: auto; /* 右对齐 */
    margin-left: 87px; /* 右对齐，并与右侧圆形对齐 */
    text-align: left; /* 标题文本靠左 */
}

#home .home-content h1,
#home .home-content h2 {
    text-align: left; /* 保证文本左对齐 */
}

#home .home-content h1 {
    font-size: 2.7rem;
    color: #fff;
}

#home .home-content h2 {
    font-size: 1.5rem;
    color: #f39c12;
    margin-top: 1rem; /* 确保与上一段落有三行的距离 */
    margin-bottom: 3rem;
}

/* 为两段文字添加渐显和滑动特效 */
#home .intro-text {
    font-size: 1rem;  /* 设置文字较小 */
    color: #fff;  /* 白色字体 */
    width: 100%;  /* 确保文字在一行上对齐 */
    text-align: justify; /* 两端对齐 */
    margin-top: 15px;
    line-height: 1.5;
    padding-left: 0;  /* 删除段落缩进 */
    max-width: 70%; /* 设置最大宽度，避免过长的行 */
    word-wrap: break-word;
    opacity: 0;  /* 初始设置为透明 */
    transform: translateY(30px);  /* 初始向下偏移 */
    animation: fadeInUp 1s forwards;  /* 应用动画 */
    animation-delay: 0.5s;  /* 延迟出现 */
}

/* 第二段文字的延迟 */
#home .intro-text:nth-of-type(2) {
    animation-delay: 1s;  /* 第二段文字延迟1秒出现 */
}

/* 动画效果：渐显并从下方滑入 */
@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);  /* 初始下方位置 */
    }
    100% {
        opacity: 1;
        transform: translateY(0);  /* 最终回到正常位置 */
    }
}

/* 放大圆形至400px，并添加旋转动画 */
#home .profile-circle {
    position: absolute;
    right: 7%;  /* 右侧对齐 */
    top: 50%;
    transform: translateY(-50%) scale(0.3); /* 初始状态：缩小并垂直居中 */
    width: 400px;  /* 放大圆形至400px */
    height: 400px; /* 放大圆形至400px */
    border-radius: 50%;
    border: 5px dashed #f39c12; /* 断开的虚线边框 */
    display: flex;
    justify-content: center;
    align-items: center;
    animation: rotateCircle 2s ease-out forwards, scaleUpCircle 1.5s ease-in-out forwards; /* 混合旋转和放大 */
}

.profile-circle img {
    width: 100%;
    height: 100%;
    border-radius: 50%; /* 确保图片是圆形 */
    object-fit: cover; /* 图片填充 */
}

/* 动态渐变背景动画 */
@keyframes gradientAnimation {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 旋转的虚线圆形边框动画 */
@keyframes rotateCircle {
    0% {
        transform: translateY(-50%) rotate(0deg) scale(0.3); /* 初始缩小并无旋转 */
    }
    100% {
        transform: translateY(-50%) rotate(360deg) scale(1); /* 完成旋转并放大 */
    }
}

/* 放大圆形效果 */
@keyframes scaleUpCircle {
    0% {
        transform: translateY(-50%) scale(0.3); /* 初始缩小 */
    }
    100% {
        transform: translateY(-50%) scale(1); /* 放大 */
    }
}

/* 按钮样式：Enter 按钮 */
#home .enter-btn {
    margin-top: 2rem; /* 给按钮与文字之间添加间距 */
    padding: 10px 30px;
    border: 2px solid #f39c12;
    color: #f39c12;
    background: transparent;
    font-size: 1.2rem;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    display: inline-block;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
    border-radius: 50px;
    opacity: 0;  /* 初始为透明 */
    animation: fadeInUp 1s forwards;  /* 应用动画 */
    animation-delay: 2s;  /* 延迟显示按钮 */
}

#home .enter-btn:hover,
#home .enter-btn:focus {
    background-color: #f39c12;
    color: #fff;
    transform: scale(1.05);  /* 鼠标悬停时略微放大 */
}

#home .enter-btn:active {
    transform: scale(0.95);  /* 按下按钮时略微缩小 */
}

/* Portfolio 页面样式 */
#portfolio {
    padding: 60px 20px;
    background-color: #111;  /* 与Home页面风格一致的背景色 */
}

#portfolio h2 {
    font-size: 2rem;  /* 增加字体大小 */
    margin-bottom: 20px;  /* 适当调整底部间距 */
    color: #f39c12; /* 金色字体 */
    text-align: center;  /* 文字居中 */
    margin-top: -35px;  /* 往上移动 */
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); /* 自动适应列数 */
    gap: 30px;
}

.portfolio-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, filter 0.6s ease;
    cursor: pointer;
}

/* 设置图片为374px * 374px */
.portfolio-item img {
    width: 374px;
    height: 374px;
    object-fit: cover;  /* 保证图片按比例填充并裁剪 */
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    margin: 0 auto;  /* 让图片居中 */
}

.portfolio-item:hover {
    transform: scale(1.05);
}

.portfolio-item .overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.portfolio-item:hover .overlay {
    opacity: 1;
}

.overlay h3 {
    color: #fff;
    font-size: 1.5rem;
    font-weight: bold;
}

/* 点击效果动画 */
.portfolio-item.clicked {
    animation: zoomOut 0.6s ease forwards;
}

@keyframes zoomOut {
    0% {
        transform: scale(1.05);
        opacity: 1;
    }
    100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

/* Writing Tasks 页面样式 */
#writing-tasks {
    padding: 60px 20px;
    background-color: #f0f0f0;
}

#writing-tasks h2 {
    font-size: 2rem;
    margin-bottom: 20px;
}

/* Footer 样式 */
footer {
    background-color: #222;
    padding: 20px;
    text-align: center;
    color: #fff;
    font-size: 14px;
}

/* 动画 */
@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: translateY(50px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInText {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 放大并旋转圆形的动画 */
@keyframes rotateAndScaleUpCircle {
    0% {
        transform: translateY(-50%) scale(0.1) rotate(0deg); /* 初始缩小并没有旋转 */
    }
    100% {
        transform: translateY(-50%) scale(1) rotate(360deg); /* 完成旋转并放大 */
    }
}

/* Home 页面中的圆形样式 */
#home .profile-circle {
    position: absolute;
    right: 7%;  /* 右侧对齐 */
    top: 50%;
    transform: translateY(-50%) scale(0.1); /* 初始状态：极小并垂直居中 */
    width: 400px;  /* 设置圆形的最终宽度 */
    height: 400px; /* 设置圆形的最终高度 */
    border-radius: 50%; /* 保持圆形 */
    border: 5px dashed #f39c12; /* 断开的虚线边框 */
    display: flex;
    justify-content: center;
    align-items: center;
    animation: rotateAndScaleUpCircle 3s ease-out forwards; /* 应用旋转与放大的动画 */
}

/* 圆形中的图片样式 */
.profile-circle img {
    width: 100%;
    height: 100%;
    border-radius: 50%; /* 确保图片是圆形 */
    object-fit: cover; /* 图片填充 */
}