/**
 * 网站样式文件
 * 遵循 SOLID 原则 - 样式与结构分离
 * 符合 Vercel Web Interface Guidelines
 */

/* 特色字体：Outfit(展示) + Noto Sans SC(中文正文) - 避免通用AI美学 */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Space+Mono:wght@400;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

/* ==================== 打字机效果 ==================== */
.typewriter-cursor {
    display: inline-block;
    color: #3b82f6;
    animation: blink 1s step-end infinite;
    font-weight: 400;
}

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

/* ==================== 基础变量 ==================== */
:root {
    --color-primary: #3b82f6;
    --color-secondary: #0ea5e9;
    --color-dark: #0f172a;
    --color-cyan: #06b6d4;
    --color-accent: #f472b6; /* 锐利点缀色 - 品红 */
    --color-accent-warm: #fb923c; /* 暖色点缀 - 橙 */
    --gradient-primary: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    --gradient-text: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 50%, var(--color-cyan) 100%);
    --gradient-accent: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-warm) 100%);
    
    /* 字体变量 */
    --font-display: 'Outfit', sans-serif;
    --font-mono: 'Space Mono', monospace;
    --font-body: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    
    color-scheme: dark;
}

/* 基础字体设置 */
* {
    font-family: var(--font-body);
}

/* 展示性字体 - 标题、品牌名、数字 */
h1, h2, h3, h4, h5, h6,
.font-display {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
}

/* 等宽字体 - 代码、数据、标签 */
.font-mono,
code, pre {
    font-family: var(--font-mono);
}

/* ==================== 无障碍：Skip Link ==================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sr-only:focus,
.sr-only:focus-visible {
    position: absolute;
    width: auto;
    height: auto;
    padding: 0.5rem 1rem;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: nowrap;
}

/* ==================== 数字等宽对齐 ==================== */
.font-tabular-nums {
    font-variant-numeric: tabular-nums;
}

/* ==================== 渐变效果 ==================== */
.gradient-text {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-bg {
    background: var(--gradient-primary);
}

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

/* ==================== 噪点纹理 & 渐变网格 (frontend-design) ==================== */
/* 全局噪点纹理叠加 - z-index 调低避免遮挡表单 */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* 渐变网格背景 */
.gradient-mesh {
    background: 
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 20%, rgba(14, 165, 233, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse 50% 60% at 60% 80%, rgba(244, 114, 182, 0.08) 0%, transparent 50%);
}

/* 点阵网格效果 */
.dot-grid {
    background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 24px 24px;
}

/* 发光边框效果 */
.glow-border {
    position: relative;
}

.glow-border::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent), var(--color-secondary));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.glow-border:hover::before {
    opacity: 1;
}

/* 光晕效果 */
.halo {
    position: relative;
}

.halo::after {
    content: "";
    position: absolute;
    inset: -20%;
    background: radial-gradient(circle, var(--color-primary) 0%, transparent 70%);
    opacity: 0;
    filter: blur(40px);
    transition: opacity 0.4s ease;
    z-index: -1;
}

.halo:hover::after {
    opacity: 0.3;
}

/* ==================== 动画效果 ==================== */
.float-animation {
    animation: float 6s ease-in-out infinite;
}

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

.blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.5;
    animation: blob 7s infinite;
}

@keyframes blob {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -50px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
}

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

/* ==================== 交错入场动画系统 (frontend-design) ==================== */
.fade-in {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 交错延迟 - 编排精良的揭示效果 */
.stagger-1 { transition-delay: 0.1s; }
.stagger-2 { transition-delay: 0.2s; }
.stagger-3 { transition-delay: 0.3s; }
.stagger-4 { transition-delay: 0.4s; }
.stagger-5 { transition-delay: 0.5s; }
.stagger-6 { transition-delay: 0.6s; }

/* 从左滑入 */
.slide-in-left {
    opacity: 0;
    transform: translateX(-60px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.slide-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

/* 从右滑入 */
.slide-in-right {
    opacity: 0;
    transform: translateX(60px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.slide-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* 缩放入场 */
.scale-in {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.scale-in.visible {
    opacity: 1;
    transform: scale(1);
}

/* 旋转入场 - 用于图标/小元素 */
.rotate-in {
    opacity: 0;
    transform: rotate(-10deg) scale(0.9);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.rotate-in.visible {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* ==================== 项目卡片效果 ==================== */
.project-card {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.4s ease;
}

.project-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(59, 130, 246, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

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

.project-card:hover img {
    transform: scale(1.1);
}

/* ==================== 创意悬停效果 (frontend-design) ==================== */
/* 磁性吸附效果 */
.magnetic-hover {
    transition: transform 0.2s ease-out;
}

/* 倾斜3D效果 */
.tilt-hover {
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.tilt-hover:hover {
    transform: perspective(1000px) rotateX(2deg) rotateY(-2deg) scale(1.02);
}

/* 边框流光效果 */
.border-flow {
    position: relative;
    overflow: hidden;
}

.border-flow::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg,
        transparent 0deg 90deg,
        var(--color-primary) 90deg 180deg,
        transparent 180deg 270deg,
        var(--color-accent) 270deg 360deg
    );
    animation: borderSpin 4s linear infinite paused;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.border-flow:hover::before {
    animation-play-state: running;
    opacity: 1;
}

.border-flow::after {
    content: "";
    position: absolute;
    inset: 2px;
    background: var(--color-dark);
    border-radius: inherit;
}

.border-flow > * {
    position: relative;
    z-index: 1;
}

@keyframes borderSpin {
    to { transform: rotate(360deg); }
}

/* 文字悬停扫描效果 */
.text-scan {
    position: relative;
    display: inline-block;
}

.text-scan::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-accent);
    transition: width 0.3s ease;
}

.text-scan:hover::after {
    width: 100%;
}

/* 图标弹跳旋转 */
.icon-bounce:hover i,
.icon-bounce:hover svg {
    animation: iconBounce 0.5s ease;
}

@keyframes iconBounce {
    0% { transform: scale(1) rotate(0deg); }
    30% { transform: scale(1.3) rotate(-10deg); }
    50% { transform: scale(0.9) rotate(5deg); }
    70% { transform: scale(1.1) rotate(-3deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* 闪烁光效 */
.shimmer {
    position: relative;
    overflow: hidden;
}

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

.shimmer:hover::before {
    left: 100%;
}

/* ==================== 头像指示点 ==================== */
.avatar-dot.active {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.2);
}

/* ==================== 轮播效果 ==================== */
.carousel-slide {
    transition: opacity 0.5s ease-in-out;
}

/* ==================== 响应式优化 ==================== */
@media (max-width: 768px) {
    .blob {
        filter: blur(60px);
        opacity: 0.3;
    }
    
    .float-animation {
        animation-duration: 4s;
    }
}

/* ==================== 减弱动画 (无障碍) ==================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .float-animation {
        animation: none;
    }
    
    .blob {
        animation: none;
    }
    
    .fade-in {
        opacity: 1;
        transform: none;
        transition: none;
    }
    
    .skill-bar {
        transition: none;
    }
}

/* ==================== 滚动条美化 ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

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

/* 移除默认焦点样式，仅在键盘导航时显示 */
:focus:not(:focus-visible) {
    outline: none;
}

/* ==================== 按钮通用效果 ==================== */
.btn-hover {
    position: relative;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.3s ease;
}

.btn-hover::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.btn-hover:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 10px 25px -5px rgba(59, 130, 246, 0.5),
        0 0 20px rgba(59, 130, 246, 0.2);
}

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

.btn-hover:active {
    transform: translateY(-1px);
}

/* ==================== 卡片悬浮效果 ==================== */
.card-hover {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.4s ease;
}

.card-hover:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 
        0 20px 40px -15px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* ==================== 文字选中效果 ==================== */
::selection {
    background: var(--color-primary);
    color: white;
}

/* ==================== 链接效果 ==================== */
a {
    transition: color 0.2s ease;
}

/* ==================== 输入框焦点效果 ==================== */
input:focus-visible,
textarea:focus-visible {
    outline: none;
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* ==================== 触控优化 ==================== */
button,
a,
[role="button"] {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.2);
}

/* ==================== 加载动画 (备用) ==================== */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner {
    animation: spin 1s linear infinite;
}

/* ==================== 标题锚点滚动边距 ==================== */
[id] {
    scroll-margin-top: 5rem;
}

/* ==================== 图片样式优化 ==================== */
/* 图片加载占位符防止 CLS */
img {
    background-color: rgba(255, 255, 255, 0.05);
}

/* ==================== 骨架屏加载效果 ==================== */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

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

/* ==================== 可点击元素增强 ==================== */
.cursor-pointer,
button,
a,
[role="button"],
input[type="submit"],
input[type="button"] {
    cursor: pointer;
}

/* ==================== 按钮加载状态 (UI-UX-Pro-MAX) ==================== */
button:disabled,
input[type="submit"]:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    pointer-events: none;
}

button.loading {
    position: relative;
    color: transparent;
}

button.loading::after {
    content: "";
    position: absolute;
    width: 1.25rem;
    height: 1.25rem;
    top: 50%;
    left: 50%;
    margin-left: -0.625rem;
    margin-top: -0.625rem;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ==================== 表单验证反馈 ==================== */
input:invalid:not(:placeholder-shown),
textarea:invalid:not(:placeholder-shown) {
    border-color: #ef4444;
}

input:valid:not(:placeholder-shown),
textarea:valid:not(:placeholder-shown) {
    border-color: #22c55e;
}

/* ==================== 工作经历卡片增强 ==================== */
.experience-card {
    position: relative;
    overflow: hidden;
}

/* 左侧指示条 - 始终显示，悬停时变亮 */
.experience-card::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0.3;
    transition: opacity 0.3s ease;
    z-index: 10;
}

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

/* 公司 Logo 容器增强 */
.company-logo-wrapper {
    position: relative;
    overflow: hidden;
    background: #0f172a;
}

.company-logo-wrapper::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(59, 130, 246, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.experience-card:hover .company-logo-wrapper::after {
    opacity: 1;
}

/* Logo图片样式 */
.company-logo-wrapper img {
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.experience-card:hover .company-logo-wrapper img {
    transform: scale(1.08);
    filter: drop-shadow(0 4px 15px rgba(59, 130, 246, 0.4));
}

/* 时间线标签 */
.timeline-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.timeline-badge::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.2);
        opacity: 0.7;
    }
}

/* ==================== 联系表单增强 ==================== */
.contact-form {
    position: relative;
}

/* 表单输入框高级效果 */
.form-input-wrapper {
    position: relative;
}

.form-input-wrapper input,
.form-input-wrapper textarea {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    width: 100%;
    color: white;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.form-input-wrapper input:focus,
.form-input-wrapper textarea:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--color-primary);
    box-shadow: 
        0 0 0 3px rgba(59, 130, 246, 0.15),
        0 4px 20px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

/* 浮动标签效果 */
.floating-label {
    position: absolute;
    left: 1.25rem;
    top: 1rem;
    color: rgba(255, 255, 255, 0.5);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background: transparent;
    padding: 0 0.25rem;
    font-size: 1rem;
    z-index: 2;
}

.form-input-wrapper input:focus ~ .floating-label,
.form-input-wrapper input:not(:placeholder-shown) ~ .floating-label,
.form-input-wrapper textarea:focus ~ .floating-label,
.form-input-wrapper textarea:not(:placeholder-shown) ~ .floating-label {
    top: -0.5rem;
    left: 1rem;
    font-size: 0.75rem;
    color: var(--color-primary);
    background: var(--color-dark);
}

/* 输入框底部光效 */
.form-input-wrapper::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: all 0.3s ease;
    transform: translateX(-50%);
    border-radius: 1px;
}

.form-input-wrapper:focus-within::after {
    width: calc(100% - 2rem);
}

/* 提交按钮增强 */
.submit-btn {
    position: relative;
    overflow: hidden;
    background: var(--gradient-primary);
    border: none;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.submit-btn::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;
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 10px 30px -5px rgba(59, 130, 246, 0.5),
        0 0 20px rgba(59, 130, 246, 0.2);
}

.submit-btn:hover::before {
    left: 100%;
}

.submit-btn:active {
    transform: translateY(-1px);
}

/* 联系信息卡片动效 */
.contact-info-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 1rem;
    transition: all 0.3s ease;
}

.contact-info-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(8px);
}

.contact-info-item .icon-wrapper {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    transition: all 0.3s ease;
}

.contact-info-item:hover .icon-wrapper {
    background: rgba(59, 130, 246, 0.2);
    transform: rotate(-10deg) scale(1.1);
}

/* ==================== 表单确保可交互 ==================== */
#contactForm input,
#contactForm textarea,
#contactForm button {
    position: relative;
    z-index: 10;
}
