/*
Theme Name: N4EP Finance
Theme URI: https://n4ep.com
Author: N4EP Finance
Author URI: https://n4ep.com
Description: A clean, fast-loading, SEO-friendly personal finance WordPress theme for N4EP Finance. Built for US audience content on money, budgeting, credit, saving, mortgages, investing, insurance and financial calculators.
Version: 3.5
Requires at least: 5.8
Tested up to: 6.6
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: n4ep-finance
Tags: blog, news, one-column, two-columns, right-sidebar, custom-menu, featured-images, translation-ready
*/

/* =========================================
   0. THEME VARIABLES (Light / Dark mode)
========================================= */
:root {
    --bg: #f7f9fb;
    --surface: #ffffff;
    --surface-alt: #eef2f5;
    --text: #1c2733;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --heading: #0f1f2e;
    --border: #e5e9ed;
    --primary: #0b5f3c;
    --primary-strong: #0f7a4d;
    --primary-soft: #eaf6f0;
    --link: #0b5f3c;
    --footer-bg: #0f1f2e;
    --footer-text: #cbd5e1;
}

[data-theme="dark"] {
    --bg: #10161c;
    --surface: #1a222b;
    --surface-alt: #222b34;
    --text: #e5e9ee;
    --text-secondary: #a9b4c0;
    --text-muted: #8b96a3;
    --heading: #f5f7f9;
    --border: #2b3540;
    --primary: #34c98a;
    --primary-strong: #2fae7d;
    --primary-soft: #163529;
    --link: #4fd8a0;
    --footer-bg: #0a0f14;
    --footer-text: #a9b4c0;
}

/* =========================================
   1. RESET / BASE
========================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    max-width: 100%;
}

body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 17px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    transition: background-color .2s ease, color .2s ease;
    width: 100%;
}

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

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

a:hover {
    text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--heading);
    margin: 0 0 .6em;
}

p {
    margin: 0 0 1.2em;
}

ul, ol {
    padding-left: 1.4em;
}

.container {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 20px;
}

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

.skip-link:focus {
    position: fixed !important;
    clip: auto !important;
    width: auto !important;
    height: auto !important;
    top: 10px;
    left: 10px;
    z-index: 10000;
    background: var(--primary);
    color: #fff;
    padding: 12px 18px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
}

/* Dark mode toggle button */
.theme-toggle {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    transition: background-color .2s ease, border-color .2s ease;
}

.theme-toggle:hover {
    border-color: var(--primary);
}

.theme-toggle-icon {
    display: none;
    line-height: 1;
}

.theme-icon-light { display: block; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: block; }

/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
    z-index: 500;
    box-shadow: 0 6px 20px rgba(0,0,0,.2);
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* =========================================
   2. HEADER
========================================= */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 999;
    transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.site-header.is-scrolled {
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    flex-wrap: wrap;
    gap: 14px;
}

.site-header .container {
    max-width: 1400px;
}

@media (min-width: 721px) {
    .site-header-inner {
        flex-wrap: nowrap;
        gap: 20px;
        padding: 14px 24px;
    }
    .site-branding {
        flex-shrink: 0;
    }
    .main-navigation {
        flex: 1 1 auto;
        min-width: 0;
    }
    .main-navigation ul {
        flex-wrap: nowrap;
        justify-content: flex-end;
        gap: 0;
    }
    .main-navigation a {
        white-space: nowrap;
        padding: 10px 10px;
        font-size: 14.5px;
    }
    .header-controls {
        flex-shrink: 0;
    }
}

@media (min-width: 1300px) {
    .main-navigation a {
        padding: 10px 14px;
        font-size: 15px;
    }
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-logo img {
    max-height: 54px;
    width: auto;
}

.site-logo-dark {
    display: none;
}

[data-theme="dark"] .site-logo-light {
    display: none;
}

[data-theme="dark"] .site-logo-dark {
    display: block;
}

.site-title {
    font-size: 24px;
    margin: 0;
    letter-spacing: -0.5px;
}

.site-title a {
    color: var(--heading);
}

.site-description {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

.mobile-nav-header {
    display: none;
}

/* Primary nav */
.main-navigation {
    flex: 1 1 auto;
    display: flex;
    justify-content: flex-end;
}

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

.main-navigation li {
    position: relative;
}

.main-navigation a {
    display: block;
    padding: 10px 14px;
    color: var(--text);
    font-weight: 600;
    font-size: 15px;
    border-radius: 6px;
}

.main-navigation a:hover,
.main-navigation .current-menu-item > a {
    background: var(--primary-soft);
    color: var(--primary);
    text-decoration: none;
}

.main-navigation ul ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    border-radius: 8px;
    padding: 6px;
    min-width: 200px;
    border: 1px solid var(--border);
}

.main-navigation li:hover > ul {
    display: block;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border);
    padding: 0;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.hamburger {
    position: relative;
    width: 20px;
    height: 14px;
    display: block;
}

.hamburger span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform .25s ease, opacity .25s ease, top .25s ease;
}

.hamburger span:nth-child(1) { top: 0; }
.hamburger span:nth-child(2) { top: 6px; }
.hamburger span:nth-child(3) { top: 12px; }

.menu-toggle.is-active .hamburger span:nth-child(1) {
    top: 6px;
    transform: rotate(45deg);
}

.menu-toggle.is-active .hamburger span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.is-active .hamburger span:nth-child(3) {
    top: 6px;
    transform: rotate(-45deg);
}

/* Mobile menu backdrop overlay */
.menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 998;
    opacity: 0;
    transition: opacity .25s ease;
}

.menu-overlay.is-visible {
    display: block;
    opacity: 1;
}

body.menu-open {
    overflow: hidden;
}

/* =========================================
   2b. BREADCRUMBS
========================================= */
.n4ep-breadcrumbs {
    font-size: 13.5px;
    color: var(--text-muted);
    padding: 16px 0 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.n4ep-breadcrumbs a {
    color: var(--text-muted);
    font-weight: 500;
}

.n4ep-breadcrumbs a:hover {
    color: var(--primary);
    text-decoration: none;
}

.n4ep-breadcrumbs .sep {
    color: var(--border);
}

.n4ep-breadcrumbs .current {
    color: var(--text);
    font-weight: 600;
}

/* =========================================
   3. LAYOUT / CONTENT
========================================= */
.site-content {
    padding: 36px 0 60px;
}

.content-layout {
    display: grid;
    grid-template-columns: 2.2fr 1fr;
    gap: 40px;
    align-items: start;
    min-width: 0;
}

.content-layout > * {
    min-width: 0;
}

.content-layout.full-width {
    grid-template-columns: 1fr;
}

/* =========================================
   4. HERO / FEATURED (homepage)
========================================= */
.hero-section {
    background: linear-gradient(135deg, #0b5f3c 0%, #0f7a4d 100%);
    color: #fff;
    padding: 56px 0;
    margin-bottom: 40px;
}

.hero-section h1 {
    color: #fff;
    font-size: 34px;
    max-width: 640px;
}

.hero-section p {
    color: rgba(255,255,255,.9);
    max-width: 560px;
    font-size: 18px;
}

.category-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.category-pills a {
    background: rgba(255,255,255,.15);
    color: #fff;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,.3);
}

.category-pills a:hover {
    background: rgba(255,255,255,.28);
    text-decoration: none;
}

/* =========================================
   5. ARTICLE CARDS / LOOP
========================================= */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 26px;
    margin-bottom: 40px;
}

.post-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    transition: box-shadow .25s ease, transform .25s ease, border-color .25s ease, background-color .2s ease;
}

.post-card:hover {
    box-shadow: 0 16px 40px rgba(0,0,0,.18);
    transform: translateY(-4px);
    border-color: var(--primary);
}

.post-card-thumb img {
    transition: transform .4s ease;
}

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

.post-card-thumb {
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #eef2f5;
}

.post-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.post-card-body {
    padding: 18px;
    background: #ffffff !important;
    min-height: 60px;
}

.post-card-category {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #0b5f3c !important;
    background: #eaf6f0 !important;
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 10px;
}

.post-card-title {
    font-size: 19px;
    margin-bottom: 8px;
}

.post-card-title a {
    color: #0f1f2e !important;
    font-weight: 700 !important;
}

.post-card-excerpt {
    font-size: 14.5px;
    color: #475569 !important;
    margin-bottom: 10px;
}

.post-meta {
    font-size: 13px;
    color: #64748b !important;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

[data-theme="dark"] .post-card-body {
    background: var(--surface, #1a222b) !important;
}

[data-theme="dark"] .post-card-title a {
    color: var(--heading, #f5f7f9) !important;
}

[data-theme="dark"] .post-card-excerpt {
    color: var(--text-secondary, #a9b4c0) !important;
}

[data-theme="dark"] .post-meta {
    color: var(--text-muted, #8b96a3) !important;
}

[data-theme="dark"] .post-card-category {
    color: var(--primary, #34c98a) !important;
    background: var(--primary-soft, #163529) !important;
}

/* Single post */
.single-post-header {
    margin-bottom: 24px;
}

.single-post-header .post-card-category {
    margin-bottom: 14px;
}

.single-post-title {
    font-size: 32px;
    margin-bottom: 14px;
    overflow-wrap: break-word;
    word-break: break-word;
}

.single-post-thumb {
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 30px;
}

.entry-content {
    background: var(--surface);
    padding: 32px;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 18px;
    line-height: 1.8;
    color: var(--text);
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

.entry-content * {
    max-width: 100%;
}

.entry-content h2 {
    font-size: 24px;
    margin-top: 1.4em;
}

.entry-content h3 {
    font-size: 20px;
    margin-top: 1.2em;
}

.entry-content blockquote {
    border-left: 4px solid var(--primary);
    margin: 1.5em 0;
    padding: .6em 1.2em;
    background: var(--primary-soft);
    color: var(--text-secondary);
    font-style: italic;
}

.author-box {
    display: flex;
    gap: 16px;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-top: 30px;
}

.author-box img {
    border-radius: 50%;
    width: 64px;
    height: 64px;
    object-fit: cover;
}

/* Disclaimer note used on finance content */
.disclaimer-box {
    background: #fff8e6;
    border: 1px solid #f2d98a;
    color: #8a6d1c;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 14px;
    margin: 24px 0;
}

[data-theme="dark"] .disclaimer-box {
    background: #2e2712;
    border-color: #5c4a1a;
    color: #f2d98a;
}

/* Tables inside articles */
.table-scroll {
    overflow-x: auto;
    margin: 1.6em 0;
    border-radius: 8px;
}

.entry-content table {
    border-collapse: collapse;
    width: 100%;
    min-width: 420px;
    font-size: 16px;
}

.entry-content th,
.entry-content td {
    padding: 12px 16px;
    border: 1px solid var(--border);
    text-align: left;
}

.entry-content th {
    background: var(--surface-alt);
    font-weight: 600;
    color: var(--heading);
}

.entry-content tr:nth-child(even) td {
    background: var(--surface-alt);
}

/* =========================================
   5b. RELATED POSTS
========================================= */
.related-posts {
    margin: 44px 0;
    padding-top: 36px;
    border-top: 1px solid var(--border);
}

.related-posts-title {
    font-size: 22px;
    margin-bottom: 20px;
}

/* =========================================
   5b. HORIZONTAL POST LIST (homepage/archives)
========================================= */
.post-list {
    display: flex;
    flex-direction: column;
    margin-bottom: 40px;
}

.post-list-item {
    display: flex;
    gap: 24px;
    padding: 28px 0;
    border-bottom: 1px solid var(--border);
    align-items: flex-start;
}

.post-list-item:first-child {
    padding-top: 0;
}

.post-list-thumb {
    flex: 0 0 240px;
    aspect-ratio: 16/9;
    border-radius: 10px;
    overflow: hidden;
    background: var(--surface-alt);
    display: block;
}

.post-list-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: transform .3s ease;
}

.post-list-item:hover .post-list-thumb img {
    transform: scale(1.03);
}

.post-list-body {
    flex: 1;
    min-width: 0;
}

.post-list-title {
    font-size: 22px;
    margin: 8px 0 8px;
}

.post-list-title a {
    color: var(--heading);
}

.post-list-item:hover .post-list-title a {
    color: var(--primary);
}

.post-list-excerpt {
    font-size: 15.5px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.6;
}

@media (max-width: 640px) {
    .post-list-item {
        flex-direction: column;
        gap: 14px;
        padding: 22px 0;
    }
    .post-list-thumb {
        flex: none;
        width: 100%;
    }
    .post-list-title {
        font-size: 19px;
    }
}

/* =========================================
   5c. DON'T MISS OUT (popup while reading)
========================================= */
.dont-miss-out-popup {
    position: fixed;
    z-index: 950;
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 16px 44px rgba(0,0,0,.2);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, transform .3s ease, visibility .3s;
    padding: 4px;
}

.dont-miss-out-popup.is-visible {
    opacity: 1;
    visibility: visible;
}

.dmo-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--surface-alt, #eef2f5);
    border: none;
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
    color: var(--text-muted, #64748b);
    z-index: 2;
}

.dont-miss-out {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    padding: 12px 34px 12px 12px;
}

.dont-miss-out:hover {
    text-decoration: none;
}

.dont-miss-out-thumb {
    flex: 0 0 72px;
    height: 54px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface-alt, #eef2f5);
}

.dont-miss-out-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.dont-miss-out-body {
    flex: 1;
    min-width: 0;
}

.dont-miss-out-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--primary, #0b5f3c);
    margin-bottom: 4px;
}

.dont-miss-out-title {
    font-size: 14.5px;
    margin: 2px 0 0;
    color: var(--heading, #0f1f2e);
    line-height: 1.35;
}

.dont-miss-out-arrow {
    font-size: 18px;
    color: var(--primary, #0b5f3c);
    flex-shrink: 0;
}

/* Desktop: bottom-right toast */
@media (min-width: 641px) {
    .dont-miss-out-popup {
        bottom: 24px;
        right: 24px;
        width: 340px;
        transform: translateY(16px);
    }
    .dont-miss-out-popup.is-visible {
        transform: translateY(0);
    }
}

/* Mobile: full-width bottom bar */
@media (max-width: 640px) {
    .dont-miss-out-popup {
        left: 10px;
        right: 10px;
        bottom: 10px;
        transform: translateY(16px);
    }
    .dont-miss-out-popup.is-visible {
        transform: translateY(0);
    }
    .dont-miss-out-thumb {
        display: none;
    }
}

/* Live ad units (admin-provided code) get a subtle label wrapper */
.ad-slot-live {
    background: transparent;
    border: none;
    padding: 0;
    text-align: center;
    overflow: hidden;
}

.in-content-ad {
    margin: 28px 0;
}

.feed-ad {
    margin: 8px 0 28px;
}

/* =========================================
   5d. COMMENTS SECTION
========================================= */
.comments-area {
    margin: 44px 0;
    padding-top: 36px;
    border-top: 1px solid var(--border);
}

.comments-title,
.comment-reply-title {
    font-size: 22px;
    margin-bottom: 20px;
}

.comment-list {
    list-style: none;
    margin: 0 0 30px;
    padding: 0;
}

.comment-list .children {
    list-style: none;
    margin: 0;
    padding-left: 40px;
}

.comment-list > li {
    margin-bottom: 20px;
}

.comment-body {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 20px;
}

.comment-meta {
    margin-bottom: 10px;
}

.comment-author.vcard {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.comment-author .avatar {
    border-radius: 50%;
    width: 40px;
    height: 40px;
}

.comment-author .fn {
    font-style: normal;
    font-weight: 600;
    color: var(--heading);
    font-size: 15px;
}

.comment-author .says {
    display: none;
}

.comment-metadata {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-left: 50px;
}

.comment-metadata a {
    color: var(--text-muted);
}

.comment-content p {
    margin: 0 0 10px;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.7;
    overflow-wrap: break-word;
    word-break: break-word;
}

.comment-content p:last-child {
    margin-bottom: 0;
}

.comment .reply {
    margin-top: 10px;
}

.comment-reply-link {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 4px 12px;
    border-radius: 999px;
}

.comment-reply-link:hover {
    background: var(--primary-soft);
    text-decoration: none;
}

.bypostauthor > .comment-body {
    border-color: var(--primary);
}

/* Comment form */
#respond {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}

.comment-form p {
    margin-bottom: 16px;
}

.comment-form label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
}

.comment-form textarea {
    resize: vertical;
}

.comment-notes,
.comment-form-cookies-consent {
    font-size: 13px;
    color: var(--text-muted);
}

.form-submit {
    margin-bottom: 0 !important;
}

/* "More From N4EP" mixed-category section (below comments) */
.more-from-site {
    margin: 44px 0;
}

.mini-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.mini-card {
    background: #ffffff !important;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    transition: box-shadow .2s ease, transform .2s ease;
}

.mini-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 26px rgba(0,0,0,.12);
}

.mini-card-title {
    font-size: 14.5px;
    line-height: 1.4;
    margin: 0 0 10px;
    min-height: 40px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mini-card-title a {
    color: #0f1f2e !important;
    font-weight: 600 !important;
}

.mini-card-thumb {
    display: block;
    aspect-ratio: 16/9;
    border-radius: 8px;
    overflow: hidden;
    background: #eef2f5;
}

.mini-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

[data-theme="dark"] .mini-card {
    background: var(--surface, #1a222b) !important;
}

[data-theme="dark"] .mini-card-title a {
    color: var(--heading, #f5f7f9) !important;
}

@media (max-width: 780px) {
    .mini-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 460px) {
    .mini-card-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   6. SIDEBAR / WIDGETS
========================================= */
.widget {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    transition: background-color .2s ease, border-color .2s ease;
}

.widget-title {
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--primary);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-soft);
}

.widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.widget li {
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 14.5px;
}

.widget li:last-child {
    border-bottom: none;
}

.search-form {
    display: flex;
    gap: 8px;
}

.search-form input[type="search"] {
    flex: 1;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    background: var(--surface);
    color: var(--text);
    min-height: 44px;
}

.search-form button {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    min-height: 44px;
}

/* Newsletter widget */
.newsletter-widget {
    background: linear-gradient(135deg, #0b5f3c 0%, #0f7a4d 100%);
    border: none;
}

.newsletter-widget .widget-title {
    color: #fff;
    border-bottom-color: rgba(255,255,255,.25);
}

.newsletter-copy {
    color: rgba(255,255,255,.9);
    font-size: 14px;
    margin-bottom: 14px;
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.newsletter-form input {
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
}

.newsletter-form button {
    background: #0f1f2e;
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s ease;
}

.newsletter-form button:hover {
    background: #1c2733;
}

/* Reading progress bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    z-index: 1000;
}

.reading-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--primary);
    transition: width .1s linear;
}

/* Popular posts widget */
.popular-posts-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.popular-post-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
}

.popular-post-item:last-child {
    border-bottom: none;
}

.popular-post-rank {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popular-post-title {
    font-size: 14.5px;
    color: var(--text);
    line-height: 1.5;
}

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

.updated-badge {
    color: var(--primary);
    font-weight: 600;
}

.print-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12.5px;
    cursor: pointer;
}

.print-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Print-friendly layout */
@media print {
    .site-header,
    .site-footer,
    .sidebar,
    .n4ep-breadcrumbs,
    .social-share,
    .dont-miss-out-popup,
    .related-posts,
    .author-box,
    .ad-slot,
    .theme-toggle,
    .back-to-top,
    .reading-progress,
    .cookie-banner,
    .print-btn,
    .hero-section {
        display: none !important;
    }
    .entry-content {
        border: none;
        padding: 0;
    }
    .content-layout {
        display: block;
    }
    body {
        background: #fff;
        color: #000;
    }
}

/* Social share buttons */
.social-share {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin: 28px 0;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.social-share-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.social-share-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.share-btn {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--text);
    cursor: pointer;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
}

.share-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    text-decoration: none;
}

/* Cookie consent banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    z-index: 900;
    box-shadow: 0 -8px 24px rgba(0,0,0,.2);
}

.cookie-banner p {
    margin: 0;
    font-size: 14px;
    max-width: 720px;
}

.cookie-banner a {
    color: #fff;
    text-decoration: underline;
}

.cookie-accept-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    min-height: 40px;
}

/* FAQ accordion */
.n4ep-faq {
    margin: 32px 0;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 10px;
    background: var(--surface);
}

.faq-question {
    font-weight: 600;
    cursor: pointer;
    color: var(--heading);
    list-style: none;
}

.faq-question::-webkit-details-marker {
    display: none;
}

.faq-question::before {
    content: '+';
    display: inline-block;
    width: 18px;
    color: var(--primary);
    font-weight: 700;
}

.faq-item[open] .faq-question::before {
    content: '\2212';
}

.faq-answer {
    margin-top: 10px;
    color: var(--text-secondary);
    padding-left: 18px;
}

/* Key Takeaways box */
.key-takeaways {
    background: var(--primary-soft);
    border: 1px solid var(--primary);
    border-radius: 12px;
    padding: 20px 24px;
    margin: 0 0 28px;
}

.key-takeaways-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    margin: 0 0 12px;
    color: var(--primary);
}

.key-takeaways-icon {
    color: var(--primary);
    font-size: 15px;
}

.key-takeaways ul {
    margin: 0;
    padding-left: 20px;
}

.key-takeaways li {
    margin-bottom: 8px;
    color: var(--text);
    line-height: 1.6;
}

.key-takeaways li:last-child {
    margin-bottom: 0;
}

@media (max-width: 640px) {
    .post-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    .post-card-body {
        padding: 14px 16px;
    }
    .post-card-title {
        font-size: 17px;
    }
    .post-card-excerpt {
        font-size: 14px;
    }
}

/* Ad placement blocks */
.ad-slot {
    background: var(--surface-alt);
    border: 1px dashed var(--border);
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
    font-size: 13px;
    border-radius: 10px;
    margin-bottom: 24px;
}

/* Calculators section */
.calculator-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.calc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 16px 0 20px;
}

.calc-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.calc-grid input,
.calc-grid select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: 15px;
    min-height: 42px;
}

.calc-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
}

.calc-btn:hover {
    background: var(--primary-strong);
}

.calc-result {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.calc-result-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
}

.calc-result-label {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.calc-result-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
}

.calc-result-sub {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    font-size: 14px;
    color: var(--text-secondary);
}

.calc-budget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
}

/* =========================================
   7. PAGINATION
========================================= */
.pagination {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.pagination a,
.pagination span {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.pagination .current {
    background: #0b5f3c;
    color: #fff;
    border-color: #0b5f3c;
}

/* =========================================
   8. FOOTER
========================================= */
.site-footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 50px 0 24px;
    margin-top: 60px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-grid h3 {
    color: #fff;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 14px;
}

.footer-grid ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-grid a {
    color: #cbd5e1;
    font-size: 14px;
    line-height: 2;
}

.footer-grid a:hover {
    color: #fff;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.1);
    padding-top: 20px;
    font-size: 13px;
    color: #94a3b8;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

/* =========================================
   9. RESPONSIVE
========================================= */
@media (max-width: 880px) {
    .content-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .menu-toggle {
        display: flex;
    }
    .site-header-inner {
        flex-wrap: nowrap;
    }
    .main-navigation {
        display: block;
        position: fixed;
        top: 0;
        right: -100%;
        width: 82%;
        max-width: 320px;
        height: 100%;
        background: var(--surface);
        z-index: 999;
        padding: 20px;
        box-shadow: -10px 0 40px rgba(0,0,0,.2);
        overflow-y: auto;
        transition: right .3s ease;
    }
    .main-navigation.is-open {
        right: 0;
    }
    .mobile-nav-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-bottom: 16px;
        margin-bottom: 8px;
        border-bottom: 1px solid var(--border);
    }
    .mobile-nav-title {
        font-size: 18px;
        font-weight: 700;
        color: var(--heading);
    }
    .mobile-nav-close {
        background: var(--surface-alt);
        border: none;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        font-size: 22px;
        line-height: 1;
        color: var(--text);
        cursor: pointer;
    }
    .main-navigation ul {
        flex-direction: column;
        gap: 2px;
    }
    .main-navigation a {
        min-height: 48px;
        display: flex;
        align-items: center;
        border-bottom: 1px solid var(--border);
        border-radius: 0;
        font-size: 16px;
    }
    .main-navigation li:last-child > a {
        border-bottom: none;
    }
    .main-navigation ul ul {
        position: static;
        box-shadow: none;
        display: block;
        padding-left: 12px;
        border: none;
        background: transparent;
    }
    .hero-section h1 {
        font-size: 26px;
    }
    .entry-content {
        padding: 20px;
        font-size: 17px;
    }
    .comment-list .children {
        padding-left: 16px;
    }
    .comment-body {
        padding: 14px 16px;
    }
    .related-posts-title {
        font-size: 19px;
    }
    .container {
        padding: 0 16px;
    }
    .back-to-top {
        bottom: 16px;
        right: 16px;
        width: 42px;
        height: 42px;
    }
    .site-header-inner {
        gap: 10px;
    }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
