/* 
 * Bluworks Single Post Styles 
 * APPROACH: Mobile-First + RTL Support via Logical Properties
 */

/* --- Typography & Fonts (Arabic Support) --- */
:lang(ar) body.single-post,
:lang(ar) .blu-post-title,
:lang(ar) .blu-entry-content,
:lang(ar) .blu-toc-heading,
:lang(ar) .blu-mobile-toc-summary,
:lang(ar) .blu-toc-links a {
    font-family: 'Noto Sans Arabic', 'Inter', sans-serif !important;
}

/* --- Layout & Background --- */
body.single-post {
    background-color: #f2f9fe;
}

.blu-single-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* --- Post Header (Hero) --- */
.blu-post-header {
    padding-top: 32px;
    padding-bottom: 32px;
    max-width: 850px;
    margin-inline: auto; /* Centers horizontally RTL & LTR */
}

/* Breadcrumbs */
.blu-breadcrumbs {
    font-size: 13px;
    color: #4b5563;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.blu-breadcrumbs a {
    text-decoration: none;
    color: inherit;
}

/* Category Badge */
.blu-cat-badge {
    display: inline-block;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #1570EF;
    background-color: rgba(20, 93, 252, 0.1);
    border-radius: 9999px;
    margin-bottom: 20px;
    text-decoration: none;
}

/* Title */
.blu-post-title {
    font-family: 'Inter', sans-serif;
    font-size: 30px; 
    font-weight: 700;
    color: #111827;
    margin-bottom: 24px;
    line-height: 1.2;
    letter-spacing: -0.03em;
}

:lang(ar) .blu-post-title {
    letter-spacing: 0;
    line-height: 1.4;
}

/* Author Meta */
.blu-author-block {
    display: flex;
    align-items: center;
}

.blu-author-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-inline-end: 12px; /* RTL Safe Margin */
}

.blu-author-info {
    font-size: 13px;
}

.blu-author-name {
    font-weight: 600;
    color: #111827;
    font-size: 15px;
    margin-bottom: 2px;
}

.blu-post-meta-text {
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* --- Main Layout Grid --- */
.blu-content-wrapper {
    display: flex;
    flex-direction: column; 
    gap: 32px;
    padding-bottom: 48px;
}

/* --- SIDEBAR TOC (Desktop Sticky) --- */
.blu-sidebar-toc {
    display: none; 
    width: 280px; 
    flex-shrink: 0;
}

.blu-toc-card {
    background-color: #ffffff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(20, 93, 252, 0.05);
    border: 1px solid #f3f4f6;
}

.blu-toc-heading {
    font-size: 12px;
    font-weight: 700;
    color: #9ca3af;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.blu-toc-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Link Styles with Logical Properties */
.blu-toc-links a {
    font-size: 14px;
    color: #4b5563;
    text-decoration: none;
    transition: all 0.2s;
    display: block;
    line-height: 1.5;
    
    /* RTL Safe Border Logic */
    border-inline-start: 2px solid #e5e7eb; 
    padding-inline-start: 16px;
    margin-inline-start: -2px; /* Pulls border back to align */
}

/* Hover/Active */
.blu-toc-links a:hover,
.blu-toc-links a.active {
    color: #1570EF;
    font-weight: 600;
    border-inline-start-color: #1570EF; 
    
    /* Gradient direction needs explicit RTL check usually, or use 'to inline-end' in very modern browsers */
    background: linear-gradient(to right, #f8fafc, transparent); 
}
:lang(ar) .blu-toc-links a:hover {
   background: linear-gradient(to left, #f8fafc, transparent); 
}

/* Sub-items (H3) Indentation via Class */
.blu-toc-subitem {
    font-size: 13px !important;
    padding-inline-start: 32px !important; /* Deeper indent */
}

/* --- INLINE / MOBILE TOC (Boxed & Bold Design) --- */
.blu-mobile-toc-wrapper {
    display: block; 
    margin: 32px 0;
    background-color: #F2F9FE; 
    border: 1px solid #dbeafe; 
    
    /* Bold Accent Border - Logical Property */
    border-inline-start: 5px solid #1570EF;
    
    border-radius: 8px; 
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); 
    transition: box-shadow 0.3s ease;
}

.blu-mobile-toc-wrapper:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

.blu-mobile-toc-summary {
    cursor: pointer;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 18px;
    color: #111827;
    list-style: none;
    outline: none;
    user-select: none;
}
.blu-mobile-toc-summary::-webkit-details-marker { display: none; }

.blu-mobile-toc-summary svg {
    color: #1570EF;
    width: 24px;
    height: 24px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.blu-mobile-toc-details[open] .blu-mobile-toc-summary svg {
    transform: rotate(180deg);
}

.blu-mobile-toc-nav {
    padding: 0 24px 24px 24px;
    border-top: 1px solid #dbeafe;
}

.blu-mobile-toc-nav ul {
    margin: 16px 0 0 0;
    padding-left: 0; /* Reset */
    padding-inline-start: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.blu-mobile-toc-nav li { margin: 0; }

.blu-mobile-toc-nav a {
    text-decoration: none;
    color: #334155;
    font-size: 16px;
    font-weight: 500;
    display: block;
    line-height: 1.5;
    transition: all 0.2s ease;
}

.blu-mobile-toc-nav a:hover {
    color: #1570EF;
    transform: translateX(4px); 
}
:lang(ar) .blu-mobile-toc-nav a:hover {
    transform: translateX(-4px); /* Slide left for Arabic */
}

/* --- Main Content Card --- */
.blu-article-card {
    width: 100%;
    background-color: #ffffff;
    border-radius: 16px;
    padding: 24px; 
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    overflow-wrap: break-word; 
}

/* Typography (Prose) */
.blu-entry-content {
    color: #374151;
    font-size: 16px;
    line-height: 1.6;
}

.blu-entry-content p { margin-bottom: 20px; }

.blu-entry-content h2 {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin-top: 32px;
    margin-bottom: 16px;
    line-height: 1.3;
}

.blu-entry-content h3 {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin-top: 24px;
    margin-bottom: 12px;
}

.blu-entry-content ul {
    margin-bottom: 24px;
    padding-inline-start: 16px; /* RTL Safe List Padding */
    list-style-type: disc;
}

.blu-entry-content li { margin-bottom: 8px; }

.blu-entry-content img {
    border-radius: 12px;
    height: auto;
    max-width: 100%;
    margin-bottom: 24px;
    display: block;
}

/* Share Section */
.blu-share-footer {
    border-top: 1px solid #e5e7eb;
    padding-top: 24px;
    margin-top: 32px;
    display: flex;
    flex-direction: column; 
    gap: 16px;
    align-items: flex-start;
}

.blu-share-label {
    font-weight: 500;
    color: #374151;
}

.blu-share-icons {
    display: flex;
    gap: 12px;
}

.blu-share-icon {
    width: 40px;
    height: 40px;
    background-color: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4b5563;
    text-decoration: none;
    transition: all 0.2s;
}

/* --- Related Posts --- */
.blu-related-section {
    padding-top: 40px;
    padding-bottom: 40px;
}

.blu-related-title {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 24px;
}

.blu-related-grid {
    display: grid;
    grid-template-columns: 1fr; 
    gap: 24px;
}

.blu-rel-card {
    background-color: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
}

.blu-rel-img-wrap {
    height: 200px;
    width: 100%;
}

.blu-rel-img { 
    height: 100%; 
    width: 100%; 
    object-fit: cover; 
}

.blu-rel-body { 
    padding: 20px; 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
}

.blu-rel-cat { 
    display: inline-block; 
    padding: 4px 10px; 
    font-size: 11px; 
    font-weight: 500; 
    color: #1570EF;
    background-color: rgba(20, 93, 252, 0.1); 
    border-radius: 9999px; 
    margin-bottom: 12px; 
    width: fit-content;
}

.blu-rel-title { 
    font-size: 18px; 
    font-weight: 700; 
    color: #111827; 
    margin: 0 0 12px 0; 
    line-height: 1.4; 
}

.blu-rel-title a { text-decoration: none; color: inherit; }

.blu-rel-excerpt { 
    font-size: 14px; 
    color: #4b5563; 
    margin-bottom: 16px; 
    line-height: 1.6; 
    flex: 1; 
}

.blu-rel-meta { 
    font-size: 12px; 
    color: #6b7280; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

/* =========================================
   TABLET (min-width: 768px)
   ========================================= */
@media (min-width: 768px) {
    .blu-single-container { padding: 0 32px; }

    .blu-post-header {
        padding-top: 48px;
        padding-bottom: 48px;
    }

    .blu-post-title { font-size: 40px; }
    .blu-article-card { padding: 48px; }

    .blu-share-footer {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .blu-related-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =========================================
   DESKTOP (min-width: 1024px)
   ========================================= */
@media (min-width: 1024px) {
    /* 1. Show Sidebar TOC */
    .blu-sidebar-toc {
        display: block;
        position: sticky;
        top: 120px;
    }
    
    /* 2. Hide Inline TOC */
    .blu-mobile-toc-wrapper { display: none; }

    /* 3. Row Layout */
    .blu-content-wrapper {
        flex-direction: row;
        align-items: flex-start;
        gap: 48px;
    }

    /* 4. Updates */
    .blu-post-title { font-size: 48px; }
    .blu-article-card { padding: 64px; flex: 1; }
    .blu-entry-content { font-size: 18px; }

    .blu-related-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
/* --- Author Link Styling (Interactive) --- */
.blu-author-avatar-link {
    display: block;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.blu-author-avatar-link:hover {
    opacity: 0.8;
}

.blu-author-link {
    text-decoration: none;
    color: inherit; /* Inherit dark grey from parent */
    transition: all 0.2s ease;
    border-bottom: 1px solid transparent;
}

.blu-author-link:hover {
    color: #1570EF; /* Brand Blue */
    border-bottom-color: #1570EF;
}

/* Specific overrides for single post structure */
.blu-author-name {
    display: flex;
    align-items: center;
}