/* ============================================
   DEBUGLY BLOG - Dedicated Stylesheet
   ============================================ */

/* Declare cascade layers used in this file */
@layer components, utilities;

/* ============================================
   1. BLOG-SPECIFIC DESIGN TOKENS
   ============================================ */

/* Blog-specific color variables - scoped to semantic elements */
main,
article,
aside {
    /* Blog-specific colors (Light) */
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #8e8e93;
    --surface-secondary: #ffffff;
    --surface-tertiary: #f6f6f6;
    --accent-primary: #007aff;
    --accent-gradient: linear-gradient(135deg, #007aff 0%, #0056cc 100%);
    --success-color: #28a745;
    --warning-color: #ffc107;
    --error-color: #dc3545;
    
    /* Code block specific colors */
    --code-bg: #f8f9fa;
    --code-border: #e1e4e8;
    --code-text: #24292e;
    --inline-code-bg: #f3f4f6;
    --inline-code-text: #0969da;

    /* Prism token colors (Light) */
    --prism-comment: #6a737d;
    --prism-keyword: #d73a49;
    --prism-class: #6f42c1;
    --prism-operator: #005cc5;
    --prism-punctuation: #24292e;
    --prism-string: #22863a;
    --prism-number: #005cc5;
    --prism-function: #6f42c1;
    --prism-constant: #e36209;
}

/* Dark Theme Override for semantic blog elements */
[data-theme="dark"] main,
[data-theme="dark"] article,
[data-theme="dark"] aside {
    /* Blog-specific colors (Dark) */
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-tertiary: #6e6e73;
    --surface-secondary: #2d2d2d;
    --surface-tertiary: #3a3a3a;
    --accent-primary: #0a84ff;
    --accent-gradient: linear-gradient(135deg, #0a84ff 0%, #0056cc 100%);
    --success-color: #30d158;
    --warning-color: #ffcc02;
    --error-color: #ff453a;
    
    /* Code block specific colors for dark theme */
    --code-bg: #1e2024;
    --code-border: #3d4147;
    --code-text: #e6edf3;
    --inline-code-bg: #343941;
    --inline-code-text: #79c0ff;

    /* Prism token colors (Dark) */
    --prism-comment: #7c8696;
    --prism-keyword: #c678dd;
    --prism-class: #e6c07b;
    --prism-operator: #56b6c2;
    --prism-punctuation: #abb2bf;
    --prism-string: #98c379;
    --prism-number: #d19a66;
    --prism-function: #61afef;
    --prism-constant: #e06c75;
}

/* System Dark Mode Preference for semantic blog elements */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) main,
    :root:not([data-theme]) article,
    :root:not([data-theme]) aside {
        /* Blog-specific colors (Dark) */
        --text-primary: #ffffff;
        --text-secondary: #a0a0a0;
        --text-tertiary: #6e6e73;
        --surface-secondary: #2d2d2d;
        --surface-tertiary: #3a3a3a;
        --accent-primary: #0a84ff;
        --accent-gradient: linear-gradient(135deg, #0a84ff 0%, #0056cc 100%);
        --success-color: #30d158;
        --warning-color: #ffcc02;
        --error-color: #ff453a;
        
        /* Code block specific colors for system dark theme */
        --code-bg: #1e2024;
        --code-border: #3d4147;
        --code-text: #e6edf3;
        --inline-code-bg: #343941;
        --inline-code-text: #79c0ff;

        /* Prism token colors (System Dark) */
        --prism-comment: #7c8696;
        --prism-keyword: #c678dd;
        --prism-class: #e6c07b;
        --prism-operator: #56b6c2;
        --prism-punctuation: #abb2bf;
        --prism-string: #98c379;
        --prism-number: #d19a66;
        --prism-function: #61afef;
        --prism-constant: #e06c75;
    }
}

/* ============================================
   2. BLOG STYLES
   ============================================ */

/* Blog post page main container */
body.blog-post-page main {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

/* Individual blog post article */
article {
    background: var(--surface-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Article header - for both individual posts and blog post cards */
article > header {
    padding: 2rem 2rem 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: block;
}

/* Blog post card header (post-meta) */
.post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    /* Slightly larger for contrast at small sizes */
    font-size: 0.9rem;
    padding: 0;
    border-bottom: none;
}

.post-category {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.blog-post-card:hover .post-category {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

/* Article header title */
article > header h1 {
    margin: 0 0 1rem 0;
    font-size: clamp(2rem, 5vw, 2.5rem);
    line-height: 1.2;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.02em;
    position: relative;
}

.post-excerpt {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
    font-weight: 400;
    font-style: italic;
    border-left: 3px solid var(--accent-primary);
    padding-left: 1rem;
    background: linear-gradient(90deg, var(--surface-tertiary) 0%, transparent 100%);
    border-radius: 0 8px 8px 0;
    padding: 1rem;
    padding-left: 1.5rem;
}

/* Blog post card footer (post-tags) */
.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: auto;
}

.tag {
    background: var(--surface-tertiary);
    color: var(--text-secondary);
    padding: 0.3rem 0.7rem;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.tag::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.blog-post-card:hover .tag {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

.blog-post-card:hover .tag::before {
    left: 100%;
}

.reading-time {
    color: var(--text-tertiary);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.reading-time::before {
    content: '📖';
    font-size: 0.7rem;
}

/* Article content */
article > section {
    padding: 2rem;
    line-height: 1.7;
    /* Slightly larger, responsive base text size for readability */
    font-size: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
    /* Optional comfortable measure for long-form reading */
    max-width: 72ch;
    margin-inline: auto;
}

/* Article content typography */
article > section h2 {
    /* Unified rhythm using spacing tokens */
    margin: var(--space-2xl) 0 var(--space-lg) 0;
    font-size: clamp(1.5rem, 4vw, 1.8rem);
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.01em;
    position: relative;
    padding-bottom: 0.5rem;
}

article > section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 2px;
}

article > section h3 {
    /* Unified rhythm using spacing tokens */
    margin: var(--space-xl) 0 var(--space-md) 0;
    font-size: clamp(1.2rem, 3vw, 1.4rem);
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.01em;
    position: relative;
}

article > section p {
    /* Use token-based spacing and neutral tracking */
    margin-bottom: var(--space-lg);
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 1em;
    font-weight: 400;
    letter-spacing: 0;
}

/* First paragraph drop cap effect */
article > section > p:first-of-type::first-letter {
    float: left;
    font-size: 3.2em;
    line-height: 0.8;
    margin: 0.1em 0.1em 0 0;
    color: var(--accent-primary);
    font-weight: 700;
}

article > section ul,
article > section ol {
    /* Align list spacing with paragraph rhythm */
    margin-bottom: var(--space-lg);
    padding-left: var(--space-xl);
}

article > section li {
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Tighter spacing for nested lists */
article > section li > ul,
article > section li > ol {
    margin-top: var(--space-sm);
}

/* Avoid extra space after last list item */
article > section li:last-child {
    margin-bottom: 0;
}


/* ============================================
   PRISM.JS SYNTAX HIGHLIGHTING OVERRIDES
   ============================================ */

/* Theme-aware code blocks with high contrast */
section.post-content pre[class*="language-"] {
    background: var(--code-bg) !important;
    border: 1px solid var(--code-border);
    border-radius: 8px;
    padding: 1.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

section.post-content code[class*="language-"] {
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    font-size: 0.8rem;
    background: transparent !important;
}

/* Prism token color mapping (low priority via layer; theme CSS can override) */
@layer components {
    section.post-content .token.comment { color: var(--prism-comment); }
    section.post-content .token.keyword { color: var(--prism-keyword); }
    section.post-content .token.class-name { color: var(--prism-class); }
    section.post-content .token.operator { color: var(--prism-operator); }
    section.post-content .token.punctuation { color: var(--prism-punctuation); }
    section.post-content .token.string { color: var(--prism-string); }
    section.post-content .token.number { color: var(--prism-number); }
    section.post-content .token.function { color: var(--prism-function); }
    section.post-content .token.constant { color: var(--prism-constant); }
}

/* Language label for code blocks */
section.post-content pre[class*="language-"]::before {
    content: attr(class);
    content: attr(class) " ";
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    background: var(--accent-primary);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    opacity: 0.9;
    z-index: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Specific language labels */
section.post-content pre[class*="language-java"]::before {
    content: "JAVA";
}

section.post-content pre[class*="language-python"]::before {
    content: "PYTHON";
}

section.post-content pre[class*="language-javascript"]::before {
    content: "JS";
}

section.post-content pre[class*="language-js"]::before {
    content: "JS";
}

section.post-content pre[class*="language-json"]::before {
    content: "JSON";
}

section.post-content pre[class*="language-bash"]::before {
    content: "BASH";
}

/* Inline code styling */
section.post-content p code,
section.post-content li code,
section.post-content td code {
    background: var(--inline-code-bg) !important;
    color: var(--inline-code-text) !important;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--code-border);
}

/* Article content blockquotes and images */
article > section blockquote {
    border-left: 4px solid var(--accent-primary);
    margin: var(--space-xl) 0;
    padding: var(--space-lg) var(--space-xl);
    background: var(--surface-tertiary);
    border-radius: 0 8px 8px 0;
    position: relative;
    box-shadow: none;
    border: 1px solid var(--border-color);
}

article > section blockquote::before {
    content: '\201C';
    position: absolute;
    top: 0.5rem;
    left: 0.75rem;
    font-size: 2rem;
    color: var(--accent-primary);
    opacity: 0.15;
    line-height: 1;
}

article > section blockquote p {
    margin: 0;
    font-style: italic;
    font-size: 1em;
    line-height: 1.6;
    color: var(--text-primary);
    position: relative;
    z-index: 1;
}

article > section img {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    margin: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Tables in blog content */
article > section table {
    width: 100%;
    margin: 2rem 0;
    border-collapse: collapse;
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
    font-size: 0.95rem;
    overflow-x: auto;
    display: block;
    white-space: nowrap;
}

article > section thead {
    background: var(--surface-tertiary);
    border-bottom: 2px solid var(--border-color);
    display: table-header-group;
}

article > section th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    display: table-cell;
}

article > section tbody {
    display: table-row-group;
}

article > section tbody tr {
    border-bottom: 1px solid var(--border-color);
    display: table-row;
}

article > section tbody tr:last-child {
    border-bottom: none;
}

article > section td {
    padding: 0.875rem 1rem;
    color: var(--text-primary);
    line-height: 1.5;
    display: table-cell;
}

/* Article footer */
article > footer {
    padding: 2rem;
    border-top: 1px solid var(--border-color);
}

/* Article footer navigation */
article > footer nav,
footer nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

article > footer nav .btn-base,
footer nav .btn-base {
    flex: 1;
    text-align: center;
    text-decoration: none;
}

/* ============================================
   3. BLOG LISTING STYLES
   ============================================ */

/* Blog listing page main container */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 60px);
}

/* Sticky header for blog pages */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--background-color);
    min-height: 60px;
    display: block;
}

/* Blog listing page header */
.blog-header {
    text-align: center;
    margin-bottom: 3rem;
    min-height: 140px;
    position: relative;
    padding: 2rem 0;
}

.blog-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 2px;
}

.blog-header h1 {
    font-size: clamp(2rem, 5vw, 2.5rem);
    margin-bottom: 1rem;
    color: var(--text-primary);
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.02em;
    /* Simplify: solid heading color for readability */
}

.blog-header p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
    font-weight: 400;
}

.blog-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 3rem;
    align-items: start;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    contain: layout style;
}

.blog-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    min-height: 400px;
}

.blog-post-card {
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    transition: box-shadow var(--transition-slow), border-color var(--transition-slow);
    min-height: 280px;
    position: relative;
    overflow: hidden;
}

.blog-post-card::before { display: none; }

.blog-post-card:hover {
    transform: none;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border-color: var(--border-color);
    background: var(--surface-secondary);
}

.blog-post-card:hover::before {
    transform: scaleX(1);
}

.blog-post-card h2 {
    margin-bottom: 1rem;
    font-size: 1.4rem;
    line-height: 1.3;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.blog-post-card h2 a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition-slow);
    position: relative;
}

.blog-post-card h2 a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.blog-post-card:hover h2 a {
    color: var(--accent-primary);
}

.blog-post-card:hover h2 a::after {
    width: 100%;
}

.blog-post-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-meta time {
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* .post-meta time::before {
    content: '📅';
    font-size: 0.7rem;
} */

/* Blog listing page sidebar */
aside,
.blog-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 400px;
    flex-shrink: 0;
}

/* Sidebar sections */
aside > section,
.sidebar-section {
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    min-height: 120px;
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

aside > section::before,
.sidebar-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

aside > section:hover,
.sidebar-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-primary);
}

aside > section:hover::before,
.sidebar-section:hover::before {
    opacity: 1;
}

aside > section h3,
.sidebar-section h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

aside > section h3::before,
.sidebar-section h3::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 2px;
}

.category-list {
    list-style: none;
    padding: 0;
}

.category-list li {
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-list a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.category-list a:hover,
.category-list a.active {
    color: var(--accent-primary);
}

.count {
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-link {
    background: var(--surface-tertiary);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.tag-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

.tag-link:hover {
    color: white;
    border-color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.tag-link:hover::before {
    left: 0;
}

.cta-button {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)) !important;
    color: white !important;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    display: inline-block;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.3);
}

.cta-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.cta-button:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 122, 255, 0.4);
}

.cta-button:hover::before {
    left: 100%;
}


.error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.error-message h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

/* ============================================
   4. ANIMATIONS AND MICRO-INTERACTIONS
   ============================================ */

/* Enhanced animations */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}


/* Apply animations to elements */
.blog-post-card {
    animation: fadeInUp 0.6s ease-out;
}

.blog-post-card:nth-child(2) {
    animation-delay: 0.1s;
}

.blog-post-card:nth-child(3) {
    animation-delay: 0.2s;
}

.blog-post-card:nth-child(4) {
    animation-delay: 0.3s;
}

.sidebar-section {
    animation: slideInRight 0.6s ease-out;
}

.sidebar-section:nth-child(2) {
    animation-delay: 0.2s;
}

.sidebar-section:nth-child(3) {
    animation-delay: 0.4s;
}


/* ============================================
   5. BLOG POST ENHANCEMENTS
   ============================================ */

/* Enhanced Code Block Styling */
article > section pre {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
    overflow-x: hidden;
    overflow-y: hidden;
    white-space: pre;
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Menlo', 'Ubuntu Mono', 'SF Mono', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    max-width: 100%;
    display: block;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-left: 4px solid var(--accent-primary);
}

article > section code:not(pre code) {
    /* Toned-down inline code for better flow */
    background: var(--inline-code-bg);
    color: var(--inline-code-text);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Menlo', 'Ubuntu Mono', 'SF Mono', 'Consolas', monospace;
    font-size: 0.9em;
    font-weight: 500;
    word-break: normal;
    word-wrap: normal;
    border: 1px solid var(--code-border);
    box-shadow: none;
    position: relative;
}

article > section pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    display: block;
    overflow-x: auto;
    white-space: pre;
    word-break: normal;
    word-wrap: normal;
    border: none;
    box-shadow: none;
    font-weight: normal;
    font-size: inherit;
}

/* Blog Post Special Boxes */
.highlight-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    padding: 20px;
    border-radius: 8px;
    margin: 24px 0;
}

.highlight-box h3 {
    margin-top: 0;
    color: white !important;
}

.highlight-box * {
    color: white !important;
}

/* Respect reduced motion preferences (accessibility) */
@media (prefers-reduced-motion: reduce) {
    .blog-post-card,
    .blog-post-card::before,
    .blog-post-card h2 a,
    .post-category,
    .tag,
    .tag::before,
    .sidebar-section {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }
}

/* ============================================
   6. PRINT STYLES (Blog)
   ============================================ */
@media print {
    /* General reset for print */
    :root {
        color-scheme: light;
    }
    body {
        background: #ffffff !important;
        color: #000000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        font-size: 12pt;
        line-height: 1.5;
    }
    /* Remove decorative drop caps and clamps in print */
    article > section > p:first-of-type::first-letter { all: unset !important; }
    .blog-post-card p { -webkit-line-clamp: unset !important; display: block !important; }
    /* Hide chrome */
    dbl-header,
    .sticky-header,
    .site-header,
    nav,
    .blog-sidebar,
    .post-navigation,
    .cta-button { display: none !important; }

    /* Article layout */
    main,
    .blog-post-container,
    .blog-post {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        border: 0 !important;
        background: transparent !important;
    }
    article > section,
    .post-content {
        max-width: none !important;
        margin: 0 !important;
    }
    .post-header,
    .post-content,
    .post-footer {
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        border: 0 !important;
    }
    /* Headings and text */
    .post-header h1 { font-size: 22pt; margin: 0 0 12pt; color: #000 !important; }
    .post-content h2 { font-size: 16pt; margin: 18pt 0 8pt; color: #000 !important; }
    .post-content h3 { font-size: 14pt; margin: 14pt 0 6pt; color: #000 !important; }
    .post-content p, .post-content li { font-size: 12pt; line-height: 1.5; }
    .post-content ul, .post-content ol { padding-left: 18pt; margin: 0 0 10pt; }

    /* Links show destination */
    .post-content a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 10pt;
    }
    .post-content a { color: #000 !important; text-decoration: underline; }

    /* Images and code blocks */
    .post-content img,
    .post-content pre { page-break-inside: avoid; }
    .post-content pre {
        background: #f6f8fa !important;
        color: #000 !important;
        border: 1px solid #d0d7de !important;
        box-shadow: none !important;
    }
}

.tip-box {
    background-color: #e8f5e8;
    border-left: 4px solid #28a745;
    padding: 16px;
    margin: 20px 0;
    border-radius: 0 8px 8px 0;
    color: #155724;
}

.warning-box {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 16px;
    margin: 20px 0;
    border-radius: 0 8px 8px 0;
    color: #856404;
}

/* Dark mode styles for blog post enhancements */
[data-theme="dark"] article > section pre {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    border-color: var(--border-color);
    color: #e6e6e6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] article > section code:not(pre code) {
    background: linear-gradient(135deg, var(--surface-tertiary) 0%, rgba(255, 255, 255, 0.05) 100%);
    color: var(--accent-primary);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] article > section pre code {
    background: transparent;
    border: none;
    box-shadow: none;
}

[data-theme="dark"] .tip-box {
    background: linear-gradient(135deg, #0d2818 0%, #1a3d26 100%);
    border-left: 4px solid #28a745;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .warning-box {
    background: linear-gradient(135deg, #3d2f00 0%, #4d3a00 100%);
    border-left: 4px solid #ffc107;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .highlight-box {
    background: linear-gradient(135deg, #2d2d2d 0%, #3a3a3a 100%);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Dark mode blog card enhancements */
[data-theme="dark"] .blog-post-card {
    background: linear-gradient(135deg, var(--surface-secondary) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .blog-post-card:hover {
    background: linear-gradient(135deg, var(--surface-tertiary) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-color: rgba(10, 132, 255, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(10, 132, 255, 0.2);
}

/* Dark mode sidebar improvements */
[data-theme="dark"] aside > section,
[data-theme="dark"] .sidebar-section {
    background: linear-gradient(135deg, var(--surface-secondary) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] aside > section:hover,
[data-theme="dark"] .sidebar-section:hover {
    background: linear-gradient(135deg, var(--surface-tertiary) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-color: rgba(10, 132, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* System dark mode preferences */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) article > section pre {
        background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
        border-color: var(--border-color);
        color: #e6e6e6;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }
    
    :root:not([data-theme]) article > section code:not(pre code) {
        background: linear-gradient(135deg, var(--surface-tertiary) 0%, rgba(255, 255, 255, 0.05) 100%);
        color: var(--accent-primary);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    :root:not([data-theme]) article > section pre code {
        background: transparent;
        border: none;
        box-shadow: none;
    }
    
    :root:not([data-theme]) .tip-box {
        background: linear-gradient(135deg, #0d2818 0%, #1a3d26 100%);
        border-left: 4px solid #28a745;
        color: #ffffff;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    }
    
    :root:not([data-theme]) .warning-box {
        background: linear-gradient(135deg, #3d2f00 0%, #4d3a00 100%);
        border-left: 4px solid #ffc107;
        color: #ffffff;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    }
}

/* ============================================
   6. MOBILE ENHANCEMENTS
   ============================================ */



/* ============================================
   6. LINK STYLES FOR BLOG CONTENT
   ============================================ */

/* General link styles for blog content */
article a,
.blog-post-card a:not(h2 a),
section.post-content a {
    color: var(--accent-primary);
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-underline-offset: 3px;
    text-decoration-thickness: 1.5px;
}

article a:hover,
.blog-post-card a:not(h2 a):hover,
section.post-content a:hover {
    text-decoration-color: currentColor;
    opacity: 0.8;
}

article a:focus,
.blog-post-card a:not(h2 a):focus,
section.post-content a:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    text-decoration-color: currentColor;
}

/* Dark mode link colors for better contrast */
[data-theme="dark"] article a,
[data-theme="dark"] .blog-post-card a:not(h2 a),
[data-theme="dark"] section.post-content a {
    color: #79c0ff; /* Light blue for excellent contrast on dark backgrounds */
}

[data-theme="dark"] article a:visited,
[data-theme="dark"] section.post-content a:visited {
    color: #bb86fc; /* Light purple for visited links */
}

[data-theme="dark"] article a:hover,
[data-theme="dark"] .blog-post-card a:not(h2 a):hover,
[data-theme="dark"] section.post-content a:hover {
    color: #58a6ff; /* Brighter blue on hover */
}

/* System dark mode preferences */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) article a,
    :root:not([data-theme]) .blog-post-card a:not(h2 a),
    :root:not([data-theme]) section.post-content a {
        color: #79c0ff;
    }
    
    :root:not([data-theme]) article a:visited,
    :root:not([data-theme]) section.post-content a:visited {
        color: #bb86fc;
    }
    
    :root:not([data-theme]) article a:hover,
    :root:not([data-theme]) .blog-post-card a:not(h2 a):hover,
    :root:not([data-theme]) section.post-content a:hover {
        color: #58a6ff;
    }
}

/* ============================================
   7. BLOG RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    
    /* Blog Mobile Styles */
    .blog-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        padding: 0;
    }
    
    .blog-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
    }
    
    /* Mobile main container */
    main {
        padding: 1rem;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Hide sidebar on mobile */
    aside,
    .blog-sidebar {
        display: none;
    }
    
    .blog-post-card {
        margin: 0 auto;
        max-width: 100%;
        border-radius: 12px;
        padding: 1.25rem;
        min-height: 240px;
        touch-action: manipulation;
    }

    /* Disable decorative drop cap on small screens */
    article > section > p:first-of-type::first-letter {
        all: unset;
    }
    
    /* Better touch targets */
    .blog-post-card h2 a {
        padding: 0.5rem 0;
        display: block;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .tag {
        min-height: 32px;
        display: flex;
        align-items: center;
        padding: 0.4rem 0.8rem;
        touch-action: manipulation;
    }
    
    .post-category {
        min-height: 28px;
        display: flex;
        align-items: center;
        touch-action: manipulation;
    }
    
    /* Mobile blog header */
    .blog-header {
        padding: 1rem 0;
        margin-bottom: 2rem;
    }
    
    .blog-header h1 {
        font-size: 2rem;
        background: var(--text-primary);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .blog-header p {
        font-size: 1rem;
        padding: 0 1rem;
    }
    
    .blog-header::before {
        width: 40px;
        height: 3px;
    }
    
    /* Blog Post Mobile */
    body.blog-post-page main {
        padding: 0.5rem;
        margin: 0;
        max-width: 100%;
    }
    
    article {
        border-radius: 0;
        margin: 0;
    }
    
    article > header {
        padding: 1rem;
    }
    
    article > header h1 {
        font-size: 1.75rem;
        line-height: 1.2;
        margin-bottom: 0.75rem;
    }
    
    .post-excerpt {
        font-size: 1rem;
        line-height: 1.5;
        margin-bottom: 1rem;
    }
    
    .post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .post-tags {
        margin-top: 0.5rem;
    }
    
    .tag {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
    }
    
    article > section {
        padding: 1rem;
    }
    
    article > section h2 {
        font-size: 1.5rem;
        margin: 1.5rem 0 0.75rem 0;
    }
    
    article > section h3 {
        font-size: 1.25rem;
        margin: 1.25rem 0 0.75rem 0;
    }
    
    article > section p {
        margin-bottom: 1rem;
        line-height: 1.6;
    }
    
    article > section pre {
        font-size: 0.8rem;
        padding: 1rem;
        margin: 1rem 0;
        overflow-x: auto;
        border-radius: 6px;
        word-wrap: break-word;
        white-space: pre-wrap;
        overflow-wrap: break-word;
    }
    
    article > section code {
        font-size: 0.8rem;
        padding: 0.15rem 0.3rem;
    }
    
    article > section ul,
    article > section ol {
        padding-left: 1.5rem;
        margin-bottom: 1rem;
    }
    
    article > section li {
        font-size: 0.95rem;
        margin-bottom: 0.4rem;
    }
    
    article > section blockquote {
        margin: 1rem 0;
        padding: 0.75rem 1rem;
        border-radius: 0 6px 6px 0;
    }
    
    article > footer {
        padding: 1rem;
    }
    
    article > footer nav,
    footer nav {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    article > footer nav .btn-base,
    footer nav .btn-base {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Blog Post Enhancements Mobile Styles */
    article > section pre {
        padding: 12px;
        font-size: 13px;
        border-radius: 6px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        max-width: calc(100vw - 32px);
    }
    
    /* Visual indicator for scrollable content */
    article > section pre::-webkit-scrollbar {
        height: 8px;
    }
    
    article > section pre::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
    }
    
    article > section pre::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 4px;
    }
    
    article > section pre::-webkit-scrollbar-thumb:hover {
        background: #555;
    }
    
    /* Better spacing for mobile readability */
    article > section {
        line-height: 1.6;
    }

    /* Mobile table styles */
    article > section table {
        font-size: 0.85rem;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    article > section th,
    article > section td {
        padding: 0.625rem 0.75rem;
    }
}
