:root {
    --bg-color: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --ad-bg: #f1f5f9;
    --ad-text: #94a3b8;
    --shadow-sm: 0 1px 3px 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);
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --font-sans: 'Inter', system-ui, sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0f172a;
        --text-main: #f8fafc;
        --text-muted: #94a3b8;
        --accent: #6366f1;
        --accent-hover: #818cf8;
        --card-bg: #1e293b;
        --border: #334155;
        --ad-bg: #0b1120;
        --ad-text: #475569;
    }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-sans); background: var(--bg-color); color: var(--text-main); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; transition: var(--transition); }
img { max-width: 100%; height: auto; display: block; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* Header */
.site-header { background: var(--card-bg); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-sm); backdrop-filter: blur(10px); background: color-mix(in srgb, var(--card-bg) 90%, transparent); }
.site-header .container { display: flex; justify-content: space-between; align-items: center; height: 70px; }
.logo { font-size: 1.5rem; font-weight: 900; letter-spacing: -0.5px; }
.logo span { color: var(--accent); }
.main-nav { display: flex; gap: 1.5rem; font-weight: 500; }
.main-nav a { color: var(--text-muted); position: relative; }
.main-nav a:hover, .main-nav a.active { color: var(--accent); }
.main-nav a.active::after { content: ''; position: absolute; bottom: -23px; left: 0; width: 100%; height: 2px; background: var(--accent); }

/* Ads */
.ad-container { margin: 2rem auto; display: flex; justify-content: center; }
.ad-banner { background: var(--ad-bg); color: var(--ad-text); display: flex; align-items: center; justify-content: center; border: 1px dashed var(--border); border-radius: var(--radius-md); font-size: 0.875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; text-align: center; padding: 1rem; position: relative; overflow: hidden; }
.ad-banner::before { content: 'ADVERTISEMENT'; position: absolute; top: 0; left: 0; right: 0; font-size: 0.6rem; padding: 2px; background: var(--border); color: var(--text-muted); letter-spacing: 2px; }
.ad-728x90 { width: 100%; max-width: 728px; height: 90px; }
.ad-300x250 { width: 100%; max-width: 300px; height: 250px; margin: 0 auto; }
.ad-300x600 { width: 100%; max-width: 300px; height: 600px; margin: 0 auto; }
.ad-native { height: 100%; min-height: 300px; border: none; background: linear-gradient(135deg, var(--ad-bg) 0%, var(--border) 100%); }

/* Main Layout */
.main-content { display: grid; grid-template-columns: 1fr 320px; gap: 2.5rem; margin-bottom: 4rem; align-items: start; }
@media (max-width: 992px) { .main-content { grid-template-columns: 1fr; } }

/* Post Grid */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 2rem; }
.post-card { background: var(--card-bg); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); border: 1px solid var(--border); transition: var(--transition); display: flex; flex-direction: column; }
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.post-thumb { position: relative; display: block; aspect-ratio: 16/10; overflow: hidden; }
.post-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.post-card:hover .post-thumb img { transform: scale(1.05); }
.post-tags { position: absolute; top: 1rem; left: 1rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.tag { background: rgba(255,255,255,0.9); backdrop-filter: blur(4px); color: #0f172a; padding: 0.25rem 0.75rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
@media (prefers-color-scheme: dark) { .tag { background: rgba(15,23,42,0.8); color: #f8fafc; } }
.tag:hover { background: var(--accent); color: white; }
.post-content { padding: 1.5rem; display: flex; flex-direction: column; flex-grow: 1; }
.post-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.75rem; line-height: 1.4; }
.post-title a:hover { color: var(--accent); }
.post-excerpt { color: var(--text-muted); font-size: 0.9375rem; margin-bottom: 1.5rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; flex-grow: 1; }
.post-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.875rem; border-top: 1px solid var(--border); padding-top: 1rem; margin-top: auto; }
.author { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; }
.author img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.author:hover { color: var(--accent); }
.date { color: var(--text-muted); }

/* Sidebar */
.widget { background: var(--card-bg); border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 2rem; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.widget-title { font-size: 1.125rem; font-weight: 700; margin-bottom: 1.25rem; padding-bottom: 0.75rem; border-bottom: 2px solid var(--bg-color); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag-cloud .tag { position: static; background: var(--bg-color); color: var(--text-main); border: 1px solid var(--border); transition: var(--transition); }
.tag-cloud .tag:hover { background: var(--accent); color: white; border-color: var(--accent); }
.author-list { list-style: none; }
.author-list li { margin-bottom: 1rem; }
.author-list li:last-child { margin-bottom: 0; }
.author-list a { display: flex; align-items: center; gap: 1rem; padding: 0.5rem; border-radius: var(--radius-md); transition: var(--transition); }
.author-list a:hover { background: var(--bg-color); transform: translateX(5px); }
.author-list img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.author-info { display: flex; flex-direction: column; }
.author-name { font-weight: 600; color: var(--text-main); }
.author-posts { font-size: 0.75rem; color: var(--text-muted); }
.sticky-widget { position: sticky; top: 90px; }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 0.5rem; margin-top: 3rem; }
.page-link { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--card-bg); border: 1px solid var(--border); font-weight: 500; transition: var(--transition); }
.page-link:hover:not(.disabled) { background: var(--bg-color); color: var(--accent); border-color: var(--accent); }
.page-link.active { background: var(--accent); color: white; border-color: var(--accent); box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3); }
.page-link.disabled { opacity: 0.5; cursor: not-allowed; }
.page-link.prev, .page-link.next { width: auto; padding: 0 1rem; }

/* Footer */
.site-footer { background: var(--card-bg); border-top: 1px solid var(--border); padding: 4rem 0 2rem; margin-top: auto; }
.footer-content { display: grid; grid-template-columns: 1fr auto; gap: 2rem; margin-bottom: 3rem; }
@media (max-width: 768px) { .footer-content { grid-template-columns: 1fr; text-align: center; } .footer-links { justify-content: center; } }
.footer-brand p { color: var(--text-muted); margin-top: 0.5rem; max-width: 300px; }
@media (max-width: 768px) { .footer-brand p { margin: 0.5rem auto; } }
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: center; }
.footer-links a { color: var(--text-muted); font-weight: 500; }
.footer-links a:hover { color: var(--accent); }
.footer-bottom { text-align: center; color: var(--text-muted); font-size: 0.875rem; padding-top: 2rem; border-top: 1px solid var(--border); }

/* Single Post Specific */
.post-header { margin-bottom: 2rem; text-align: center; max-width: 800px; margin: 0 auto 2rem; }
.post-header .tag { position: static; display: inline-block; margin-bottom: 1rem; }
.post-single-title { font-size: clamp(2rem, 5vw, 3rem); font-weight: 900; line-height: 1.2; margin-bottom: 1.5rem; }
.post-single-meta { display: flex; justify-content: center; align-items: center; gap: 1rem; color: var(--text-muted); flex-wrap: wrap; }
.post-single-meta .author img { width: 32px; height: 32px; }
.post-featured-image { border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 3rem; aspect-ratio: 21/9; box-shadow: var(--shadow-md); }
.post-featured-image img { width: 100%; height: 100%; object-fit: cover; }
.post-body { font-size: 1.125rem; line-height: 1.8; color: var(--text-main); max-width: 800px; margin: 0 auto; }
.post-body h2, .post-body h3 { margin: 2.5rem 0 1rem; line-height: 1.3; font-weight: 800; }
.post-body p { margin-bottom: 1.5rem; }
.post-body img { border-radius: var(--radius-md); margin: 2rem 0; box-shadow: var(--shadow-sm); }
.post-body blockquote { border-left: 4px solid var(--accent); font-style: italic; color: var(--text-muted); margin: 2rem 0; background: var(--ad-bg); padding: 1.5rem 2rem; border-radius: 0 var(--radius-md) var(--radius-md) 0; font-size: 1.25rem; }
.post-body ul, .post-body ol { margin-bottom: 1.5rem; padding-left: 2rem; }
.post-body li { margin-bottom: 0.5rem; }

/* In-post Banner */
.in-post-ad { margin: 3rem 0; }

/* Page Specific */
.page-header { margin-bottom: 3rem; text-align: center; padding: 3rem 0; background: var(--card-bg); border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.page-title { font-size: 2.5rem; font-weight: 900; }

/* Author Profile */
.author-profile { background: var(--card-bg); border-radius: var(--radius-lg); padding: 3rem; text-align: center; margin-bottom: 3rem; border: 1px solid var(--border); box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.author-profile::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100px; background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%); opacity: 0.1; }
.author-profile img { width: 120px; height: 120px; border-radius: 50%; margin: 0 auto 1.5rem; border: 4px solid var(--card-bg); box-shadow: var(--shadow-md); position: relative; object-fit: cover; }
.author-profile h1 { font-size: 2rem; margin-bottom: 0.5rem; position: relative; }
.author-bio { color: var(--text-muted); max-width: 600px; margin: 0 auto; position: relative; }

/* Tag Header */
.tag-header { text-align: center; margin-bottom: 3rem; padding: 2rem; background: var(--card-bg); border-radius: var(--radius-lg); border: 1px dashed var(--border); }
.tag-header span { font-size: 1.25rem; color: var(--text-muted); }
.tag-header h1 { font-size: 2.5rem; color: var(--accent); }

/* Responsive Adjustments */
@media (max-width: 640px) {
    .site-header .container { flex-direction: column; justify-content: center; gap: 1rem; height: auto; padding: 1rem; }
    .post-grid { grid-template-columns: 1fr; }
    .post-featured-image { aspect-ratio: 16/9; }
    .author-profile { padding: 2rem 1rem; }
}

/* Feedback Form */
.feedback-form {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: clamp(1.25rem, 3vw, 2rem);
    display: grid;
    gap: 1.25rem;
    margin: 0 auto 2rem;
    max-width: 680px;
}
.feedback-form label {
    display: grid;
    gap: 0.5rem;
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 800;
}
.feedback-form input,
.feedback-form textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-color);
    color: var(--text-main);
    font: inherit;
    font-size: 1rem;
    line-height: 1.5;
    padding: 0.875rem 1rem;
    outline: none;
    transition: var(--transition);
}
.feedback-form textarea {
    min-height: 180px;
    resize: vertical;
}
.feedback-form input:focus,
.feedback-form textarea:focus {
    border-color: var(--accent);
    background: var(--card-bg);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}
.feedback-form button {
    border: 0;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    padding: 0.95rem 1.25rem;
    min-height: 52px;
    transition: var(--transition);
    box-shadow: 0 10px 20px color-mix(in srgb, var(--accent) 24%, transparent);
}
.feedback-form button:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}
.feedback-result {
    display: none;
    border-radius: var(--radius-md);
    background: var(--ad-bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
    font-weight: 700;
}
.feedback-result:not(:empty) {
    display: block;
}
.feedback-form .cf-turnstile {
    min-height: 65px;
}

@media (max-width: 640px) {
    .feedback-form {
        padding: 1rem;
        gap: 1rem;
    }
    .feedback-form button {
        width: 100%;
    }
}

/* Homepage Intro */
.main-content > h1:first-child,
.main-content > h1:first-child + p {
    grid-column: 1 / -1;
    text-align: center;
}
.main-content > h1:first-child {
    max-width: 900px;
    margin: 0 auto 0.75rem;
    font-size: clamp(2.25rem, 5vw, 4.5rem);
    line-height: 1.05;
    font-weight: 900;
    letter-spacing: 0;
    color: var(--text-main);
}
.main-content > h1:first-child + p {
    max-width: 820px;
    margin: 0 auto 2.75rem;
    color: var(--text-muted);
    font-size: clamp(1rem, 2vw, 1.2rem);
    line-height: 1.75;
}

@media (max-width: 640px) {
    .main-content > h1:first-child {
        margin-top: 0.5rem;
    }
    .main-content > h1:first-child + p {
        margin-bottom: 2rem;
    }
}
