/* ===================================
   SuperDesign Personal Site Styles
   Modern Dark Mode with Advanced Animations
   =================================== */

/* CSS Variables */
:root {
    /* Colors - OKLCH for modern color management */
    --background: oklch(0.145 0 0);
    --foreground: oklch(0.985 0 0);
    --primary: oklch(0.7 0.15 250);
    --secondary: oklch(0.8 0.12 180);
    --accent: oklch(0.75 0.18 320);
    --muted: oklch(0.3 0 0);
    --muted-foreground: oklch(0.65 0 0);
    --border: oklch(0.25 0 0);
    
    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Spacing */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slower: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: var(--font-sans);
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Selection */
::selection {
    background-color: var(--primary);
    color: var(--foreground);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--muted);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--muted-foreground);
}

/* ===================================
   Animations & Keyframes
   =================================== */

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

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

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

@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 scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

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

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

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px var(--primary);
    }
    50% {
        box-shadow: 0 0 40px var(--primary), 0 0 60px var(--accent);
    }
}

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

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn var(--transition-slower) ease-out forwards;
    opacity: 0;
    animation-delay: var(--delay, 0s);
}

.animate-slide-up {
    animation: slideUp var(--transition-slower) ease-out forwards;
    opacity: 0;
    animation-delay: var(--delay, 0s);
}

.animate-blink {
    animation: blink 1s step-end infinite;
}

/* ===================================
   Gradient Text
   =================================== */

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--accent), var(--secondary));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 5s ease infinite;
}

/* ===================================
   Buttons
   =================================== */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: var(--foreground);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left var(--transition-slow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px -10px var(--primary);
}

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

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    background: transparent;
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
}

.btn-secondary:hover {
    background: var(--muted);
    border-color: var(--muted-foreground);
    transform: translateY(-2px);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--foreground);
    transition: all var(--transition-base);
    text-decoration: none;
}

.btn-icon:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: scale(1.1);
}

/* ===================================
   Navigation
   =================================== */

#navbar {
    background: rgba(23, 23, 23, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid transparent;
}

#navbar.scrolled {
    background: rgba(23, 23, 23, 0.95);
    border-bottom-color: var(--border);
}

.nav-link {
    color: var(--muted-foreground);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all var(--transition-base);
    position: relative;
}

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

.nav-link:hover {
    color: var(--foreground);
}

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

/* ===================================
   Hero Section
   =================================== */

#hero {
    position: relative;
}

.grid-bg {
    background-image: 
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 50px 50px;
    }
}

.floating-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.3;
    animation: float 6s ease-in-out infinite;
}

.shape-1 {
    width: 300px;
    height: 300px;
    background: var(--primary);
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.shape-2 {
    width: 200px;
    height: 200px;
    background: var(--accent);
    bottom: 20%;
    right: 10%;
    animation-delay: 2s;
}

.shape-3 {
    width: 150px;
    height: 150px;
    background: var(--secondary);
    top: 50%;
    right: 30%;
    animation-delay: 4s;
}

.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--muted);
    color: var(--muted-foreground);
    transition: all var(--transition-base);
}

.social-icon:hover {
    background: var(--primary);
    color: var(--foreground);
    transform: translateY(-4px) scale(1.1);
}

/* ===================================
   Skills Section
   =================================== */

.skill-item {
    transition: transform var(--transition-base);
}

.skill-item:hover {
    transform: translateX(10px);
}

.skill-bar {
    width: 0;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 999px;
    position: relative;
    overflow: hidden;
}

.skill-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255,255,255,0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

.skill-tag {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-base);
    cursor: default;
}

.skill-tag:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px -4px var(--primary);
}

/* ===================================
   About Image 3D Tilt
   =================================== */

.about-image-tilt {
    transform-style: preserve-3d;
    transform: perspective(1000px) rotateX(0deg) rotateY(0deg) translateY(0);
    will-change: transform;
    transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.about-image-tilt:hover {
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.5);
}

.about-avatar-image {
    /* Light enhancement to improve perceived sharpness. */
    image-rendering: -webkit-optimize-contrast;
    filter: contrast(1.08) saturate(1.06) brightness(1.02);
}

.csdn-icon-image {
    image-rendering: -webkit-optimize-contrast;
}

/* ===================================
   Project Cards
   =================================== */

.project-card {
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    transform-style: preserve-3d;
    transform: perspective(1000px) rotateX(0deg) rotateY(0deg) translateY(0);
    will-change: transform;
}

.project-card:hover {
    border-color: var(--primary);
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.5);
}


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

.card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    opacity: 0;
    transition: opacity var(--transition-slow);
}

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

.tech-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary);
    color: var(--foreground);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Project triple sections: 责任/技术/结果 */
.project-triple {
    margin: 1rem 0 1rem;
    padding: 1rem;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.project-triple-item + .project-triple-item {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.project-triple-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--foreground);
    opacity: 0.95;
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.project-triple-list {
    list-style: none;
    margin: 0;
    padding: 0;
    color: var(--muted-foreground);
    font-size: 0.85rem;
    line-height: 1.55;
}

.project-triple-list li {
    position: relative;
    padding-left: 1rem;
}

.project-triple-list li + li {
    margin-top: 0.35rem;
}

.project-triple-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.65em;
    width: 0.35rem;
    height: 0.35rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
}

.project-triple-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.mini-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--foreground);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Contact action buttons */
.contact-actions .contact-action-btn {
    justify-content: center;
    width: 100%;
    font-size: 0.9rem;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 9rem;
}

@media (min-width: 640px) {
    .contact-actions {
        flex-wrap: wrap;
    }

    .contact-actions .contact-action-btn {
        width: auto;
    }
}

/* Toast */
.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(23, 23, 23, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(14px);
    color: var(--foreground);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: calc(100vw - 48px);
}

.toast.hide {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
    transition: opacity var(--transition-base), transform var(--transition-base);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    transition: opacity var(--transition-base), transform var(--transition-base);
}

/* ===================================
   Timeline (Experience)
   =================================== */

.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--primary), var(--accent));
    border-radius: 999px;
}

.timeline-item {
    position: relative;
    padding-bottom: 3rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -2rem;
    top: 0;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid var(--background);
    transform: translateX(-50%);
    box-shadow: 0 0 0 3px var(--primary);
}

.timeline-content {
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all var(--transition-base);
}

.timeline-content:hover {
    border-color: var(--primary);
    transform: translateX(10px);
}

/* ===================================
   Contact Form
   =================================== */

.input-field {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--foreground);
    font-family: var(--font-sans);
    font-size: 1rem;
    transition: all var(--transition-base);
}

.input-field::placeholder {
    color: var(--muted-foreground);
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.input-field:hover:not(:focus) {
    border-color: var(--muted-foreground);
}

/* ===================================
   Cursor Glow Effect
   =================================== */

#cursor-glow {
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    transition: transform 100ms ease-out;
    will-change: transform;
}

/* ===================================
   Starlight Particle Effect (保留的星光效果)
   =================================== */

.starlight-particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.starlight-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: white;
    border-radius: 50%;
    opacity: 0;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    animation: starlightRise 15s ease-in-out infinite;
}

@keyframes starlightRise {
    0% {
        opacity: 0;
        transform: translateY(100vh) scale(0);
    }
    10% {
        opacity: 1;
        transform: translateY(100vh) scale(1);
    }
    90% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(0.5);
    }
}

/* ===================================
   Responsive Design
   =================================== */

@media (max-width: 768px) {
    html {
        scroll-padding-top: 60px;
    }
    
    .gradient-text {
        font-size: 0.9em;
    }
    
    .timeline {
        padding-left: 1.5rem;
    }
    
    .timeline-marker {
        left: -1.5rem;
    }
}

/* ===================================
   Utility Classes
   =================================== */

.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glass {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Smooth reveal on scroll */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}
