/* src/components/blog/blog-post-content.css */
/* Consolidated blog post styles - ~350 lines vs 1000+ */

@import url('../../css/variables.css');

/* ===== CORE LAYOUT ===== */
.blog-post-article {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.7;
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
}

.article-content {
    --tw-prose-body: var(--color-text-secondary);
    --tw-prose-headings: var(--color-text-primary);
    --tw-prose-links: var(--color-primary-600);
}

/* ===== TYPOGRAPHY ===== */
.content-section p,
.prose-paragraph p,
.section-content p {
    margin-bottom: 1.5rem;
    font-size: 1.125rem;
    line-height: 1.8;
    font-weight: 400;
}

.content-section h1,
.content-section h2,
.content-section h3,
.content-section h4 {
    color: var(--color-text-primary);
    font-weight: 700;
    letter-spacing: -0.025em;
}

.content-section h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    line-height: 1.1;
    margin-bottom: 2rem;
    background: var(--gradient-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.content-section h2 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin: 3rem 0 1.5rem;
    scroll-margin-top: 6rem;
    position: relative;
}

.content-section h2::before {
    content: '';
    position: absolute;
    left: -1rem;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--gradient-primary);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.3s;
}

.content-section h2:hover::before {
    opacity: 1;
}

.content-section h3 {
    font-size: 1.5rem;
    margin: 2.5rem 0 1rem;
    font-weight: 600;
    color: var(--color-primary-600);
}

.content-section h4 {
    font-size: 1.25rem;
    margin: 2rem 0 0.75rem;
    font-weight: 600;
}

/* Enhanced excerpt in header */
.article-header>p,
.article-header .text-xl {
    font-size: 1.375rem !important;
    line-height: 1.6 !important;
    margin: 1.5rem 0 2.5rem !important;
    font-weight: 400 !important;
    letter-spacing: -0.01em;
}

.article-header p p {
    margin: 0 !important;
    display: inline;
    font-size: inherit !important;
}

/* ===== LINKS ===== */
.content-section a,
.prose-enhanced a,
.section-content a,
.article-content a {
    color: #0099cc;
    text-decoration: underline;
    text-decoration-color: rgba(0, 153, 204, 0.4);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.content-section a:hover,
.prose-enhanced a:hover,
.section-content a:hover,
.article-content a:hover {
    color: #0077aa;
    text-decoration-color: #0077aa;
    text-decoration-thickness: 2px;
}

/* External link indicator */
.content-section a[href^="http"]:not([href*="spartera.com"])::after,
.prose-enhanced a[href^="http"]:not([href*="spartera.com"])::after {
    content: '↗';
    display: inline-block;
    margin-left: 0.25rem;
    font-size: 0.875em;
    opacity: 0.6;
}

/* ===== AUTHOR CARD ===== */
.author-avatar {
    width: 3rem !important;
    height: 3rem !important;
    border-radius: 50% !important;
    border: 2px solid var(--color-border-primary);
    transition: all 0.3s;
}

.author-avatar:hover {
    transform: scale(1.05);
    border-color: var(--color-primary-500);
}

.author-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    padding: var(--card-padding);
    box-shadow: var(--card-shadow);
    transition: all 0.3s;
}

.author-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}

.author-card .author-name {
    color: var(--color-text-primary);  /* Add !important */
    font-weight: 600;
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
}

.author-card .text-inverse{
    color: var(--color-dark-text-primary);
}

.dark .author-card .author-name {
    color: var(--color-dark-text-primary);
}

.author-card .author-bio {
    color: var(--color-gray-300);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* ===== BREADCRUMB & BADGES ===== */
.breadcrumb-link {
    color: var(--color-text-muted);
    text-decoration: none;
    transition: all 0.3s;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: var(--btn-radius-sm);
}

.breadcrumb-link:hover {
    color: var(--color-primary-600);
    background: var(--color-primary-50);
    transform: translateY(-1px);
}

.category-badge {
    background: var(--color-primary-100);
    color: var(--color-primary-700);
    border: 1px solid var(--color-primary-200);
    border-radius: var(--btn-radius);
    padding: 0.375rem 0.875rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.3s;
}

.category-badge:hover {
    background: var(--color-primary-500);
    color: var(--color-text-inverse);
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary);
}

/* ===== TABLE OF CONTENTS ===== */
.sticky-toc {
    position: sticky;
    top: 8rem;
    /* Accounts for header height + spacing */
    max-height: calc(100vh - 10rem);
    /* Adjusted for top offset + bottom padding */
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    transition: all 0.3s;
}

.sticky-toc:hover {
    box-shadow: var(--card-shadow-hover);
}

.sticky-toc h3 {
    color: var(--color-text-primary);
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border-primary);
}

.toc-link {
    display: block;
    color: var(--color-text-secondary);
    text-decoration: none;
    padding: 0.75rem 1rem;
    margin: 0.25rem 0;
    border-radius: var(--btn-radius-sm);
    border-left: 3px solid transparent;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
    transition: all 0.3s;
}

.toc-link:hover,
.toc-link.active {
    color: var(--color-primary-600);
    background: var(--color-primary-50);
    border-left-color: var(--color-primary-500);
    transform: translateX(4px);
}

.toc-link.active {
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

/* TOC scrollbar */
.sticky-toc::-webkit-scrollbar {
    width: 6px;
}

.sticky-toc::-webkit-scrollbar-track {
    background: var(--color-gray-100);
    border-radius: 3px;
}

.sticky-toc::-webkit-scrollbar-thumb {
    background: var(--color-primary-300);
    border-radius: 3px;
}

.sticky-toc::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-500);
}

/* Dark mode scrollbar */
.dark .sticky-toc::-webkit-scrollbar-track {
    background: #374151;
}

.dark .sticky-toc::-webkit-scrollbar-thumb {
    background: #6b7280;
}

.dark .sticky-toc::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ===== LISTS & QUOTES ===== */
.prose-enhanced ul,
.prose-enhanced ol {
    margin: 1.5rem 0;
    padding-left: 1.5rem;
}

.prose-enhanced li {
    margin: 0.75rem 0;
    color: var(--color-text-secondary);
    font-size: 1.125rem;
    line-height: 1.8;
}

.prose-enhanced ul li::marker {
    color: var(--color-primary-500);
    font-size: 1.25rem;
}

.prose-enhanced ol li::marker {
    color: var(--color-primary-600);
    font-weight: 600;
}

.prose-enhanced blockquote {
    border-left: 4px solid var(--color-primary-500);
    background: var(--color-primary-50);
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    border-radius: var(--card-radius);
    font-style: italic;
    color: var(--color-text-secondary);
}

.prose-enhanced blockquote p {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

/* ===== IMAGES ===== */
.section-image {
    margin: 3rem 0;
    border-radius: var(--card-radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: all 0.3s;
}

.section-image:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
}

.section-image img {
    transition: transform 0.5s;
    width: 100%;
    height: auto;
}

.section-image:hover img {
    transform: scale(1.03);
}

/* ===== TAGS ===== */
.tags-section {
    margin-top: 4rem;
    padding: 2rem;
    border-top: 1px solid var(--color-border-primary);
    background: var(--gradient-bg-subtle);
    border-radius: var(--card-radius);
}

.tags-section .tag {
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border-primary);
    border-radius: var(--btn-radius);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s;
    display: inline-flex;
    margin: 0.25rem;
}

.tags-section .tag:hover {
    background: var(--color-primary-500);
    color: var(--color-text-inverse);
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary);
}

/* ===== READING PROGRESS ===== */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--gradient-primary);
    z-index: 1000;
    transition: width 0.1s ease;
    box-shadow: 0 0 10px rgba(0, 153, 204, 0.4);
}

/* ===== DARK MODE ===== */
.dark .blog-post-article {
    background-color: var(--color-dark-bg-primary);
    color: var(--color-dark-text-primary);
}

.dark .content-section h1 {
    background: linear-gradient(135deg, var(--color-primary-300), var(--color-primary-400));
    background-clip: text;
    -webkit-background-clip: text;
}

.dark .content-section h3 {
    color: var(--color-primary-300);
}

.dark .content-section a,
.dark .prose-enhanced a {
    color: #60a5fa;
    text-decoration-color: rgba(96, 165, 250, 0.4);
}

.dark .content-section a:hover,
.dark .prose-enhanced a:hover {
    color: #93c5fd;
    text-decoration-color: #93c5fd;
}

.dark .breadcrumb-link:hover {
    color: var(--color-primary-300);
    background: rgba(0, 153, 204, 0.1);
}

.dark .category-badge {
    background: rgba(0, 153, 204, 0.2);
    color: var(--color-primary-300);
    border-color: var(--color-primary-600);
}

.dark .category-badge:hover {
    background: var(--color-primary-600);
    color: var(--color-text-inverse);
}

.dark .toc-link:hover,
.dark .toc-link.active {
    color: var(--color-primary-300);
    background: rgba(0, 153, 204, 0.1);
    border-left-color: var(--color-primary-400);
}

.dark .sticky-toc::-webkit-scrollbar-track {
    background: var(--color-dark-bg-muted);
}

.dark .sticky-toc::-webkit-scrollbar-thumb {
    background: var(--color-primary-600);
}

.dark .prose-enhanced blockquote {
    border-left-color: var(--color-primary-400);
    background: rgba(0, 153, 204, 0.1);
}

.dark .tags-section .tag {
    background: var(--color-dark-bg-secondary);
    color: var(--color-dark-text-primary);
}

.dark .tags-section .tag:hover {
    background: var(--color-primary-600);
    color: var(--color-text-inverse);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sticky-toc {
        position: static;
        /* Disable sticky behavior on mobile/tablet */
        max-height: none;
        margin-bottom: 2rem;
    }
}

@media (max-width: 768px) {
    .article-header>p {
        font-size: 1.25rem !important;
        line-height: 1.5 !important;
    }

    .content-section p,
    .prose-enhanced li {
        font-size: 1rem;
        line-height: 1.7;
    }

    .content-section h2 {
        font-size: 1.5rem;
        margin-top: 2rem;
    }

    .section-image,
    .tags-section {
        margin: 2rem 0;
    }
}

@media (max-width: 640px) {
    .content-section h2::before {
        display: none;
    }

    .content-section h1 {
        font-size: 1.75rem;
    }

    .author-avatar {
        width: 2.5rem !important;
        height: 2.5rem !important;
    }
}

/* ===== ACCESSIBILITY ===== */
.content-section a:focus-visible,
.toc-link:focus-visible,
.category-badge:focus-visible,
.tags-section .tag:focus-visible {
    outline: 2px solid var(--color-primary-500);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}

/* ===== PRINT ===== */
@media print {

    .sticky-toc,
    .reading-progress,
    .tags-section .tag {
        display: none !important;
    }

    .blog-post-article,
    .content-section h1,
    .content-section p {
        color: black !important;
        background: white !important;
    }
}

/* Breadcrumb positioning fix */
#blog-breadcrumb {
    margin-top: var(--total-header-height);
}

@media (max-width: 1024px) {
    #blog-breadcrumb {
        margin-top: var(--header-height);
    }
}


/* ===== MOVED FROM PHP FILE ===== */
/* Scrollbar styling now consolidated above in main TOC section */

.toc-link.active {
    background-color: white;
    color: #3B82F6;
    border-left-color: #3B82F6;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.dark .toc-link.active {
    background-color: #374151;
    color: #60a5fa;
    border-left-color: #60a5fa;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
}

.toc-link.active .toc-arrow {
    opacity: 1;
    transform: translateX(0);
}

.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #3B82F6, #1D4ED8);
    z-index: 9999;
    transition: width 0.1s ease;
}