/**
 * Blog Post Page Styles
 * Extends case-study.css for blog-specific elements
 * Uses the same design tokens from style.css
 */

/* ============================================
   PAGE BACKGROUND
   ============================================ */

body.blog-post-page {
    background: #FCF9F2;
}

/* ============================================
   NAVBAR - Same as case study
   ============================================ */

.blog-post-page .site-nav {
    padding: clamp(1rem, 2vw, 1.5rem) var(--side-padding);
    --nav-bg: rgba(249, 247, 242, 0.92);
    --nav-blur: 20px;
    --nav-border: rgba(0, 0, 0, 0.06);
    --nav-shadow: none;
}

/* Active nav link for blog - underline only, no color change */
.blog-post-page .nav-links a.active::before {
    width: 100%;
    left: 0;
}

/* ============================================
   BLOG POST HERO SECTION
   ============================================ */

.blog-post-hero {
    padding-top: clamp(8rem, 12vw, 12rem);
    padding-bottom: clamp(2.5rem, 5vw, 3.5rem);
    background: #FCF9F2;
}

.blog-post-layout {
    display: grid;
    grid-template-columns: 1fr 250px;
    gap: clamp(2rem, 5vw, 4rem);
    align-items: start;
}

.blog-post-main {
    display: flex;
    flex-direction: column;
    gap: clamp(2rem, 4vw, 3rem);
}

/* ============================================
   BLOG META INFO
   ============================================ */

.blog-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.blog-author-mini {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.author-avatar-mini {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(0, 0, 0, 0.05);
}

.author-info-mini {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.author-name-mini {
    font-weight: 500;
    color: var(--color-text-primary);
}

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

.reading-time {
    color: var(--color-text-secondary);
}

/* ============================================
   BLOG FEATURED IMAGE
   ============================================ */

.blog-featured-image {
    margin-top: 0.5rem;
}

/* ============================================
   BLOG CONTENT - RICH TEXT SUPPORT
   ============================================ */

.blog-content-section {
    scroll-margin-top: 100px;
}

.blog-intro-section {
    margin-bottom: 0;
}

.blog-lead {
    font-family: var(--font-body);
    font-size: var(--text-xl);
    line-height: 1.6;
    color: var(--color-text-secondary);
    margin: 0;
}

.blog-rich-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.blog-rich-content p {
    font-family: var(--font-body);
    font-size: var(--text-lg);
    line-height: 1.7;
    color: var(--color-text-secondary);
    margin: 0;
}

/* Links within content */
.blog-rich-content a {
    color: var(--color-text-primary);
    text-decoration: underline;
    text-decoration-color: var(--color-lime);
    text-underline-offset: 3px;
    text-decoration-thickness: 2px;
    transition: text-decoration-color 0.3s var(--ease-smooth);
}

.blog-rich-content a:hover {
    text-decoration-color: var(--color-pink);
}

/* Strong and emphasis */
.blog-rich-content strong {
    font-weight: 600;
    color: var(--color-text-primary);
}

.blog-rich-content em {
    font-style: italic;
}

/* ============================================
   LISTS
   ============================================ */

.blog-list {
    font-family: var(--font-body);
    font-size: var(--text-lg);
    line-height: 1.7;
    color: var(--color-text-secondary);
    margin: 0;
    padding-left: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.blog-list li {
    padding-left: 0.5rem;
}

.blog-list li::marker {
    color: var(--color-lime-dark);
}

.blog-list-numbered li::marker {
    font-weight: 500;
    color: var(--color-text-primary);
}

/* Nested lists */
.blog-list .blog-list {
    margin-top: 0.75rem;
    gap: 0.5rem;
}

/* ============================================
   BLOCKQUOTES / PULLQUOTES
   ============================================ */

.blog-blockquote {
    position: relative;
    background: var(--color-yellow);
    border-radius: var(--radius-lg);
    padding: clamp(1.5rem, 3vw, 2.5rem);
    margin: 0.5rem 0;
}

.blog-blockquote::before {
    content: '"';
    position: absolute;
    top: -0.25rem;
    left: 1rem;
    font-family: var(--font-heading);
    font-size: 4rem;
    line-height: 1;
    color: rgba(0, 0, 0, 0.1);
}

.blog-blockquote p {
    font-family: var(--font-body);
    font-size: var(--text-xl);
    font-style: italic;
    line-height: 1.5;
    color: var(--color-text-primary);
    margin: 0;
}

.blog-blockquote cite {
    display: block;
    margin-top: 1rem;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-style: normal;
    font-weight: 500;
    color: var(--color-text-secondary);
}

/* ============================================
   FIGURES / INLINE IMAGES
   ============================================ */

.blog-figure {
    margin: 0.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.blog-figure img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    display: block;
}

.blog-figure figcaption {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    text-align: center;
}

/* ============================================
   CODE BLOCKS
   ============================================ */

.blog-code-block {
    background: #1e1e2e;
    color: #cdd6f4;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    overflow-x: auto;
    font-family: 'SF Mono', 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: var(--text-sm);
    line-height: 1.7;
    margin: 1.5rem 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.blog-code-block code {
    font-family: inherit;
    color: inherit;
    background: transparent;
    padding: 0;
}

/* Ensure pre tags inside rich content have proper styling */
.blog-rich-content pre {
    background: #1e1e2e;
    color: #cdd6f4;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    overflow-x: auto;
    font-family: 'SF Mono', 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: var(--text-sm);
    line-height: 1.7;
    margin: 1.5rem 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.blog-rich-content pre code {
    color: #cdd6f4;
    background: transparent;
    padding: 0;
    font-size: inherit;
}

/* Inline code (not inside pre blocks) */
.blog-rich-content > code,
.blog-rich-content p code,
.blog-rich-content li code,
.blog-rich-content td code {
    background: rgba(0, 0, 0, 0.08);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 0.85em;
    color: #1a1a1a;
    white-space: nowrap;
}

/* Code block wrapper with copy button */
.code-block-wrapper {
    position: relative;
}

.code-copy-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s var(--ease-smooth);
}

.code-block-wrapper:hover .code-copy-btn {
    opacity: 1;
}

.code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.code-copy-btn.copied {
    background: var(--color-lime);
    color: #1a1a1a;
}

/* ============================================
   TABLES
   ============================================ */

.blog-rich-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-family: var(--font-body);
    font-size: var(--text-base);
    background: rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.blog-rich-content thead {
    background: rgba(0, 0, 0, 0.04);
}

.blog-rich-content th {
    font-weight: 600;
    color: var(--color-text-primary);
    text-align: left;
    padding: 1rem 1.25rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.08);
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.blog-rich-content td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    color: var(--color-text-secondary);
    line-height: 1.5;
    vertical-align: top;
}

.blog-rich-content tbody tr:last-child td {
    border-bottom: none;
}

.blog-rich-content tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

/* Responsive table wrapper */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin: 1.5rem 0;
    -webkit-overflow-scrolling: touch;
}

.table-wrapper table {
    margin: 0;
    min-width: 600px;
}

/* Striped table variant */
.blog-rich-content table.striped tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

@media (max-width: 768px) {
    .blog-rich-content th,
    .blog-rich-content td {
        padding: 0.75rem 1rem;
        font-size: var(--text-sm);
    }
}

/* ============================================
   AUTHOR BIO CARD
   ============================================ */

.blog-author-bio {
    background: #DBC9FF;
}

.author-bio-avatar {
    width: clamp(120px, 15vw, 160px);
    height: clamp(120px, 15vw, 160px);
}

.author-bio-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.author-bio-label {
    font-family: var(--font-body);
    font-size: var(--text-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    margin: 0;
}

.author-bio-name {
    font-family: var(--font-heading);
    font-size: var(--text-2xl);
    font-weight: 400;
    color: var(--color-text-primary);
    margin: 0;
}

.author-bio-role {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin: 0 0 0.5rem 0;
}

.author-bio-text {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--color-text-primary);
    margin: 0;
}

.author-social-links {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.author-social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    color: var(--color-text-primary);
    transition: background-color 0.3s var(--ease-smooth), transform 0.3s var(--ease-smooth);
}

.author-social-link:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
}

/* ============================================
   BLOG SIDEBAR ADDITIONS
   ============================================ */

.blog-sidebar {
    position: sticky;
    top: 120px;
}

.blog-share {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.share-label {
    font-family: var(--font-body);
    font-size: var(--text-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    margin: 0 0 1rem 0;
}

.share-buttons {
    display: flex;
    gap: 0.5rem;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.04);
    color: var(--color-text-primary);
    transition: all 0.3s var(--ease-smooth);
}

.share-btn:hover {
    background: var(--color-lime);
    transform: translateY(-2px);
}

.share-btn.share-twitter:hover {
    background: #1DA1F2;
    color: white;
}

.share-btn.share-linkedin:hover {
    background: #0077B5;
    color: white;
}

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

.share-btn.share-copy.copied {
    background: var(--color-lime);
}

.share-btn.share-copy.copied::after {
    content: 'Copied!';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-text-primary);
    color: white;
    font-size: 0.625rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
}

/* ============================================
   RELATED POSTS SECTION
   ============================================ */

.related-posts-section {
    background: #FCF9F2;
}

.related-post-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.related-excerpt {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--color-text-secondary);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   BLOG PAGE FOOTER OVERRIDE
   ============================================ */

.blog-post-page .site-footer-new {
    background: #FCF9F2;
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */

@media (max-width: 1024px) {
    .blog-post-layout {
        grid-template-columns: 1fr;
    }

    .blog-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .blog-post-hero {
        padding-top: clamp(6rem, 10vw, 8rem);
    }

    .blog-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .author-info-mini {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .blog-author-bio .testimonial-content-wrapper {
        flex-direction: column;
    }

    .author-bio-avatar {
        width: 100%;
        max-width: 140px;
        height: auto;
        aspect-ratio: 1;
    }

    .blog-blockquote {
        padding: 1.5rem;
    }

    .blog-blockquote::before {
        font-size: 3rem;
    }
}

@media (max-width: 576px) {
    .blog-rich-content p,
    .blog-list {
        font-size: var(--text-base);
    }

    .blog-lead {
        font-size: var(--text-lg);
    }

    .blog-blockquote p {
        font-size: var(--text-lg);
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

/* Initial states for scroll reveal (matches case-study.css) */
.blog-tags,
.blog-title,
.blog-meta,
.blog-featured-image,
.blog-content-section,
.blog-author-bio,
.explore-topics,
.related-post-card,
.cta-card {
    opacity: 0;
    transform: translateY(30px);
}

/* Visible state */
.blog-tags.visible,
.blog-title.visible,
.blog-meta.visible,
.blog-featured-image.visible,
.blog-content-section.visible,
.blog-author-bio.visible,
.explore-topics.visible,
.related-post-card.visible,
.cta-card.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Blog-specific hover effects */
.blog-featured-image:hover .ba-single-image img {
    transform: scale(1.02);
}

/* Rich content image hover */
.blog-figure img {
    transition: transform 0.6s var(--ease-smooth);
}

.blog-figure:hover img {
    transform: scale(1.01);
}


/* ============================================
   CTA CARDS SECTION
   ============================================ */

.blog-cta-section {
    padding: clamp(2rem, 4vw, 3rem) var(--side-padding) clamp(3rem, 6vw, 5rem);
    background: var(--color-bg);
}

.blog-cta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(1rem, 2vw, 1.5rem);
    max-width: var(--content-max-width);
    margin: 0 auto;
}

.blog-cta-card {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    border-radius: var(--radius-lg);
    overflow: hidden;
    padding: clamp(1.5rem, 3vw, 2rem);
    transition: transform 0.4s var(--ease-smooth);
}

.blog-cta-card:hover {
    transform: translateY(-4px);
}

/* CTA Card color variants */
.blog-cta-card--pink {
    background: #FFCCC9;
}

.blog-cta-card--blue {
    background: #BFDFFF;
}

.blog-cta-card--beige {
    background: #D4F4A0;
}

.blog-cta-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
    max-width: 100%;
}

.blog-cta-title {
    font-family: var(--font-heading);
    font-size: var(--text-xl);
    font-weight: 400;
    line-height: 1.2;
    color: var(--color-text-primary);
    margin: 0;
}

.blog-cta-desc {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--color-text-secondary);
    margin: 0;
}

.blog-cta-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-primary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--color-text-primary);
    border-radius: var(--radius-md);
    margin-top: 0.5rem;
    width: fit-content;
    transition: background 0.3s var(--ease-smooth), transform 0.3s var(--ease-smooth);
}

.blog-cta-link:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: translateX(4px);
}

.blog-cta-link svg {
    transition: transform 0.3s var(--ease-smooth);
}

.blog-cta-link:hover svg {
    transform: translate(2px, -2px);
}

/* Compact variant */
.blog-cta-card--compact {
    padding: clamp(1.25rem, 2.5vw, 1.75rem);
}

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

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .site-nav,
    .blog-sidebar,
    .related-posts-section,
    .blog-cta-section,
    .site-footer-new,
    #webgl-container {
        display: none !important;
    }

    .blog-post-hero {
        padding-top: 2rem;
    }

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

    .blog-rich-content p,
    .blog-list {
        font-size: 12pt;
        line-height: 1.5;
    }

    .blog-blockquote {
        border-left: 4px solid #000;
        background: none;
        padding: 1rem;
    }
}
