/* Import Modern Font */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    /* Light Mode Variables */
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --accent: #4361ee;
    --accent-hover: #3730a3;
    --border-color: #e2e8f0;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --shadow-sm: 0 4px 6px -1px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1);
}

/* Automatic Dark Mode */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0f172a;
        --card-bg: #1e293b;
        --text-main: #f8fafc;
        --text-muted: #94a3b8;
        --accent: #6380ff;
        --accent-hover: #8da1ff;
        --border-color: #334155;
        --glass-bg: rgba(15, 23, 42, 0.85);
        --shadow-sm: 0 4px 6px -1px rgba(0,0,0,0.3);
        --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.4);
        --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.5);
    }
}

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

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- Navbar / Header --- */
.site-header {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 16px 24px;
    transition: all 0.3s ease;
}
.navbar {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.nav-icon {
    width: 28px;
    height: 28px;
}
.nav-icon .svg-bg {
    fill: var(--accent);
}
.logo span {
    color: var(--accent);
}

/* --- Home Page Layout --- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}
.hero-section {
    text-align: center;
    margin-bottom: 24px;
}
.page-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -1.5px;
    color: var(--text-main);
}
.page-subtitle {
    color: var(--text-muted);
    font-size: 1.25rem;
    max-width: 600px;
    margin: 0 auto;
}

/* --- Grid Layout --- */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 32px;
}

/* --- Blog Cards --- */
.post-card {
    background: var(--card-bg);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}
.post-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}
.post-link-wrapper {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.post-image-wrapper {
    width: 100%;
    height: 220px;
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
}
.post-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.post-card:hover .post-image {
    transform: scale(1.05);
}
.post-content {
    padding: 28px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.post-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 12px;
}
.post-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 12px 0;
    line-height: 1.3;
    color: var(--text-main);
}
.post-excerpt {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    flex-grow: 1;
    line-height: 1.6;
}
.post-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    font-weight: 600;
}

/* Fade In Animation for JS Loaded Posts */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.6s ease forwards;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Single Post Page Layout --- */
.article-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 60px 24px;
}
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 40px;
    transition: color 0.2s;
}
.back-link:hover {
    color: var(--accent);
}
.article-header {
    text-align: center;
    margin-bottom: 48px;
}
.article-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -1.5px;
    margin: 20px 0;
    color: var(--text-main);
}
.article-meta {
    color: var(--text-muted);
    font-size: 1.05rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}
.dot-separator {
    color: var(--border-color);
}
.article-hero-wrapper {
    margin-bottom: 48px;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}
.article-hero-img {
    width: 100%;
    display: block;
}

/* --- Single Post Content Typography (Highly Optimized for n8n/Markdown) --- */
.article-content {
    font-size: 1.15rem;
    color: var(--text-main);
    line-height: 1.8;
}
.article-content h2 { 
    font-size: 2rem; 
    margin: 48px 0 24px; 
    font-weight: 700;
    letter-spacing: -0.5px;
}
.article-content h3 { 
    font-size: 1.5rem; 
    margin: 40px 0 20px; 
    font-weight: 600;
}
.article-content p { 
    margin-bottom: 24px; 
    color: var(--text-main);
}
.article-content a { 
    color: var(--accent); 
    text-decoration: none; 
    font-weight: 600; 
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 4px;
    text-decoration-thickness: 2px;
}

.article-content a:hover { 
    color: var(--accent-hover);
    text-decoration-color: var(--accent-hover); 
}
.article-content ul, .article-content ol { 
    margin-bottom: 24px; 
    padding-left: 24px; 
}
.article-content li { 
    margin-bottom: 12px; 
}
.article-content blockquote {
    border-left: 4px solid var(--accent);
    margin: 40px 0;
    padding: 24px 32px;
    background: var(--card-bg);
    border-radius: 0 16px 16px 0;
    font-style: italic;
    color: var(--text-muted);
    font-size: 1.25rem;
    box-shadow: var(--shadow-sm);
}
.article-content img {
    max-width: 100%;
    border-radius: 16px;
    margin: 40px 0;
    box-shadow: var(--shadow-md);
}
.article-content pre, .article-content code {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.9em;
}
.article-content pre {
    padding: 20px;
    overflow-x: auto;
    margin: 30px 0;
}
.article-content code {
    padding: 2px 6px;
    color: var(--accent);
}

/* --- Skeleton Loaders --- */
.skeleton-card {
    background: var(--card-bg);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    padding-bottom: 24px;
    box-shadow: var(--shadow-sm);
}
.skeleton {
    background: var(--border-color);
    background: linear-gradient(110deg, var(--border-color) 8%, var(--card-bg) 18%, var(--border-color) 33%);
    background-size: 200% 100%;
    animation: 1.5s shimmer linear infinite;
}
@media (prefers-color-scheme: dark) {
    .skeleton {
        background: linear-gradient(110deg, #334155 8%, #1e293b 18%, #334155 33%);
        background-size: 200% 100%;
    }
}
.skel-img { height: 220px; width: 100%; border-radius: 20px 20px 0 0; }
.skel-text { height: 16px; margin: 20px 28px; border-radius: 6px; }
.skel-text.title { height: 28px; width: 70%; margin-top: 28px; }
.skel-text.short { width: 40%; }

@keyframes shimmer {
    to { background-position-x: -200%; }
}

#loader { display: none; margin-top: 32px; }
.end-message {
    text-align: center; 
    color: var(--text-muted); 
    margin-top: 60px;
    font-weight: 600; 
    display: none; 
    padding: 24px; 
    background: var(--card-bg); 
    border: 1px solid var(--border-color);
    border-radius: 16px;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .page-title { font-size: 2.2rem; }
    .article-title { font-size: 2.5rem; }
    .article-content { font-size: 1.05rem; }
    .article-container { padding: 40px 20px; }
    .post-grid { grid-template-columns: 1fr; }
}