:root {
    /* --- Color Palette --- */
    --bg: #f7f7f7;
    --bg-card: #ffffff;
    --border-subtle: #e2e2e2;
    --text-main: #2c3e50;
    --text-muted: #777777;
    
    /* --- Category Colors --- */
    --accent-1: #f39c12; /* JS */
    --accent-2: #8e44ad; /* JQ */
    --accent-3: #27ae60; /* Web */
    --accent-4: #2980b9; /* CSS */
    --accent-5: #e67e22; /* News/Other */
    
    /* --- UI Elements --- */
    --shadow-soft: 0 6px 18px rgba(0,0,0,0.05);
    --radius-card: 8px;
    --transition-fast: 0.2s ease;
}

/* =========================================
   1. RESET & BASE STYLES
   ========================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

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

.page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 16px 16px 40px;
}

/* =========================================
   2. HEADER & NAVIGATION
   ========================================= */
.site-header {
    margin-bottom: 24px;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo {
    font-weight: 700;
    letter-spacing: 0.08em;
    font-size: 1.15rem;
}

.search-wrapper {
    flex: 1;
    max-width: 250px;
    position: relative;
}

.search-input {
    width: 100%;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    padding: 8px 34px 8px 14px;
    font-size: 0.9rem;
    background-color: #ffffff;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.95rem;
    color: var(--text-muted);
    pointer-events: none;
}

.nav-toggle {
    display: none;
    border: 0;
    background: transparent;
    font-size: 1.35rem;
    cursor: pointer;
    padding: 4px 6px;
}

.nav-toggle:focus {
    outline: 2px solid var(--accent-4);
    outline-offset: 2px;
}

.main-nav {
    margin-top: 16px;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.main-nav ul {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
}

.main-nav li {
    padding: 10px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    position: relative;
}

.main-nav li:hover {
    background-color: #f1f1f1;
}

.main-nav li.is-active {
    color: var(--accent-4);
    font-weight: 600;
}

.main-nav li.is-active::after {
    content: "";
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 0;
    height: 2px;
    background: var(--accent-4);
    border-radius: 999px;
}

/* =========================================
   3. SHARED COMPONENTS (Cards, Badges)
   ========================================= */
main {
    margin-top: 26px;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 28px 0 14px;
}

/* Badges */
.category-badge {
    padding: 3px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 999px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #ffffff;
}

.category-js    { background-color: var(--accent-1); }
.category-jq    { background-color: var(--accent-2); }
.category-web   { background-color: var(--accent-3); }
.category-css   { background-color: var(--accent-4); }
.category-news  { background-color: #DEE6E9; color: #3D3D3D; }

/* Post Cards (Grid Items) */
.post-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-card);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.post-image {
    background: linear-gradient(135deg, #dfe6e9, #f5f6fa);
    object-fit: cover;
    width: 100%;
}

.post-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
	background-color: #FFF;
}

.post-meta {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
}

.post-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
}

.post-card:hover .post-title {
    text-decoration: underline;
}

/* =========================================
   4. INDEX / HOME PAGE STYLES
   ========================================= */
/* Hero Layout */
.hero {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.hero .post-image { height: 190px; }
.hero .post-image.large { height: 230px; }
.hero .post-title.large { font-size: 1.25rem; }

.post-excerpt {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Recent Grid */
.recent-grid, .suggested-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.recent-grid .post-image, 
.suggested-grid .post-image { 
    height: 150px; 
}

/* Pagination */
.pagination {
    margin-top: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

.page-btn {
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background-color: #ffffff;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    text-align: center;
    min-width: 100px;
}

.page-btn:hover {
    background-color: #f1f1f1;
}

/* =========================================
   5. SINGLE ARTICLE PAGE STYLES
   ========================================= */
.article-wrapper {
    background-color: var(--bg-card);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft);
    padding: 24px 22px 26px;
}

.article-header {
    margin-bottom: 18px;
}

.article-category {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.article-title {
    font-size: 1.7rem;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.3;
}

.article-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.article-image {
    margin: 18px -22px 18px;
    background: linear-gradient(135deg, #dfe6e9, #f5f6fa);
    height: 260px;
    width: calc(100% + 44px); /* Full bleed */
    object-fit: cover;
}

.article-body {
    font-size: 0.95rem;
    color: var(--text-main);
}

.article-body p { margin-bottom: 16px; }
.article-body h2 { font-size: 1.2rem; margin: 20px 0 10px; }
.article-body h3 { font-size: 1.05rem; margin: 18px 0 8px; }
.article-body ul { margin: 0 0 16px 18px; padding-left: 4px; }
.article-body li { margin-bottom: 6px; }

/* =========================================
   6. FOOTER
   ========================================= */
footer {
    margin-top: 34px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* =========================================
   7. RESPONSIVE DESIGN
   ========================================= */
@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .recent-grid, .suggested-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .page {
        padding-inline: 12px;
    }

    .search-wrapper {
        max-width: none;
    }

    /* Mobile Nav Toggle */
    .nav-toggle {
        display: block;
    }

    .main-nav {
        border-top: none;
        margin-top: 10px;
        display: none; /* Hide by default */
    }

    body.nav-open .main-nav {
        display: block;
    }

    .main-nav ul {
        flex-direction: column;
        border-radius: var(--radius-card);
        background-color: #ffffff;
        box-shadow: var(--shadow-soft);
        border: 1px solid var(--border-subtle);
        padding-block: 4px;
    }

    .main-nav li {
        padding: 10px 14px;
    }

    /* Mobile Grid Adjustments */
    .recent-grid, .suggested-grid {
        grid-template-columns: 1fr;
    }

    .article-image {
        margin-inline: -16px;
        width: calc(100% + 32px);
        height: 210px;
    }
}
