/* ===== blog.css ===== */
/* Blog page styles – clean, responsive, no horizontal overflow, with modal */

/* ---------- RESET OVERFLOW ---------- */
html,
body {
    overflow-x: hidden;
    max-width: 100%;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

img,
svg,
video,
iframe {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ---------- BLOG LAYOUT ---------- */
.blog-section {
    background: var(--white);
    overflow-x: hidden;
}

.blog-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
    max-width: 100%;
}

/* ---------- BLOG POSTS ---------- */
.blog-main {
    min-width: 0; /* prevents flex/grid overflow */
    overflow-wrap: break-word;
}

.blog-post {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
    flex-wrap: wrap;
}

.post-image {
    flex: 0 0 200px;
    overflow: hidden;
    border-radius: var(--card-radius);
}

.post-image img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    transition: var(--transition);
}

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

.post-content {
    flex: 1;
    min-width: 0;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

.post-category {
    background: var(--light-gray);
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    color: var(--deep-blue);
    font-weight: 500;
}

.post-title {
    margin-bottom: 0.75rem;
    font-size: 1.4rem;
    word-break: break-word;
}

.post-excerpt {
    margin-bottom: 1rem;
    color: var(--text-light);
    word-break: break-word;
}

/* ---------- SIDEBAR ---------- */
.blog-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-width: 0;
}

.sidebar-widget {
    background: var(--light-gray);
    border-radius: var(--card-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    overflow-wrap: break-word;
}

.widget-title {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.widget-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 2px;
    background: var(--gold);
}

/* Search form */
.search-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.search-form input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: 2rem;
    font-family: inherit;
    font-size: 1rem;
    min-width: 0;
}

.search-form button {
    padding: 0.75rem 1.5rem;
    border-radius: 2rem;
    white-space: nowrap;
}

/* Categories & Recent Posts */
.categories-widget ul,
.recent-posts-widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.categories-widget li,
.recent-posts-widget li {
    margin-bottom: 0.75rem;
}

.categories-widget a,
.recent-posts-widget a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

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

.tag-cloud a {
    background: var(--white);
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    transition: var(--transition);
    white-space: nowrap;
}

/* ---------- PAGINATION ---------- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.75rem;
    border-radius: 0.5rem;
    background: var(--light-gray);
    color: var(--deep-blue);
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}

/* ---------- NO RESULTS ---------- */
.no-results {
    text-align: center;
    padding: 2rem;
    background: var(--light-gray);
    border-radius: var(--card-radius);
    margin-top: 2rem;
    display: none;
}

/* ---------- SCROLL REVEAL ---------- */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- BLOG MODAL (for full post) ---------- */
.blog-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}
.blog-modal.active {
    display: flex;
}
.modal-content {
    background: var(--white);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    border-radius: var(--card-radius);
    overflow-y: auto;
    position: relative;
    cursor: default;
    animation: modalFadeIn 0.3s ease;
    padding: 2rem;
}
@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: var(--deep-blue);
    transition: var(--transition);
    line-height: 1;
    z-index: 10;
}
.modal-close:hover {
    color: var(--gold);
}
.modal-body img {
    width: 100%;
    height: auto;
    border-radius: var(--card-radius);
    margin-bottom: 1rem;
}
.modal-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-light);
}
.modal-meta span:last-child {
    background: var(--light-gray);
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    color: var(--deep-blue);
}
#modalTitle {
    margin-bottom: 1rem;
}
#modalFullContent {
    line-height: 1.6;
    color: var(--text-dark);
}
#modalFullContent p {
    margin-bottom: 1rem;
}
#modalFullContent ul, #modalFullContent ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

/* ---------- RESPONSIVE (NO OVERFLOW) ---------- */
@media (max-width: 992px) {
    .blog-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .blog-sidebar {
        order: -1;
    }
}

@media (max-width: 768px) {
    .blog-post {
        flex-direction: column;
        gap: 1rem;
    }
    .post-image {
        flex: 0 0 auto;
        max-width: 100%;
    }
    .post-image img {
        height: auto;
        max-height: 220px;
    }
    .search-form {
        flex-direction: column;
    }
    .search-form button {
        width: 100%;
    }
    .tag-cloud a {
        white-space: normal;
    }
    .modal-content {
        padding: 1.5rem;
        width: 95%;
    }
    .modal-close {
        top: 10px;
        right: 15px;
        font-size: 1.8rem;
    }
}