/*
Theme Name:  News & Info
Theme URI:   https://example.com/
Author:      Your Name
Author URI:  https://example.com/
Description: A clean, responsive theme for news, information and events. Features a top navigation menu, right-side category widget, and Modern Events Calendar Lite integration.
Version:     1.0.0
Requires at least: 6.0
Requires PHP: 8.0
License:     GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: newsinfo
Tags: news, events, responsive, two-column, custom-menu, widgets
*/

/* -------------------------------------------------------
   CSS Custom Properties
------------------------------------------------------- */
:root {
    --color-primary:     #2c5f8a;
    --color-primary-dk:  #1d4468;
    --color-primary-lt:  #e8f2f9;
    --color-accent:      #e05a2b;
    --color-accent-dk:   #c04820;
    --color-text:        #1e1e1e;
    --color-text-muted:  #5a5a5a;
    --color-border:      #d8dde3;
    --color-bg:          #f4f6f8;
    --color-bg-card:     #ffffff;
    --color-sidebar-bg:  #f0f4f8;

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-serif: Georgia, "Times New Roman", Times, serif;

    --nav-height: 60px;
    --sidebar-width: 280px;
    --content-max: 860px;
    --gap: 28px;
    --radius: 8px;

    --shadow-sm: 0 1px 4px rgba(0,0,0,.08);
    --shadow-md: 0 2px 10px rgba(0,0,0,.10);
}

/* -------------------------------------------------------
   Reset & Base
------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.7;
    color: var(--color-text);
    background: var(--color-bg);
}

img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-accent); text-decoration: underline; }
ul, ol { padding-left: 1.4em; }
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-text);
    margin-bottom: 0.6em;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p  { margin-bottom: 1em; }

/* -------------------------------------------------------
   Layout Wrapper
------------------------------------------------------- */
.site-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-content-area {
    display: flex;
    flex-direction: row;
    gap: var(--gap);
    max-width: calc(var(--content-max) + var(--sidebar-width) + var(--gap) + 64px);
    margin: 0 auto;
    padding: var(--gap) 32px;
    width: 100%;
    flex: 1;
    align-items: flex-start;
}

.site-main {
    flex: 1;
    min-width: 0; /* prevent flex overflow */
}

/* -------------------------------------------------------
   Top Navigation
------------------------------------------------------- */
.site-header {
    background: var(--color-primary);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: calc(var(--content-max) + var(--sidebar-width) + var(--gap) + 64px);
    margin: 0 auto;
    padding: 0 32px;
    display: flex;
    align-items: center;
    height: var(--nav-height);
    gap: 24px;
}

.site-branding {
    flex-shrink: 0;
}

.site-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: 0.01em;
}
.site-title:hover { color: rgba(255,255,255,.85); text-decoration: none; }

.site-description {
    font-size: 0.75rem;
    color: rgba(255,255,255,.65);
    margin: 0;
}

/* Nav menu */
.main-navigation {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.main-navigation ul {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 4px;
}

.main-navigation ul li a {
    display: block;
    padding: 8px 14px;
    color: rgba(255,255,255,.88);
    font-size: 0.92rem;
    font-weight: 500;
    border-radius: var(--radius);
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    text-decoration: none;
}

.main-navigation ul li a:hover,
.main-navigation ul li.current-menu-item > a,
.main-navigation ul li.current_page_item > a {
    background: rgba(255,255,255,.15);
    color: #fff;
}

/* Hamburger button (mobile) */
.menu-toggle {
    display: none;
    background: none;
    border: 2px solid rgba(255,255,255,.6);
    border-radius: var(--radius);
    padding: 6px 10px;
    cursor: pointer;
    color: #fff;
    font-size: 1.1rem;
    line-height: 1;
}

/* -------------------------------------------------------
   Sidebar
------------------------------------------------------- */
.site-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--nav-height) + var(--gap));
    max-height: calc(100vh - var(--nav-height) - var(--gap) * 2);
    overflow-y: auto;
    scrollbar-width: thin;
}

/* Widget boxes */
.widget {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: var(--gap);
    box-shadow: var(--shadow-sm);
}

.widget-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    border-bottom: 2px solid var(--color-primary-lt);
    padding-bottom: 8px;
    margin-bottom: 14px;
}

/* Category widget — selectable list */
.widget_categories ul,
.widget_newsinfo_categories ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.widget_categories ul li,
.widget_newsinfo_categories ul li {
    border-bottom: 1px solid var(--color-border);
}

.widget_categories ul li:last-child,
.widget_newsinfo_categories ul li:last-child {
    border-bottom: none;
}

.widget_categories ul li a,
.widget_newsinfo_categories ul li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 4px;
    color: var(--color-text);
    font-size: 0.95rem;
    transition: color 0.15s, padding-left 0.15s;
    text-decoration: none;
}

.widget_categories ul li a:hover,
.widget_newsinfo_categories ul li a:hover {
    color: var(--color-primary);
    padding-left: 6px;
}

.widget_categories ul li.current-cat > a,
.widget_newsinfo_categories ul li.current-cat > a {
    color: var(--color-accent);
    font-weight: 600;
}

.widget_categories ul li a .cat-count,
.widget_newsinfo_categories ul li a .cat-count {
    font-size: 0.78rem;
    background: var(--color-primary-lt);
    color: var(--color-primary);
    padding: 1px 7px;
    border-radius: 20px;
    font-weight: 600;
}

/* -------------------------------------------------------
   Post Cards (index / archive)
------------------------------------------------------- */
.post-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: var(--gap);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s, transform 0.15s;
}

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

.post-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.post-card-category {
    background: var(--color-primary-lt);
    color: var(--color-primary);
    padding: 2px 9px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.78rem;
    text-decoration: none;
}
.post-card-category:hover { background: var(--color-primary); color: #fff; text-decoration: none; }

.post-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.post-card-title a { color: var(--color-text); }
.post-card-title a:hover { color: var(--color-primary); text-decoration: none; }

.post-card-excerpt {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-thumbnail {
    border-radius: calc(var(--radius) - 2px);
    margin-bottom: 14px;
    width: 100%;
    object-fit: cover;
    max-height: 240px;
}

.read-more {
    display: inline-block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
}
.read-more:hover { color: var(--color-accent); text-decoration: underline; }

/* -------------------------------------------------------
   Single Post
------------------------------------------------------- */
.entry-single {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 36px;
    box-shadow: var(--shadow-sm);
}

.entry-header { margin-bottom: 24px; }
.entry-title { font-size: 1.8rem; }
.entry-meta {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 0;
}
.entry-meta a { color: var(--color-text-muted); }
.entry-meta a:hover { color: var(--color-primary); }

.entry-content { line-height: 1.8; }
.entry-content h2 { margin-top: 1.6em; }
.entry-content h3 { margin-top: 1.4em; }
.entry-content img { border-radius: var(--radius); margin: 1em 0; }
.entry-content blockquote {
    border-left: 4px solid var(--color-primary);
    padding-left: 16px;
    margin: 1.2em 0;
    color: var(--color-text-muted);
    font-style: italic;
}

.entry-footer {
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid var(--color-border);
    font-size: 0.88rem;
    color: var(--color-text-muted);
}
.entry-footer a { color: var(--color-text-muted); }

/* Post navigation */
.post-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: var(--gap);
    gap: var(--gap);
}
.post-navigation a {
    flex: 1;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
    transition: background 0.15s;
}
.post-navigation a:hover { background: var(--color-primary-lt); text-decoration: none; }
.post-navigation .nav-prev { text-align: left; }
.post-navigation .nav-next { text-align: right; }

/* -------------------------------------------------------
   Archive / Category Header
------------------------------------------------------- */
.archive-header {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius);
    padding: 18px 24px;
    margin-bottom: var(--gap);
}
.archive-title { font-size: 1.3rem; margin-bottom: 4px; }
.archive-description { color: var(--color-text-muted); font-size: 0.92rem; margin: 0; }

/* -------------------------------------------------------
   Pagination
------------------------------------------------------- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: var(--gap);
    flex-wrap: wrap;
}
.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--color-text);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.pagination .page-numbers:hover,
.pagination .page-numbers.current {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

/* -------------------------------------------------------
   Events (MEC Integration)
------------------------------------------------------- */
.events-page-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dk) 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 28px 32px;
    margin-bottom: var(--gap);
}
.events-page-header h1 { color: #fff; margin: 0 0 6px; }
.events-page-header p { margin: 0; color: rgba(255,255,255,.8); }

/* Override some MEC default styles to match the theme */
.mec-wrap,
.mec-event-list-view,
.mec-calendar-tlike {
    font-family: var(--font-sans) !important;
}

.mec-event-article,
.mec-event-item {
    border-radius: var(--radius) !important;
    border-color: var(--color-border) !important;
}

.mec-event-title a { color: var(--color-text) !important; }
.mec-event-title a:hover { color: var(--color-primary) !important; }

/* MEC skin overrides */
.mec-event-day { background: var(--color-primary) !important; }
.mec-btn-bg1, .mec-btn-bg2 {
    background: var(--color-primary) !important;
    border-radius: var(--radius) !important;
}

/* -------------------------------------------------------
   Footer
------------------------------------------------------- */
.site-footer {
    background: var(--color-primary-dk);
    color: rgba(255,255,255,.75);
    padding: 28px 32px;
    margin-top: auto;
    font-size: 0.88rem;
}

.footer-inner {
    max-width: calc(var(--content-max) + var(--sidebar-width) + var(--gap) + 64px);
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.footer-inner a { color: rgba(255,255,255,.75); }
.footer-inner a:hover { color: #fff; text-decoration: underline; }

/* -------------------------------------------------------
   Responsive — Tablet (max 900px)
------------------------------------------------------- */
@media (max-width: 900px) {
    :root {
        --sidebar-width: 240px;
        --gap: 20px;
    }

    .header-inner { padding: 0 20px; }
    .site-content-area { padding: var(--gap) 20px; }
}

/* -------------------------------------------------------
   Responsive — Mobile (max 680px)
------------------------------------------------------- */
@media (max-width: 680px) {
    :root { --gap: 16px; }

    /* Stack menu vertically */
    .menu-toggle { display: flex; margin-left: auto; }

    .main-navigation {
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: var(--color-primary-dk);
        display: none;
        flex-direction: column;
        padding: 12px 20px 20px;
        box-shadow: var(--shadow-md);
    }
    .main-navigation.is-open { display: flex; }
    .main-navigation ul { flex-direction: column; gap: 2px; width: 100%; }
    .main-navigation ul li a { padding: 10px 14px; }

    .site-header { position: sticky; }

    /* Stack sidebar below content */
    .site-content-area {
        flex-direction: column;
        padding: var(--gap) 16px;
    }

    .site-sidebar {
        width: 100%;
        position: static;
        max-height: none;
        overflow: visible;
    }

    /* Full-width post cards */
    .post-card { padding: 18px; }
    .entry-single { padding: 20px; }
    .post-navigation { flex-direction: column; }
    .entry-title { font-size: 1.4rem; }
    .footer-inner { flex-direction: column; text-align: center; }
}

/* -------------------------------------------------------
   Skip link (accessibility)
------------------------------------------------------- */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--color-accent);
    color: #fff;
    padding: 8px 16px;
    z-index: 9999;
    border-radius: 0 0 var(--radius) 0;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: top 0.15s;
}
.skip-link:focus { top: 0; }

/* -------------------------------------------------------
   Utility
------------------------------------------------------- */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute;
    height: 1px;
    width: 1px;
    overflow: hidden;
    white-space: nowrap;
}

.no-posts {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 36px;
    text-align: center;
    color: var(--color-text-muted);
}
