/* 
 * Dr. Sangdon Park - Academic Profile
 * Modern and responsive CSS for academic personal website
 */

:root {
    --primary-color: #2563eb;         /* Blue 600 */
    --primary-dark: #1d4ed8;          /* Blue 700 */
    --secondary-color: #0f172a;       /* Slate 900 */
    --accent-color: #ef4444;          /* Red 500 */
    --text-color: #334155;            /* Slate 700 */
    --text-light: #64748b;            /* Slate 500 */
    --bg-color: #ffffff;              /* White */
    --bg-light: #f8fafc;              /* Slate 50 */
    --border-color: #e2e8f0;          /* Slate 200 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s ease;
    --container-width: 1140px;
    --container-width-lg: 1200px;
    --primary-rgb: 37, 99, 235; /* For RGBA */
    --base-font-size: 16px;     /* 기본 폰트 크기 정의 */
}

/* Dark Theme Variables */
/* Apply dark theme variables directly to html element */
html[data-theme="dark"] {
    --primary-color: #3b82f6;         /* Blue 500 */
    --primary-dark: #60a5fa;          /* Blue 400 */
    --secondary-color: #f8fafc;       /* Slate 50 (becomes primary text) */
    --accent-color: #f87171;          /* Red 400 */
    --text-color: #cbd5e1;            /* Slate 300 */
    --text-light: #94a3b8;            /* Slate 400 */
    --bg-color: #0f172a;              /* Slate 900 */
    --bg-light: #1e293b;              /* Slate 800 */
    --border-color: #334155;          /* Slate 700 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --primary-rgb: 59, 130, 246;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans KR', 'Lato', sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.7;
    font-size: 16px;
    transition: background-color 0.3s ease, color 0.3s ease; /* Add transition */
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Lato', 'Noto Sans KR', sans-serif;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

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

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

p {
    margin-bottom: 1rem;
    color: var(--text-light);
    font-size: 1.1rem;        /* 1.05rem에서 1.1rem으로 기본 글자 크기 증가 */
}

ul {
    list-style: none;
}

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

/* Language Switcher */
.ko {
    display: none;
}

body.ko .en {
    display: none;
}

body.ko .ko {
    display: block;
}

span.ko {
    display: none;
}

body.ko span.en {
    display: none;
}

body.ko span.ko {
    display: inline;
}

/* Container */
.container {
    width: 100%;
    max-width: var(--container-width-lg);
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background-color: var(--bg-color);
    box-shadow: var(--shadow-sm);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    transition: var(--transition), background-color 0.3s ease; /* Update transition */
}

.header.scrolled {
    box-shadow: var(--shadow-md);
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
}

.logo h2 {
    font-size: 1.5rem;
    margin-bottom: 0;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links li a {
    color: var(--secondary-color);
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
    transition: var(--transition);
}

.nav-links li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--primary-color);
    transition: var(--transition);
}

.nav-links li a:hover,
.nav-links li a.active {
    color: var(--primary-color);
}

.nav-links li a:hover::after,
.nav-links li a.active::after {
    width: 100%;
}

.language-toggle {
    display: flex;
    gap: 8px;
}

.lang-btn {
    background: none;
    border: 1px solid var(--border-color);
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
    color: var(--text-light); /* Adjust base color */
}

.lang-btn.active {
    background-color: var(--primary-color);
    color: var(--bg-color); /* Use variable for contrast */
    border-color: var(--primary-color);
}

.nav-toggle {
    display: none;
    cursor: pointer;
    font-size: 1.5rem;
}

/* Hero Section */
.hero {
    padding: 90px 0 40px; /* Further reduced padding */
    background-color: var(--bg-color);
}

.hero-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 60px;
}

.hero-text {
    flex: 1;
}

.hero-text h1 {
    font-size: 2.6rem; /* Slightly reduced size */
    font-weight: 700;
    margin-bottom: 0.8rem;
    color: var(--secondary-color);
}

.hero-text .title {
    font-size: 1.3rem;
    color: var(--text-light);
    margin-bottom: 0.8rem;
}

.hero-text .identity {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 1.8rem;
    font-weight: 500;
}

/* Hero Contact Links (replaces hero-buttons) */
.hero-contact-links {
    display: flex;
    gap: 18px;
    margin-top: 2rem;
}

.hero-contact-links .icon-link {
    color: var(--secondary-color);
    font-size: 1.8rem;
    transition: var(--transition);
}

.hero-contact-links .icon-link:hover {
    color: var(--primary-color);
    transform: translateY(-2px);
}

.hero-image {
    flex: 0 0 260px; /* Reduced image container size */
}

.hero-image img {
    width: 100%;
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 5px solid var(--bg-color); /* Adjust border for dark mode */
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
}

.primary-btn:hover {
    background-color: var(--primary-dark);
    color: white;
}

.secondary-btn {
    background-color: transparent;
    color: var(--secondary-color);
    border: 1px solid var(--border-color);
}

.secondary-btn:hover {
    background-color: var(--bg-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.view-more-btn {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.view-more-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Dark Mode Specific Button Adjustments */
/* Use html selector */
html[data-theme="dark"] .primary-btn {
    color: #0f172a; /* Dark text on light blue button */
}
html[data-theme="dark"] .primary-btn:hover {
    color: #0f172a;
}
html[data-theme="dark"] .view-more-btn:hover {
    color: #0f172a; /* Dark text on light blue button */
}

/* Section Styles */
.section {
    padding: 60px 0; /* Further reduced padding */
}

.bg-light {
    background-color: var(--bg-light);
}

.section-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 2.5rem; /* Further reduced margin */
    position: relative;
    padding-bottom: 0.8rem; /* Slightly reduced bottom padding */
    color: var(--secondary-color);
}

.section-title::after {
    content: '';
    position: absolute;
    width: 60px;
    height: 3px;
    background-color: var(--primary-color);
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

/* About Section */
.about-content {
    display: flex;
    gap: 50px;
    align-items: flex-start;
}

.about-text {
    flex: 1.5;
}

.contact-info {
    flex: 1;
    background-color: var(--bg-color);
    padding: 30px;
    border-radius: 10px;
    box-shadow: var(--shadow-md);
}

.contact-info h3 {
    margin-bottom: 20px;
    font-size: 1.4rem;
    color: var(--secondary-color);
}

.contact-info ul li {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
}

.contact-info ul li i {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-top: 5px;
}

/* New class for single column layout */
.about-content-single {
    margin: 0 auto;
}

.about-text p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-color);
}

/* Research Section */
#research {
}

.research-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 15px; /* Further reduced gap */
}

.research-card {
    background-color: var(--bg-color);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: none;
    transition: border-color 0.3s ease, transform 0.3s ease;
}

.research-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary-color);
}

.research-icon {
    width: 50px;
    height: 50px;
    background-color: rgba(var(--primary-rgb), 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
}

.research-icon i {
    font-size: 24px;
    color: var(--primary-color);
}

.research-card h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--secondary-color);
}

.research-card p {
    color: var(--text-color);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* Publications Section */
.subsection-title {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 2.5rem;
    color: var(--secondary-color);
    text-align: center;
}

hr.section-divider {
    border: 0;
    height: 1px;
    background-color: var(--border-color);
    max-width: 300px;
    margin: 4rem auto;
}

.publications-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 3rem;
}

.pub-nav-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    padding: 8px 18px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    color: var(--text-light); /* Adjust base color */
}

.pub-nav-btn:hover,
.pub-nav-btn.active {
    background-color: var(--primary-color);
    color: var(--bg-color); /* Use variable for contrast */
    border-color: var(--primary-color);
}

.publications-container {
    max-width: 900px;
    margin: 0 auto;
}

.publication-item {
    margin-bottom: 25px;
    padding: 20px;
    background-color: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: none;
    transition: border-color 0.3s ease;
}

.publication-item:hover {
    border-color: var(--primary-color);
    transform: none;
    box-shadow: none;
}

.publication-item h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--secondary-color);
}

.publication-authors {
    font-weight: 400;
    color: var(--text-color);
    margin-bottom: 8px;
    font-size: 1.05rem;
}

.publication-authors em {
    font-style: normal;
    font-weight: 600;
    color: var(--secondary-color);
}

.publication-journal {
    font-style: normal;
    color: var(--text-light);
    margin-bottom: 12px;
    font-size: 1.05rem;
    line-height: 1.5;
}

.publication-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.publication-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--primary-color);
    font-weight: 500;
    font-size: 1rem;
    margin-top: 0;
}

.publication-link i {
    font-size: 13px;
}

.publication-citations {
    font-size: 1rem;
    color: var(--text-light);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.publication-citations i {
    font-size: 13px;
}

.loading-text {
    text-align: center;
    color: var(--text-light);
    font-style: italic;
    margin: 40px 0;
}

.view-more-container {
    text-align: center;
    margin-top: 40px;
}

/* Experience & Education Timeline */
.experience-timeline,
.education-timeline {
    margin: 0 auto;
    position: relative;
}

.experience-timeline::before,
.education-timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 10px;
    width: 2px;
    height: calc(100% - 20px);
    background-color: var(--border-color);
}

.timeline-item {
    margin-bottom: 15px; /* Further reduced margin */
    padding-left: 40px;
    position: relative;
}

.timeline-dot {
    width: 16px;
    height: 16px;
    background-color: var(--primary-color);
    border: 3px solid var(--bg-color);
    border-radius: 50%;
    position: absolute;
    left: 0px;
    top: 5px;
    z-index: 2;
}

.timeline-date {
    position: relative;
    width: auto;
    padding-right: 0;
    margin-left: 0;
    margin-bottom: 0.3rem;
}

.timeline-date p {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 0;
}

.timeline-content {
    background-color: transparent;
    padding: 0;
    box-shadow: none;
    border: none;
    margin-left: 0;
}

.timeline-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--secondary-color);
}

.timeline-subtitle {
    font-weight: 500;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1rem;
}

.timeline-details {
    color: var(--text-light);
    font-size: 1.05rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.timeline-details li {
    color: var(--text-light);
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.timeline-details li::before {
    content: '-';
    color: var(--primary-color);
    position: absolute;
    left: 0;
    top: 1px;
}

/* Contact Section */
#contact {
    background-color: var(--bg-light);
}

.contact-container {
    max-width: var(--container-width-lg); /* 900px에서 --container-width-lg (1200px)로 변경 */
    margin: 0 auto;
}

.contact-info-large {
    display: grid;
    /* grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); 에서 아래와 같이 변경 */
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

.contact-item {
    background-color: var(--bg-color);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: none;
    display: flex;
    gap: 15px;
    align-items: center;
}

.contact-icon {
    width: 45px;
    height: 45px;
    background-color: rgba(var(--primary-rgb), 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.contact-icon i {
    font-size: 18px;
    color: var(--primary-color);
}

.contact-details {
    flex: 1;
}

.contact-details h3 {
    font-size: 1.1rem;
    margin-bottom: 5px;
    color: var(--secondary-color);
}

.contact-details p {
    margin-bottom: 0;
    font-size: 1.05rem;
    color: var(--text-color);
}

.contact-details p a {
    color: var(--text-color);
}

.contact-details p a:hover {
    color: var(--primary-color);
}

/* Footer */
.footer {
    background-color: var(--secondary-color);
    color: #e2e8f0;
    padding: 25px 0; /* Further reduced padding */
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-text p {
    margin-bottom: 0;
    color: var(--text-light);
    font-size: 1.05rem;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    width: 36px;
    height: 36px;
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: var(--transition);
    font-size: 1rem;
}

.social-links a:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
}

/* Dark mode adjustments for footer */
/* Use html selector */
html[data-theme="dark"] .footer {
    background-color: #020617; /* Even darker slate for footer */
    color: #cbd5e1; /* Slightly lighter text */
}

html[data-theme="dark"] .footer-text p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.05rem;
}

html[data-theme="dark"] .social-links a {
    background-color: #1e293b; /* Slate 800 */
    color: #e2e8f0; /* Slate 200 */
}

html[data-theme="dark"] .social-links a:hover {
    background-color: var(--primary-color);
    color: #0f172a;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .container {
        max-width: 960px;
    }
}

@media (max-width: 992px) {
    .container {
        max-width: 960px;
    }
    
    .hero-text h1 {
        font-size: 2.5rem;
    }
    
    .hero-image {
        flex: 0 0 280px;
    }
}

@media (max-width: 768px) {
    .container {
        max-width: 720px;
    }
    
    .nav-links {
        position: fixed;
        top: 80px;
        left: -100%;
        width: 100%;
        background-color: var(--bg-color);
        flex-direction: column;
        gap: 0;
        box-shadow: var(--shadow-md);
        transition: var(--transition);
        z-index: 100;
    }
    
    .nav-links.active {
        left: 0;
    }
    
    .nav-links li a {
        display: block;
        padding: 15px;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-links li a::after {
        display: none;
    }
    
    .nav-toggle {
        display: block;
    }
    
    .hero-content {
        flex-direction: column-reverse;
        text-align: center;
    }
    
    .hero-image {
        flex: 0 0 220px; /* Slightly adjusted for medium screens */
    }
    
    .hero-buttons {
        justify-content: center;
    }
    
    .about-content {
        flex-direction: column;
    }
    
    .timeline-item {
        padding-left: 30px;
    }

    .experience-timeline::before,
    .education-timeline::before {
        left: 10px;
    }

    .timeline-dot {
        left: 0px;
    }

    .footer-content {
        flex-direction: column;
        gap: 15px;
    }

    .subsection-title {
        font-size: 1.4rem;
        margin-bottom: 2rem;
    }

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

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

@media (max-width: 576px) {
    .section {
        padding: 40px 0; /* Further reduced padding for small screens */
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .hero-text h1 {
        font-size: 2.2rem;
    }
    
    .hero-text .title {
        font-size: 1.1rem;
    }
    
    .hero-text .identity {
        font-size: 1rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .publications-nav {
        overflow-x: auto;
        padding-bottom: 10px;
        justify-content: flex-start;
    }
    
    .hero-image {
        max-width: 180px; /* Significantly reduce image size on small screens */
        flex-basis: 180px; /* Ensure flex basis matches max-width */
        /* margin: 0 auto; should be inherited or already set */
    }

    .hero-image img {
        border-width: 3px; /* Reduce border thickness for smaller image */
    }
}

/* Publications Section Specifics */
/* #publications .container { max-width: 900px; } Removed */

/* Style for the selected publications grid */
#selected-publications-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columns */
    gap: 15px; /* Further reduced gap */
    max-width: none; /* Override any potential inherited max-width */
    margin-bottom: 2rem; /* Adjusted margin */
}

#selected-publications-list .publication-item {
    /* Adjust styles for card layout */
    margin-bottom: 0; /* Remove bottom margin as gap handles spacing */
    display: flex; /* Enable flexbox for content alignment */
    flex-direction: column; /* Stack content vertically */
    justify-content: space-between; /* Push footer to bottom */
    height: 100%; /* Make cards in the same row equal height */
}

#selected-publications-list .publication-item h3 {
    font-size: 1.1rem; /* Slightly smaller title for cards */
    line-height: 1.4;
    color: var(--secondary-color); /* Ensure heading color uses variable */
}

#selected-publications-list .publication-authors,
#selected-publications-list .publication-journal {
    font-size: 1rem; /* Smaller text for cards */
}

#selected-publications-list .publication-footer {
    /* Footer styles remain mostly the same */
    margin-top: 1rem; /* Ensure some space above footer */
}

/* #publications .publications-container { max-width: none; } This seems redundant now */

/* Responsive for Selected Publications Grid */
@media (max-width: 992px) {
    #selected-publications-list {
        grid-template-columns: repeat(2, 1fr); /* 2 columns */
    }
    /* ... */
}

@media (max-width: 768px) {
    #selected-publications-list {
        grid-template-columns: 1fr; /* 1 column */
    }
     /* ... */
}

/* Seminar Section */
#seminar .about-text p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.text-center {
    text-align: center;
}

#seminar .contact-highlight {
    margin-top: 1.5rem;
    font-size: 1.1rem;
    font-weight: 500;
}

#seminar .contact-highlight i {
    margin-right: 8px;
    color: var(--primary-color);
}

/* Experience & Education Adjustments */
#experience,
#education {
    /* Optional: Adjust padding if needed */
}

/* Contact Section Adjustments */
#contact .container {
     /* max-width: 900px; Removed section-specific container width */
}

/* Footer Adjustments */
.footer {
    padding: 25px 0; /* Further reduced padding */
}

/* Writings Section (ko.html) */
#writings {
    padding-top: 40px; /* Reduce top padding specifically for this section */
}

#writings .article-list-container {
    /* max-width: 800px; Removed max-width */
    margin: 0 auto;
}

/* Apply grid layout to the article list */
.article-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columns */
    gap: 15px; /* Further reduced gap */
}

.article-item {
    /* Adjustments for card layout in grid */
    margin-bottom: 0; /* Remove bottom margin, gap handles spacing */
    display: flex; /* Use flexbox */
    flex-direction: column; /* Stack content vertically */
    justify-content: space-between; /* Push meta to bottom */
    height: 100%; /* Equal height cards in a row */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-color);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.article-item:hover {
     border-color: var(--primary-color);
     box-shadow: var(--shadow-sm);
}

.article-link {
    display: flex; /* Use flexbox for link content */
    flex-direction: column; /* Stack title and meta */
    flex-grow: 1; /* Allow link to fill the card */
    padding: 1.5rem 1.8rem;
    color: var(--secondary-color);
    text-decoration: none;
}

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

.article-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--secondary-color);
}

.article-meta {
    color: var(--text-light);
    font-size: 1.05rem;
    margin-bottom: 0.8rem;
    display: block;
}

/* Responsive adjustments for article grid */
@media (max-width: 992px) {
    .article-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columns */
    }
}

@media (max-width: 768px) {
    .article-grid {
        grid-template-columns: 1fr; /* 1 column */
    }
}

/* Article Page Styles (articles/*.html) */
.article-page {
    padding-top: 120px; /* Adjust for fixed header */
    padding-bottom: 100px;
    background-color: var(--bg-color); /* Ensure background matches theme */
}

/* Ensure dark mode applies correctly to article content */
html[data-theme="dark"] .article-content {
    background-color: var(--bg-color); /* Explicitly set dark background */
    border-color: var(--border-color); /* Explicitly set dark border */
}

.article-content {
    /* max-width: 800px; Keeping this for individual article readability */
    margin: 0 auto;
    background-color: var(--bg-color);
    padding: 40px 50px; /* Padding inside article box */
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease; /* Add transition */
}

.article-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.article-main-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    color: var(--secondary-color);
    line-height: 1.3;
}

.article-date {
    font-size: 1.05rem;
    color: var(--text-light);
    margin-bottom: 0;
}

.article-body h2 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--secondary-color);
}

.article-body h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.8rem;
    color: var(--secondary-color);
}

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

.article-body a {
    color: var(--primary-color);
    text-decoration: underline;
}

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

.article-body ul,
.article-body ol {
    padding-left: 1.5rem;
    margin-bottom: 1.2rem;
}

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

.article-body blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--text-light);
    background-color: var(--bg-light);
}

.article-body figure {
    margin: 1.5rem 0;
}

.article-body figcaption {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 0.5rem;
}

.article-body img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto; /* Center images */
    border-radius: 4px;
}

.article-body pre {
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1.2rem;
    color: var(--text-color);
}

.article-body code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
}

.article-body pre code {
    color: var(--text-color);
    background-color: transparent;
    border: none;
    padding: 0;
}

/* Dark mode specific code block */
/* Use html selector */
html[data-theme="dark"] .article-body pre {
    background-color: #1e293b; /* Slightly lighter dark background */
    color: #e2e8f0;
}
html[data-theme="dark"] .article-body pre code {
    color: #e2e8f0;
}

/* Add Theme Toggle Button Style */
.theme-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-light);
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 32px;
}

.theme-toggle-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.theme-toggle-btn i {
    font-size: 1rem;
    line-height: 1;
}
