/* ============================================
   SmartPounds Theme — Light Finance
   ============================================ */

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

:root {
    --bg: #f8faf9;
    --card-bg: #ffffff;
    --text: #1a1a2e;
    --text-muted: #555;
    --text-faint: #717171;
    --brand: #1B4332;
    --brand-light: #2D6A4F;
    --border: #e0e8e0;
    --shadow: 0 1px 3px rgba(0,0,0,0.04);
    --radius: 12px;
    --max-width: 1200px;
    --content-width: 720px;
}

body {
    font-family: "Inter", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* --- Header / Nav --- */
.site-header {
    background: #fff;
    border-bottom: 2px solid var(--brand);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-logo {
    font-family: Georgia, serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--brand);
}

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

.site-nav { display: flex; gap: 0; }

.site-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 24px;
}

.site-nav li { margin: 0; padding: 0; }

.site-nav a, .nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.site-nav a:hover, .nav-link:hover, .nav-link.active { color: var(--brand); }

/* --- Reading Progress Bar --- */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: var(--brand);
    z-index: 9999;
    transition: width 0.1s linear;
}

/* --- Table of Contents --- */
.toc-container {
    max-width: var(--content-width);
    margin: 0 auto 2em;
    padding: 0 24px;
}
.toc-toggle {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--brand);
    font-family: Georgia, serif;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.toc-arrow { transition: transform 0.2s; }
.toc-open .toc-arrow { transform: rotate(90deg); }
.toc-nav {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
}
.toc-open .toc-nav { max-height: 500px; }
.toc-nav ul { list-style: none; margin: 0; padding: 12px 16px; }
.toc-nav li { margin: 0; padding: 6px 0; }
.toc-nav li.toc-sub { padding-left: 1.2em; }
.toc-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.88rem;
    transition: color 0.2s;
}
.toc-nav a:hover { color: var(--brand); }

/* --- Share Buttons --- */
.share-buttons {
    max-width: var(--content-width);
    margin: 2em auto 0;
    padding: 1.5em 24px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
}
.share-label { font-size: 0.85rem; color: var(--text-faint); font-weight: 500; }
.share-links { display: flex; gap: 8px; flex-wrap: wrap; }
.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
    font-family: inherit;
    padding: 0;
}
.share-btn svg { width: 18px; height: 18px; }
.share-btn:hover { border-color: var(--brand); color: var(--brand); }
.share-twitter:hover { color: #000; border-color: #000; }
.share-facebook:hover { color: #1877F2; border-color: #1877F2; }
.share-linkedin:hover { color: #0A66C2; border-color: #0A66C2; }
.share-reddit:hover { color: #FF4500; border-color: #FF4500; }
.share-pinterest:hover { color: #E60023; border-color: #E60023; }
.share-whatsapp:hover { color: #25D366; border-color: #25D366; }
.share-bluesky:hover { color: #0085FF; border-color: #0085FF; }

/* --- Author Bio --- */
.author-bio {
    max-width: var(--content-width);
    margin: 2em auto;
    padding: 1.5em 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-top: 1px solid var(--border);
}
.author-avatar img, .author-initials {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}
.author-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
}
.author-name { font-weight: 600; color: var(--text); text-decoration: none; }
.author-name:hover { color: var(--brand); }
.author-bio-text { font-size: 0.85rem; color: var(--text-muted); margin: 4px 0 0; }

/* --- Bento Grid --- */
.home-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 32px 24px;
}

.bento-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    grid-template-rows: auto auto;
    gap: 12px;
    margin-bottom: 40px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(27,67,50,0.08);
}

.card-link {
    display: block;
    padding: 24px;
    height: 100%;
}

.card-featured { grid-row: span 2; }

.card-featured .card-title {
    font-family: Georgia, serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand);
    line-height: 1.3;
    margin-bottom: 10px;
}

.card-featured .card-excerpt {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 16px;
}

.card-small .card-title {
    font-family: Georgia, serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand);
    line-height: 1.3;
    margin-bottom: 8px;
}

/* --- Category Badges --- */
.badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 10px;
    border-radius: 4px;
    margin-bottom: 10px;
    background: #d4edda;
    color: #1B4332;
}

.badge-comparison, .badge-comparisons { background: #cce5ff; color: #0c5460; }
.badge-deep-dive, .badge-deep-dives { background: #fff3cd; color: #856404; }
.badge-news { background: #e8daef; color: #6c3483; }
.badge-guide, .badge-guides { background: #d1ecf1; color: #0c5460; }
.badge-trend, .badge-trends { background: #fce4ec; color: #c0392b; }
.badge-personal { background: #d4edda; color: #1B4332; }
.badge-roundup, .badge-roundups { background: #fef3c7; color: #92400e; }

/* --- Tags --- */
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }

.tag-pill {
    display: inline-block;
    background: #f0f7f0;
    color: var(--brand-light);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.7rem;
}

/* --- Card Meta --- */
.card-meta {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-faint);
}

/* --- Posts Grid (after bento) --- */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 40px;
}

.card-grid img.card-image {
    border-radius: var(--radius) var(--radius) 0 0;
    margin: -24px -24px 16px;
    max-width: none;
    width: calc(100% + 48px);
    height: 220px;
    object-fit: cover;
}

.card-grid .card-title {
    font-family: Georgia, serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand);
    line-height: 1.3;
    margin-bottom: 6px;
}

.card-grid .card-excerpt {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 24px 0;
}

.page-link {
    color: var(--brand);
    font-weight: 600;
    font-size: 0.875rem;
}

.page-number { color: var(--text-faint); font-size: 0.85rem; }

/* --- Post Article --- */
.post-article {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 48px 24px;
}

.post-header { margin-bottom: 32px; }

.post-title {
    font-family: Georgia, serif;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 700;
    color: var(--brand);
    line-height: 1.2;
    margin: 12px 0 16px;
}

.post-excerpt {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-faint);
}

.meta-separator { color: var(--border); }

.post-feature-image { margin-bottom: 32px; border-radius: var(--radius); overflow: hidden; }
.post-feature-image figcaption { font-size: 0.8rem; color: var(--text-faint); margin-top: 8px; text-align: center; }

/* --- Post Body --- */
.post-body {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text);
}

.post-body p { margin-bottom: 1.5em; }
.post-body h2 { font-family: Georgia, serif; color: var(--brand); margin: 2.5em 0 0.8em; font-size: 1.5rem; }
.post-body h3 { font-family: Georgia, serif; color: var(--brand); margin: 2em 0 0.6em; font-size: 1.25rem; }
.post-body ul, .post-body ol { margin: 1em 0 1.5em 1.5em; }
.post-body li { margin-bottom: 0.5em; }
.post-body blockquote { border-left: 3px solid var(--brand); padding-left: 1em; margin: 1.5em 0; color: var(--text-muted); font-style: italic; }
.post-body a { color: var(--brand-light); text-decoration: underline; text-underline-offset: 3px; }
.post-body a:hover { color: var(--brand); }
.post-body pre { background: #1a1a2e; color: #e2e8f0; padding: 1.2em; border-radius: 8px; overflow-x: auto; margin: 1.5em 0; font-size: 0.9em; }
.post-body code { font-size: 0.9em; }
.post-body :not(pre) > code { background: #f0f7f0; padding: 0.15em 0.4em; border-radius: 4px; }
.post-body img { border-radius: 8px; margin: 1.5em 0; }
.post-body .kg-width-wide { margin-left: -4vw; margin-right: -4vw; width: calc(100% + 8vw); }
.post-body .kg-width-full { margin-left: calc(-50vw + 50%); margin-right: calc(-50vw + 50%); width: 100vw; }
.post-body .kg-width-wide img,
.post-body .kg-width-full img { width: 100%; }

/* --- Post Footer --- */
.post-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); }

/* --- Comments --- */
.gh-comments { max-width: var(--content-width); margin: 0 auto; padding: 0 24px 48px; }

/* --- Related Posts --- */
.related-posts { max-width: var(--content-width); margin: 0 auto; padding: 0 24px 48px; }
.related-title { font-family: Georgia, serif; color: var(--brand); font-size: 1.2rem; margin-bottom: 16px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* --- Tag Page --- */
.tag-page { max-width: var(--max-width); margin: 0 auto; padding: 32px 24px; }
.tag-header { margin-bottom: 32px; }
.tag-name { font-family: Georgia, serif; color: var(--brand); font-size: 2rem; }
.tag-description { color: var(--text-muted); margin-top: 8px; }

/* --- Error Page --- */
.error-page { text-align: center; padding: 120px 24px; }
.error-code { font-family: Georgia, serif; font-size: 6rem; color: var(--brand); }
.error-message { color: var(--text-muted); font-size: 1.2rem; margin: 16px 0 32px; }
.error-link { color: var(--brand); font-weight: 600; text-decoration: underline; }

/* --- Footer --- */
.site-footer { border-top: 1px solid var(--border); padding: 24px; text-align: center; }
.footer-copyright { font-size: 0.8rem; color: var(--text-faint); }

/* --- Responsive --- */
@media (max-width: 768px) {
    .bento-grid { grid-template-columns: 1fr; }
    .card-featured { grid-row: auto; }
    .posts-grid { grid-template-columns: 1fr; }
    .related-grid { grid-template-columns: 1fr; }
    .site-nav { display: none; }
    .post-article { padding: 24px 16px; }
}
