/* Custom styles for personal website */

:root {
    --primary-color: #3b82f6;
    --bg-dark: #000000;
    --bg-light: #f5f5f5;
    --card-bg-dark: rgba(10, 10, 10, 0.7);
    --card-bg-light: rgba(255, 255, 255, 0.7);
    --text-primary: #f5f5f5;
    --text-secondary: #a3a3a3;
    --border-color: #262626;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleRotate {
    from {
        opacity: 0;
        transform: scale(0.4) rotate(90deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes cardSlideIn {
    from {
        transform: translateY(200px) scale(0);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

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

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

/* Utility classes */
.animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

.animate-scale-rotate {
    animation: scaleRotate 1s ease-out forwards;
}

.animate-card-slide {
    animation: cardSlideIn 0.6s ease-out forwards;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* Delay utilities */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.delay-900 { animation-delay: 0.9s; }

/* Social link effects */
.social-link {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: inline-block;
    position: relative;
    z-index: 100;
}

.social-link:hover {
    transform: scale(1.2) translateY(-5px);
    color: var(--primary-color);
    filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.5));
    z-index: 999999;
}

/* Custom Tooltip Styling - 参考图片样式 */
.social-link[title]::before {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: rgba(255, 255, 255, 0.98);
    color: #333;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    z-index: 999999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    isolation: isolate;
}

.social-link[title]:hover::before {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.social-link[title]::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    border: 6px solid transparent;
    border-top-color: rgba(255, 255, 255, 0.98);
    z-index: 999998;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    isolation: isolate;
}

.social-link[title]:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

html.dark .social-link[title]::before {
    background: rgba(50, 50, 50, 0.95);
    color: #f5f5f5;
}

html.dark .social-link[title]::after {
    border-top-color: rgba(50, 50, 50, 0.95);
}

.social-link:active {
    transform: scale(1.1);
}

/* Avatar Tooltip - 与social-link样式一致 */
.avatar-wrapper[title]::before {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: rgba(255, 255, 255, 0.98);
    color: #333;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    z-index: 999999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    isolation: isolate;
}

.avatar-wrapper[title]:hover::before {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.avatar-wrapper[title]::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    border: 6px solid transparent;
    border-top-color: rgba(255, 255, 255, 0.98);
    z-index: 999998;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    isolation: isolate;
}

.avatar-wrapper[title]:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

html.dark .avatar-wrapper[title]::before {
    background: rgba(50, 50, 50, 0.95);
    color: #f5f5f5;
}

html.dark .avatar-wrapper[title]::after {
    border-top-color: rgba(50, 50, 50, 0.95);
}

/* Background effects */
.bg-parallax {
    transition: transform 0.15s ease-out;
    will-change: transform;
}

.card-container {
    transition: transform 0.15s ease-out;
    will-change: transform;
}

/* Glassmorphism effect */
.glass-card {
    background: var(--card-bg-dark);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: all 0.5s ease;
}

/* Light mode - 亮色模式 (卡片和背景都变亮) */
html:not(.dark) .glass-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}

html:not(.dark) body {
    background-color: var(--bg-light);
}

html:not(.dark) #bg-image {
    filter: brightness(0.7) !important;
}

/* Dark mode - 暗色模式 */
html.dark .glass-card {
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

html.dark body {
    background-color: var(--bg-dark);
}

html.dark #bg-image {
    filter: brightness(0.15) !important;
}

/* Body transition */
body {
    transition: background-color 0.5s ease;
}

/* Avatar glow effect */
.avatar-glow {
    position: relative;
}

.avatar-glow::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: linear-gradient(45deg, #3b82f6, #8b5cf6, #ec4899);
    border-radius: 50%;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: pulse 2s ease-in-out infinite;
}

.avatar-glow:hover::after {
    opacity: 0.7;
}

/* Text gradient effect */
.text-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, #262626 25%, #404040 50%, #262626 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

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

/* Responsive utilities */
@media (max-width: 768px) {
    .social-link svg {
        width: 24px;
        height: 24px;
    }
}

/* Accessibility */
.social-link:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 4px;
}

/* Smooth scrolling for any future content */
html {
    scroll-behavior: smooth;
}

/* Dark mode specific adjustments */
@media (prefers-color-scheme: dark) {
    body {
        background-color: var(--bg-dark);
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
