/* Modern Reset & Variables */
:root {
    --bg-body: #ffffff;
    --bg-card: #ffffff;
    --text-main: #1a1a1a;
    --text-muted: #666666;
    --primary: #2563eb;
    /* Royal Blue */
    --accent: #0f172a;
    /* Slate 900 */
    --border: #e5e7eb;
    --font-sans: 'Inter', system-ui, sans-serif;
    --font-serif: 'Merriweather', serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-body: #0f172a;
        --bg-card: #1e293b;
        --text-main: #f8fafc;
        --text-muted: #94a3b8;
        --primary: #3b82f6;
        --accent: #f8fafc;
        --border: #334155;
    }
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.8;
}

img {
    max-width: 100%;
    display: block;
}

/* Layout */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    padding: 2rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: block;
    width: 54px;
    height: 54px;
    transition: transform 0.2s;
}

.logo img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    /* Ensures SVG circle stays rounded if needed, mostly redundant but safe */
}

.logo:hover {
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    font-weight: 500;
    color: var(--text-muted);
}

.nav-links a.active,
.nav-links a:hover {
    color: var(--text-main);
}

.cta-button {
    background: var(--primary);
    color: white !important;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
}

/* Home Hero */
.hero {
    text-align: center;
    padding: 4rem 0;
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    letter-spacing: -1px;
    line-height: 1.1;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.hero-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    object-fit: cover;
    border: 3px solid var(--border);
}

/* Grid */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    padding-bottom: 4rem;
}

/* Post Card */
.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

.post-image-wrapper {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.post-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.post-card:hover .post-image-wrapper img {
    transform: scale(1.05);
}

.category-tag {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

.post-content-preview {
    padding: 1.5rem;
}

.post-content-preview time {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.post-content-preview h2 {
    font-size: 1.25rem;
    margin: 0.5rem 0;
    line-height: 1.3;
}

.post-content-preview p {
    color: var(--text-muted);
    font-size: 0.95rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.read-more {
    display: inline-block;
    margin-top: 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
}

/* Single Post */
.post-article {
    max-width: 720px;
    margin: 0 auto 4rem;
}

.post-header {
    text-align: center;
    margin-bottom: 2rem;
}

.category-pill {
    display: inline-block;
    background: var(--border);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.post-header h1 {
    font-size: 2.5rem;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.post-header time {
    color: var(--text-muted);
}

.hero-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: 16px;
    margin-bottom: 2rem;
}

.rich-text {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    color: var(--text-main);
}

.rich-text p {
    margin-bottom: 1.5rem;
}

.rich-text h2 {
    font-family: var(--font-sans);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

/* Author Mini */
.author-bio-mini {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-top: 4rem;
}

.author-bio-mini img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.author-bio-mini h3 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

/* Contact/About/Tools Pages */
.page-content {
    max-width: 800px;
    margin: 0 auto 4rem;
}

.page-hero {
    margin-bottom: 3rem;
    position: relative;
    /* Ensure containment if needed */
}

.about-profile-img {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    object-fit: cover;
    float: right;
    margin-left: 2rem;
    margin-bottom: 1rem;
    border: 4px solid var(--bg-body);
    box-shadow: 0 0 0 2px var(--border);
}

@media (max-width: 768px) {
    .about-profile-img {
        float: none;
        display: block;
        margin: 0 auto 1.5rem;
        width: 120px;
        height: 120px;
    }

    .page-hero {
        text-align: center;
    }
}

.page-hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.tool-card {
    display: flex;
    gap: 1.5rem;
    padding: 2rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 1.5rem;
    align-items: start;
}

.tool-card.featured {
    border: 2px solid var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.tool-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: var(--bg-body);
    object-fit: contain;
    padding: 8px;
    border: 1px solid var(--border);
}

/* Animation */
.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
    opacity: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Footer */
footer {
    padding: 4rem 0;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

    .hero-img {
        width: 100px;
        height: 100px;
    }
}