/*
 * BLOCK 48 — Grid Listing Layout (CSS Grid Native)
 */

/* === GRID CONTAINER === */
.b48-wrapper {
    display: grid !important;
    grid-template-columns: repeat(var(--b48-cols, 2), 1fr);
    gap: var(--b48-gap);
    align-content: start;
    align-items: start;
    margin-left: 0 !important;
    margin-right: 0 !important;
}
.b48-wrapper::before, .b48-wrapper::after {
    display: none !important;
}

/* === CARD INNER === */
.b48-wrapper .b48-grid-item {
    margin-bottom: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    border-bottom: none !important;
    width: 100% !important;
    clear: none !important;
}

/* Tắt đường kẻ hàng khi setting OFF */
.b48-wrapper.b48-sep-row-off .b48-grid-item {
    border-bottom: none !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

/* Tắt đường kẻ cột khi setting OFF */
.b48-wrapper.b48-sep-col-off .b48-grid-item::before {
    display: none !important;
    content: none !important;
}
.b48-wrapper .b48-grid-item .item-inner {
    background-color: var(--b48-card-bg, #ffffff);
    border-radius: var(--b48-card-radius, 0);
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Image */
.b48-wrapper .b48-grid-item .featured {
    margin-bottom: 12px;
    width: 100%;
    position: relative;
    display: block;
}

.b48-wrapper .b48-grid-item .img-holder {
    display: block;
    width: 100%;
    border-radius: var(--b48-img-radius, 4px);
    overflow: hidden;
    aspect-ratio: 16/9;
    background-size: cover;
    background-position: center;
}

/* === Nuke wpautop in excerpt === */
.b48-wrapper .b48-post-summary > p, 
.b48-wrapper .b48-post-summary > br {
    display: none !important;
    margin: 0 !important;
    height: 0 !important;
}
.b48-wrapper .b48-post-summary p:first-of-type {
    display: -webkit-box !important;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: auto !important;
    margin: 0 !important;
}

/* === META CONTAINER === */
.b48-wrapper .b48-meta-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 10px 0;
    padding: 0;
    font-size: 11px;
    line-height: 1.2;
    color: #888888;
}

/* Badge */
.b48-wrapper .b48-term-badge {
    display: inline-flex;
    align-items: center;
    background-color: #f3f4f6;
    color: #4b5563;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 3px;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.b48-wrapper .b48-term-badge:hover {
    background-color: #3b82f6;
    color: #ffffff;
}

/* Author Link */
.b48-wrapper .b48-meta-author a {
    color: #4b5563;
    text-decoration: none;
    font-weight: 500;
}
.b48-wrapper .b48-meta-author a:hover {
    color: #3b82f6;
}

/* Separator */
.b48-wrapper .b48-meta-sep {
    color: #d1d5db;
    font-size: 10px;
}

/* Date */
.b48-wrapper .b48-meta-time {
    color: #9ca3af;
}

/* === POST TITLE === */
.b48-wrapper .title {
    margin: 0 0 8px 0 !important;
    padding: 0;
    line-height: 1.4;
}

.b48-wrapper .b48-post-title {
    text-decoration: none;
    line-height: 1.4;
    transition: color 0.2s ease;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === POST EXCERPT === */
.b48-wrapper .b48-post-summary {
    line-height: 1.6;
    margin: 0;
    padding: 0;
    flex: 1; /* Pushes excerpt to bottom if needed, or allows content to flow */
}

/* === RESPONSIVE === */
/* Tablet */
@media (max-width: 991px) {
    .b48-wrapper {
        grid-template-columns: repeat(var(--b48-cols-tablet, 2), 1fr);
    }
}

/* Mobile */
@media (max-width: 767px) {
    .b48-wrapper {
        grid-template-columns: repeat(var(--b48-cols-mobile, 1), 1fr);
    }
}
