/* --- BLOG LIST & DETAILS STYLES --- */

.blog-page {
    background-color: #F8F9FA;
    padding: 80px 0;
    overflow-x: hidden;
}

.blog-layout-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    /* CRITICAL: prevents grid cells from overflowing their allocated fraction */
    min-width: 0;
    overflow: hidden;
}

/* All direct grid children MUST have min-width: 0 to respect fr units */
.blog-layout-row > * {
    min-width: 0;
    overflow: hidden;
}

@media (max-width: 991px) {
    .blog-layout-row {
        grid-template-columns: 1fr;
    }
}

/* --- BLOG HERO BANNER --- */
.blog-hero {
    position: relative;
    padding: 180px 0 100px;
    background-color: var(--color-dark);
    overflow: hidden;
    color: var(--color-white);
}

.blog-hero-content {
    position: relative;
    z-index: 2;
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
    /* Ensure long unbreakable words wrap inside the hero */
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    overflow: hidden;
}


/* --- BREADCRUMB --- */
.blog-breadcrumb {
    margin-bottom: 20px;
}

.blog-breadcrumb ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.blog-breadcrumb li {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.6);
}

.blog-breadcrumb a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    transition: color 0.3s ease;
}

.blog-breadcrumb a:hover {
    color: var(--color-primary);
}

.blog-breadcrumb li.active {
    color: var(--color-primary);
}

/* --- BLOG GRID --- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

@media (max-width: 768px) {
    .blog-grid {
        grid-template-columns: 1fr;
    }
}

.blog-card {
    background: var(--color-white);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
    transition: all 0.4s ease;
}

.blog-card:hover {
    box-shadow: 0 15px 40px rgba(0,0,0,0.08);
    transform: translateY(-5px);
}

.blog-image {
    position: relative;
    overflow: hidden;
    height: 250px;
}

.blog-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

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

.blog-category-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    background: var(--color-primary);
    color: var(--color-white);
    padding: 5px 15px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 4px;
    font-weight: 600;
}

.blog-content {
    padding: 30px;
}

.blog-meta {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.stretched-link::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    content: "";
}

.blog-meta i {
    color: var(--color-primary);
    margin-right: 5px;
}

.blog-title {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 15px;
    line-height: 1.3;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.blog-title a {
    color: var(--color-dark);
    text-decoration: none;
    transition: color 0.3s ease;
}

.blog-title a:hover {
    color: var(--color-primary);
}

.blog-excerpt {
    color: var(--color-text-muted);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 20px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.btn-read-more {
    display: inline-block;
    color: var(--color-dark);
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    position: relative;
    padding-bottom: 5px;
}

.btn-read-more::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--color-primary);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.4s ease;
}

.btn-read-more:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* --- BLOG SIDEBAR --- */
.blog-sidebar {
    padding-left: 30px;
}

@media (max-width: 991px) {
    .blog-sidebar {
        padding-left: 0;
        margin-top: 50px;
    }
}

.widget {
    background: var(--color-white);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
    margin-bottom: 40px;
    /* Clip any overflow from inner content */
    overflow: hidden;
}


.widget-title {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 25px;
    position: relative;
    padding-bottom: 15px;
}

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

.widget-categories ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.widget-categories li {
    margin-bottom: 15px;
}

.widget-categories li:last-child {
    margin-bottom: 0;
}

.widget-categories a {
    color: var(--color-text-muted);
    text-decoration: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    transition: color 0.3s ease;
    /* Prevent flex from stretching beyond widget width */
    min-width: 0;
}

/* Category name text: allow wrapping, take remaining space */
.widget-categories a span:first-child {
    min-width: 0;
    flex: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.widget-categories a:hover {
    color: var(--color-primary);
}

.cat-count {
    background: rgba(0,0,0,0.05);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    color: var(--color-dark);
    /* Never shrink the count badge */
    flex-shrink: 0;
    white-space: nowrap;
}

.recent-post-item {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    /* Prevent flex children from stretching the row */
    min-width: 0;
    overflow: hidden;
}

.recent-post-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.recent-post-img {
    width: 70px;
    height: 70px;
    border-radius: 4px;
    overflow: hidden;
    margin-right: 15px;
    flex-shrink: 0;
}

.recent-post-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recent-post-info {
    /* CRITICAL: flex child must have min-width:0 to respect parent width */
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.recent-post-info h5 {
    font-family: var(--font-heading);
    font-size: 16px;
    line-height: 1.4;
    margin-bottom: 5px;
    /* Wrap long unbroken strings */
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.recent-post-info h5 a {
    color: var(--color-dark);
    text-decoration: none;
    transition: color 0.3s ease;
    /* Wrap long text within the anchor */
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    display: block;
}

.recent-post-info h5 a:hover {
    color: var(--color-primary);
}

.recent-post-date {
    font-size: 12px;
    color: var(--color-text-muted);
}

/* --- BLOG DETAILS --- */
.blog-details-content {
    background: var(--color-white);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
    /* Prevent long unbreakable strings from stretching the card */
    overflow: hidden;
    max-width: 100%;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.blog-details-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 30px;
}

.blog-details-body {
    font-size: 16px;
    line-height: 1.8;
    color: #444;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
    overflow: hidden;
}

.blog-details-body h1,
.blog-details-body h2,
.blog-details-body h3,
.blog-details-body h4 {
    font-family: var(--font-heading);
    color: var(--color-dark);
    margin: 30px 0 15px;
    font-weight: 600;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.blog-details-body p {
    margin-bottom: 20px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.blog-details-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
}

.blog-details-body ul,
.blog-details-body ol {
    margin-bottom: 20px;
    padding-left: 20px;
}

.blog-details-body li {
    margin-bottom: 10px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* --- PAGINATION STYLES --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 40px 0 0;
    gap: 10px;
}

.pagination .page-item {
    margin: 0;
}

.pagination .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: var(--color-white);
    color: var(--color-dark);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.pagination .page-link:hover,
.pagination .page-item.active .page-link {
    background-color: var(--color-primary);
    color: var(--color-white);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(212, 175, 55, 0.2);
}

.pagination .page-item.disabled .page-link {
    background-color: #f1f1f1;
    color: #aaa;
    pointer-events: none;
    box-shadow: none;
}
