/* Enhanced Blog Post Styles */

/* Prevent layout shifts */
body {
    overflow-y: scroll; /* Prevent shift from scrollbar appearing */
}

/* Create a fixed page structure before content loads */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Header and metadata */
.blog-post-header {
    text-align: left;
    padding: 30px 0 30px;
    position: relative;
    overflow: hidden;
    max-width: 800px;
    margin: 0 auto;
    border-bottom: 1px solid #eaeaea;
    margin-bottom: 40px;
    background: none !important; /* Override generic header background */
    background-image: none !important; /* Ensure no background image is shown */
    color: #333; /* Reset text color */
    box-shadow: none; /* Remove any box shadow */
    display: block; /* Override flex display */
    min-height: 150px; /* Reserve space for header */
}

.blog-breadcrumb {
    font-size: 0.9em;
    margin-bottom: 25px;
    color: #666;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    min-height: 24px; /* Reserve space */
}

#blog-post-title {
    font-size: 2.4em;
    margin-bottom: 15px;
    line-height: 1.3;
    color: #1a5f7a;
    font-weight: 600;
    min-height: 3.2em; /* Minimum height to reserve space for 2 lines of title */
}

.blog-post-meta {
    margin-bottom: 0;
    font-size: 0.95em;
    color: #666;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 25px;
    flex-wrap: wrap;
    min-height: 24px; /* Reserve space for metadata */
}

.blog-post-date, .blog-post-author {
    display: flex;
    align-items: center;
}

/* Post content */
.blog-post-content {
    max-width: 800px;
    margin: 0 auto 50px;
    line-height: 1.8;
    color: #333;
    text-align: left;
    min-height: 500px; /* Increased minimum height for content */
    position: relative; /* For absolute positioning of placeholders */
    contain: layout; /* Contain layout changes */
}

/* Loading state for content */
.blog-post-content.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 500px;
    background: linear-gradient(
        to bottom,
        #f3f3f3 0%,
        #f3f3f3 20px,
        #fafafa 40px,
        #f3f3f3 60px
    );
    background-size: 100% 80px;
    animation: shimmer 2s infinite linear;
    opacity: 0.5;
}

@keyframes shimmer {
    0% { background-position: -468px 0; }
    100% { background-position: 468px 0; }
}

/* Image handling to prevent layout shifts */
.blog-post-content img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9; /* Default aspect ratio */
    display: block;
    margin: 2em auto;
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    contain: size layout; /* Contain size and layout changes */
}

/* Image figure container */
.blog-post-content figure {
    margin: 2em 0;
    width: 100%;
    contain: layout; /* Contain layout changes */
}

.blog-post-content figcaption {
    margin-top: 0.5em;
    text-align: center;
    font-size: 0.9em;
    color: #666;
    font-style: italic;
}

.blog-post-content h1,
.blog-post-content h2,
.blog-post-content h3,
.blog-post-content h4,
.blog-post-content h5,
.blog-post-content h6 {
    font-weight: 600;
    color: #1a5f7a;
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    text-align: left;
}

.blog-post-content h1 {
    font-size: 2.2em;
    line-height: 1.3;
}

.blog-post-content h2 {
    font-size: 1.8em;
    line-height: 1.35;
    border-bottom: 1px solid #eaeaea;
    padding-bottom: 10px;
}

.blog-post-content h3 {
    font-size: 1.4em;
    line-height: 1.4;
}

.blog-post-content p {
    margin-bottom: 1.5em;
    font-size: 1.05em;
    line-height: 1.7;
}

.blog-post-content ul,
.blog-post-content ol {
    margin: 0 0 1.5em 0;
    padding-left: 1.5em;
}

.blog-post-content li {
    margin-bottom: 0.8em;
    position: relative;
}

.blog-post-content blockquote {
    border-left: 4px solid #1a5f7a;
    padding: 0.5em 0 0.5em 1.5em;
    margin: 2em 0;
    background-color: rgba(26, 95, 122, 0.05);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #444;
}

.blog-post-content pre {
    background-color: #f6f8fa;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5em 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    line-height: 1.4;
}

.blog-post-content code {
    font-family: 'Courier New', Courier, monospace;
    background-color: #f6f8fa;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
    color: #1a5f7a;
}

.blog-post-content pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 1em;
}

.blog-post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2em 0;
    border: 1px solid #e1e4e8;
}

.blog-post-content th,
.blog-post-content td {
    padding: 12px 15px;
    text-align: left;
    border: 1px solid #e1e4e8;
}

.blog-post-content th {
    background-color: #f6f8fa;
    font-weight: 600;
}

/* Flowchart styles */
.blog-post-content pre:not([class]) {
    background-color: #f8f9fb;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e1e4e8;
    font-family: 'Courier New', Courier, monospace;
    line-height: 1.3;
    color: #333;
    white-space: pre-wrap;
}

/* Share and related sections */
.blog-post-footer {
    max-width: 800px;
    margin: 60px auto 0;
    padding-top: 40px;
    border-top: 1px solid #eee;
    text-align: left;
    min-height: 200px; /* Reserve space for footer content */
    contain: layout; /* Contain layout changes */
}

.blog-post-share h3,
.related-posts h3 {
    font-size: 1.4em;
    margin-bottom: 20px;
    color: #333;
}

.share-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 40px;
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    margin-bottom: 40px;
}

.return-to-blog {
    margin-top: 40px;
}

/* Button styles */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background-color: #1a5f7a;
    color: white;
}

.btn-primary:hover {
    background-color: #15485c;
}

.btn-outline {
    background-color: transparent;
    color: #1a5f7a;
    border: 1px solid #1a5f7a;
}

.btn-outline:hover {
    background-color: #1a5f7a;
    color: white;
}

/* Share button styles */
.share-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.facebook {
    background-color: #3b5998;
}

.twitter {
    background-color: #1da1f2;
}

.linkedin {
    background-color: #0077b5;
}

.email {
    background-color: #777;
}

.share-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 10px rgba(0,0,0,0.1);
}

@media (max-width: 992px) {
    .related-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .blog-post-content {
        min-height: 400px;
    }
    
    .blog-post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .blog-post-footer {
        margin: 40px auto 0;
    }
    
    .blog-post-content h1 {
        font-size: 1.8em;
    }
    
    .blog-post-content h2 {
        font-size: 1.5em;
    }
    
    .blog-post-content h3 {
        font-size: 1.3em;
    }
}

@media (max-width: 576px) {
    .related-posts-grid {
        grid-template-columns: 1fr;
    }
    
    .blog-post-header h1 {
        font-size: 1.8em;
    }
    
    .share-buttons {
        justify-content: center;
    }
}

/* Related Posts Section Styles */
.related-posts {
    margin-top: 50px;
    margin-bottom: 40px;
}

.related-posts h3 {
    margin-bottom: 25px;
    color: #1a5f7a;
    font-size: 1.6em;
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    margin-bottom: 40px;
}

/* Related Post Card Styles */
.related-post-card {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.related-post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.related-post-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.related-post-image {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    background-color: #f0f0f0;
}

.related-post-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.related-post-card:hover .related-post-image img {
    transform: scale(1.05);
}

.related-post-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.related-post-title {
    font-size: 1.2em;
    font-weight: 600;
    color: #1a5f7a;
    margin-bottom: 10px;
    line-height: 1.4;
}

.related-post-date {
    font-size: 0.85em;
    color: #666;
    margin-top: auto;
}

/* Placeholder card styles during loading */
.placeholder-card {
    background-color: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    height: 100%;
}

.placeholder-card .placeholder-image {
    height: 160px;
    background-color: #eee;
    border-radius: 8px 8px 0 0;
}

.placeholder-card .placeholder-content {
    padding: 15px;
}

.placeholder-card .placeholder-title {
    width: 80%;
    height: 20px;
    background-color: #ddd;
    margin-bottom: 10px;
    border-radius: 4px;
}

.placeholder-card .placeholder-date {
    width: 50%;
    height: 15px;
    background-color: #ddd;
    border-radius: 4px;
}

/* Responsive Styles for Related Posts */
@media (max-width: 992px) {
    .related-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .related-posts-grid {
        grid-template-columns: 1fr;
    }
    
    .related-post-title {
        font-size: 1.1em;
    }
} 