/* ==========================================================================
   Design System & Variables
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700;800&display=swap');

:root {
    /* Colors - Light Mode */
    --primary-color: #0d6efd;
    /* Medical Blue */
    --primary-hover: #0b5ed7;
    --secondary-color: #198754;
    /* Health Green */

    --bg-color: #f8f9fa;
    --surface-color: #ffffff;
    --surface-hover: #f1f3f5;

    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;

    --border-color: #dee2e6;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --hover-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);

    /* Typography */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Layout */
    --container-width: 1360px;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --primary-color: #3d8bfd;
    --primary-hover: #0d6efd;
    --secondary-color: #20c997;

    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --surface-hover: #2d2d2d;

    --text-primary: #f8f9fa;
    --text-secondary: #ced4da;
    --text-muted: #6c757d;

    --border-color: #343a40;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 0.5em;
}

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

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

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

ul {
    list-style: none;
}

.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto !important;
    padding: 0 5vw;
    /* Much larger outer margins on all screens */
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: var(--font-body);
}

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

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

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 50rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-blue {
    background-color: rgba(13, 110, 253, 0.1);
    color: var(--primary-color);
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

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

.logo a {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-accent {
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    align-items: center;
}

.nav-links div {
    display: flex;
    align-items: center;
}

.nav-links ul {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-links li {
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 1rem;
    display: block;
}

.nav-links a:hover,
.nav-links a.active,
.nav-links li.current-menu-item>a,
.nav-links li.current_page_item>a {
    color: var(--primary-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.theme-toggle:hover {
    background-color: var(--surface-hover);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* ==========================================================================
   AdSense Placeholders (Critical for Setup)
   ========================================================================== */
.ad-slot {
    background-color: var(--surface-hover);
    border: 1px dashed var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-radius: var(--border-radius-sm);
    margin: 2rem 0;
    overflow: hidden;
    position: relative;
}

.ad-slot::before {
    content: "Advertisement";
    position: absolute;
    top: 5px;
    left: 5px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ad-leaderboard {
    width: 100%;
    min-height: 90px;
    margin: 1rem 0 2rem;
}

.ad-sidebar {
    width: 100%;
    min-height: 250px;
    margin-bottom: 2rem;
}

.ad-sidebar-large {
    min-height: 600px;
}

.ad-in-article {
    width: 100%;
    min-height: 250px;
    margin: 2rem 0;
}

/* ==========================================================================
   Main Layout Grid
   ========================================================================== */
.main-layout {
    display: flex;
    justify-content: center;
    /* Keep content grouped together in the absolute center */
    gap: 3rem;
    /* Tighter gap so sidebar relates to content */
    margin-top: 3rem;
    margin-bottom: 5rem;
    width: 100%;
}

.main-content {
    flex: 1;
    max-width: 720px;
    /* Optimal reading line length (approx 75 characters) */
    min-width: 0;
}

.sidebar {
    width: 320px;
    /* Standard sidebar size */
    flex-shrink: 0;
    position: sticky;
    top: 100px;
    height: fit-content;
}

/* ==========================================================================
   Blog Posts Components
   ========================================================================== */
.section-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    position: relative;
    padding-bottom: 0.75rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

/* Featured Post Hero */
.featured-post {
    margin: 2rem 0;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    background-color: var(--surface-color);
    box-shadow: var(--card-shadow);
    display: grid;
    grid-template-columns: 1fr 1fr;
    transition: var(--transition);
}

.featured-post:hover {
    box-shadow: var(--hover-shadow);
    transform: translateY(-4px);
}

.featured-img-wrap {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.featured-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.featured-post:hover .featured-img-wrap img {
    transform: scale(1.05);
}

.featured-content {
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.featured-content h2 {
    font-size: 2.2rem;
    margin-bottom: 1rem;
}

.featured-content h2 a {
    color: var(--text-primary);
}

.featured-content h2 a:hover {
    color: var(--primary-color);
}

.post-excerpt {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

/* Post Grid */
.post-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.post-card {
    background-color: var(--surface-color);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    box-shadow: var(--hover-shadow);
    transform: translateY(-4px);
}

.post-card-img {
    height: 220px;
    overflow: hidden;
    position: relative;
}

.post-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.post-card:hover .post-card-img img {
    transform: scale(1.05);
}

.post-card-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.post-card-content h3 {
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
}

.post-card-content h3 a {
    color: var(--text-primary);
}

.post-card-content h3 a:hover {
    color: var(--primary-color);
}

.post-card-content .post-excerpt {
    font-size: 1rem;
    flex-grow: 1;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Sidebar Widgets */
.widget {
    background-color: var(--surface-color);
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

.widget-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

.widget-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 40px;
    height: 2px;
    background-color: var(--primary-color);
}

.popular-posts-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.popular-post-item {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.popular-post-img {
    width: 80px;
    height: 80px;
    border-radius: var(--border-radius-sm);
    object-fit: cover;
}

.popular-post-info h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.popular-post-info a {
    color: var(--text-primary);
}

.popular-post-info a:hover {
    color: var(--primary-color);
}

.popular-post-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ==========================================================================
   Comments Section
   ========================================================================== */
#comments {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.comments-title,
.comment-reply-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-family: var(--font-heading);
}

.comment-list {
    margin: 0 0 2rem;
    padding: 0;
    list-style: none;
}

.comment-list .comment {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--border-radius-md);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.comment-list .children {
    margin-left: 2rem;
    padding-left: 0;
    list-style: none;
    margin-top: 1.5rem;
}

.comment-body {
    display: flex;
    flex-direction: column;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.comment-meta img {
    border-radius: 50%;
    width: 40px;
    height: 40px;
}

.comment-meta .fn {
    font-weight: 600;
    font-style: normal;
}

.comment-metadata a {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.comment-content p {
    margin-bottom: 1rem;
}

.reply a {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color);
}

.comment-respond {
    background: var(--surface-hover);
    padding: 2rem;
    border-radius: var(--border-radius-md);
    margin-top: 2rem;
}

.comment-form label,
#respond label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea,
#respond input[type="text"],
#respond input[type="email"],
#respond input[type="url"],
#respond textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background-color: var(--surface-color);
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition);
}

#respond input:focus,
#respond textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.comment-form input[type="submit"],
#respond input[type="submit"] {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 1rem;
}

.comment-form input[type="submit"]:hover,
#respond input[type="submit"]:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--hover-shadow);
}

.comment-notes,
.logged-in-as {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.comment-form-cookies-consent,
#wp-comment-cookies-consent {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

/* ==========================================================================
   Search Modal
   ========================================================================== */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(5px);
}

.search-modal.active {
    opacity: 1;
    visibility: visible;
}

.search-modal-content {
    width: 90%;
    max-width: 600px;
    background: var(--surface-color);
    padding: 3rem;
    border-radius: var(--border-radius-lg);
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.search-modal.active .search-modal-content {
    transform: translateY(0);
}

.close-search {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.close-search:hover {
    color: var(--primary-color);
    transform: rotate(90deg);
}

.modal-search-form {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.modal-search-form input {
    flex: 1;
    padding: 1rem 1.5rem;
    font-size: 1.2rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
}

.modal-search-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-search-form button {
    padding: 0 2rem;
    font-size: 1.2rem;
}

/* Footer Section */
.site-footer {
    background-color: #1a1a1a;
    color: #f8f9fa;
    padding: 4rem 0 2rem;
    margin-top: 4rem;
}

[data-theme="dark"] .site-footer {
    background-color: #0d0d0d;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-about p {
    color: #adb5bd;
    margin-top: 1rem;
}

.footer-widget h4 {
    color: #ffffff;
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    font-family: var(--font-heading);
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-links a {
    color: #adb5bd;
}

.footer-links a:hover {
    color: var(--primary-color);
    padding-left: 5px;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #333;
    color: #adb5bd;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-layout {
        flex-direction: column;
    }

    .main-content,
    .sidebar {
        width: 100%;
    }

    .sidebar {
        position: static;
        max-width: 100%;
        margin-top: 3rem;
    }

    .featured-post {
        grid-template-columns: 1fr;
    }

    .featured-img-wrap {
        height: 300px;
    }

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

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

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 80px;
        left: 0;
        width: 100%;
        background-color: var(--surface-color);
        flex-direction: column;
        padding: 2rem;
        box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);
        border-top: 1px solid var(--border-color);
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links div.menu {
        width: 100%;
    }

    .nav-links ul {
        flex-direction: column;
        width: 100%;
        gap: 1.5rem;
    }

    .nav-links li {
        width: 100%;
        text-align: center;
    }

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