/* Blog Post Styles - Maximum Readability */
/* Requires: tokens/base.css, tokens/theme-light.css */

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

/* Utility classes */
.hidden {
    display: none !important;
}

/* ============================================
   Body - Optimal reading font
   ============================================ */
body {
    font-family: 'Charter', 'Bitstream Charter', 'Sitka Text', Cambria, serif;
    font-size: 16px;
    line-height: 1.4;
    color: rgb(var(--color-text));
    background: rgb(var(--color-background));
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Grain texture overlay for blog pages */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.015;
    pointer-events: none;
    z-index: -1;
}

/* ============================================
   Zoom Controls - Fixed right side
   ============================================ */
.zoom-controls {
    position: fixed;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 100;
    background: rgb(var(--color-background));
    border: 1px solid rgb(var(--color-border-muted));
    border-radius: var(--radius-md);
    padding: 0.25rem;
    box-shadow: var(--shadow-sm);
}

.zoom-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: rgb(var(--color-text));
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: var(--radius-default);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--duration-fast);
}

.zoom-btn:hover {
    background: rgb(var(--color-surface));
}

.zoom-btn:active {
    background: rgb(var(--color-surface-hover));
}

#zoom-reset {
    font-size: 0.875rem;
    font-weight: 600;
}

/* ============================================
   Article Container - Responsive width
   ============================================ */
.article-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* ============================================
   Breadcrumb
   ============================================ */
.article-breadcrumb {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.875rem;
    color: rgb(var(--color-text-secondary));
    margin-bottom: 2rem;
}

.article-breadcrumb a {
    color: rgb(var(--color-info));
    text-decoration: underline;
}

.article-breadcrumb a:hover {
    opacity: 0.8;
}

.article-breadcrumb .separator {
    margin: 0 0.5rem;
    color: rgb(var(--color-text-muted));
}

.article-breadcrumb .current {
    color: rgb(var(--color-text-secondary));
}

/* ============================================
   Article Header
   ============================================ */
.article-header {
    margin-bottom: 2rem;
}

.article-meta {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.875rem;
    color: rgb(var(--color-text-secondary));
    margin-bottom: 0.75rem;
}

.article-meta .category {
    background: rgb(var(--color-info));
    color: rgb(var(--color-background));
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
}

/* Article stats (likes, comments, shares) */
.article-stats {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.875rem;
    color: rgb(var(--color-text-secondary));
    margin-bottom: 1rem;
}

.article-stats .stats-loading {
    font-style: italic;
    opacity: 0.6;
}

.article-stats .stats-item {
    display: inline;
}

.article-author {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.9rem;
    color: rgb(var(--color-text-secondary));
    margin-top: 0.5rem;
}

.article-author strong {
    color: rgb(var(--color-text));
}

.article-header h1 {
    font-size: 2.5rem;
    line-height: 1.2;
    margin-bottom: 1rem;
    font-weight: 700;
    color: rgb(var(--color-text));
}

.article-subtitle {
    font-size: 1.25rem;
    color: rgb(var(--color-text-secondary));
    line-height: 1.4;
    font-style: italic;
}

/* ============================================
   Featured Image
   ============================================ */
.featured-image {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: var(--radius-default);
    margin-bottom: 2rem;
}

/* ============================================
   Article Content - Readable Typography
   ============================================ */
.article-content {
    font-size: 16px;
    line-height: 1.4;
    color: rgb(var(--color-text));
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: rgb(var(--color-text));
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.article-content h1 {
    font-size: 2.5em;
    margin-bottom: 1rem;
    font-weight: 700;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgb(var(--color-border-muted));
}

.article-content h2 {
    font-size: 1.75em;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgb(var(--color-border-light));
}

.article-content h3 {
    font-size: 1.4em;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.article-content h4 { font-size: 1.15em; }

.article-content p {
    margin-bottom: 1.25rem;
}

.article-content a {
    color: rgb(var(--color-info));
    text-decoration: underline;
}

.article-content a:hover {
    opacity: 0.8;
}

.article-content ul,
.article-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.article-content li {
    margin-bottom: 0.4rem;
}

.article-content blockquote {
    border-left: 3px solid rgb(var(--color-info));
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: rgb(var(--color-text-secondary));
    font-style: italic;
}

.article-content code {
    font-family: var(--font-family-mono);
    background: rgb(var(--color-code-bg));
    padding: 0.1rem 0.3rem;
    border-radius: var(--radius-sm);
    font-size: 0.9em;
}

.article-content pre {
    background: rgb(var(--color-code-bg));
    padding: 1rem;
    border-radius: var(--radius-default);
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid rgb(var(--color-border-muted));
}

.article-content pre code {
    background: none;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1.5;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-default);
    margin: 1.5rem 0;
}

.article-content hr {
    border: none;
    border-top: 1px solid rgb(var(--color-border-muted));
    margin: 2rem 0;
}

/* ============================================
   Related Documents / CTA Buttons
   ============================================ */
.cta-buttons {
    margin: 2rem 0;
    padding: 1.5rem;
    background: rgb(var(--color-background-alt));
    border-radius: var(--radius-lg);
    border: 1px solid rgb(var(--color-border-light));
}

.cta-buttons h3 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: rgb(var(--color-text-secondary));
    margin: 0 0 1rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cta-buttons .btn-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.cta-buttons .btn {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--duration-fast);
}

.cta-buttons .btn-primary {
    background: rgb(var(--color-info));
    color: rgb(var(--color-background));
}

.cta-buttons .btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.cta-buttons .btn-secondary {
    background: rgb(var(--color-background));
    color: rgb(var(--color-text));
    border: 1px solid rgb(var(--color-border-muted));
}

.cta-buttons .btn-secondary:hover {
    background: rgb(var(--color-surface));
    border-color: rgb(var(--color-text-muted));
}

/* ============================================
   Article Footer - Tags
   ============================================ */
.article-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgb(var(--color-border-muted));
}

.article-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 1.5rem 0;
}

.article-tags .tag {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: rgb(var(--color-surface));
    color: rgb(var(--color-text-secondary));
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

/* ============================================
   Back to Blog Navigation
   ============================================ */
.article-navigation {
    padding: 1.5rem 0;
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.back-to-blog {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: rgb(var(--color-info));
    text-decoration: underline;
    text-underline-offset: 2px;
    font-size: 0.9rem;
}

.back-to-blog:hover {
    opacity: 0.8;
}

.edit-post-btn {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: rgb(var(--color-info));
    color: rgb(var(--color-background));
    padding: 0.5rem 1rem;
    border-radius: var(--radius-default);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
}

.edit-post-btn:hover {
    opacity: 0.9;
}

/* ============================================
   Footer - Thin light background version
   ============================================ */
footer {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: rgb(var(--color-background));
    color: rgb(var(--color-text-secondary));
    padding: 1.5rem;
    margin-top: 3rem;
    border-top: 1px solid rgb(var(--color-border-light));
}

.footer-grid {
    max-width: 900px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.footer-section h3 {
    color: rgb(var(--color-text));
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.footer-section p {
    font-size: 0.8rem;
    line-height: 1.5;
    color: rgb(var(--color-text-secondary));
}

.footer-section a {
    color: rgb(var(--color-text-secondary));
    text-decoration: none;
}

.footer-section a:hover {
    color: rgb(var(--color-text));
    text-decoration: underline;
}

.footer-bottom {
    max-width: 900px;
    margin: 1rem auto 0;
    padding-top: 1rem;
    border-top: 1px solid rgb(var(--color-border-light));
    text-align: center;
}

.footer-bottom p {
    font-size: 0.75rem;
    color: rgb(var(--color-text-muted));
}

/* ============================================
   Mobile Responsive
   ============================================ */
@media (max-width: 768px) {
    body {
        font-size: 16px;
    }

    .article-container {
        padding: 1.5rem 1rem 2rem;
    }

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

    .article-content {
        font-size: 16px;
        line-height: 1.65;
    }

    .article-content h1 { font-size: 1.75em; }
    .article-content h2 { font-size: 1.4em; }
    .article-content h3 { font-size: 1.2em; }

    .zoom-controls {
        right: 0.5rem;
        top: auto;
        bottom: 1rem;
        transform: none;
    }

    .zoom-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .article-container {
        padding: 1rem 0.75rem 1.5rem;
    }

    .article-header h1 {
        font-size: 1.35rem;
    }

    .article-content {
        font-size: 15px;
    }

    .article-breadcrumb {
        font-size: 0.8rem;
    }

    .article-meta {
        font-size: 0.8rem;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .zoom-controls {
        display: none;
    }

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

    footer {
        display: none;
    }

    .comments-section {
        display: none;
    }
}

/* ============================================
   Comments Section
   ============================================ */
.comments-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgb(var(--color-border-muted));
}

.comments-header {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: rgb(var(--color-text));
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comments-icon {
    font-size: 1.25rem;
}

.comments-count {
    font-size: 1rem;
    font-weight: 400;
    color: rgb(var(--color-text-secondary));
}

/* Comment Form */
.comment-form-container {
    margin-bottom: 2rem;
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.comment-form textarea {
    font-family: inherit;
    font-size: 1rem;
    padding: 0.75rem;
    border: 1px solid rgb(var(--color-border-muted));
    border-radius: var(--radius-md);
    resize: vertical;
    min-height: 80px;
    transition: border-color var(--duration-fast);
}

.comment-form textarea:focus {
    outline: none;
    border-color: rgb(var(--color-info));
}

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

.comment-form-footer-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.char-count {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.8rem;
    color: rgb(var(--color-text-secondary));
}

.sentiment-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.8rem;
}

.sentiment-bar {
    width: 60px;
    height: 6px;
    background: rgb(var(--color-surface-elevated));
    border-radius: var(--radius-full);
    overflow: hidden;
}

.sentiment-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--duration-normal), background var(--duration-normal);
}

.sentiment-fill.positive {
    background: rgb(var(--color-success));
}

.sentiment-fill.neutral {
    background: rgb(var(--color-warning));
}

.sentiment-fill.negative {
    background: rgb(var(--color-error));
}

.sentiment-label {
    color: rgb(var(--color-text-muted));
    min-width: 50px;
}

.btn-submit-comment {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: rgb(var(--color-info));
    color: rgb(var(--color-background));
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity var(--duration-fast);
}

.btn-submit-comment:hover {
    opacity: 0.9;
}

.btn-submit-comment:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.moderation-notice {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.8rem;
    color: rgb(var(--color-text-secondary));
    margin-top: 0.5rem;
}

/* Login Prompt */
.comment-login-prompt {
    background: rgb(var(--color-background-alt));
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    text-align: center;
}

.comment-login-prompt p {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.95rem;
    color: rgb(var(--color-text-secondary));
    margin: 0;
}

.comment-login-prompt a {
    color: rgb(var(--color-info));
    font-weight: 500;
}

/* Comments List */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.comments-loading,
.comments-empty {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    text-align: center;
    padding: 2rem;
    color: rgb(var(--color-text-secondary));
    font-size: 0.95rem;
}

/* Load More */
.comments-load-more {
    text-align: center;
    margin-top: 1.5rem;
}

.btn-load-more {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: rgb(var(--color-background));
    border: 1px solid rgb(var(--color-border-muted));
    padding: 0.6rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--duration-fast);
}

.btn-load-more:hover {
    background: rgb(var(--color-surface));
    border-color: rgb(var(--color-text-secondary));
}

/* Comment Toast */
.comment-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    opacity: 0;
    transition: all var(--duration-normal);
    z-index: 1000;
}

.comment-toast.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.comment-toast.success {
    background: rgb(var(--color-success));
    color: rgb(var(--color-background));
}

.comment-toast.error {
    background: rgb(var(--color-error));
    color: rgb(var(--color-background));
}

/* Mobile Comments */
@media (max-width: 768px) {
    .comments-header {
        font-size: 1.25rem;
    }

    .comment {
        padding: 0.75rem;
    }

    .comment-avatar {
        width: 32px;
        height: 32px;
    }

    .comment-form-footer {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }

    .btn-submit-comment {
        width: 100%;
    }
}
