/* ========================================
   个人作品集网站 - 自定义样式
   ======================================== */

/* 基础配置 */
:root {
    --primary-color: #4f46e5;
    --secondary-color: #7c3aed;
    --accent-color: #06b6d4;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f9fafb;
}

/* 字体设置 */
.font-poppins {
    font-family: 'Poppins', sans-serif;
}

/* ========================================
   动画效果
   ======================================== */

/* 浮动动画 */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

/* 滑入动画 */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-in-left {
    animation: slideInLeft 0.8s ease-out forwards;
    opacity: 0;
}

/* 延迟动画 */
.delay-200 {
    animation-delay: 0.2s;
}

.delay-400 {
    animation-delay: 0.4s;
}

.delay-600 {
    animation-delay: 0.6s;
}

.delay-800 {
    animation-delay: 0.8s;
}

.delay-1000 {
    animation-delay: 1s;
}

/* 淡入动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.animate-fade-in {
    animation: fadeIn 1s ease-out forwards;
}

/* 缩放动画 */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-scale-in {
    animation: scaleIn 0.5s ease-out forwards;
}

/* ========================================
   导航栏样式
   ======================================== */

.nav-link {
    position: relative;
    font-weight: 500;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s ease;
}

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

/* 导航栏滚动效果 */
.navbar-scrolled {
    background-color: rgba(255, 255, 255, 0.98) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
}

/* ========================================
   技能卡片动画
   ======================================== */

.skill-card {
    position: relative;
    overflow: hidden;
}

.skill-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.skill-card:hover::before {
    left: 100%;
}

/* 技能进度条动画 */
.skill-bar {
    width: 0;
    transition: width 1.5s ease-out;
}

.skill-bar.animate {
    width: var(--target-width);
}

/* ========================================
   项目卡片样式
   ======================================== */

.project-card {
    opacity: 1;
    transform: scale(1);
    transition: all 0.5s ease;
}

.project-card.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

/* 项目筛选按钮 */
.filter-btn {
    position: relative;
    overflow: hidden;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.filter-btn:hover::before {
    width: 300px;
    height: 300px;
}

/* ========================================
   时间线样式
   ======================================== */

.timeline-item {
    position: relative;
}

/* 时间线连接线 */
.timeline-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
}

@media (min-width: 768px) {
    .timeline-item::before {
        left: 50%;
        transform: translateX(-50%);
    }
}

/* 时间线点动画 */
.timeline-dot {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(79, 70, 229, 0);
    }
}

/* ========================================
   表单样式
   ======================================== */

input:focus,
textarea:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

/* 表单提交动画 */
@keyframes submitSuccess {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

.submit-success {
    animation: submitSuccess 0.5s ease;
}

/* ========================================
   回到顶部按钮
   ======================================== */

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   响应式设计
   ======================================== */

/* 平板设备 */
@media (max-width: 1024px) {
    .container {
        max-width: 90%;
    }
    
    section {
        padding-top: 4rem;
        padding-bottom: 4rem;
    }
}

/* 移动设备 */
@media (max-width: 768px) {
    /* 导航栏 */
    #navbar {
        padding: 0.75rem 0;
    }
    
    /* 个人简介区 */
    #about {
        padding-top: 6rem;
    }
    
    /* 技能卡片 */
    .skill-card {
        padding: 1.5rem;
    }
    
    /* 项目卡片 */
    .project-card {
        margin-bottom: 1.5rem;
    }
    
    /* 时间线 */
    .timeline-item::before {
        left: 0;
    }
    
    .timeline-dot {
        left: 0 !important;
        transform: translateX(0) !important;
    }
    
    /* 联系表单 */
    #contact-form {
        padding: 1.5rem;
    }
}

/* 小屏幕手机 */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* 按钮 */
    button,
    a {
        padding: 0.5rem 1rem;
    }
}

/* ========================================
   滚动动画
   ======================================== */

.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ========================================
   加载动画
   ======================================== */

.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* ========================================
   工具类
   ======================================== */

/* 文字渐变 */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 玻璃态效果 */
.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 阴影效果 */
.shadow-glow {
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.3);
}

/* ========================================
   打印样式
   ======================================== */

@media print {
    /* 隐藏不必要的元素 */
    #navbar,
    #back-to-top,
    .social-icon,
    .filter-btn {
        display: none !important;
    }
    
    /* 重置背景色 */
    body {
        background: white !important;
    }
    
    /* 显示链接URL */
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}

/* ========================================
   深色模式支持（可选）
   ======================================== */

@media (prefers-color-scheme: dark) {
    /* 如果需要深色模式，可以在这里添加样式 */
    /* 目前保持浅色主题 */
}

/* ========================================
   无障碍访问
   ======================================== */

/* 焦点可见性 */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 减少动画（用户偏好） */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   自定义滚动条
   ======================================== */

/* Webkit浏览器 */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) #f1f1f1;
}
