/*
Theme Name:        HealthSearchHub Magazine
Theme URI:         https://healthsearchhub.com
Author:            HealthSearchHub Team
Author URI:        https://healthsearchhub.com
Description:       A clean magazine-style WordPress theme for HealthSearchHub.com with a right sidebar, dark green branding, and responsive design.
Version:           1.0.0
Tested up to:      6.9
Requires at least: 6.0
Requires PHP:      7.4
License:           GNU General Public License v2 or later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html
Text Domain:       flavor
Tags:              blog, two-columns, right-sidebar, custom-colors, custom-logo, custom-menu, featured-images, footer-widgets, threaded-comments, translation-ready
*/

/* =============================================
   RESET & BASE
   ============================================= */

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

:root {
    --c-primary:      #1B5E20;
    --c-primary-dark:  #0D3B13;
    --c-primary-light: #2E7D32;
    --c-primary-pale:  #E8F5E9;
    --c-white:         #FFFFFF;
    --c-bg:            #F0F2F0;
    --c-border:        #D5D5D5;
    --c-border-light:  #E8E8E8;
    --c-text:          #222222;
    --c-text-light:    #555555;
    --c-text-muted:    #888888;
    --c-link:          #1B5E20;
    --c-link-hover:    #0D3B13;
    --shadow-sm:       0 1px 3px rgba(0,0,0,.08);
    --shadow-md:       0 2px 8px rgba(0,0,0,.12);
    --radius:          6px;
    --font-body:       'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading:    'Montserrat', 'Open Sans', sans-serif;
    --sidebar-width:   300px;
    --container-max:   1200px;
    --header-height:   80px;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--c-text);
    background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--c-link); text-decoration: none; transition: color .2s; }
a:hover { color: var(--c-link-hover); }

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

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.3;
    color: var(--c-text);
    margin-bottom: .5em;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

p  { margin-bottom: 1.2em; }
ul, ol { margin: 0 0 1.2em 1.5em; }

.screen-reader-text {
    clip: rect(1px,1px,1px,1px);
    position: absolute !important;
    height: 1px; width: 1px;
    overflow: hidden;
    word-wrap: normal !important;
}

/* =============================================
   LAYOUT
   ============================================= */

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 20px;
}

/* Two-column grid: content left, sidebar right */
.two-col {
    display: grid;
    grid-template-columns: 1fr var(--sidebar-width);
    gap: 30px;
    align-items: start;
    padding: 30px 0;
}

.col-content {
    min-width: 0;
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 30px;
}

.col-sidebar {
    min-width: 0;
    position: sticky;
    top: 100px;
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 20px;
}

/* =============================================
   HEADER
   ============================================= */

.site-header {
    background: var(--c-primary-dark);
    border-bottom: 3px solid var(--c-primary);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
}

/* Bigger logo — darkened to match theme */
.site-logo img {
    max-height: 60px;
    width: auto;
    filter: brightness(0.75) saturate(1.2);
}
.site-logo a {
    display: flex;
    align-items: center;
}

.site-title {
    margin: 0;
    font-size: 1.5rem;
}
.site-title a {
    color: var(--c-white);
    text-decoration: none;
    font-family: var(--font-heading);
    font-weight: 700;
}

/* NAV */
.main-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 4px;
}
.main-nav ul li a {
    display: block;
    padding: 8px 16px;
    color: rgba(255,255,255,.9);
    font-size: .9375rem;
    font-weight: 600;
    border-radius: var(--radius);
    transition: background .2s, color .2s;
}
.main-nav ul li a:hover,
.main-nav ul li.current-menu-item > a {
    background: rgba(255,255,255,.15);
    color: #fff;
}

/* Dropdown */
.main-nav ul ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    min-width: 200px;
    z-index: 999;
}
.main-nav ul li { position: relative; }
.main-nav ul li:hover > ul { display: block; }
.main-nav ul ul li a {
    color: var(--c-text);
    padding: 10px 16px;
    font-size: .875rem;
    border-radius: 0;
}
.main-nav ul ul li a:hover {
    background: var(--c-primary-pale);
    color: var(--c-primary-dark);
}

/* Mobile toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
}

/* Search toggle */
.search-toggle-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,.9);
    cursor: pointer;
    padding: 8px;
    font-size: 1.25rem;
    transition: color .2s;
}
.search-toggle-btn:hover { color: #fff; }

.search-overlay {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 12px;
    width: 320px;
    z-index: 998;
}
.search-overlay.active { display: block; }
.search-overlay .search-field {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font-size: .9375rem;
}

/* =============================================
   BREADCRUMBS
   ============================================= */

.breadcrumbs {
    font-size: .8125rem;
    color: var(--c-text-muted);
    margin-bottom: 20px;
}
.breadcrumbs a { color: var(--c-primary); }
.breadcrumbs a:hover { text-decoration: underline; }

/* =============================================
   SINGLE POST
   ============================================= */

.entry-categories { margin-bottom: 12px; }

.category-badge {
    display: inline-block;
    background: var(--c-primary);
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 3px;
    letter-spacing: .03em;
}
.category-badge:hover { background: var(--c-primary-dark); color: #fff; }

.entry-title {
    font-size: 1.85rem;
    line-height: 1.25;
    margin-bottom: .5em;
}

.entry-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    font-size: .8125rem;
    color: var(--c-text-muted);
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--c-border-light);
}
.entry-meta svg { vertical-align: -2px; margin-right: 4px; }
.entry-meta a { color: var(--c-text-muted); }
.entry-meta a:hover { color: var(--c-primary); }

.entry-thumbnail {
    margin-bottom: 24px;
    border-radius: var(--radius);
    overflow: hidden;
}
.entry-thumbnail img {
    width: 100%;
    height: auto;
}

.entry-content {
    font-size: 1rem;
    line-height: 1.8;
}
.entry-content h2 { margin-top: 1.5em; }
.entry-content h3 { margin-top: 1.3em; }
.entry-content blockquote {
    border-left: 4px solid var(--c-primary);
    padding: 16px 20px;
    margin: 1.5em 0;
    background: var(--c-primary-pale);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
}
.entry-content img {
    border-radius: var(--radius);
    margin: 1em 0;
}
.entry-content .wp-block-image { margin: 1.5em 0; }
.entry-content .wp-block-image figcaption {
    font-size: .8125rem;
    color: var(--c-text-muted);
    text-align: center;
    margin-top: 8px;
}

/* Tags */
.entry-tags { margin: 24px 0; }
.entry-tags .tag-links a {
    display: inline-block;
    background: var(--c-bg);
    color: var(--c-text-light);
    font-size: .8125rem;
    padding: 4px 12px;
    border-radius: 3px;
    margin: 0 4px 6px 0;
    border: 1px solid var(--c-border-light);
}
.entry-tags .tag-links a:hover {
    background: var(--c-primary-pale);
    color: var(--c-primary);
    border-color: var(--c-primary);
}

/* Author bio */
.author-bio {
    display: flex;
    gap: 20px;
    padding: 24px;
    background: var(--c-bg);
    border-radius: var(--radius);
    margin-top: 24px;
    border: 1px solid var(--c-border-light);
}
.author-bio .author-avatar img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
}
.author-bio .author-name { font-size: 1rem; margin-bottom: 4px; }
.author-bio .author-name a { color: var(--c-text); }
.author-bio .author-description {
    font-size: .875rem;
    color: var(--c-text-light);
    line-height: 1.6;
    margin: 0;
}

/* =============================================
   POST NAVIGATION
   ============================================= */

.post-navigation {
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid var(--c-border-light);
}
.post-navigation .nav-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.post-navigation .nav-links > div {
    padding: 16px;
    background: var(--c-bg);
    border-radius: var(--radius);
    border: 1px solid var(--c-border-light);
    transition: border-color .2s;
}
.post-navigation .nav-links > div:hover {
    border-color: var(--c-primary);
}
.post-navigation .nav-subtitle {
    display: block;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--c-primary);
    font-weight: 600;
    margin-bottom: 4px;
}
.post-navigation .nav-title {
    display: block;
    font-size: .9375rem;
    font-weight: 600;
    color: var(--c-text);
    line-height: 1.3;
}
.post-navigation a { text-decoration: none; }
.post-navigation a:hover .nav-title { color: var(--c-primary); }

/* =============================================
   RELATED POSTS
   ============================================= */

.related-posts {
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid var(--c-border-light);
}
.related-posts-heading {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: var(--c-text);
}
.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.related-post-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--c-border-light);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--c-text);
    transition: border-color .2s, box-shadow .2s;
    align-items: center;
}
.related-post-card:hover {
    border-color: var(--c-primary);
    box-shadow: var(--shadow-sm);
    color: var(--c-text);
}
.related-post-thumb {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--c-bg);
}
.related-post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.related-post-info { flex: 1; min-width: 0; }
.related-post-name {
    font-size: .875rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.related-post-card:hover .related-post-name { color: var(--c-primary); }
.related-post-date {
    font-size: .75rem;
    color: var(--c-text-muted);
}

/* =============================================
   COMMENTS
   ============================================= */

.comments-area {
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid var(--c-border-light);
}
.comments-area .comment-reply-title {
    font-size: 1.25rem;
    margin-bottom: 16px;
}
.comment-form label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: .9375rem;
    transition: border-color .2s;
}
.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--c-primary);
}
.comment-form textarea { min-height: 140px; resize: vertical; }
.comment-form p { margin-bottom: 14px; }
.comment-form .form-submit input {
    background: var(--c-primary);
    color: #fff;
    border: none;
    padding: 12px 28px;
    font-size: .9375rem;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background .2s;
}
.comment-form .form-submit input:hover { background: var(--c-primary-dark); }

.comment-list {
    list-style: none;
    margin: 0 0 24px;
    padding: 0;
}
.comment-list .comment {
    padding: 16px 0;
    border-bottom: 1px solid var(--c-border-light);
}
.comment-author { font-weight: 600; }
.comment-metadata { font-size: .8125rem; color: var(--c-text-muted); }

/* =============================================
   SIDEBAR / WIDGETS
   ============================================= */

.col-sidebar .widget {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--c-border-light);
}
.col-sidebar .widget:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.widget-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--c-primary);
    color: var(--c-text);
}

.col-sidebar img {
    max-width: 100%;
    height: auto;
}
.col-sidebar .wp-block-image {
    margin: 0;
}
.col-sidebar .wp-block-image figure {
    margin: 0;
}

.widget ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.widget ul li {
    padding: 6px 0;
    border-bottom: 1px solid var(--c-border-light);
    font-size: .9375rem;
}
.widget ul li:last-child { border-bottom: none; }
.widget ul li a { color: var(--c-text-light); }
.widget ul li a:hover { color: var(--c-primary); }

.widget .search-field {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font-size: .875rem;
}

/* =============================================
   CARDS (archive / homepage)
   ============================================= */

.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.card {
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow .2s, transform .2s;
}
.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}
.card-image {
    aspect-ratio: 16/9;
    overflow: hidden;
}
.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}
.card:hover .card-image img { transform: scale(1.04); }
.card-image .category-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1;
}
.card-image { position: relative; }

.card-body { padding: 20px; }
.card-body .entry-title {
    font-size: 1.0625rem;
    margin-bottom: .4em;
    line-height: 1.3;
}
.card-body .entry-title a { color: var(--c-text); }
.card-body .entry-title a:hover { color: var(--c-primary); }
.card-body .entry-excerpt {
    font-size: .875rem;
    color: var(--c-text-light);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: .8em;
}
.card-body .entry-meta {
    font-size: .8125rem;
    color: var(--c-text-muted);
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* Featured post */
.featured-post {
    position: relative;
    min-height: 420px;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 30px;
}
.featured-post .featured-image {
    position: absolute;
    inset: 0;
}
.featured-post .featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.featured-post .featured-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,.8) 0%, rgba(0,0,0,.1) 60%);
}
.featured-post .featured-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px;
    color: #fff;
}
.featured-post .featured-content .entry-title { color: #fff; font-size: 2rem; }
.featured-post .featured-content .entry-title a { color: #fff; }
.featured-post .featured-content .entry-meta { color: rgba(255,255,255,.8); border: none; padding: 0; margin: 0; }
.featured-post .featured-content .entry-meta a { color: rgba(255,255,255,.8); }
.featured-post a { text-decoration: none; color: inherit; display: block; }

/* Section heading */
.section-heading {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--c-text);
    margin: 30px 0 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--c-primary);
    font-family: var(--font-heading);
}

/* =============================================
   FOOTER
   ============================================= */

.site-footer {
    background: var(--c-primary-dark);
    color: rgba(255,255,255,.8);
    padding: 40px 0 0;
    margin-top: 40px;
}
.site-footer a { color: rgba(255,255,255,.9); }
.site-footer a:hover { color: #fff; }

.footer-widgets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(255,255,255,.15);
}
.footer-widgets .widget-title {
    color: #fff;
    border-bottom-color: var(--c-primary-light);
}
.footer-widgets .widget ul li { border-bottom-color: rgba(255,255,255,.1); }
.footer-widgets .widget ul li a { color: rgba(255,255,255,.7); }
.footer-widgets .widget ul li a:hover { color: #fff; }

.footer-bottom {
    text-align: center;
    padding: 20px 0;
    font-size: .8125rem;
    color: rgba(255,255,255,.5);
}

/* Disclaimer */
.footer-disclaimer {
    text-align: center;
    font-size: .75rem;
    color: rgba(255,255,255,.4);
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.1);
    line-height: 1.5;
}

/* =============================================
   PAGE TEMPLATES
   ============================================= */

.page-header {
    background: var(--c-primary-dark);
    color: #fff;
    padding: 30px 0;
    margin-bottom: 0;
}
.page-header .page-title {
    color: #fff;
    margin: 0;
    font-size: 1.75rem;
}
.page-header .archive-description {
    color: rgba(255,255,255,.8);
    margin-top: 8px;
    font-size: .9375rem;
}

/* 404 */
.error-404 { text-align: center; padding: 60px 20px; }
.error-404 .page-title { font-size: 4rem; color: var(--c-primary); margin-bottom: .3em; }

/* Search results */
.search-results .entry-title { font-size: 1.25rem; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 30px 0;
}
.pagination .page-numbers {
    display: inline-block;
    padding: 8px 14px;
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font-size: .875rem;
    color: var(--c-text);
}
.pagination .page-numbers.current,
.pagination .page-numbers:hover {
    background: var(--c-primary);
    color: #fff;
    border-color: var(--c-primary);
}

/* =============================================
   WIDE / FULL BLOCKS
   ============================================= */

.entry-content .alignwide {
    margin-left: -30px;
    margin-right: -30px;
    max-width: calc(100% + 60px);
}
.entry-content .alignfull {
    margin-left: -30px;
    margin-right: -30px;
    max-width: calc(100% + 60px);
}

/* =============================================
   RESPONSIVE: 1024px
   ============================================= */

@media (max-width: 1024px) {
    .two-col {
        grid-template-columns: 1fr 260px;
        gap: 24px;
    }
    .posts-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-widgets { grid-template-columns: repeat(2, 1fr); }
    .featured-post .featured-content .entry-title { font-size: 1.75rem; }
}

/* =============================================
   RESPONSIVE: 768px
   ============================================= */

@media (max-width: 768px) {
    :root { --header-height: 60px; }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }

    .main-nav { display: none; }
    .main-nav.toggled { display: block; position: absolute; top: 100%; left: 0; right: 0; background: var(--c-primary-dark); border-top: 1px solid rgba(255,255,255,.1); padding: 10px 0; }
    .main-nav.toggled ul { flex-direction: column; gap: 0; }
    .main-nav.toggled ul li a { padding: 12px 20px; border-radius: 0; }
    .main-nav ul ul { position: static; box-shadow: none; border: none; padding-left: 20px; }

    .menu-toggle { display: flex; align-items: center; justify-content: center; }

    .two-col {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .col-sidebar {
        position: static;
        width: 100%;
        max-width: 100%;
    }

    .posts-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .post-navigation .nav-links { grid-template-columns: 1fr; }
    .related-posts-grid { grid-template-columns: 1fr; }

    .featured-post { min-height: 300px; }
    .featured-post .featured-content { padding: 20px; }
    .featured-post .featured-content .entry-title { font-size: 1.5rem; }

    .col-content { padding: 20px; }

    .entry-content .alignwide,
    .entry-content .alignfull {
        margin-left: -20px;
        margin-right: -20px;
        max-width: calc(100% + 40px);
    }

    .search-overlay { width: calc(100vw - 40px); right: -60px; }
}

/* =============================================
   RESPONSIVE: 480px
   ============================================= */

@media (max-width: 480px) {
    .container { padding: 0 16px; }
    .posts-grid { grid-template-columns: 1fr; }
    .footer-widgets { grid-template-columns: 1fr; }
    .col-content { padding: 16px; }

    .entry-content .alignwide,
    .entry-content .alignfull {
        margin-left: -16px;
        margin-right: -16px;
        max-width: calc(100% + 32px);
    }

    .site-logo img { max-height: 45px; }

    img { max-width: 100% !important; }
}

/* =============================================
   PRINT
   ============================================= */

@media print {
    .site-header, .site-footer, .col-sidebar, .post-navigation, .related-posts, .comments-area { display: none; }
    .two-col { grid-template-columns: 1fr; }
    .col-content { border: none; padding: 0; box-shadow: none; }
    body { background: #fff; }
}
