/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Custom Properties for Theming */
:root {
    /* Light Mode Colors */
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f9fafb;
    --bg-card: #ffffff;
    --bg-button: #f3f4f6;
    --bg-button-hover: #2563eb;
    --bg-header: #ffffff;
    --bg-footer: #1f2937;
    
    --text-primary: #333333;
    --text-secondary: #4b5563;
    --text-tertiary: #6b7280;
    --text-heading: #1f2937;
    --text-button: #374151;
    --text-button-hover: #ffffff;
    
    --accent-primary: #2563eb;
    --accent-primary-hover: #1d4ed8;
    --accent-secondary: #fbbf24;
    
    --border-color: #e5e7eb;
    --shadow-sm: rgba(0, 0, 0, 0.05);
    --shadow-md: rgba(0, 0, 0, 0.1);
    
    --gradient-hero: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-featured: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    
    --icon-bg: rgba(37, 99, 235, 0.1);
    --tag-bg: #e0e7ff;
    --tag-text: #3730a3;
}

[data-theme="dark"] {
    /* Dark Mode Colors */
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #111827;
    --bg-card: #1f2937;
    --bg-button: #374151;
    --bg-button-hover: #7c3aed;
    --bg-header: #1f2937;
    --bg-footer: #0f172a;
    
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-tertiary: #9ca3af;
    --text-heading: #f9fafb;
    --text-button: #e5e7eb;
    --text-button-hover: #ffffff;
    
    --accent-primary: #a37cfd;
    --accent-primary-hover: #8b5cf6;
    --accent-secondary: #fbbf24;
    
    --border-color: #374151;
    --shadow-sm: rgba(0, 0, 0, 0.3);
    --shadow-md: rgba(0, 0, 0, 0.5);
    
    --gradient-hero: linear-gradient(135deg, #4c1d95 0%, #581c87 100%);
    --gradient-featured: linear-gradient(135deg, #4c1d95 0%, #581c87 100%);
    
    --icon-bg: rgba(139, 92, 246, 0.2);
    --tag-bg: rgba(139, 92, 246, 0.2);
    --tag-text: #c4b5fd;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--bg-header);
    box-shadow: 0 2px 10px var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.nav-brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    transition: color 0.3s ease;
}

.nav-brand p {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    margin-top: -2px;
    transition: color 0.3s ease;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--accent-primary);
}

/* Hero Section */
.hero {
    background: var(--gradient-hero);
    color: white;
    padding: 4rem 0;
    text-align: center;
    transition: background 0.3s ease;
}

.hero-content h2 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 3rem;
    opacity: 0.9;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 2rem;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-secondary);
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Articles Section */
.articles {
    padding: 4rem 0;
    background: var(--bg-tertiary);
    transition: background-color 0.3s ease;
}

.articles h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--text-heading);
    transition: color 0.3s ease;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.article-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
    border: 1px solid var(--border-color);
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px var(--shadow-md);
}

.article-card.featured {
    grid-column: span 2;
    background: var(--gradient-featured);
    color: white;
    transition: background 0.3s ease;
}

.article-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.article-icon {
    min-width: 55px;
    width: 55px;
    height: 50px;
    border-radius: 10px;
    background: var(--icon-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 1.5rem;
    color: var(--accent-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.article-card.featured .article-icon {
    background: rgba(255, 255, 255, 0.2);
    color: #fbbf24;
}

.article-title h3 {
    font-size: 1.5rem;
    margin-bottom: 0.3rem;
    color: var(--text-heading);
    transition: color 0.3s ease;
}

.article-card.featured .article-title h3 {
    color: white;
}

.article-subtitle {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    margin: 0;
    transition: color 0.3s ease;
}

.article-card.featured .article-subtitle {
    color: rgba(255, 255, 255, 0.9);
}

.article-description {
    margin-bottom: 1.5rem;
}

.article-description p {
    color: var(--text-secondary);
    line-height: 1.6;
    transition: color 0.3s ease;
}

.article-card.featured .article-description p {
    color: rgba(255, 255, 255, 0.95);
}

.article-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.article-links {
    display: flex;
    gap: 1rem;
}

/* About Section */
.about {
    padding: 4rem 0;
    background: var(--bg-secondary);
    transition: background-color 0.3s ease;
}

.about h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--text-heading);
    transition: color 0.3s ease;
}

.about-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    align-items: start;
}

.about-text p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.tech-stack h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--text-heading);
    transition: color 0.3s ease;
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tech-tag {
    background: var(--border-color);
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Projects Section */
.projects {
    padding: 4rem 0;
    background: var(--bg-tertiary);
    transition: background-color 0.3s ease;
}

.projects h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--text-heading);
    transition: color 0.3s ease;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.project-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
    border: 1px solid var(--border-color);
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px var(--shadow-md);
}

.project-card.featured {
    grid-column: span 2;
    background: var(--gradient-featured);
    color: white;
    transition: background 0.3s ease;
}

.project-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.project-icon {
    width: 55px;
    height: 50px;
    border-radius: 10px;
    background: var(--icon-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    transition: background-color 0.3s ease;
}

.featured .project-icon {
    background: rgba(255, 255, 255, 0.2);
}

.project-icon i {
    font-size: 1.5rem;
    color: var(--accent-primary);
    transition: color 0.3s ease;
}

.featured .project-icon i {
    color: white;
}

.project-title h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.project-subtitle {
    font-size: 0.9rem;
    opacity: 0.7;
}

.project-description {
    margin-bottom: 1.5rem;
}

.project-description p {
    font-size: 1rem;
    line-height: 1.6;
}

.project-description a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid rgba(37, 99, 235, 0.3);
    transition: border-bottom-color 0.3s ease, color 0.3s ease;
}

.project-description a:hover {
    border-bottom-color: var(--accent-primary);
}

.project-description a:visited {
    color: var(--accent-primary);
}

.featured .project-description a {
    color: #fbbf24;
    border-bottom-color: rgba(251, 191, 36, 0.4);
}

.featured .project-description a:hover {
    border-bottom-color: #fbbf24;
}

.featured .project-description a:visited {
    color: #fbbf24;
}

.project-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.feature-tag {
    background: var(--tag-bg);
    color: var(--tag-text);
    padding: 0.3rem 0.6rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.featured .feature-tag {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.project-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.project-links > div {
    width: 100%;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.2rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.project-links .btn {
    display: flex;
    width: 100%;
    box-sizing: border-box;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
    transition: background-color 0.3s ease;
}

.btn-primary:hover {
    background: var(--accent-primary-hover);
}

.featured .btn-primary {
    background: white;
    color: var(--accent-primary);
}

.featured .btn-primary:hover {
    background: var(--bg-button);
}

.btn-secondary {
    background: var(--bg-button);
    color: var(--text-button);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.btn-secondary:hover {
    background: var(--bg-button-hover);
    color: var(--text-button-hover);
}

/* Contact Section */
.contact {
    padding: 4rem 0;
    background: var(--bg-secondary);
    text-align: center;
    transition: background-color 0.3s ease;
}

.contact h2 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-heading);
    transition: color 0.3s ease;
}

.contact-content p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    transition: color 0.3s ease;
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--bg-button);
    color: var(--text-button);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.contact-link:hover {
    background: var(--bg-button-hover);
    color: var(--text-button-hover);
}

.contact-link i {
    font-size: 1.2rem;
}

/* Footer */
.footer {
    background: var(--bg-footer);
    color: white;
    text-align: center;
    padding: 2rem 0;
    transition: background-color 0.3s ease;
}

.footer p {
    opacity: 0.8;
}

/* Theme Toggle Button */
.theme-toggle {
    background: var(--bg-button);
    color: var(--text-button);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.theme-toggle:hover {
    background: var(--bg-button-hover);
    color: var(--text-button-hover);
    border-color: var(--accent-primary);
}

.theme-toggle i {
    font-size: 1rem;
}

/* Article Styles */
.article-content {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.7;
}

.article-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.article-content h2 {
    font-size: 1.8rem;
    margin: 2.5rem 0 1rem 0;
    color: var(--text-primary);
    border-bottom: 2px solid var(--accent-primary);
    padding-bottom: 0.5rem;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.article-content p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.article-content a {
    color: var(--accent-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease, color 0.3s ease;
    font-weight: 500;
}

.article-content a:hover {
    border-bottom-color: var(--accent-primary);
}

.article-content a:visited {
    color: var(--accent-primary);
}

.article-content ul {
    margin: 1.5rem 0;
    padding-left: 2rem;
    color: var(--text-secondary);
}

.article-content li {
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.article-content strong {
    color: var(--text-primary);
    transition: color 0.3s ease;
}

/* Article Highlight Boxes */
.highlight-box {
    background-color: var(--bg-card);
    border-left: 4px solid var(--accent-primary);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 2px 8px var(--shadow-sm);
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.highlight-box strong {
    color: var(--accent-primary);
    font-weight: 600;
    display: block;
    margin-bottom: 0.5rem;
}

.highlight-box ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.5rem;
}

.highlight-box li {
    margin-bottom: 0.3rem;
    color: var(--text-secondary);
}

.metrics {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.05));
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-left: 4px solid #22c55e;
    padding: 1.5rem;
    border-radius: 0 8px 8px 0;
    margin: 2rem 0;
    box-shadow: 0 2px 8px var(--shadow-sm);
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.metrics strong {
    color: #22c55e;
    font-weight: 600;
    display: block;
    margin-bottom: 0.5rem;
}

.metrics ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.5rem;
}

.metrics li {
    margin-bottom: 0.3rem;
    color: var(--text-secondary);
}

.tech-stack {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--text-tertiary);
    padding: 1.5rem;
    border-radius: 0 8px 8px 0;
    margin: 2rem 0;
    box-shadow: 0 2px 8px var(--shadow-sm);
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.tech-stack strong {
    color: var(--text-primary);
    font-weight: 600;
    display: block;
    margin-bottom: 0.5rem;
}

.tech-stack ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.5rem;
}

.tech-stack li {
    margin-bottom: 0.3rem;
    color: var(--text-secondary);
}

/* Dark mode adjustments for highlight boxes */
[data-theme="dark"] .metrics {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.08));
    border-color: rgba(34, 197, 94, 0.4);
}

.article-meta {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
    transition: border-color 0.3s ease;
}

.article-meta .subtitle {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

.article-meta .author {
    color: var(--accent-primary);
    font-weight: 500;
    transition: color 0.3s ease;
}

.series-note {
    background: var(--bg-card);
    border-left: 4px solid var(--accent-primary);
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: var(--text-secondary);
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.series-note a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease, color 0.3s ease;
}

.series-note a:hover {
    border-bottom-color: var(--accent-primary);
}

.article-banner {
    margin: 2rem 0 3rem 0;
    text-align: center;
}

.banner-image {
    width: 100%;
    max-width: 800px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--shadow-md);
    transition: box-shadow 0.3s ease;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent-primary);
    text-decoration: none;
    margin-bottom: 2rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: var(--accent-primary-hover);
}

.article-section {
    padding: 4rem 0;
    background: var(--bg-primary);
    transition: background-color 0.3s ease;
}

.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--accent-primary);
    z-index: 1000;
    transition: width 0.1s ease, background-color 0.3s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .theme-toggle {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }
    
    .hero-content h2 {
        font-size: 2rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
    }
    
    .article-card.featured {
        grid-column: span 1;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .project-card.featured {
        grid-column: span 1;
    }
    
    .contact-links {
        flex-direction: column;
        align-items: center;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .article-content h1 {
        font-size: 2rem;
    }
    
    .article-content h2 {
        font-size: 1.5rem;
        margin: 2rem 0 1rem 0;
    }
    
    .article-content p {
        font-size: 1rem;
    }
    
    .article-section {
        padding: 2rem 0;
    }
}

@media (max-width: 480px) {
    .hero-content h2 {
        font-size: 1.8rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }
    
    .project-card {
        padding: 1.5rem;
    }
    
    .project-header {
        flex-direction: column;
        text-align: center;
    }
    
    .project-icon {
        margin-right: 0;
        margin-bottom: 1rem;
    }
}