/* Shared Blog Styles */

/* Prevent horizontal scroll on mobile */
html {
    overflow-x: hidden;
}

body {
    margin: 0;
    background-color: #1a1a1a;
    color: #e0e0e0;
    font-family: 'Georgia', serif;
    line-height: 1.6;
    overflow-x: hidden; /* Prevent horizontal scroll */
    width: 100%;
    max-width: 100vw; /* Never exceed viewport width */
}

/* Ensure all content respects viewport width */
* {
    max-width: 100%;
    box-sizing: border-box; /* Include padding in width calculations */
}

/* Responsive container that scales with screen size */
.blog-container {
    max-width: 1200px; /* Increased from 800px for larger screens */
    margin: 0 auto;
    padding: 40px 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Media queries for different screen sizes */
@media (min-width: 1400px) {
    .blog-container {
        max-width: 1400px; /* Even wider on very large screens */
        padding: 60px 40px;
    }
}

@media (max-width: 1200px) {
    .blog-container {
        max-width: 1000px;
        padding: 40px 30px;
    }
}

@media (max-width: 992px) {
    .blog-container {
        max-width: 800px; /* Original width for tablets */
        padding: 30px 20px;
    }
}

@media (max-width: 768px) {
    .blog-container {
        max-width: 100%;
        padding: 20px 15px;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .blog-container {
        padding: 15px 10px; /* Even less padding on small phones */
    }
}

.blog-header {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #2c3e50 0%, #1a1a1a 100%);
    margin-bottom: 40px;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .blog-header {
        padding: 30px 15px;
        margin-bottom: 30px;
    }
}

.blog-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: #4CAF50;
    word-wrap: break-word; /* Prevent long words from causing overflow */
}

@media (max-width: 768px) {
    .blog-header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .blog-header h1 {
        font-size: 1.75rem;
    }
}

.blog-header p {
    font-style: italic;
    color: #b0b0b0;
}

.home-link {
    display: inline-block;
    margin-bottom: 20px;
    color: #4CAF50;
    text-decoration: none;
    font-size: 1rem;
}

.home-link:hover {
    text-decoration: underline;
}

/* Blog listing grid - responsive columns */
.blog-posts {
    display: grid;
    gap: 30px;
    width: 100%;
}

@media (max-width: 768px) {
    .blog-posts {
        gap: 20px;
    }
}

/* Multi-column layout for larger screens */
@media (min-width: 1200px) {
    .blog-posts {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on large screens */
        gap: 40px;
    }
}

@media (min-width: 1600px) {
    .blog-posts {
        grid-template-columns: repeat(3, 1fr); /* 3 columns on extra large screens */
        gap: 40px;
    }
}

.post-card {
    background-color: #2a2a2a;
    padding: 30px;
    border-radius: 8px;
    border-left: 4px solid #4CAF50;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word; /* Break long words if needed */
}

@media (max-width: 768px) {
    .post-card {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .post-card {
        padding: 15px;
    }
}

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

.post-card h2 {
    margin-top: 0;
    color: #4CAF50;
    word-wrap: break-word;
}

.post-card h2 a {
    color: #4CAF50;
    text-decoration: none;
}

.post-card h2 a:hover {
    text-decoration: underline;
}

.post-meta {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.post-excerpt {
    color: #c0c0c0;
    margin-bottom: 15px;
}

.read-more {
    color: #4CAF50;
    text-decoration: none;
    font-weight: bold;
}

.read-more:hover {
    text-decoration: underline;
}

/* Individual Post Styles - Responsive width */
.post-content {
    background-color: #2a2a2a;
    padding: 40px;
    border-radius: 8px;
    margin-bottom: 40px;
    max-width: 900px; /* Limit width for readability but allow more space */
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
}

/* Scale post content width based on screen size */
@media (min-width: 1400px) {
    .post-content {
        max-width: 1100px; /* Wider on large screens */
        padding: 60px 80px;
    }
}

@media (max-width: 768px) {
    .post-content {
        padding: 25px 20px;
        border-radius: 0; /* Remove rounded corners on mobile for edge-to-edge */
    }
}

@media (max-width: 480px) {
    .post-content {
        padding: 20px 15px;
    }
}

.post-title {
    color: #4CAF50;
    font-size: 2.5rem;
    margin-bottom: 10px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

@media (max-width: 768px) {
    .post-title {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .post-title {
        font-size: 1.75rem;
    }
}

.post-content p {
    margin-bottom: 1.2rem;
    font-size: 1.1rem; /* Slightly larger for better readability */
    word-wrap: break-word;
}

@media (min-width: 1400px) {
    .post-content p {
        font-size: 1.15rem; /* Even larger on big screens */
        line-height: 1.8;
    }
}

@media (max-width: 480px) {
    .post-content p {
        font-size: 1rem;
    }
}

.post-content h2 {
    color: #5fb862;
    margin-top: 2rem;
    margin-bottom: 1rem;
    word-wrap: break-word;
}

.post-content ul, .post-content ol {
    margin-bottom: 1.2rem;
    padding-left: 2rem;
}

@media (max-width: 480px) {
    .post-content ul, .post-content ol {
        padding-left: 1.5rem;
    }
}

.post-content li {
    margin-bottom: 0.5rem;
}

.back-to-blog {
    display: inline-block;
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.back-to-blog:hover {
    background-color: #45a049;
}

/* Responsive images - ensure they scale properly and never overflow */
.post-content img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
}

/* Responsive tables - prevent horizontal overflow */
.post-content table {
    width: 100%;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

@media (min-width: 768px) {
    .post-content table {
        display: table;
    }
}

/* Prevent code blocks from causing overflow */
.post-content pre {
    overflow-x: auto;
    max-width: 100%;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.post-content code {
    word-wrap: break-word;
}

/* Fix for iframes (videos) on mobile */
.post-content iframe {
    max-width: 100%;
}

/* Ensure video containers are responsive */
.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
