:root {
    --primary: #4a90e2;
    --primary-hover: #357abd;
    --bg-color: #eef2f5;
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.8);
    --shadow-color: rgba(0, 0, 0, 0.05);
}

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

body, html {
    width: 100%;
    height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-color);
    background-image: url('bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text-main);
    overflow-x: hidden;
    line-height: 1.6;
}

/* Rain Canvas */
#rain-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* Depth Overlay / Fog Effect */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 增加更浓郁的白色雾气渐变 */
    background: radial-gradient(ellipse at top, rgba(255, 255, 255, 0.4) 0%, rgba(238, 242, 245, 0.6) 100%);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 0;
    pointer-events: none;
}

/* Main Layout */
.content-container {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation */
.glass-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    border-radius: 100px;
    margin-bottom: 3rem;
    box-shadow: 0 4px 20px var(--shadow-color);
    position: relative;
    overflow: hidden;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 0.05em;
    z-index: 1;
}

nav {
    display: flex;
    gap: 2rem;
    z-index: 1;
}

.nav-link {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

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

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

/* Blog Layout */
.blog-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    flex: 1;
}

.section-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--text-main);
    font-weight: 800;
}

/* Glass Card Common */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px var(--shadow-color);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
    position: relative;
    overflow: hidden;
}

/* Interactive Spotlight Hover Effect adapted for light mode */
.glass-card::before, .glass-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 255, 255, 0.9), transparent 40%);
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 0;
}

.glass-card:hover::before, .glass-nav:hover::before {
    opacity: 1;
}

.is-mobile .glass-card::before, .is-mobile .glass-nav::before {
    display: none !important;
}

.glass-card > * {
    position: relative;
    z-index: 1;
}

.glass-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.08);
}

/* Article Card */
.article-card h3 {
    font-size: 1.6rem;
    margin: 0.5rem 0 1rem;
    color: var(--text-main);
}

.article-date {
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 600;
}

.article-card p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.read-more {
    display: inline-block;
    text-decoration: none;
    color: var(--primary);
    font-weight: 600;
    transition: all 0.3s ease;
    padding: 0.5rem 1.2rem;
    background: rgba(74, 144, 226, 0.1);
    border-radius: 50px;
}

.read-more:hover {
    background: var(--primary);
    color: white;
    transform: translateX(5px);
}

/* Sidebar */
.author-card {
    text-align: center;
}

.avatar {
    width: 80px;
    height: 80px;
    background: rgba(74, 144, 226, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 1.5rem;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.author-bio {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

.tags-card h3 {
    margin-bottom: 1.5rem;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--glass-border);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    color: var(--text-main);
    transition: all 0.3s ease;
    cursor: pointer;
}

.tag:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: auto;
}

/* Animations */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 1s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.3s; }
.delay-3 { animation-delay: 0.5s; }

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

@media (max-width: 900px) {
    .blog-layout {
        grid-template-columns: 1fr;
    }
    nav {
        display: none;
    }
}

/* --- Aurora Gradients & Effects --- */
.aurora-text {
    background: linear-gradient(135deg, #4a90e2 0%, #9b51e0 50%, #43e97b 100%);
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: auroraShine 5s linear infinite;
    font-weight: 800;
}

@keyframes auroraShine {
    to { background-position: 200% center; }
}

/* --- Cinematic Reveal Animations --- */
.reveal {
    opacity: 0;
    transform: translateY(50px) scale(0.95) rotateX(5deg);
    transition: all 0.8s cubic-bezier(0.19, 1, 0.22, 1);
    transform-style: preserve-3d;
    perspective: 1000px;
}

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

/* --- Article Drawer (Read Full Article) --- */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.drawer-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.article-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 70%;
    max-width: 900px;
    height: 100%;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.7);
    border-left: 1px solid var(--glass-border);
    border-radius: 30px 0 0 30px;
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.6s ease;
    overflow-y: auto;
    padding: 4rem 3rem;
    box-shadow: -15px 0 40px rgba(0, 0, 0, 0.1);
}

.article-drawer.active {
    transform: translateX(0);
    opacity: 1;
    pointer-events: all;
}

.drawer-close {
    position: absolute;
    top: 2rem;
    left: 2rem;
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.8);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.drawer-close:hover {
    color: var(--primary);
    transform: rotate(90deg) scale(1.1);
    background: #fff;
    box-shadow: 0 8px 25px rgba(74, 144, 226, 0.2);
}

/* Drawer Inner Components */
.drawer-content {
    position: relative;
    /* Removed the global opacity transition to allow child staggered animations */
}

/* Staggered Animation for Drawer Children */
.full-article > * {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}

.article-drawer.active .full-article > * {
    opacity: 1;
    transform: translateY(0);
}

.article-drawer.active .full-article > *:nth-child(1) { transition-delay: 0.1s; }
.article-drawer.active .full-article > *:nth-child(2) { transition-delay: 0.15s; }
.article-drawer.active .full-article > *:nth-child(3) { transition-delay: 0.2s; }
.article-drawer.active .full-article > *:nth-child(4) { transition-delay: 0.25s; }
.article-drawer.active .full-article > *:nth-child(5) { transition-delay: 0.3s; }
.article-drawer.active .full-article > *:nth-child(6) { transition-delay: 0.35s; }
.article-drawer.active .full-article > *:nth-child(7) { transition-delay: 0.4s; }
.article-drawer.active .full-article > *:nth-child(8) { transition-delay: 0.45s; }

.drawer-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.drawer-content p {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

.drawer-content .timeline {
    border-left: 3px solid var(--primary);
    padding-left: 1.5rem;
    margin: 2rem 0 2rem 10px;
}

.drawer-content .timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.drawer-content .timeline-item::before {
    content: '';
    position: absolute;
    left: -1.95rem;
    top: 6px;
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(74, 144, 226, 0.5);
}

.drawer-content pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1.5rem;
    border-radius: 12px;
    overflow-x: auto;
    font-family: 'Consolas', monospace;
    margin-bottom: 2rem;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.drawer-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 1.5rem 2rem;
    background: rgba(74, 144, 226, 0.08);
    border-radius: 0 16px 16px 0;
    font-style: italic;
    margin-bottom: 2rem;
    color: var(--text-main);
    font-size: 1.15rem;
}

/* Custom Scrollbar for Drawer */
.article-drawer::-webkit-scrollbar {
    width: 8px;
}
.article-drawer::-webkit-scrollbar-track {
    background: transparent;
}
.article-drawer::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
}
.article-drawer::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.2);
}

/* Article Meta Info */
.article-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.badge {
    padding: 4px 14px;
    border-radius: 50px;
    background: rgba(74, 144, 226, 0.15);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Code Highlight Fake Classes */
.kw { color: #c678dd; } /* keyword */
.str { color: #98c379; } /* string */
.fn { color: #61afef; } /* function */
.cm { color: #7f848e; font-style: italic; } /* comment */

@media (max-width: 768px) {
    .article-drawer {
        width: 100%;
        border-radius: 0;
        padding: 4rem 1.5rem;
    }
}

/* Mobile UA Specific Bottom Sheet */
.is-mobile .article-drawer {
    width: 100%;
    height: 85vh;
    top: auto;
    bottom: 0;
    right: 0;
    transform: translateY(100%);
    border-radius: 30px 30px 0 0;
    border-left: none;
    border-top: 1px solid var(--glass-border);
    padding: 3.5rem 1.5rem 2rem;
}

.is-mobile .article-drawer.active {
    transform: translateY(0);
}

.is-mobile .drawer-close {
    top: 1rem;
    left: auto;
    right: 1.5rem;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
}

/* Add a pull-down handle for mobile */
.is-mobile .article-drawer::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 6px;
    background: rgba(0,0,0,0.15);
    border-radius: 10px;
}

/* Adjust background position for mobile to show the character (who is on the right side of the image) */
body.is-mobile {
    background-position: 80% center;
}
