/* ==========================================================================
   Blog Base Styles
   ========================================================================== */

:root {
    --color-primary: #3b82f6;
    --color-primary-dark: #2563eb;
    --color-primary-light: #dbeafe;
    --color-text: #1e293b;
    --color-text-secondary: #64748b;
    --color-bg: #ffffff;
    --color-bg-alt: #f8fafc;
    --color-bg-dark: #0f172a;
    --color-border: #e2e8f0;
    --color-code-bg: #1e293b;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--color-primary-dark);
}

img {
    max-width: 100%;
    display: block;
}

/* ==========================================================================
   Page Load Animation
   ========================================================================== */

body {
    animation: fadeInPage 0.6s ease-out both;
}

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

/* ==========================================================================
   Scroll Reveal
   ========================================================================== */

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

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

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

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

.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    padding: 0 2rem;
}

.navbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand .icon {
    font-size: 1.5rem;
}

.navbar-nav {
    display: flex;
    list-style: none;
    gap: 0.25rem;
}

.navbar-nav a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--color-text-secondary);
    font-weight: 500;
    font-size: 0.9375rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    position: relative;
}

.navbar-nav a:hover,
.navbar-nav a.active {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.navbar-nav a.active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--color-primary);
    border-radius: 2px;
}

/* Mobile menu toggle */
.navbar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.navbar-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-text);
    margin: 5px 0;
    transition: var(--transition);
    border-radius: 2px;
}

/* ==========================================================================
   Container
   ========================================================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.container-narrow {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
}

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

.hero {
    padding: 6rem 0 4rem;
    text-align: center;
    background: linear-gradient(135deg, var(--color-bg-alt) 0%, var(--color-primary-light) 100%);
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 800;
    color: var(--color-text);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero h1 .highlight {
    color: var(--color-primary);
}

.hero p {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    color: var(--color-text-secondary);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    background: var(--color-primary);
    color: #fff;
    font-weight: 600;
    border-radius: 50px;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

.hero-cta:hover {
    background: var(--color-primary-dark);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

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

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2rem;
    padding: 3rem 0;
}

.card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 2rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--color-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
    border-color: transparent;
}

.card:hover::before {
    transform: scaleX(1);
}

.card-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50px;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.card p {
    color: var(--color-text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 1.25rem;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}

.card-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ==========================================================================
   Stats Section
   ========================================================================== */

.stats {
    padding: 4rem 0;
    background: var(--color-bg-alt);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    text-align: center;
}

.stat-item {
    padding: 1.5rem;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--color-primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
    font-weight: 500;
}

/* ==========================================================================
   Article Content
   ========================================================================== */

.article-header {
    padding: 4rem 0 2rem;
}

.article-header .card-tag {
    margin-bottom: 1rem;
}

.article-header h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 1rem;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

.article-body {
    padding: 2rem 0 4rem;
}

.article-body h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 2.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-border);
    color: var(--color-text);
}

.article-body h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 2rem 0 0.75rem;
    color: var(--color-text);
}

.article-body p {
    margin-bottom: 1.25rem;
    color: var(--color-text);
    line-height: 1.8;
}

.article-body ul, .article-body ol {
    margin: 0 0 1.25rem 1.5rem;
    line-height: 1.8;
}

.article-body li {
    margin-bottom: 0.5rem;
}

.article-body strong {
    font-weight: 600;
    color: var(--color-text);
}

/* ==========================================================================
   Code Blocks
   ========================================================================== */

.article-body code {
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.875em;
}

.article-body p code,
.article-body li code {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    padding: 0.15em 0.4em;
    border-radius: 4px;
}

.article-body pre {
    background: var(--color-code-bg);
    color: #e2e8f0;
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 1.5rem 0;
    line-height: 1.6;
    position: relative;
}

.article-body pre code {
    color: inherit;
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: 0.8125rem;
}

.article-body pre .keyword { color: #c084fc; }
.article-body pre .string { color: #86efac; }
.article-body pre .comment { color: #64748b; font-style: italic; }
.article-body pre .annotation { color: #fbbf24; }
.article-body pre .type { color: #67e8f9; }
.article-body pre .method { color: #93c5fd; }
.article-body pre .number { color: #fb923c; }
.article-body pre .sql-keyword { color: #c084fc; }

/* ==========================================================================
   Section Titles
   ========================================================================== */

.section-title {
    text-align: center;
    padding: 3rem 0 2rem;
}

.section-title h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.section-title p {
    color: var(--color-text-secondary);
    font-size: 1.0625rem;
}

.section-title .accent-bar {
    width: 60px;
    height: 4px;
    background: var(--color-primary);
    border-radius: 2px;
    margin: 1rem auto 0;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
    background: var(--color-bg-dark);
    color: #94a3b8;
    padding: 3rem 0;
    text-align: center;
    font-size: 0.875rem;
}

.footer a {
    color: var(--color-primary);
}

.footer p + p {
    margin-top: 0.5rem;
}

/* ==========================================================================
   About Page
   ========================================================================== */

.about-hero {
    display: flex;
    align-items: center;
    gap: 3rem;
    padding: 4rem 0;
}

.about-avatar {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.3);
}

.about-content h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.about-content .tagline {
    color: var(--color-primary);
    font-weight: 600;
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.about-content p {
    color: var(--color-text-secondary);
    line-height: 1.8;
    margin-bottom: 1rem;
}

/* Skills */
.skills-section {
    padding: 2rem 0 4rem;
}

.skills-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-align: center;
}

.skill-item {
    margin-bottom: 1.25rem;
}

.skill-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9375rem;
}

.skill-bar {
    height: 10px;
    background: var(--color-border);
    border-radius: 5px;
    overflow: hidden;
}

.skill-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), #8b5cf6);
    border-radius: 5px;
    width: 0;
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Contact */
.contact-section {
    padding: 2rem 0 4rem;
}

.contact-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.contact-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--color-bg-alt);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    transition: var(--transition);
}

.contact-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary);
}

.contact-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--color-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.contact-card h4 {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.contact-card a, .contact-card p {
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

/* ==========================================================================
   Archives Page
   ========================================================================== */

.archive-list {
    padding: 2rem 0 4rem;
}

.archive-item {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-border);
    transition: var(--transition);
}

.archive-item:hover {
    background: var(--color-bg-alt);
}

.archive-date {
    min-width: 100px;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    font-weight: 500;
    padding-top: 0.125rem;
}

.archive-info {
    flex: 1;
}

.archive-info h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
}

.archive-info h3 a {
    color: var(--color-text);
}

.archive-info h3 a:hover {
    color: var(--color-primary);
}

.archive-tag {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50px;
}

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

@media (max-width: 768px) {
    .navbar-toggle {
        display: block;
    }

    .navbar-nav {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--color-bg);
        flex-direction: column;
        padding: 1rem;
        border-bottom: 1px solid var(--color-border);
        box-shadow: var(--shadow-lg);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: var(--transition);
    }

    .navbar-nav.open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .hero {
        padding: 4rem 0 3rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .about-hero {
        flex-direction: column;
        text-align: center;
        padding: 2rem 0;
    }

    .archive-item {
        flex-direction: column;
        gap: 0.5rem;
    }

    .article-meta {
        gap: 0.75rem;
    }

    .container, .container-narrow {
        padding: 0 1.25rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .stat-number {
        font-size: 2rem;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }
}
