/* ═══════════════════════════════════════════
   GymPlatePrep — Gym Nutrition Blog
   Design: Bold, premium, clean — inspired by
   Gold's Gym blog aesthetic
   ═══════════════════════════════════════════ */

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

:root {
    --color-bg: #f8f9fa;
    --color-surface: #ffffff;
    --color-text: #1a1a2e;
    --color-text-secondary: #4a4a5e;
    --color-text-muted: #6b7280;
    --color-primary: #e85d04;
    --color-primary-dark: #cc4d00;
    --color-primary-light: #fff0e6;
    --color-accent: #16a34a;
    --color-accent-dark: #15803d;
    --color-border: #e5e7eb;
    --color-border-light: #f0f0f5;
    --color-code-bg: #f3f4f6;
    --color-hero-start: #1a1a2e;
    --color-hero-end: #2d1b00;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', monospace;

    --max-width: 800px;
    --content-width: 720px;

    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-2xl: 4rem;
    --space-3xl: 6rem;

    --radius: 12px;
    --radius-sm: 6px;
    --radius-pill: 999px;
}

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

body {
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

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

a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

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

/* ─── Header ──────────────────────────────── */
.site-header {
    background: rgba(255, 255, 255, 0.97);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--color-text);
    text-decoration: none;
    letter-spacing: -0.03em;
}

.site-logo:hover {
    color: var(--color-text);
    text-decoration: none;
}

.site-logo__icon {
    font-size: 1.4rem;
    display: inline-block;
    transform: scaleX(-1);
}

.site-nav {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.site-nav a {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    padding: var(--space-xs) 0;
    position: relative;
    transition: color 0.2s ease;
}

.site-nav a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-primary);
    transition: width 0.2s ease;
    border-radius: 1px;
}

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

.site-nav a:hover::after {
    width: 100%;
}

/* ─── Hero (Homepage) ─────────────────────── */
.hero {
    background: linear-gradient(135deg, var(--color-hero-start) 0%, var(--color-hero-end) 100%);
    padding: var(--space-3xl) 0 var(--space-2xl);
    text-align: center;
    margin: calc(-1 * var(--space-lg)) calc(-1 * var(--space-lg)) var(--space-xl);
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 50%, rgba(232, 93, 4, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(22, 163, 74, 0.08) 0%, transparent 40%);
    pointer-events: none;
}

.hero--with-image {
    background-size: cover;
    background-position: center 30%;
    background-repeat: no-repeat;
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(10, 10, 26, 0.75) 0%, rgba(26, 13, 0, 0.8) 100%);
    z-index: 0;
}

.hero__content {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: var(--space-md);
    letter-spacing: -0.03em;
    color: #ffffff;
}

.hero p {
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.75);
    max-width: 580px;
    margin: 0 auto;
    line-height: 1.65;
    font-weight: 400;
}

/* ─── Article Hero ──────────────────────────── */
.article-hero {
    position: relative;
    padding: var(--space-3xl) 0 var(--space-2xl);
    text-align: center;
    margin: calc(-1 * var(--space-lg)) calc(-1 * var(--space-lg)) var(--space-xl);
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
    overflow: hidden;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.article-hero--gradient {
    background: linear-gradient(135deg, var(--color-hero-start) 0%, var(--color-hero-end) 100%);
}

.article-hero--with-image {
    background-size: cover;
    background-position: center 35%;
    background-repeat: no-repeat;
}

.article-hero__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(10, 10, 26, 0.7) 0%, rgba(26, 13, 0, 0.8) 100%);
    z-index: 0;
}

.article-hero__content {
    position: relative;
    z-index: 1;
    max-width: var(--content-width);
    margin: 0 auto;
}

.article-hero__content h1 {
    font-size: 2.6rem;
    font-weight: 900;
    line-height: 1.15;
    margin-bottom: var(--space-md);
    letter-spacing: -0.03em;
    color: #ffffff;
}

.article-hero__content .article-meta {
    justify-content: center;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.article-hero__content .article-meta__date {
    color: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .article-hero--gradient {
    background: linear-gradient(135deg, #080812 0%, #1a0f00 100%);
}

/* ─── Section Titles ────────────────────── */
.section-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: var(--space-lg);
    letter-spacing: -0.02em;
    color: var(--color-text);
}

/* ─── Post Card with Thumbnail ──────────── */
.post-card--has-image {
    display: flex;
    gap: var(--space-lg);
    align-items: flex-start;
}

.post-card__thumb {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    border-radius: var(--radius);
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

@media (max-width: 480px) {
    .post-card--has-image {
        flex-direction: column;
        gap: var(--space-md);
    }

    .post-card__thumb {
        width: 100%;
        height: 180px;
    }
}

/* ─── Category Tags ─────────────────────── */
.category-tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.2em 0.7em;
    border-radius: var(--radius-pill);
    background: var(--color-primary);
    color: #ffffff;
    line-height: 1.5;
}

.category-tag:hover {
    background: var(--color-primary-dark);
    color: #ffffff;
    text-decoration: none;
}

/* ─── Post Cards (Index) ────────────────── */
.posts-list {
    padding-bottom: var(--space-2xl);
}

.post-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.post-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.07);
    transform: translateY(-3px);
}

.post-card__meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
    flex-wrap: wrap;
}

.post-card__date {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.post-card__title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: var(--space-sm) 0;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.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-secondary);
    font-size: 0.95rem;
    line-height: 1.65;
}

.post-card__link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    margin-top: var(--space-md);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-primary);
    transition: gap 0.2s ease;
}

.post-card__link:hover {
    gap: var(--space-sm);
    text-decoration: none;
}

/* ─── Article Meta ─────────────────────────── */
.article-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-border-light);
}

.article-meta__date {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

/* ─── Article Content ─────────────────────── */
.main-content {
    padding-top: var(--space-xl);
    padding-bottom: var(--space-2xl);
}

.main-content article {
    max-width: var(--content-width);
    margin: 0 auto;
}

article h1 {
    font-size: 2.4rem;
    font-weight: 900;
    line-height: 1.15;
    margin: var(--space-xl) 0 var(--space-sm);
    letter-spacing: -0.03em;
    color: var(--color-text);
    scroll-margin-top: 90px;
}

article h2 {
    font-size: 1.65rem;
    font-weight: 800;
    margin: var(--space-2xl) 0 var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--color-border);
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--color-text);
    scroll-margin-top: 90px;
}

article h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: var(--space-xl) 0 var(--space-sm);
    line-height: 1.3;
    color: var(--color-text);
    scroll-margin-top: 90px;
}

article h4 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: var(--space-xl) 0 var(--space-sm);
    color: var(--color-text);
    scroll-margin-top: 90px;
}

article p {
    margin-bottom: var(--space-lg);
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--color-text-secondary);
}

article ul, article ol {
    margin-bottom: var(--space-lg);
    padding-left: var(--space-lg);
}

article li {
    margin-bottom: var(--space-sm);
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--color-text-secondary);
}

article li strong {
    color: var(--color-text);
}

article li::marker {
    color: var(--color-primary);
}

/* ─── Blockquotes ──────────────────────────── */
article blockquote {
    border-left: 4px solid var(--color-primary);
    padding: var(--space-lg) var(--space-xl);
    margin: var(--space-xl) 0;
    background: var(--color-primary-light);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
    color: var(--color-text-secondary);
    position: relative;
}

article blockquote::before {
    content: '"';
    position: absolute;
    top: 0.25rem;
    left: var(--space-md);
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--color-primary);
    line-height: 1;
    opacity: 0.3;
    font-style: normal;
}

article blockquote p {
    margin-bottom: 0;
    font-size: 1.05rem;
}

/* ─── Code ─────────────────────────────────── */
article pre {
    background: var(--color-code-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: var(--space-lg);
    overflow-x: auto;
    margin-bottom: var(--space-lg);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
}

article code {
    background: var(--color-code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--color-primary-dark);
}

article pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    color: inherit;
}

/* ─── Horizontal Rule ──────────────────────── */
article hr {
    border: none;
    border-top: 2px solid var(--color-border);
    margin: var(--space-2xl) 0;
}

/* ─── Images ───────────────────────────────── */
article img {
    border-radius: var(--radius);
    margin: var(--space-xl) 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ─── Tables ───────────────────────────────── */
article table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: var(--space-xl);
    font-size: 0.9rem;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--color-border);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

article thead {
    /* For compatibility when <thead> is used, but our renderer uses first row as th */
}

article th {
    background: linear-gradient(180deg, #1a1a2e 0%, #252540 100%);
    color: #ffffff;
    font-weight: 600;
    text-align: left;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: none;
}

article td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--color-border-light);
    color: var(--color-text-secondary);
}

article tr:last-child td {
    border-bottom: none;
}

article tr:nth-child(even) td {
    background: var(--color-bg);
}

article tr:hover td {
    background: var(--color-primary-light);
}

/* Bold inside tables */
article td strong,
article th strong {
    color: var(--color-text);
}

/* Links inside tables */
article td a {
    font-weight: 600;
}

/* ─── Key Takeaways & FAQ ────────────────── */
article h2:last-of-type {
    /* Special styling for final sections */
}

article p:has(strong:only-child) {
    /* Standalone bold lines */
    font-weight: 600;
    color: var(--color-text);
}

/* ─── Footer ───────────────────────────────── */
.site-footer {
    background: var(--color-hero-start);
    color: #9ca3af;
    padding: var(--space-2xl) 0 var(--space-lg);
    margin-top: var(--space-2xl);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.footer-col h3 {
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: var(--space-md);
    letter-spacing: -0.01em;
}

.footer-col p {
    font-size: 0.875rem;
    line-height: 1.65;
    color: #9ca3af;
}

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

.footer-col li {
    margin-bottom: var(--space-sm);
}

.footer-col a {
    color: #9ca3af;
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

.footer-col a:hover {
    color: #ffffff;
    text-decoration: none;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: var(--space-lg);
    text-align: center;
    font-size: 0.825rem;
    color: #6b7280;
}

/* ─── Responsive ───────────────────────────── */
@media (max-width: 900px) {
    .site-nav {
        gap: var(--space-md);
    }

    .site-nav a {
        font-size: 0.8rem;
    }

    .site-header .container {
        padding-top: var(--space-sm);
        padding-bottom: var(--space-sm);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-md);
    }

    .hero {
        padding: var(--space-2xl) var(--space-md);
        margin: calc(-1 * var(--space-md)) calc(-1 * var(--space-md)) var(--space-lg);
    }

    .hero h1 {
        font-size: 2.1rem;
    }

    .hero p {
        font-size: 1rem;
    }

    article h1 {
        font-size: 1.8rem;
    }

    article h2 {
        font-size: 1.35rem;
    }

    article p {
        font-size: 1rem;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .site-nav {
        gap: var(--space-sm);
    }

    .site-nav a {
        font-size: 0.75rem;
    }

    .post-card__title {
        font-size: 1.2rem;
    }

    /* Article hero on tablet */
    .article-hero {
        min-height: 220px;
        padding: var(--space-2xl) var(--space-md);
    }

    .article-hero__content h1 {
        font-size: 2rem;
    }

    /* Make tables scrollable on mobile */
    article table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.7rem;
    }

    .hero--with-image {
        min-height: 300px;
    }

    .post-card {
        padding: var(--space-md);
    }

    .post-card__title {
        font-size: 1.1rem;
    }

    .article-hero {
        min-height: 180px;
        padding: var(--space-xl) var(--space-md);
    }

    .article-hero__content h1 {
        font-size: 1.5rem;
    }

    .email-capture {
        padding: var(--space-xl) var(--space-md);
    }

    .email-capture__fields {
        flex-direction: column;
    }

    .email-capture__input {
        width: 100%;
    }

    .email-capture__btn {
        width: 100%;
    }

    .posts-list {
        padding-bottom: var(--space-xl);
    }
}

/* ═══════════════════════════════════════════
   DARK MODE
   ═══════════════════════════════════════════ */
[data-theme="dark"] {
    --color-bg: #0d0d1a;
    --color-surface: #1a1a2e;
    --color-text: #e8e8e8;
    --color-text-secondary: #a0a0b8;
    --color-text-muted: #7a7a90;
    --color-primary: #f97316;
    --color-primary-dark: #ea580c;
    --color-primary-light: #2d1b00;
    --color-accent: #22c55e;
    --color-accent-dark: #16a34a;
    --color-border: #2d2d44;
    --color-border-light: #252538;
    --color-code-bg: #1e1e32;
    --color-hero-start: #080812;
    --color-hero-end: #1a0f00;
}

[data-theme="dark"] body {
    background: var(--color-bg);
    color: var(--color-text);
}

[data-theme="dark"] .site-header {
    background: rgba(13, 13, 26, 0.97);
    border-bottom-color: var(--color-border);
}

[data-theme="dark"] .site-logo {
    color: #ffffff;
}

[data-theme="dark"] .site-nav a {
    color: var(--color-text-muted);
}

[data-theme="dark"] .site-nav a:hover {
    color: var(--color-primary);
}

[data-theme="dark"] .post-card {
    background: var(--color-surface);
    border-color: var(--color-border);
}

[data-theme="dark"] .post-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .post-card__title a {
    color: #ffffff;
}

[data-theme="dark"] .post-card__title a:hover {
    color: var(--color-primary);
}

[data-theme="dark"] article blockquote {
    background: var(--color-primary-light);
}

[data-theme="dark"] article code {
    background: var(--color-code-bg);
    color: #fbbf24;
}

[data-theme="dark"] article pre {
    background: var(--color-code-bg);
    border-color: var(--color-border);
}

[data-theme="dark"] article th {
    background: linear-gradient(180deg, #252540 0%, #1a1a2e 100%);
}

[data-theme="dark"] article tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] article tr:hover td {
    background: rgba(249, 115, 22, 0.08);
}

[data-theme="dark"] .site-footer {
    border-top: 1px solid var(--color-border);
}

/* ─── Theme Toggle ──────────────────────── */
.site-nav-group {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.theme-toggle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    cursor: pointer;
    color: var(--color-text-muted);
    transition: all 0.2s ease;
    padding: 0;
}

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

.theme-toggle__icon {
    display: block;
    transition: transform 0.3s ease;
}

.theme-toggle:hover .theme-toggle__icon {
    transform: rotate(15deg);
}

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

/* ─── Reading Progress Bar ──────────────── */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-accent) 100%);
    z-index: 1000;
    transition: width 0.05s linear;
    pointer-events: none;
}

/* ─── Table of Contents ─────────────────── */
.toc {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
    border-left: 4px solid var(--color-primary);
}

.toc__title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    margin: 0 0 var(--space-sm);
    padding: 0;
    border: none;
}

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

.toc__item {
    margin: 0;
}

.toc__item a {
    display: block;
    padding: 0.3rem 0;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border-light);
    transition: color 0.2s ease;
    text-decoration: none;
}

.toc__item:last-child a {
    border-bottom: none;
}

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

.toc__item--h3 {
    padding-left: var(--space-lg);
}

.toc__item--h3 a {
    font-size: 0.85rem;
}

/* ─── Email Capture ──────────────────── */
.email-capture {
    background: linear-gradient(135deg, var(--color-primary), #059669);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl) var(--space-xl);
    margin: var(--space-2xl) 0;
    text-align: center;
    color: #fff;
}

.email-capture__title {
    font-size: 1.5rem;
    margin: 0 0 var(--space-sm);
    color: #fff;
}

.email-capture__text {
    font-size: 1rem;
    opacity: 0.9;
    max-width: 540px;
    margin: 0 auto var(--space-lg);
    line-height: 1.6;
}

.email-capture__form {
    max-width: 460px;
    margin: 0 auto;
}

.email-capture__fields {
    display: flex;
    gap: var(--space-sm);
}

.email-capture__input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.email-capture__input::placeholder {
    color: rgba(255,255,255,0.65);
}

.email-capture__input:focus {
    border-color: #fff;
}

.email-capture__btn {
    padding: var(--space-sm) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    background: #fff;
    color: var(--color-primary);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}

.email-capture__btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.email-capture__btn:active {
    transform: translateY(0);
}

.email-capture__msg {
    margin: var(--space-sm) 0 0;
    font-size: 0.875rem;
    min-height: 1.25em;
}

.email-capture__msg--error {
    color: #fca5a5;
}

/* Dark mode override */
[data-theme="dark"] .email-capture {
    background: linear-gradient(135deg, #065f46, #047857);
}

/* ─── Related Posts ──────────────────── */
.related-posts {
    margin: var(--space-2xl) 0;
}

.section-title {
    font-size: 1.35rem;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-xs);
    border-bottom: 2px solid var(--color-border);
}

.related-posts__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.related-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.related-card__thumb {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

.related-card__body {
    padding: var(--space-md);
}

.related-card__title {
    font-size: 1rem;
    margin: 0 0 var(--space-xs);
}

.related-card__title a {
    color: var(--color-text);
    text-decoration: none;
}

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

.related-card__excerpt {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin: 0 0 var(--space-sm);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-card__link {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
}

.related-card__link:hover {
    text-decoration: underline;
}

/* ─── Error Page (404) ──────────────────── */
.error-page {
    text-align: center;
    padding: var(--space-3xl) 0;
}

.error-page h1 {
    font-size: 2.5rem;
    margin-top: 0;
}

.error-page ul {
    list-style: none;
    padding: 0;
    display: inline-block;
    text-align: left;
}

.error-page li {
    margin-bottom: var(--space-sm);
}

/* ─── Print Styles ────────────────────────── */
@media print {
    *, *::before, *::after {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    .site-header,
    .site-footer,
    .reading-progress,
    .theme-toggle,
    .toc,
    .category-tag,
    .site-nav,
    .post-card__link,
    .email-capture,
    .related-posts {
        display: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    .main-content {
        padding-top: 0;
    }

    article h1 { font-size: 20pt; }
    article h2 { font-size: 16pt; }
    article h3 { font-size: 14pt; }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666 !important;
    }

    a[href^="/"]::after {
        content: " (https://gymplateprep.com" attr(href) ")";
    }

    a[href^="#"]::after {
        content: "";
    }

    article pre {
        border: 1px solid #ccc;
        white-space: pre-wrap;
        word-break: break-word;
    }

    article img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }

    article table {
        border-collapse: collapse;
        border: 1px solid #999;
    }

    article th, article td {
        border: 1px solid #999;
        padding: 4pt 8pt;
    }

    .hero {
        padding: var(--space-lg) 0;
        margin: 0;
        background: none !important;
    }

    .hero h1 {
        color: #000 !important;
        font-size: 24pt;
    }

    .hero p {
        color: #333 !important;
    }

    @page {
        margin: 2cm;
    }
}
