/* ==================== 动画关键帧 ==================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 213, 135, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 213, 135, 0.8);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* ==================== 动画类 ==================== */

.fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

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

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

.slide-in-right {
    animation: slideInRight 0.8s ease-out forwards;
}

/* ==================== 自定义光标 ==================== */

.custom-cursor {
    position: fixed;
    width: 40px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.cursor-dot {
    position: fixed;
    width: 8px;
    height: 8px;
    background-color: #ffd587;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    transform: translate(-50%, -50%);
}

/* 在移动设备上隐藏自定义光标 */
@media (max-width: 768px) {
    .custom-cursor,
    .cursor-dot {
        display: none;
    }
}

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

.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #ffd587, #ffb347);
    color: #232739;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 213, 135, 0.4);
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(255, 213, 135, 0.6);
}

.back-to-top:active {
    transform: translateY(-2px);
}

/* ==================== 增强的卡片效果 ==================== */

.paper-card,
.container blockquote {
    position: relative;
    overflow: hidden;
}

.paper-card::before,
.container blockquote::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;
}

.paper-card:hover::before,
.container blockquote:hover::before {
    left: 100%;
}

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

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffd587;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==================== 文字渐变效果 ==================== */

.gradient-text {
    background: linear-gradient(135deg, #ffd587, #ffb347, #ff8c42);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s linear infinite;
    background-size: 200% auto;
}

/* ==================== 悬停发光效果 ==================== */

.glow-on-hover {
    transition: all 0.3s ease;
}

.glow-on-hover:hover {
    animation: glow 1.5s ease-in-out infinite;
}

/* ==================== 图片悬停效果 ==================== */

img {
    transition: transform 0.3s ease, filter 0.3s ease;
}

img:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* ==================== 链接下划线动画 ==================== */

.animated-link {
    position: relative;
    text-decoration: none;
}

.animated-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #ffd587;
    transition: width 0.3s ease;
}

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

/* ==================== 按钮波纹效果 ==================== */

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

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}

/* ==================== 响应式菜单动画 ==================== */

.menu-toggle {
    display: none;
    background: transparent;
    border: 2px solid #ffd587;
    color: #ffd587;
    font-size: 24px;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.menu-toggle:hover {
    background: rgba(255, 213, 135, 0.2);
    transform: rotate(90deg);
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
        position: fixed;
        top: 20px;
        right: 20px;
        z-index: 1001;
    }

    header nav ul {
        position: fixed;
        top: 0;
        right: -100%;
        width: 70%;
        height: 100vh;
        background: rgba(35, 39, 57, 0.98);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transition: right 0.4s ease;
        backdrop-filter: blur(10px);
    }

    header nav ul.show {
        right: 0;
    }

    header nav li {
        margin: 20px 0;
        opacity: 0;
        transform: translateX(50px);
    }

    header nav ul.show li {
        animation: slideInRight 0.5s ease forwards;
    }

    header nav ul.show li:nth-child(1) {
        animation-delay: 0.1s;
    }

    header nav ul.show li:nth-child(2) {
        animation-delay: 0.2s;
    }

    header nav ul.show li:nth-child(3) {
        animation-delay: 0.3s;
    }

    header nav ul.show li:nth-child(4) {
        animation-delay: 0.4s;
    }
}

/* ==================== 滚动条美化 ==================== */

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(35, 39, 57, 0.5);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #ffd587, #ffb347);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #ffb347, #ff8c42);
}

/* ==================== 页面过渡效果 ==================== */

body {
    transition: opacity 0.3s ease;
}

/* ==================== 表单元素美化 ==================== */

input,
textarea,
select {
    transition: all 0.3s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #ffd587;
    box-shadow: 0 0 10px rgba(255, 213, 135, 0.3);
}

/* ==================== 工具提示动画 ==================== */

.tooltip {
    position: relative;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    padding: 8px 12px;
    background: rgba(35, 39, 57, 0.95);
    color: #ffd587;
    border-radius: 5px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-size: 14px;
}

.tooltip:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}

/* ==================== 进度条动画 ==================== */

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
}

.progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #ffd587, #ffb347);
    width: 0;
    transition: width 0.3s ease;
}

/* ==================== 卡片翻转效果 ==================== */

.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* ==================== 打字机光标 ==================== */

.typing-cursor::after {
    content: '|';
    animation: blink 1s step-end infinite;
}

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

/* ==================== 悬浮动画 ==================== */

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

/* ==================== 脉冲动画 ==================== */

.pulse-animation {
    animation: pulse 2s ease-in-out infinite;
}
