/* ==========================================================================
   Lua Blog Ghost Theme
   Matches heylua.ai blog design exactly
   ========================================================================== */

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

:root {
    --color-bg: #ffffff;
    --color-black: #000000;
    --color-dark: #0d0d0d;
    --color-text: #1a1a1a;
    --color-text-secondary: #6b6b6b;
    --color-text-muted: #999999;
    --color-border: #e5e5e5;
    --color-border-light: #eeeeee;
    --color-bg-subtle: #f7f7f7;
    --color-blue: #2563eb;
    --color-red: #e53935;
    --color-white: #ffffff;
    --color-code-bg: #0d0d0d;

    --font-family: 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', monospace;

    --container-max: 1120px;
    --container-narrow: 720px;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --transition: 180ms ease;
}

/* ---------- Dark Mode ---------- */
[data-theme="dark"] {
    --color-bg: #111111;
    --color-black: #000000;
    --color-dark: #0a0a0a;
    --color-text: #e8e8e8;
    --color-text-secondary: #a0a0a0;
    --color-text-muted: #666666;
    --color-border: #2a2a2a;
    --color-border-light: #222222;
    --color-bg-subtle: #1a1a1a;
    --color-white: #e8e8e8;
    --color-code-bg: #0a0a0a;
}

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

[data-theme="dark"] .post-content a {
    color: #60a5fa;
}

[data-theme="dark"] .featured-post,
[data-theme="dark"] .post-nav-item {
    border-color: var(--color-border);
    background: var(--color-bg-subtle);
}

[data-theme="dark"] .tag-pill {
    background: var(--color-bg-subtle);
    color: var(--color-text);
    border-color: var(--color-border);
}

[data-theme="dark"] .tag-pill.active {
    background: var(--color-white);
    color: var(--color-black);
}

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

[data-theme="dark"] .share-btn {
    background: var(--color-bg-subtle);
    color: var(--color-text-secondary);
}

[data-theme="dark"] .post-content pre {
    background: var(--color-code-bg);
    border: 1px solid var(--color-border);
}

[data-theme="dark"] .post-content code {
    background: var(--color-bg-subtle);
}

[data-theme="dark"] .hero-badge {
    border-color: var(--color-border);
    color: var(--color-text-secondary);
}

[data-theme="dark"] .post-card-image {
    opacity: 0.9;
}

[data-theme="dark"] .btn-error-primary {
    background: var(--color-white);
    color: var(--color-black);
}

[data-theme="dark"] .toc {
    background: var(--color-bg-subtle);
    border-color: var(--color-border);
}

[data-theme="dark"] .newsletter-slidein {
    background: #1a1a1a;
    border-color: var(--color-border);
}

[data-theme="dark"] .sticky-share {
    background: #1a1a1a;
    border-color: var(--color-border);
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    color: var(--color-text);
    background: var(--color-black);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    background: var(--color-bg);
}

a {
    color: inherit;
    text-decoration: none;
}

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

ul, ol {
    list-style: none;
}

/* ---------- Layout ---------- */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 32px;
}

.container-narrow {
    max-width: var(--container-narrow);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-family);
    font-weight: 500;
    border-radius: 100px;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    border: none;
}

.btn-header {
    padding: 8px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-white);
    background: transparent;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 100px;
}

.btn-header:hover {
    border-color: var(--color-white);
    background: rgba(255, 255, 255, 0.08);
}

.btn-red {
    padding: 10px 24px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-white);
    background: var(--color-red);
    border-radius: var(--radius-sm);
}

.btn-red:hover {
    background: #c62828;
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-black);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-white);
    letter-spacing: -0.01em;
}

.logo-icon {
    flex-shrink: 0;
}

.header-actions {
    display: flex;
    align-items: center;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.mobile-menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--color-white);
    border-radius: 2px;
}

/* ---------- Blog Hero ---------- */
.blog-hero {
    padding: 48px 0 40px;
    text-align: center;
}

.hero-badge {
    display: inline-block;
    padding: 6px 16px;
    border: 1px solid var(--color-border);
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: 20px;
}

.blog-hero h1 {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--color-text);
    margin-bottom: 40px;
    line-height: 1.15;
}

/* ---------- Featured Post ---------- */
.featured-post {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-align: left;
    text-decoration: none;
    color: inherit;
    transition: box-shadow var(--transition);
}

.featured-post:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.featured-post-image {
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.featured-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-post-content {
    padding: 32px 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.featured-post-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    margin-bottom: 20px;
}

.featured-post-meta .tag-link {
    color: var(--color-blue);
    font-weight: 500;
}

.featured-post-meta time {
    color: var(--color-text-muted);
}

.meta-sep {
    color: var(--color-text-muted);
}

.featured-post-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
    margin-bottom: 12px;
    color: var(--color-text);
}

.featured-post-content p {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.read-post-link {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---------- Tag Filter ---------- */
.tag-filter {
    padding: 40px 0 32px;
}

.tag-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-pill {
    padding: 8px 18px;
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text);
    background: var(--color-white);
    border: 1.5px solid var(--color-border);
    border-radius: 100px;
    cursor: pointer;
    transition: all var(--transition);
}

.tag-pill:hover {
    border-color: var(--color-text);
}

.tag-pill.active {
    background: var(--color-black);
    color: var(--color-white);
    border-color: var(--color-black);
}

/* ---------- Posts Grid ---------- */
.posts-section {
    padding: 0 0 80px;
}

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

.post-card {
    transition: opacity var(--transition);
}

.post-card.hidden {
    display: none;
}

.post-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.post-card-image {
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 14px;
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 300ms ease;
}

.post-card-link:hover .post-card-image img {
    transform: scale(1.03);
}

.post-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 6px;
    color: var(--color-text);
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.post-card-meta span:first-child {
    color: var(--color-text-secondary);
}

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 48px;
    font-size: 0.9rem;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1.5px solid var(--color-border);
    border-radius: 100px;
    font-weight: 500;
    transition: all var(--transition);
}

.pagination a:hover {
    border-color: var(--color-text);
}

/* ---------- Bottom CTA ---------- */
.bottom-cta {
    background: var(--color-dark);
    padding: 56px 0;
}

.bottom-cta-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 48px;
    align-items: start;
}

.bottom-cta-subscribe h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-white);
    margin-bottom: 8px;
}

.bottom-cta-subscribe > p {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.5;
    margin-bottom: 20px;
}

.subscribe-form {
    margin-bottom: 12px;
}

.subscribe-fields {
    display: flex;
    gap: 8px;
}

.subscribe-fields input[type="email"] {
    flex: 1;
    padding: 10px 16px;
    font-family: var(--font-family);
    font-size: 0.85rem;
    color: var(--color-white);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color var(--transition);
}

.subscribe-fields input[type="email"]::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.subscribe-fields input[type="email"]:focus {
    border-color: rgba(255, 255, 255, 0.4);
}

/* Ghost adds these classes to the form automatically */
.subscribe-loading,
.subscribe-success,
.subscribe-error {
    display: none;
    font-size: 0.85rem;
    margin-top: 8px;
}

.subscribe-form.loading .subscribe-loading {
    display: block;
    color: rgba(255, 255, 255, 0.6);
}

.subscribe-form.success .subscribe-loading,
.subscribe-form.success .subscribe-fields {
    display: none;
}

.subscribe-form.success .subscribe-success {
    display: block;
    color: #10b981;
}

.subscribe-form.error .subscribe-error {
    display: block;
    color: var(--color-red);
}

.bottom-cta-subscribe small {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
}

.bottom-cta-subscribe small a {
    color: rgba(255, 255, 255, 0.55);
    text-decoration: underline;
}

.bottom-cta-card .bottom-cta-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    color: var(--color-white);
    margin-bottom: 16px;
}

.bottom-cta-card h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-white);
    margin-bottom: 6px;
}

.bottom-cta-card > p {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.5;
    margin-bottom: 12px;
}

.cta-link {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-blue);
    transition: color var(--transition);
}

.cta-link:hover {
    color: #3b82f6;
}

/* ---------- Footer ---------- */
.site-footer {
    background: var(--color-black);
    padding: 24px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-logo img {
    height: 22px;
    filter: brightness(0) invert(1);
}

.footer-nav {
    display: flex;
    gap: 28px;
}

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

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

.footer-nav a {
    font-size: 0.85rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.55);
    transition: color var(--transition);
}

.footer-nav a:hover {
    color: var(--color-white);
}

/* ---------- Single Post ---------- */
.post-header {
    padding: 64px 0 32px;
    text-align: center;
}

.post-tag {
    display: inline-block;
    padding: 5px 14px;
    border: 1px solid var(--color-border);
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-blue);
    margin-bottom: 16px;
}

.post-title {
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 16px;
}

.post-excerpt {
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    max-width: 560px;
    margin: 0 auto 24px;
    line-height: 1.6;
}

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

.post-meta-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.author-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.author-avatar-lg {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 16px;
}

.post-feature-image {
    margin-bottom: 40px;
}

.post-feature-image img {
    border-radius: var(--radius-lg);
    width: 100%;
}

.post-feature-image figcaption {
    text-align: center;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 12px;
}

/* ---------- Post Content ---------- */
.post-content {
    padding-bottom: 80px;
}

.post-content h2 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 48px 0 16px;
}

.post-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 40px 0 12px;
}

.post-content h4 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 32px 0 8px;
}

.post-content p {
    margin-bottom: 24px;
    line-height: 1.75;
    font-size: 1.05rem;
}

.post-content a {
    color: var(--color-blue);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.post-content img {
    border-radius: var(--radius-md);
    margin: 32px 0;
}

.post-content blockquote {
    border-left: 3px solid var(--color-text);
    padding: 4px 0 4px 24px;
    margin: 32px 0;
    font-style: italic;
    color: var(--color-text-secondary);
}

.post-content ul,
.post-content ol {
    margin: 16px 0 24px 24px;
}

.post-content ul {
    list-style: disc;
}

.post-content ol {
    list-style: decimal;
}

.post-content li {
    margin-bottom: 8px;
    line-height: 1.7;
    font-size: 1.05rem;
}

.post-content pre {
    background: var(--color-dark);
    color: #e2e8f0;
    padding: 24px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 32px 0;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
}

.post-content code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--color-bg-subtle);
    padding: 2px 6px;
    border-radius: 4px;
}

.post-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

.post-content hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 48px 0;
}

.post-content figure {
    margin: 32px 0;
}

.post-content figcaption {
    text-align: center;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 12px;
}

.post-content .kg-image-card img,
.post-content .kg-gallery-image img {
    border-radius: var(--radius-md);
}

.post-content .kg-width-wide {
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.post-content .kg-width-full {
    max-width: none;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
}

.post-content .kg-bookmark-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin: 32px 0;
}

.post-content .kg-bookmark-container {
    display: flex;
    text-decoration: none;
    color: inherit;
}

.post-content .kg-bookmark-content {
    flex: 1;
    padding: 20px;
}

.post-content .kg-bookmark-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 8px;
}

.post-content .kg-bookmark-description {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.post-content .kg-bookmark-thumbnail {
    width: 200px;
    flex-shrink: 0;
}

.post-content .kg-bookmark-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
}

/* Ghost gallery cards */
.post-content .kg-gallery-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 32px 0;
}

.post-content .kg-gallery-row {
    display: flex;
    gap: 12px;
}

.post-content .kg-gallery-row img {
    flex: 1;
    margin: 0;
}

/* Ghost video/audio cards */
.post-content .kg-video-card,
.post-content .kg-audio-card {
    margin: 32px 0;
}

.post-content .kg-video-card video {
    width: 100%;
    border-radius: var(--radius-md);
}

/* Ghost callout card */
.post-content .kg-callout-card {
    padding: 20px 24px;
    border-radius: var(--radius-md);
    margin: 32px 0;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

/* Ghost toggle card */
.post-content .kg-toggle-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px;
    margin: 24px 0;
}

/* Tables */
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 32px 0;
    font-size: 0.95rem;
}

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

.post-content th {
    font-weight: 600;
    background: var(--color-bg-subtle);
}

/* Empty state */
.posts-grid:empty::after {
    content: "No posts yet — check back soon.";
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 0;
    color: var(--color-text-muted);
    font-size: 1rem;
}

/* ---------- Post Tags Footer ---------- */
.post-tags {
    padding-bottom: 48px;
}

.post-tags .post-card-tag {
    display: inline-block;
    padding: 5px 14px;
    border: 1px solid var(--color-border);
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-right: 6px;
    margin-bottom: 6px;
    transition: all var(--transition);
}

.post-tags .post-card-tag:hover {
    border-color: var(--color-text);
    color: var(--color-text);
}

/* ---------- Comments ---------- */
.post-comments {
    padding-bottom: 60px;
}

/* ---------- Archive Pages ---------- */
.archive-header {
    padding: 64px 0 32px;
    text-align: center;
}

.archive-header h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 12px;
}

.archive-header p {
    font-size: 1rem;
    color: var(--color-text-secondary);
    max-width: 540px;
    margin: 0 auto;
}

.post-feed {
    padding: 32px 0 80px;
}

/* ---------- Responsive ---------- */
/* ---------- Tablet (max 900px) ---------- */
@media (max-width: 900px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 28px;
    }

    .bottom-cta-grid {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }

    .bottom-cta-subscribe {
        grid-column: 1 / -1;
    }

    .featured-post {
        grid-template-columns: 1fr;
    }

    .featured-post-image {
        aspect-ratio: 16 / 9;
    }

    .post-content .kg-width-wide {
        max-width: 100%;
    }

    .post-content .kg-width-full {
        margin-left: -20px;
        margin-right: -20px;
    }
}

/* ---------- Mobile (max 640px) ---------- */
@media (max-width: 640px) {
    .container {
        padding: 0 16px;
    }

    /* Header */
    .header-actions {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    /* Hero */
    .blog-hero {
        padding: 28px 0 24px;
    }

    .blog-hero h1 {
        font-size: 1.6rem;
        margin-bottom: 24px;
    }

    .hero-badge {
        font-size: 0.75rem;
        padding: 5px 12px;
    }

    /* Featured post stacks vertically */
    .featured-post-content {
        padding: 20px;
    }

    .featured-post-content h2 {
        font-size: 1.15rem;
    }

    .featured-post-content p {
        font-size: 0.85rem;
    }

    .featured-post-meta {
        margin-bottom: 14px;
    }

    /* Tag pills scroll horizontally */
    .tag-filter {
        padding: 28px 0 24px;
    }

    .tag-pills {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 4px;
    }

    .tag-pills::-webkit-scrollbar {
        display: none;
    }

    .tag-pill {
        flex-shrink: 0;
        padding: 7px 14px;
        font-size: 0.8rem;
    }

    /* Post grid single column */
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .posts-section {
        padding-bottom: 48px;
    }

    .post-card-title {
        font-size: 0.9rem;
    }

    /* Bottom CTA */
    .bottom-cta {
        padding: 36px 0;
    }

    .bottom-cta-grid {
        grid-template-columns: 1fr 1fr;
        gap: 24px;
    }

    .bottom-cta-subscribe {
        grid-column: 1 / -1;
        padding-bottom: 24px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        margin-bottom: 4px;
    }

    .bottom-cta-subscribe h3 {
        font-size: 1rem;
    }

    .bottom-cta-subscribe > p {
        font-size: 0.8rem;
        margin-bottom: 16px;
    }

    .bottom-cta-card h4 {
        font-size: 0.85rem;
    }

    .bottom-cta-card > p {
        font-size: 0.8rem;
    }

    .bottom-cta-card .bottom-cta-icon {
        width: 36px;
        height: 36px;
        margin-bottom: 12px;
    }

    .subscribe-fields {
        flex-direction: column;
    }

    .subscribe-fields input[type="email"],
    .btn-red {
        width: 100%;
    }

    /* Footer */
    .footer-inner {
        flex-direction: column;
        gap: 16px;
        text-align: center;
        padding: 16px 0;
    }

    .footer-nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px 20px;
    }

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

    /* Author card */
    .author-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .author-card-meta {
        justify-content: center;
    }

    /* Post nav */
    .post-nav .container {
        flex-direction: column;
        gap: 12px;
    }

    .post-nav-next {
        text-align: left;
    }

    /* Related posts */
    .related-posts {
        padding: 32px 0 48px;
    }

    /* Error page */
    .error-page {
        padding: 80px 0;
    }

    .error-code {
        font-size: 5rem;
    }

    .error-actions {
        flex-direction: column;
    }

    /* Search/theme toggle on mobile */
    .search-btn {
        display: none;
    }

    /* TOC */
    .toc {
        padding: 0 16px;
    }

    /* Sticky share - hide on mobile (inline share is enough) */
    .sticky-share {
        display: none !important;
    }

    /* Newsletter slide-in */
    .newsletter-slidein {
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
    }

    .slidein-form {
        flex-direction: column;
    }

    /* Single post */
    .post-header {
        padding: 36px 0 20px;
    }

    .post-title {
        font-size: 1.5rem;
    }

    .post-excerpt {
        font-size: 1rem;
    }

    .post-meta {
        flex-direction: column;
        gap: 6px;
    }

    .post-meta .meta-sep {
        display: none;
    }

    .post-feature-image {
        margin-bottom: 28px;
    }

    .post-content {
        padding-bottom: 48px;
    }

    .post-content h2 {
        font-size: 1.3rem;
        margin-top: 36px;
    }

    .post-content h3 {
        font-size: 1.1rem;
    }

    .post-content p,
    .post-content li {
        font-size: 1rem;
    }

    .post-content pre {
        padding: 16px;
        font-size: 0.82rem;
        border-radius: var(--radius-sm);
    }

    .post-content .kg-width-full {
        margin-left: -16px;
        margin-right: -16px;
    }

    .post-content .kg-bookmark-container {
        flex-direction: column;
    }

    .post-content .kg-bookmark-thumbnail {
        width: 100%;
        height: 160px;
    }

    /* Archive */
    .archive-header {
        padding: 40px 0 24px;
    }

    .archive-header h1 {
        font-size: 1.5rem;
    }

    /* Pagination */
    .pagination {
        margin-top: 32px;
    }

    .pagination a {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}

/* ---------- Small phones (max 380px) ---------- */
@media (max-width: 380px) {
    .blog-hero h1 {
        font-size: 1.4rem;
    }

    .featured-post-content h2 {
        font-size: 1.05rem;
    }

    .post-title {
        font-size: 1.35rem;
    }

    .bottom-cta-card h4 {
        font-size: 0.9rem;
    }
}

/* ---------- Mobile menu open ---------- */
@media (max-width: 640px) {
    .header-actions.is-open {
        display: flex;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--color-black);
        padding: 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .header-actions.is-open .btn-header {
        width: 100%;
        text-align: center;
    }

    .mobile-menu-toggle.is-active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

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

    .mobile-menu-toggle.is-active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }
}

/* ---------- Touch & accessibility ---------- */
@media (hover: none) {
    .post-card-link:hover .post-card-image img {
        transform: none;
    }

    .featured-post:hover {
        box-shadow: none;
    }
}

/* ---------- Header Navigation ---------- */
.header-nav {
    display: none;
}

.header-nav ul {
    display: flex;
    list-style: none;
    gap: 24px;
}

.header-nav ul li a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.header-nav ul li a:hover {
    color: #ffffff;
}

@media (min-width: 901px) {
    .header-nav {
        display: block;
    }
}

.mobile-nav {
    display: none;
    flex-direction: column;
    gap: 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-black);
    padding: 16px 24px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.mobile-nav ul li a {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 1rem;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mobile-nav ul li a:hover {
    color: #ffffff;
}

.mobile-nav .mobile-cta {
    margin-top: 16px;
    text-align: center;
}

.site-header.menu-open .mobile-nav {
    display: flex;
}

@media (min-width: 901px) {
    .mobile-nav {
        display: none !important;
    }
}

/* ---------- Social Share ---------- */
.post-share {
    padding: 32px 0;
    border-top: 1px solid var(--color-border);
}

.post-share .container {
    display: flex;
    align-items: center;
    gap: 16px;
}

.share-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
}

.share-links {
    display: flex;
    gap: 8px;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-light);
    color: var(--color-text-secondary);
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.share-btn:hover {
    color: #ffffff;
}

.share-x:hover {
    background: #000000;
}

.share-linkedin:hover {
    background: #0A66C2;
}

.share-facebook:hover {
    background: #1877F2;
}

.share-copy:hover {
    background: var(--color-text);
}

.share-copy .icon-check {
    display: none;
    color: #22c55e;
}

.share-copy.copied .icon-link {
    display: none;
}

.share-copy.copied .icon-check {
    display: block;
}

.share-copy.copied {
    background: #f0fdf4;
}

@media (max-width: 640px) {
    .post-share .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* ---------- Reading Progress Bar ---------- */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--color-red);
    z-index: 200;
    transition: width 50ms linear;
}

/* ---------- Search Button ---------- */
.search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    border-radius: 50%;
    transition: color 0.2s, background 0.2s;
}

.search-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-search-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 0;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-family: var(--font-family);
    font-size: 1rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mobile-nav-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

/* ---------- Author Bio Card ---------- */
.post-author-card {
    padding: 32px 0;
    border-top: 1px solid var(--color-border);
}

.author-card {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.author-card-image {
    flex-shrink: 0;
}

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

.author-card-name {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.author-card-name a {
    color: var(--color-text);
    text-decoration: none;
}

.author-card-name a:hover {
    color: var(--color-blue);
}

.author-card-bio {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: 8px;
}

.author-card-meta {
    display: flex;
    gap: 16px;
}

.author-card-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--color-blue);
    text-decoration: none;
    font-weight: 500;
}

.author-card-link:hover {
    text-decoration: underline;
}

/* ---------- Previous/Next Post Navigation ---------- */
.post-nav {
    border-top: 1px solid var(--color-border);
    padding: 32px 0;
}

.post-nav .container {
    display: flex;
    gap: 24px;
}

.post-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 20px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.post-nav-item:hover {
    border-color: var(--color-text-muted);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.post-nav-next {
    text-align: right;
    margin-left: auto;
}

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

.post-nav-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.4;
}

/* ---------- Related Posts ---------- */
.related-posts {
    padding: 48px 0 64px;
    border-top: 1px solid var(--color-border);
}

.related-posts-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 28px;
    letter-spacing: -0.02em;
}

/* ---------- 404 Error Page ---------- */
.error-page {
    padding: 120px 0;
    text-align: center;
}

.error-content {
    max-width: 480px;
    margin: 0 auto;
}

.error-code {
    display: block;
    font-size: 7rem;
    font-weight: 900;
    letter-spacing: -0.05em;
    color: var(--color-text);
    line-height: 1;
    margin-bottom: 16px;
}

.error-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--color-text);
}

.error-description {
    font-size: 1rem;
    color: var(--color-text-secondary);
    margin-bottom: 32px;
}

.error-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-error-primary {
    padding: 10px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-white);
    background: var(--color-black);
    border-radius: 100px;
    text-decoration: none;
}

.btn-error-primary:hover {
    background: var(--color-dark);
}

.btn-error-secondary {
    padding: 10px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    background: transparent;
    border: 1.5px solid var(--color-border);
    border-radius: 100px;
    cursor: pointer;
    font-family: var(--font-family);
}

.btn-error-secondary:hover {
    border-color: var(--color-text);
}

/* ---------- RSS Link in Footer ---------- */
.footer-rss {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    transition: color 0.2s, background 0.2s;
}

.footer-rss:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

/* ---------- Theme Toggle ---------- */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    border-radius: 50%;
    transition: color 0.2s, background 0.2s;
}

.theme-toggle:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.theme-toggle .icon-sun {
    display: none;
}

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

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

/* ---------- Table of Contents ---------- */
.toc {
    display: none;
    max-width: var(--container-narrow);
    margin: 0 auto 32px;
    padding: 0 32px;
}

.toc.toc-visible {
    display: block;
}

.toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.toc-collapsed .toc-header {
    border-radius: var(--radius-md);
}

.toc-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.toc-toggle {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    transition: transform 0.2s;
}

.toc-collapsed .toc-toggle {
    transform: rotate(-90deg);
}

.toc-list {
    list-style: none;
    padding: 12px 20px;
    margin: 0;
    border: 1px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    background: var(--color-bg);
    counter-reset: toc;
}

.toc-collapsed .toc-list {
    display: none;
}

.toc-list li {
    counter-increment: toc;
}

.toc-list li a {
    display: block;
    padding: 6px 0;
    font-size: 0.88rem;
    color: var(--color-text-secondary);
    text-decoration: none;
    border-bottom: 1px solid var(--color-border-light);
    transition: color 0.15s;
}

.toc-list li:last-child a {
    border-bottom: none;
}

.toc-list li a:hover {
    color: var(--color-text);
}

.toc-list li a.toc-active {
    color: var(--color-blue);
    font-weight: 600;
}

.toc-list li.toc-sub a {
    padding-left: 20px;
    font-size: 0.84rem;
}

/* ---------- Sticky Share Sidebar ---------- */
.sticky-share {
    position: fixed;
    left: calc(50% - 600px);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.sticky-share.sticky-share-visible {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 1300px) {
    .sticky-share {
        display: none !important;
    }
}

.sticky-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.sticky-share-btn:hover {
    border-color: var(--color-text-muted);
    color: var(--color-text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.sticky-share-btn .icon-check {
    display: none;
}

.sticky-share-btn.copied .icon-link {
    display: none;
}

.sticky-share-btn.copied .icon-check {
    display: block;
    color: #22c55e;
}

/* ---------- Code Copy Button ---------- */
.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    font-family: var(--font-family);
    font-size: 0.72rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
}

.post-content pre:hover .code-copy-btn {
    opacity: 1;
}

.code-copy-btn:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.14);
}

.code-copy-btn.copied {
    color: #22c55e;
    opacity: 1;
}

/* ---------- Syntax Highlighting ---------- */
.hl-keyword { color: #c792ea; }
.hl-string { color: #c3e88d; }
.hl-comment { color: #676e95; font-style: italic; }
.hl-number { color: #f78c6c; }
.hl-bool { color: #ff5370; }

/* ---------- Newsletter Slide-in ---------- */
.newsletter-slidein {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 360px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    z-index: 90;
    transform: translateY(120%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s;
}

.newsletter-slidein.slidein-visible {
    transform: translateY(0);
    opacity: 1;
}

.slidein-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: color 0.15s;
}

.slidein-close:hover {
    color: var(--color-text);
}

.slidein-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 4px;
}

.slidein-text {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin-bottom: 14px;
}

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

.slidein-form input[type="email"] {
    flex: 1;
    padding: 9px 14px;
    font-family: var(--font-family);
    font-size: 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    color: var(--color-text);
    outline: none;
}

.slidein-form input[type="email"]:focus {
    border-color: var(--color-blue);
}

.slidein-form .btn {
    padding: 9px 16px;
    font-size: 0.82rem;
}

.slidein-msg {
    display: none;
    font-size: 0.82rem;
    margin-top: 8px;
}

.slidein-form.loading ~ .subscribe-loading.slidein-msg {
    display: block;
    color: var(--color-text-muted);
}

.slidein-form.success ~ .subscribe-success.slidein-msg {
    display: block;
    color: #10b981;
}

.slidein-form.error ~ .subscribe-error.slidein-msg {
    display: block;
    color: var(--color-red);
}

/* Safe area for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
    .site-footer {
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }

    .site-header .container {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
}

/* ==========================================================================
   FEATURE 1: Back to Top Button
   ========================================================================== */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-red);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 80;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease, bottom 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(229, 57, 53, 0.3);
}

.back-to-top.btt-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.back-to-top.btt-shifted {
    bottom: 100px;
}

.back-to-top:hover {
    background: #c62828;
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
    }
}

/* ==========================================================================
   FEATURE 2: Content Callout Cards (CSS-only)
   ========================================================================== */
.cta-inline,
.cta-inline-red,
.cta-inline-blue {
    border-left: 4px solid var(--color-text-muted);
    background: var(--color-bg-subtle);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    padding: 24px 28px;
    margin: 32px 0;
}

.cta-inline-red {
    border-left-color: var(--color-red);
    background: rgba(229, 57, 53, 0.06);
}

.cta-inline-blue {
    border-left-color: var(--color-blue);
    background: rgba(37, 99, 235, 0.06);
}

[data-theme="dark"] .cta-inline-red {
    background: rgba(229, 57, 53, 0.1);
}

[data-theme="dark"] .cta-inline-blue {
    background: rgba(37, 99, 235, 0.1);
}

.cta-inline h3,
.cta-inline-red h3,
.cta-inline-blue h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.cta-inline p,
.cta-inline-red p,
.cta-inline-blue p {
    margin-bottom: 12px;
    color: var(--color-text-secondary);
}

.cta-inline .btn,
.cta-inline-red .btn,
.cta-inline-blue .btn {
    display: inline-block;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
}

/* ==========================================================================
   FEATURE 3: Scroll Animations
   ========================================================================== */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .animate-on-scroll {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ==========================================================================
   FEATURE 4: Applause / Reaction Button
   ========================================================================== */
.applause-container {
    padding: 32px 0;
    text-align: center;
}

.applause-container .container-narrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.applause-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--color-bg-subtle);
    border: 2px solid var(--color-border);
    border-radius: 40px;
    padding: 12px 24px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    transition: all 0.2s ease;
    font-family: var(--font-family);
}

.applause-btn:hover {
    border-color: var(--color-red);
    background: rgba(229, 57, 53, 0.06);
}

.applause-btn.applause-liked {
    border-color: var(--color-red);
    color: var(--color-red);
}

.applause-btn.applause-liked .applause-icon {
    fill: var(--color-red);
    stroke: var(--color-red);
}

.applause-btn.applause-pop {
    animation: applausePop 0.6s ease;
}

@keyframes applausePop {
    0% { transform: scale(1); }
    30% { transform: scale(1.2); }
    60% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.applause-label {
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

.applause-count {
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   FEATURE 5: "X min left" Counter
   ========================================================================== */
.reading-time-left {
    position: fixed;
    bottom: 32px;
    left: 32px;
    background: var(--color-dark);
    color: var(--color-bg);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 80;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

[data-theme="dark"] .reading-time-left {
    background: var(--color-bg-subtle);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.reading-time-left.rtl-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 768px) {
    .reading-time-left {
        display: none;
    }
}

/* ==========================================================================
   FEATURE 6: Font Size Toggle
   ========================================================================== */
.font-size-toggle {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    cursor: pointer;
    color: var(--color-text);
    font-family: var(--font-family);
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition);
    display: none;
}

.post-template .font-size-toggle {
    display: inline-flex;
}

.font-size-toggle:hover {
    background: var(--color-bg-subtle);
}

.post-content.font-large {
    font-size: 1.2rem;
    line-height: 1.85;
}

.post-content.font-small {
    font-size: 0.92rem;
    line-height: 1.7;
}

/* ==========================================================================
   FEATURE 7: Bookmark / Save for Later
   ========================================================================== */
.bookmark-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
    z-index: 5;
    color: var(--color-text-secondary);
}

.post-card {
    position: relative;
}

.post-card:hover .bookmark-btn {
    opacity: 1;
}

.bookmark-btn:hover {
    background: var(--color-bg-subtle);
}

.bookmark-btn.bookmarked {
    opacity: 1;
    color: var(--color-red);
}

.bookmark-btn.bookmarked .bookmark-icon {
    fill: var(--color-red);
    stroke: var(--color-red);
}

/* Inline bookmark (post page) */
.post-bookmark-btn {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--color-text-secondary);
    font-family: var(--font-family);
    transition: var(--transition);
}

.post-bookmark-btn:hover {
    border-color: var(--color-red);
    color: var(--color-red);
}

.post-bookmark-btn.bookmarked {
    color: var(--color-red);
    border-color: var(--color-red);
}

/* Saved articles header button */
.saved-articles-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text);
    position: relative;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.saved-articles-btn:hover {
    color: var(--color-red);
}

.saved-count {
    position: absolute;
    top: -4px;
    right: -6px;
    background: var(--color-red);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Saved articles panel */
.saved-articles-panel {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    z-index: 110;
    display: none;
    max-height: 400px;
    overflow-y: auto;
}

.saved-articles-panel.panel-visible {
    display: block;
}

[data-theme="dark"] .saved-articles-panel {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.saved-panel-title {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--color-text);
}

.saved-article-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border-light);
    text-decoration: none;
    color: var(--color-text);
    font-size: 0.85rem;
    transition: var(--transition);
}

.saved-article-item:last-child {
    border-bottom: none;
}

.saved-article-item:hover {
    color: var(--color-red);
}

.saved-article-item span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 8px;
}

.remove-bookmark {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: 1.2rem;
    padding: 0 4px;
    flex-shrink: 0;
}

.remove-bookmark:hover {
    color: var(--color-red);
}

.saved-articles-empty {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    text-align: center;
    padding: 12px 0;
}

/* ==========================================================================
   FEATURE 8: Image Lightbox
   ========================================================================== */
.image-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.image-lightbox.lightbox-visible {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
    transition: transform 0.3s ease;
}

.lightbox-visible .lightbox-img {
    animation: lightboxZoom 0.3s ease;
}

@keyframes lightboxZoom {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   FEATURE 9: Keyboard Navigation
   ========================================================================== */
.keyboard-hints {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--color-dark);
    color: var(--color-bg);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.78rem;
    z-index: 80;
    display: flex;
    gap: 16px;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

[data-theme="dark"] .keyboard-hints {
    background: var(--color-bg-subtle);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.keyboard-hints.kb-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    padding: 2px 8px;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.72rem;
    margin-right: 4px;
    min-width: 22px;
}

[data-theme="dark"] .kbd {
    background: rgba(255, 255, 255, 0.08);
}

.post-card.kb-focused {
    outline: 2px solid var(--color-red);
    outline-offset: 4px;
    border-radius: var(--radius-md);
}

@media (max-width: 768px) {
    .keyboard-hints {
        display: none;
    }
}
