/* 基础样式 */
* {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(to bottom right, #0a0a0a, #1a1a1a, #0f0f0f);
    color: #f8f7f9;
    overflow-x: hidden;
}

html {
    scroll-behavior: smooth;
}

/* 导航栏链接样式 */
.nav-link {
    position: relative;
    transition: color 0.2s;
}

.nav-link:hover {
    color: #f8f7f9 !important;
}

.nav-link.active {
    color: #f8f7f9 !important;
}

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

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

/* 一级按钮 - 基于光标位置的光晕效果 */
.primary-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #2a2a2a, #4a4a4a, #2a2a2a);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9999px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    --mouse-x: 50%;
    --mouse-y: 50%;
}

/* 1px边框光束动画 */
.primary-btn::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 9999px;
    padding: 1px;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.5) 50%, transparent 70%);
    background-size: 200% 200%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: borderBeam 2s linear infinite;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.primary-btn:hover::after {
    opacity: 1;
}

@keyframes borderBeam {
    0% {
        background-position: -100% -100%;
    }
    100% {
        background-position: 100% 100%;
    }
}

.primary-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle 150px at var(--mouse-x) var(--mouse-y),
        rgba(255, 255, 255, 0.3),
        transparent 70%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.primary-btn:hover::before {
    opacity: 1;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.primary-btn .arrow {
    transition: transform 0.3s ease;
}

.primary-btn:hover .arrow {
    transform: translateX(4px);
}

/* 次级按钮 - Tailwind CSS风格 */
.secondary-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 500;
    color: white;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    cursor: pointer;
    overflow: hidden;
    text-decoration: none;
    transition: all 0.3s ease;
    --mouse-x: 50%;
    --mouse-y: 50%;
    backdrop-filter: blur(10px);
}

/* 划入式模糊入场动画 */
.secondary-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
    backdrop-filter: blur(10px);
}

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

/* 动态光晕效果 */
.secondary-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.2),
        transparent 70%
    );
    transform: translate(-50%, -50%) translate(calc((var(--mouse-x) - 50%) * 1px), calc((var(--mouse-y) - 50%) * 1px));
    transition: width 0.3s ease, height 0.3s ease;
    pointer-events: none;
}

.secondary-btn:hover::after {
    width: 300px;
    height: 300px;
}

/* 下划线延展效果 */
.secondary-btn .underline {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #ffffff, #a0a0a0);
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.secondary-btn:hover .underline {
    width: calc(100% - 3rem);
}

/* 箭头图标位移效果 */
.secondary-btn .arrow {
    transition: transform 0.3s ease;
    display: inline-block;
}

.secondary-btn:hover .arrow {
    transform: translateX(4px);
}

/* 悬停状态 */
.secondary-btn:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(255, 255, 255, 0.1);
}

/* 项目经历两列对齐 */
#projects .grid {
    align-items: start;
}

#projects .space-y-6 {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#projects .space-y-6 > div {
    flex: 1;
}

/* 响应式设计 */
@media (max-width: 640px) {
    nav .flex {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .nav-link {
        font-size: 12px;
        padding: 0.25rem;
    }
    
    .language-toggle {
        font-size: 12px;
        padding: 0.25rem 0.5rem;
    }
    
    h2 {
        font-size: 32px !important;
        line-height: 1.2;
    }
    
    h1 {
        font-size: 40px !important;
    }
    
    .primary-btn,
    .secondary-btn {
        width: 100%;
        justify-content: center;
        font-size: 14px;
        padding: 0.75rem 1.5rem;
    }
    
    section {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    h2 {
        font-size: 48px !important;
    }
    
    .nav-link {
        font-size: 14px;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
    background: rgba(248, 247, 249, 0.3);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(248, 247, 249, 0.5);
}

/* 滚动进入视口动画 - 不使用opacity 0 */
@keyframes fadeInUp {
    from {
        transform: translateY(30px);
        filter: blur(10px);
    }
    to {
        transform: translateY(0);
        filter: blur(0);
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-50px);
        filter: blur(10px);
    }
    to {
        transform: translateX(0);
        filter: blur(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(50px);
        filter: blur(10px);
    }
    to {
        transform: translateX(0);
        filter: blur(0);
    }
}

/* 元素进入视口动画类 */
.animate-on-scroll {
    animation: fadeInUp 0.8s ease both;
}

.animate-on-scroll-left {
    animation: slideInLeft 0.8s ease both;
}

.animate-on-scroll-right {
    animation: slideInRight 0.8s ease both;
}

/* 垂直文本裁剪滑下动画 - 逐字母 */
.text-clip-slide {
    display: inline-block;
    overflow: hidden;
}

.text-clip-slide span {
    display: inline-block;
    transform: translateY(100%);
    clip-path: inset(100% 0 0 0);
    animation: clipSlideDown 0.6s ease both;
}

@keyframes clipSlideDown {
    from {
        transform: translateY(100%);
        clip-path: inset(100% 0 0 0);
    }
    to {
        transform: translateY(0);
        clip-path: inset(0 0 0 0);
    }
}

/* H3标题逐字母动画 */
.h3-letter-animate {
    display: inline-block;
}

.h3-letter-animate span {
    display: inline-block;
    transform: translateY(20px);
    filter: blur(10px);
    animation: letterFadeUp 0.8s ease both;
}

.h3-letter-animate span:nth-child(1) { animation-delay: 0s; }
.h3-letter-animate span:nth-child(2) { animation-delay: 0.05s; }
.h3-letter-animate span:nth-child(3) { animation-delay: 0.1s; }
.h3-letter-animate span:nth-child(4) { animation-delay: 0.15s; }
.h3-letter-animate span:nth-child(5) { animation-delay: 0.2s; }
.h3-letter-animate span:nth-child(6) { animation-delay: 0.25s; }
.h3-letter-animate span:nth-child(7) { animation-delay: 0.3s; }
.h3-letter-animate span:nth-child(8) { animation-delay: 0.35s; }
.h3-letter-animate span:nth-child(9) { animation-delay: 0.4s; }
.h3-letter-animate span:nth-child(10) { animation-delay: 0.45s; }

@keyframes letterFadeUp {
    from {
        transform: translateY(20px);
        filter: blur(10px);
    }
    to {
        transform: translateY(0);
        filter: blur(0);
    }
}

/* 卡片手电筒效果 */
.card-flashlight {
    position: relative;
    overflow: hidden;
}

.card-flashlight::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle 300px at var(--flashlight-x, 50%) var(--flashlight-y, 50%),
        rgba(255, 255, 255, 0.1),
        transparent 50%
    );
    pointer-events: none;
    transition: opacity 0.3s ease;
    opacity: 0;
}

.card-flashlight:hover::before {
    opacity: 1;
}

.card-flashlight::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: radial-gradient(
        circle 200px at var(--flashlight-x, 50%) var(--flashlight-y, 50%),
        rgba(255, 255, 255, 0.3),
        transparent 60%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    transition: opacity 0.3s ease;
    opacity: 0;
}

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

/* 卡片Marquee无限循环动画 */
.card-marquee {
    position: relative;
    overflow: hidden;
}

.card-marquee::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    animation: marquee 3s linear infinite;
    mask: linear-gradient(
        90deg,
        transparent,
        rgba(0, 0, 0, 0.5),
        transparent
    );
    -webkit-mask: linear-gradient(
        90deg,
        transparent,
        rgba(0, 0, 0, 0.5),
        transparent
    );
}

@keyframes marquee {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* 响应式超大标题淡入效果 */
.hero-heading {
    font-size: clamp(2.5rem, 8vw, 6rem);
    font-weight: 900;
    line-height: 1.1;
    background: linear-gradient(to bottom, #ffffff, #a0a0a0);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 首页渐显特效 */
.hero-section {
    position: relative;
}

/* 背景科技感光球特效 */
.hero-gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0;
    animation: orbFloat 20s ease-in-out infinite;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1), transparent 70%);
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(160, 160, 160, 0.15), transparent 70%);
    bottom: 20%;
    right: 15%;
    animation-delay: 5s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.08), transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 10s;
}

@keyframes orbFloat {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.3;
    }
    25% {
        transform: translate(30px, -30px) scale(1.1);
        opacity: 0.5;
    }
    50% {
        transform: translate(-20px, 20px) scale(0.9);
        opacity: 0.4;
    }
    75% {
        transform: translate(20px, 30px) scale(1.05);
        opacity: 0.45;
    }
}

/* 网格背景特效 */
.hero-grid-pattern {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0;
    animation: gridFadeIn 2s ease 0.5s both;
    pointer-events: none;
}

@keyframes gridFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 首页内容渐显动画 */
.hero-content > * {
    opacity: 0;
    animation: heroFadeInUp 1s ease both;
}

.hero-greeting {
    animation-delay: 0.2s;
}

.hero-name {
    animation-delay: 0.4s;
}

.hero-title {
    animation-delay: 0.6s;
}

.hero-contact {
    animation-delay: 0.8s;
}

.hero-buttons {
    animation-delay: 1s;
}

.hero-image {
    opacity: 0;
    animation: heroFadeInScale 1.2s ease 0.6s both;
}

.hero-image-wrapper {
    position: relative;
    overflow: visible;
}

.hero-img {
    animation: heroImageReveal 1.5s ease 0.8s both;
}

.hero-image-glow {
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1), transparent 70%);
    opacity: 0;
    animation: glowPulse 3s ease-in-out 1.5s infinite;
    pointer-events: none;
}

@keyframes heroFadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
        filter: blur(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

@keyframes heroFadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9) translateX(30px);
        filter: blur(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateX(0);
        filter: blur(0);
    }
}

@keyframes heroImageReveal {
    from {
        opacity: 0;
        transform: scale(1.1);
        filter: blur(20px) brightness(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
        filter: blur(0) brightness(1);
    }
}

@keyframes glowPulse {
    0%, 100% {
        opacity: 0;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.05);
    }
}

@keyframes fadeTextIn {
    from {
        filter: blur(20px);
        transform: translateY(20px);
    }
    to {
        filter: blur(0);
        transform: translateY(0);
    }
}

/* 数字计数动画 */
.count-up {
    font-variant-numeric: tabular-nums;
}

/* 水平滚动Ticker */
.ticker-container {
    position: relative;
    overflow: hidden;
    mask-image: linear-gradient(
        to right,
        transparent,
        black 10%,
        black 90%,
        transparent
    );
    -webkit-mask-image: linear-gradient(
        to right,
        transparent,
        black 10%,
        black 90%,
        transparent
    );
}

.ticker {
    display: flex;
    gap: 4rem;
    animation: tickerScroll 30s linear infinite;
    will-change: transform;
}

.ticker-container:hover .ticker {
    animation-play-state: paused;
}

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

.experience-item.hidden {
    display: none;
}

.experience-item.show {
    display: block;
    animation: fadeInUp 0.5s ease both;
}

/* 图片优化 */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* 社媒图标样式 - 去除白色背景 */
#social img[src*="小红书.png"],
#social img[src*="抖音.png"] {
    object-fit: cover;
    transform: scale(1.5);
    width: 100%;
    height: 100%;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* 手机端优化样式 */
@media (max-width: 768px) {
    /* 导航栏优化 - 更细的导航栏 */
    nav {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
        min-height: 3rem;
    }
    
    nav .max-w-7xl {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    nav .text-lg {
        font-size: 1rem;
        line-height: 1.5rem;
    }
    
    #mobile-menu {
        animation: slideDown 0.3s ease-out;
        margin-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    #mobile-menu.hidden {
        display: none;
    }
    
    .nav-link {
        font-size: 0.875rem;
        padding: 0.5rem 0.5rem;
    }
    
    .language-toggle {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
    
    /* 汉堡菜单按钮优化 */
    #mobile-menu-toggle {
        padding: 0.375rem;
    }
    
    #mobile-menu-toggle svg {
        width: 1.25rem;
        height: 1.25rem;
    }
    
    /* Hero Section 手机端优化 - 增加顶部间距 */
    #home {
        padding-top: 5rem;
    }
    
    #home .hero-content {
        margin-top: 0.5rem;
    }
    
    /* 确保所有容器宽度为100% */
    .max-w-7xl {
        max-width: 100%;
        width: 100%;
    }
    
    /* 确保图片不超出屏幕宽度 */
    img {
        max-width: 100%;
        height: auto;
        width: auto;
        display: block;
    }
    
    /* 确保所有图片容器不超出 */
    .hero-image-wrapper,
    .hero-image,
    .social-icon-img {
        max-width: 100%;
        overflow: hidden;
    }
    
    /* 确保所有section的padding适配 */
    section {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* 确保grid容器不超出 */
    .grid {
        width: 100%;
        max-width: 100%;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 640px) {
    /* Hero Section 优化 - 向下移动文字避免被导航栏遮挡 */
    #home {
        padding-top: 5rem;
        padding-bottom: 4rem;
        min-height: auto;
    }
    
    /* 给hero内容添加额外的上边距，确保文字不被遮挡 */
    #home .hero-content {
        margin-top: 1rem;
    }
    
    #home .grid {
        gap: 2rem;
    }
    
    .hero-heading {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero-greeting {
        font-size: 1.125rem;
    }
    
    /* 确保导航栏更细 */
    nav {
        min-height: 2.75rem;
    }
    
    nav .max-w-7xl {
        padding-top: 0.375rem;
        padding-bottom: 0.375rem;
    }
    
    nav .text-lg {
        font-size: 0.9375rem;
    }
    
    /* 按钮优化 */
    .primary-btn {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
        width: 100%;
        justify-content: center;
    }
    
    .secondary-btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.875rem;
        width: 100%;
    }
    
    /* 卡片优化 */
    .card-flashlight {
        padding: 1.25rem;
    }
    
    /* 标题优化 */
    h2 {
        font-size: 1.875rem;
        margin-bottom: 2rem;
    }
    
    h3 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    /* 关于我部分优化 */
    #about .grid {
        gap: 1rem;
    }
    
    #about .card-flashlight {
        padding: 1.25rem;
    }
    
    /* 工作经历优化 */
    #experience .card-flashlight {
        padding: 1.25rem;
    }
    
    #experience h4 {
        font-size: 1.125rem;
        margin-bottom: 0.75rem;
    }
    
    /* 项目经历优化 */
    #projects .grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    #projects .card-flashlight {
        padding: 1.25rem;
    }
    
    #projects .grid.grid-cols-2 {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    /* 个人社媒优化 */
    #social .grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    #social .card-flashlight {
        padding: 1.25rem;
    }
    
    #social .grid.grid-cols-2 {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    /* 联系方式优化 */
    #contacts .grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    #contacts .card-flashlight {
        padding: 1.25rem;
    }
    
    /* 文字大小优化 */
    p {
        font-size: 0.875rem;
        line-height: 1.6;
    }
    
    .text-sm {
        font-size: 0.8125rem;
    }
    
    /* 间距优化 */
    section {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }
    
    .space-y-8 > * + * {
        margin-top: 1.5rem;
    }
    
    .space-y-6 > * + * {
        margin-top: 1.25rem;
    }
    
    .space-y-4 > * + * {
        margin-top: 1rem;
    }
    
    /* 项目结果网格优化 */
    #projects .bg-black\/30 .grid {
        grid-template-columns: 1fr;
    }
    
    /* 标签优化 */
    .rounded-full {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }
}
