/**
 * Blog Styles
 *
 * Styles for blog list and single post templates.
 * Optimized for content discovery and reading experience.
 */

/* ============================================
   BLOG LIST PAGE
   ============================================ */

.blog-container {
    max-width: var(--content-max-width, 1200px);
    margin: 0 auto;
    padding: var(--space-8) var(--space-6);
    /* Match docs/resume padding pattern */
}

.blog-header {
    margin-bottom: var(--space-12);
    padding: var(--space-8) 0;
    text-align: center;
}

/* Blog list header - matches about/contact (no extra padding, inherits base h1 typography) */
.blog-list-header {
    margin-bottom: var(--space-6);
}

.blog-description {
    font-size: var(--text-lg);
    color: var(--color-text-secondary);
    /* Match docs/resume text color pattern */
    max-width: 600px;
    margin: 0 auto;
    line-height: var(--leading-relaxed);
    /* Match docs/resume for readability */
}

.blog-count {
    margin-top: var(--space-4);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    /* Match docs/resume text color pattern */
}

.blog-categories {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.blog-home-hero-content {
  text-align: center;
  max-width: 600px;
  margin-inline: auto;
}

.blog-post {
  max-width: var(--prose-width);
  margin-inline: auto;
}

/* ============================================
   BLOG SHELL (about, contact, single layout wrapper)
   Used with blog-container for layout.
   ============================================ */

.blog-shell {
  /* Semantic wrapper - layout from blog-container when used together */
}

/* About page article structure */
.blog-about {
  max-width: var(--prose-width);
  margin-inline: auto;
}

.blog-about-header {
  margin-bottom: var(--space-6);
}

.blog-about-content {
  margin-bottom: var(--space-8);
}

.blog-about-footer {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-block-start: 1px solid var(--color-border-light);
}

/* Contact page article structure */
.blog-contact {
  max-width: var(--prose-width);
  margin-inline: auto;
}

.blog-contact-header {
  margin-bottom: var(--space-6);
}

.blog-contact-content {
  margin-bottom: var(--space-8);
}

.blog-contact-footer {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-block-start: 1px solid var(--color-border-light);
}

.contact-email {
  margin: 0 0 var(--space-2) 0;
  font-size: var(--text-base);
  color: var(--color-text-secondary);
}

.contact-social {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: var(--text-base);
  color: var(--color-text-secondary);
}

.contact-social a {
  color: var(--color-primary);
  text-decoration: none;
}

.contact-social a:hover {
  text-decoration: underline;
}

.view-count {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.blog-updated-inline {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Blog Section Titles */
.blog-section-title {
    font-size: var(--text-2xl);
    /* Increased from xl for better hierarchy */
    font-weight: var(--weight-bold);
    /* Increased from semibold for better prominence */
    color: var(--color-text-primary);
    margin-bottom: var(--space-8);
    /* Increased from space-6 */
    padding-bottom: var(--space-3);
    border-block-end: 2px solid var(--color-border-light);
    /* Match resume pattern */
    transition: border-color var(--transition-fast) var(--ease-out);
}

.blog-section-title:hover {
    border-block-end-color: var(--color-primary);
    /* Match resume hover pattern */
}

/* Featured Posts Section */
.blog-featured {
    margin-bottom: var(--space-12);
    padding-bottom: var(--space-8);
    border-block-end: 1px solid var(--color-border-light);
    /* Visual separation */
}

.blog-featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-6);
}

/* Force single column on very small screens */
@media (max-width: 399px) {
    .blog-featured-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .blog-featured-grid {
        grid-template-columns: 1fr;
    }
}

/* Blog Post List */
.blog-posts {
    margin-bottom: var(--space-12);
    margin-top: var(--space-8);
    /* Add top margin for separation */
}

.blog-post-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

/* Virtualize blog post lists unless DevTools are open */
html:not([data-devtools-open]) .blog-post-list > * {
  content-visibility: auto;
  contain-intrinsic-size: 200px;
}

/* Scroll-driven animations for blog posts */
.blog-post-list.stagger-fade-in>* {
    /* Will be animated by scroll-animations.css */
}

/* Blog Post Cards - use article-card + modifiers (category_card uses blog-post-card) */
.blog-featured-grid .article-card,
.blog-post-list .article-card,
.blog-post-list .blog-post-card,
.blog-home-posts-grid .article-card {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--elevation-card);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border);
    position: relative;
}

/* Gradient border support */
.blog-featured-grid .article-card.gradient-border,
.blog-post-list .article-card.gradient-border,
.blog-post-list .blog-post-card.gradient-border,
.blog-home-posts-grid .article-card.gradient-border,
.blog-featured-grid .article-card.gradient-border-strong {
    border: none;
}

.blog-featured-grid .article-card.fluid-combined,
.blog-post-list .article-card.fluid-combined,
.blog-post-list .blog-post-card.fluid-combined,
.blog-home-posts-grid .article-card.fluid-combined,
.blog-featured-grid .article-card.fluid-bg {
    border: none;
}

/* Motion gradient background on hover */
.blog-featured-grid .article-card::before,
.blog-post-list .article-card::before,
.blog-post-list .blog-post-card::before,
.blog-home-posts-grid .article-card::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -10%;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle at 40% 40%,
            color-mix(in srgb, var(--blob-color-1) 6%, transparent) 0%,
            color-mix(in srgb, var(--blob-color-2) 4%, transparent) 25%,
            transparent 50%);
    border-radius: 50%;
    animation: blob-morph var(--blob-duration-slow) ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.blog-featured-grid .article-card:hover::before,
.blog-post-list .article-card:hover::before,
.blog-post-list .blog-post-card:hover::before,
.blog-home-posts-grid .article-card:hover::before {
    opacity: 1;
}

.blog-featured-grid .article-card>*,
.blog-post-list .article-card>*,
.blog-post-list .blog-post-card>*,
.blog-home-posts-grid .article-card>* {
    position: relative;
    z-index: 1;
}

/* Fallback for browsers without color-mix */
@supports not (color: color-mix(in srgb, black, white)) {

    .blog-featured-grid .article-card::before,
    .blog-post-list .article-card::before,
    .blog-post-list .blog-post-card::before,
    .blog-home-posts-grid .article-card::before {
        background: radial-gradient(circle at 40% 40%,
                rgba(59, 130, 246, 0.06) 0%,
                rgba(139, 92, 246, 0.04) 25%,
                transparent 50%);
    }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {

    .blog-featured-grid .article-card::before,
    .blog-post-list .article-card::before,
    .blog-post-list .blog-post-card::before,
    .blog-home-posts-grid .article-card::before {
        animation: none !important;
    }
}

.blog-featured-grid .article-card:hover,
.blog-post-list .article-card:hover,
.blog-post-list .blog-post-card:hover,
.blog-home-posts-grid .article-card:hover {
    box-shadow: var(--elevation-high);
    transform: translate3d(0, -2px, 0);
    transition: box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Disable transform animations on mobile for performance */
@media (max-width: 768px) {

    .blog-featured-grid .article-card:hover,
    .blog-post-list .article-card:hover,
    .blog-post-list .blog-post-card:hover,
    .blog-home-posts-grid .article-card:hover {
        transform: none;
    }
}

/* Horizontal layout for list items */
.blog-post-list .article-card {
    flex-direction: row;
}

@media (max-width: 768px) {
    .blog-post-list .article-card {
        flex-direction: column;
    }
}

/* Blog Card Image */
.blog-card-image {
    position: relative;
    overflow: hidden;
    background: var(--color-bg-secondary);
}

.article-card--featured .blog-card-image {
    aspect-ratio: 16 / 9;
}

.blog-post-list .article-card .blog-card-image,
.blog-home-posts-grid .article-card .blog-card-image {
    flex: 0 0 280px;
    aspect-ratio: 16 / 9;
}

@media (max-width: 768px) {
    .blog-post-list .article-card .blog-card-image,
    .blog-home-posts-grid .article-card .blog-card-image {
        flex: none;
        aspect-ratio: 16 / 9;
    }
}

.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.blog-featured-grid .article-card:hover .blog-card-image img,
.blog-post-list .article-card:hover .blog-card-image img,
.blog-home-posts-grid .article-card:hover .blog-card-image img {
    transform: scale(1.05);
}

.blog-card-image a {
    display: block;
    height: 100%;
}

/* Blog Card Content */
.blog-card-content {
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    flex: 1;
}

.blog-card-title {
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    line-height: var(--leading-tight);
    /* Match docs heading pattern */
    margin: 0;
}

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

.blog-card-title a:hover {
    color: var(--color-primary);
}

/* Excerpt: compact typography scale (structure preserved, sizes minified) */
.blog-card-excerpt {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.45;
    margin: 0;
}

/* Vertical spacing between block elements (newline-like separation) */
.blog-card-excerpt > * + * {
    margin-top: var(--space-3, 0.75rem);
}

.blog-card-excerpt p {
    margin: 0;
    padding-block: var(--space-1);
}

.blog-card-excerpt p + p {
    margin-top: var(--space-3, 0.75rem);
}

/* Headings look like headers (larger, bolder, primary color) */
.blog-card-excerpt .excerpt-heading {
    font-size: 1.125em;
    font-weight: var(--weight-semibold);
    color: var(--color-text-primary);
    margin: 0;
    padding-block: var(--space-1);
}

/* Raw h1-h6 from excerpt HTML: scale to card context (override prose sizes) */
.blog-card-excerpt h1,
.blog-card-excerpt h2,
.blog-card-excerpt h3,
.blog-card-excerpt h4,
.blog-card-excerpt h5,
.blog-card-excerpt h6 {
    font-size: 1.125em;
    font-weight: var(--weight-semibold);
    color: var(--color-text-primary);
    margin: 0;
    padding-block: var(--space-1);
    line-height: var(--leading-tight);
}

.blog-card-excerpt h1 + *,
.blog-card-excerpt h2 + *,
.blog-card-excerpt h3 + *,
.blog-card-excerpt h4 + *,
.blog-card-excerpt h5 + *,
.blog-card-excerpt h6 + * {
    margin-top: var(--space-2, 0.5rem);
}

/* Minimize anchor links in card excerpts (preview context) */
.blog-card-excerpt .heading-anchor .copy-link {
    font-size: 0.75em;
    opacity: 0.6;
}

.blog-card-excerpt strong {
    font-weight: var(--weight-semibold);
    font-size: 1em;
}

.blog-card-excerpt em {
    font-style: italic;
    font-size: 1em;
}

.blog-card-excerpt code {
    font-size: 0.9em;
    padding: 0.1em 0.35em;
    background: var(--color-bg-secondary, rgba(0 0 0 / 0.06));
    border-radius: var(--radius-sm, 0.25rem);
}

/* Lists: newline + indent */
.blog-card-excerpt .excerpt-list {
    margin: 0;
    padding-left: var(--space-5, 1.25rem);
}

.blog-card-excerpt ul.excerpt-list {
    list-style: disc;
}

.blog-card-excerpt ol.excerpt-list {
    list-style: decimal;
}

.blog-card-excerpt .excerpt-list li {
    margin-top: var(--space-1, 0.25rem);
}

.blog-card-excerpt .excerpt-list li:first-child {
    margin-top: 0;
}

.blog-card-excerpt .excerpt-list .excerpt-list {
    margin-top: var(--space-1, 0.25rem);
}

/* Blog Card Metadata */
.blog-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    align-items: center;
    font-size: var(--text-sm);
    color: var(--color-text-primary-muted);
    margin-top: auto;
}

/* Meta at top of card (above title) */
.blog-card-meta--top {
    margin-top: 0;
    margin-bottom: 0;
}

.blog-author {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: var(--weight-medium);
    color: var(--color-text-primary);
}

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

.reading-time {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

/* Blog Tags */
.blog-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

/* Featured card: push tags to bottom (no read more link) */
.article-card--featured .blog-card-tags {
    margin-top: auto;
}

.blog-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--color-bg-secondary);
    color: var(--color-text-primary-muted);
    text-decoration: none;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    transition: all 0.2s ease;
}

.blog-tag:hover {
    background: var(--color-primary);
    color: white;
}

/* Read More Link */
.blog-read-more {
    display: inline-block;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: var(--weight-medium);
    font-size: var(--text-sm);
}

.blog-read-more:hover {
    text-decoration: underline;
}

/* Card footer: tags left, read more right, pushed to bottom */
.blog-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--space-4);
    margin-top: auto;
    width: 100%;
}

/* Ombre fade: excerpt appears to fade away above the footer.
   Uses mask (not overlay) so theme transitions look clean - no color overlay to flash. */
.blog-card-content:has(.blog-card-footer) .blog-card-excerpt {
    -webkit-mask-image: linear-gradient(
        to bottom,
        black 0%,
        black calc(100% - 4rem),
        transparent 100%
    );
    mask-image: linear-gradient(
        to bottom,
        black 0%,
        black calc(100% - 4rem),
        transparent 100%
    );
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-position: 0 0;
    mask-position: 0 0;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    padding-bottom: 0.5rem;
}

.blog-card-footer .blog-read-more {
    margin-left: auto;
}

/* Empty State */
.blog-empty {
    text-align: center;
    padding: var(--space-12);
    color: var(--color-text-secondary);
    /* Match docs/resume text color pattern */
    font-size: var(--text-lg);
    line-height: var(--leading-relaxed);
}

/* ============================================
   BLOG SINGLE POST PAGE
   ============================================ */

/* Container becomes full-width when it holds blog-post-layout (like docs-layout) */
.blog-container:has(.blog-post-layout) {
    max-width: 100%;
    padding-inline: 0;
}

/* blog-after-content speaks the same language as blog-post-layout: same padding, tokens, max-width */
.blog-after-content {
    grid-area: after;
    padding-block: var(--space-5) var(--space-8);
    padding-inline: var(--space-6);
    max-width: var(--container-xl, 1280px);
    margin-inline: auto;
    width: 100%;
}

/* Blog post layout: docs-like two-column (content | TOC). Content gets 1fr, TOC fixed. */
.blog-post-layout {
    display: grid;
    grid-template-areas:
        "content"
        "after";
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    width: 100%;
    max-width: none;
    padding-block: var(--space-5) var(--space-8);
    padding-inline: var(--space-6);
}

.blog-post-layout.blog-with-toc {
    grid-template-areas:
        "content toc"
        "after .";
    grid-template-columns: minmax(0, 1fr) 240px;
}

/* Main content area - takes remaining space */
.blog-post-main {
    grid-area: content;
    min-width: 0; /* Prevent grid blowout from long content */
}

/* Constrain prose for readability (like docs-main .prose) */
.blog-post-main .prose {
    max-width: var(--prose-width, 75ch);
    margin-inline: auto;
}

/* Right sidebar (TOC) - fixed width, sticky */
.blog-toc {
    grid-area: toc;
    position: sticky;
    top: 60px;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-block: var(--space-5) var(--space-8);
    padding-inline-start: var(--space-4);
    padding-inline-end: var(--space-5);
    border-left: 1px solid var(--color-border-light, var(--color-border));
}

/* Blog TOC: no inner progress bar (page has global reading-progress at top) */
.blog-toc .toc-progress {
    display: none;
}

/* Blog TOC: no inner scroll - let outer .blog-toc handle overflow (avoids scrollbar with 1-2 headers) */
.blog-toc .toc-sidebar {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
}

.blog-toc .toc-nav {
    flex: 1;
    min-width: 0;
}

.blog-toc .toc-scroll-container {
    overflow-y: visible;
    flex: none;
}

/* Hide TOC metadata in blog - hero already has date, reading time, updated */
.blog-toc .toc-metadata {
    display: none;
}

@media (max-width: 1024px) {
    .blog-post-layout.blog-with-toc {
        grid-template-areas:
            "content"
            "after";
        grid-template-columns: 1fr;
    }

    .blog-toc {
        display: none;
    }
}

/* Blog Post Hero: uses page-hero (like docs) without breadcrumbs */
.page-hero--blog {
    margin-bottom: var(--space-10);
}

/* Base hero image wrapper (modifiers add layout) */
.page-hero__image {
    display: block;
}

/* Featured image (blog-specific) */
.page-hero__image--blog {
    margin: 0 0 var(--space-6) 0;
    border-radius: var(--radius-xl);
    overflow: hidden;
    aspect-ratio: 16 / 9;
    box-shadow: var(--elevation-card);
}

.page-hero__image--blog img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Blog meta inside page-hero__meta: metadata row + mini author card */
.page-hero__meta .blog-post-meta {
    border: none;
    padding: 0;
    margin: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
}

/* Blog Post Metadata */
.blog-post-meta {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-4) 0;
    border-block-start: 1px solid var(--color-border);
    /* Changed from border-top */
    border-block-end: 1px solid var(--color-border);
    /* Changed from border-bottom */
    margin: var(--space-6) 0;
}

/* Mini author card in hero - compact avatar + name + title */
.author-mini-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.author-mini-card .author-avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.author-mini-card .author-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.author-title {
    font-size: var(--text-sm);
    color: var(--color-text-primary-muted);
}

.blog-post-details {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    align-items: center;
    font-size: var(--text-sm);
    color: var(--color-text-primary-muted);
}

.blog-post-details>* {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Blog Post Tags - in footer after content */
.blog-post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-8);
}

/* Blog Post Content */
.blog-post-content {
    margin: var(--space-10) 0;
    /* Increased spacing for better reading flow */
    font-family: var(--font-sans);
    line-height: var(--leading-relaxed);
    /* Match docs/resume for readability */
    color: var(--color-text-primary);
}

/* Blog Post Footer */
.blog-post-footer {
    margin-top: var(--space-12);
    padding-top: var(--space-8);
    /* Increased from space-6 */
    border-block-start: 2px solid var(--color-border-light);
    /* Match resume pattern */
}

/* Series nav: shows series name and part when page.series exists */
.series-nav {
    margin-bottom: var(--space-6);
}

.series-nav__header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-2);
    font-size: var(--text-sm);
}

.series-nav__label {
    color: var(--color-text-primary-muted);
}

.series-nav__name {
    font-weight: 600;
}

.series-nav__part {
    color: var(--color-text-primary-muted);
}

/* Author Bio: (avatar | about | title) | bio - left column stacked, bio flows right */
.author-bio {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: var(--space-6);
    padding: var(--space-6);
    background: var(--color-bg-secondary);
    border-radius: var(--radius-xl);
    border-inline-start: 4px solid var(--color-primary);
    margin: var(--space-8) 0;
    transition: transform var(--transition-smooth) var(--ease-smooth),
        box-shadow var(--transition-smooth) var(--ease-smooth);
    box-shadow:
        inset 0.5px 0.5px 1px rgba(255, 255, 255, 0.3),
        inset -0.5px -0.5px 1px rgba(0, 0, 0, 0.1),
        1px 1px 2px rgba(0, 0, 0, 0.08),
        -0.5px -0.5px 1px rgba(255, 255, 255, 0.2);
}

.author-bio:hover {
    transform: translate3d(0, -2px, 0);
    box-shadow:
        inset 0.5px 0.5px 1.5px rgba(255, 255, 255, 0.4),
        inset -0.5px -0.5px 1.5px rgba(0, 0, 0, 0.12),
        2px 2px 6px rgba(0, 0, 0, 0.1),
        -1px -1px 3px rgba(255, 255, 255, 0.3);
}

.author-bio-side {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    flex-shrink: 0;
}

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

.author-bio-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.author-bio-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.author-bio-info h3 {
    margin: 0;
    font-size: var(--text-lg);
}

.author-bio-info .author-title {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--color-text-primary-muted);
}

.author-bio-text {
    line-height: var(--leading-relaxed);
    margin: 0;
    color: var(--color-text-secondary);
}

.author-links {
    display: flex;
    gap: var(--space-4);
}

.author-links a {
    color: var(--color-primary);
    text-decoration: none;
    font-size: var(--text-sm);
}

.author-links a:hover {
    text-decoration: underline;
}

/* Social Sharing */
.blog-social-share {
    margin: var(--space-8) 0;
    padding: var(--space-6);
    background: var(--color-bg-secondary);
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-border-light);
}

.blog-social-share h4 {
    font-size: var(--text-lg);
    /* Increased from base for better prominence */
    font-weight: var(--weight-semibold);
    margin-bottom: var(--space-4);
    /* Increased spacing */
    color: var(--color-text-primary);
}

.share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.share-button {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    /* Use design tokens */
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-primary);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    transition: all var(--transition-fast) var(--ease-out);
    /* Use design tokens */
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.share-button:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-primary);
    transform: translate3d(0, -1px, 0);
    /* Subtle lift effect */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.share-button svg {
    flex-shrink: 0;
}

/* Newsletter CTA */
.newsletter-cta {
    padding: var(--space-6);
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

.newsletter-cta h3 {
    margin: 0 0 var(--space-2) 0;
    font-size: var(--text-lg);
}

.newsletter-cta p {
    margin: 0 0 var(--space-4) 0;
    font-size: var(--text-sm);
    color: var(--color-text-primary-muted);
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.newsletter-form input {
    padding: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
}

.newsletter-form button {
    padding: 0.5rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: var(--weight-medium);
    cursor: pointer;
}

.newsletter-form button:hover {
    background: var(--color-primary-hover);
}

/* Comments Section */
.comments-section {
    margin-top: var(--space-12);
    padding: var(--space-8) 0;
    background: var(--color-bg-secondary);
}

.comments-section h2 {
    text-align: center;
    margin-bottom: var(--space-8);
}

.comments-placeholder {
    text-align: center;
    color: var(--color-text-primary-muted);
    font-style: italic;
}

/* ============================================
   BLOG HOME PAGE
   ============================================ */

.blog-home {
    max-width: var(--content-max-width, 1200px);
    margin: 0 auto;
    padding: var(--space-8) var(--space-6);
}

/* Blog Home Hero */
.blog-home-hero {
    text-align: center;
    padding: var(--space-12) 0 var(--space-8);
    margin-bottom: var(--space-8);
    border-block-end: 1px solid var(--color-border-light);
}

.blog-home-title {
    font-size: var(--text-4xl);
    font-weight: var(--weight-bold);
    color: var(--color-text-primary);
    margin: 0 0 var(--space-4) 0;
    line-height: var(--leading-tight);
}

.blog-home-subtitle {
    font-size: var(--text-xl);
    color: var(--color-text-secondary);
    margin: 0;
    line-height: var(--leading-relaxed);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.blog-home-content {
    margin-bottom: var(--space-12);
}

/* Blog Home Recent Posts Section */
.blog-home-recent {
    margin: var(--space-12) 0;
}

.blog-home-recent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-8);
    flex-wrap: wrap;
    gap: var(--space-4);
}

.blog-home-recent-title {
    font-size: var(--text-3xl);
    font-weight: var(--weight-bold);
    color: var(--color-text-primary);
    margin: 0;
}

.blog-home-view-all {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: var(--weight-medium);
    font-size: var(--text-base);
    transition: color var(--transition-fast) var(--ease-out);
}

.blog-home-view-all:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

.blog-home-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-6);
}

@media (max-width: 640px) {
    .blog-home-posts-grid {
        grid-template-columns: 1fr;
    }
}

/* Blog home uses article-card + blog-card-* via post_card (see above) */

/* ============================================
   RECENT POSTS ON HOME PAGE (Generic home.html)
   ============================================ */

.recent-posts {
    margin: var(--space-12) 0;
    padding: var(--space-8) 0;
}

.recent-posts-title {
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-3);
    border-block-end: 2px solid var(--color-border-light);
    transition: border-color var(--transition-fast) var(--ease-out);
}

.recent-posts-title:hover {
    border-block-end-color: var(--color-primary);
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-6);
}

@media (max-width: 640px) {
    .posts-grid {
        grid-template-columns: 1fr;
    }
}

/* Post card on home page - reuse blog card styles with some adjustments */
.recent-posts .post-card {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--elevation-card);
    transition: all var(--transition-fast) var(--ease-out);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border);
    position: relative;
}

/* Motion gradient background on hover */
.recent-posts .post-card::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -10%;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle at 40% 40%,
            color-mix(in srgb, var(--blob-color-1) 6%, transparent) 0%,
            color-mix(in srgb, var(--blob-color-2) 4%, transparent) 25%,
            transparent 50%);
    border-radius: 50%;
    animation: blob-morph var(--blob-duration-slow) ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.recent-posts .post-card:hover::before {
    opacity: 1;
}

.recent-posts .post-card>* {
    position: relative;
    z-index: 1;
}

/* Fallback for browsers without color-mix */
@supports not (color: color-mix(in srgb, black, white)) {
    .recent-posts .post-card::before {
        background: radial-gradient(circle at 40% 40%,
                rgba(59, 130, 246, 0.06) 0%,
                rgba(139, 92, 246, 0.04) 25%,
                transparent 50%);
    }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .recent-posts .post-card::before {
        animation: none !important;
    }
}

.recent-posts .post-card:hover {
    box-shadow: var(--elevation-high);
    transform: translate3d(0, -2px, 0);
}

.recent-posts .post-card-image {
    position: relative;
    overflow: hidden;
    background: var(--color-bg-secondary);
    aspect-ratio: 16 / 9;
}

.recent-posts .post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.recent-posts .post-card:hover .post-card-image img {
    transform: scale(1.05);
}

.recent-posts .post-card-content {
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    flex: 1;
}

.recent-posts .post-card-title {
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    line-height: var(--leading-tight);
    margin: 0;
}

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

.recent-posts .post-card-title a:hover {
    color: var(--color-primary);
}

.recent-posts .post-card-date {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.recent-posts .post-card-excerpt {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.45;
    margin: 0;
}

.recent-posts .read-more {
    display: inline-block;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: var(--weight-medium);
    font-size: var(--text-sm);
    margin-top: auto;
}

.recent-posts .read-more:hover {
    text-decoration: underline;
}

/* ============================================
   RESPONSIVE: ULTRA-WIDE (Better Proportions)
   ============================================ */

/* Ultra-wide screens - constrain layout like docs */
@media (min-width: 1920px) {
    .blog-container:not(:has(.blog-post-layout)) {
        max-width: var(--container-3xl, 1920px);
        padding: var(--space-10) var(--space-8);
    }

    .blog-container:has(.blog-post-layout) {
        max-width: var(--container-3xl, 1920px);
        margin-inline: auto;
    }

    .blog-post-layout {
        max-width: var(--container-xl, 1280px);
        margin-inline: auto;
        padding: var(--space-10) var(--space-8);
    }

    /* Blog grid can be wider */
    .blog-grid {
        gap: var(--space-8);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .blog-container {
        padding: var(--space-6) var(--space-4);
        /* Reduce padding on mobile */
    }

    .blog-post-layout {
        padding: var(--space-6) var(--space-4);
        /* Reduce padding on mobile */
    }

    .page-hero--blog,
    .blog-post-footer {
        padding: var(--space-4) 0;
    }

    .page-hero--blog .page-hero__description {
        font-size: var(--text-lg);
        /* Slightly smaller but still readable */
        padding-bottom: var(--space-4);
    }

    .blog-card-content {
        padding: var(--space-4);
    }

    .blog-section-title {
        font-size: var(--text-xl);
        /* Smaller on mobile */
        margin-bottom: var(--space-6);
    }
}
