/*
 * BLOCK 50 — Mixed Grid Layout (Grid 1 Base with Dynamic Row Columns)
 */

/* === SPACING & STYLE TOKENS === */
.listing-item-block-50 {
    --b50-card-bg: #ffffff;
    --b50-card-radius: 4px;
    --b50-img-radius: 4px;
    --b50-meta-to-title: 10px;
    --b50-title-to-excerpt: 8px;
    --b50-meta-gap: 6px;
}

/* === MIXED GRID WRAPPERS === */
.listing-block-50 .b50-row {
    display: grid !important;
    gap: 20px !important;
    margin-bottom: 20px;
}

.listing-block-50 .b50-row:last-child {
    margin-bottom: 0;
}

.listing-block-50 .b50-row.columns-1 { grid-template-columns: 1fr !important; }
.listing-block-50 .b50-row.columns-2 { grid-template-columns: repeat(2, 1fr) !important; }
.listing-block-50 .b50-row.columns-3 { grid-template-columns: repeat(3, 1fr) !important; }
.listing-block-50 .b50-row.columns-4 { grid-template-columns: repeat(4, 1fr) !important; }

/* Override Publisher native listing-item grid/float behavior */
.listing-block-50 .b50-row > .listing-item,
.listing-block-50 .b50-row > .listing-item:nth-child(n) {
    width: 100% !important; /* Let CSS Grid control the actual width */
    float: none !important;
    margin: 0 !important;
    clear: none !important;
    display: block !important;
}

/* === CARD INNER === */
.listing-item-block-50 .item-inner {
    background-color: var(--b50-card-bg);
    border-radius: var(--b50-card-radius);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.listing-item-block-50:hover .item-inner {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.06);
}

/* === IMAGE OVERRIDES === */
.listing-item-block-50 .featured {
    margin-bottom: 12px !important;
}

.listing-item-block-50 .img-holder {
    border-radius: var(--b50-img-radius);
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* width/height injected via inline CSS depending on row */
    max-width: 100%;
}

/* === META CONTAINER === */
.listing-item-block-50 .b50-meta-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--b50-meta-gap);
    margin: 0 0 var(--b50-meta-to-title) 0;
    padding: 0;
    font-size: 11px;
    line-height: 1.2;
    color: #888888;
}

/* Category Badge */
.listing-item-block-50 .b50-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;
}

.listing-item-block-50 .b50-term-badge:hover {
    background-color: #3b82f6;
    color: #ffffff;
}

/* Author Link */
.listing-item-block-50 .b50-meta-author a {
    color: #4b5563;
    text-decoration: none;
    font-weight: 500;
}

.listing-item-block-50 .b50-meta-author a:hover {
    color: #3b82f6;
}

/* Separator */
.listing-item-block-50 .b50-meta-sep {
    color: #d1d5db;
    font-size: 10px;
}

/* Date */
.listing-item-block-50 .b50-meta-time {
    color: #9ca3af;
}

/* === POST TITLE === */
.listing-item-block-50 .title {
    margin: 0 0 var(--b50-title-to-excerpt) 0;
    padding: 0;
    line-height: 1.35;
}

.listing-item-block-50 .b50-post-title {
    text-decoration: none;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.25s ease;
}

/* === POST EXCERPT === */
.listing-item-block-50 .b50-post-summary {
    line-height: 1.6;
    margin: 0;
}

.listing-item-block-50 .b50-post-summary p {
    margin: 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* === RESPONSIVE OVERRIDES === */
@media (max-width: 768px) {
    /* Stack grid items on mobile */
    .listing-block-50 .b50-row.columns-2,
    .listing-block-50 .b50-row.columns-3,
    .listing-block-50 .b50-row.columns-4 {
        grid-template-columns: 1fr;
    }
    
    .listing-item-block-50 .img-holder {
        width: 100% !important; /* Full width on mobile regardless of setting */
        height: auto !important;
        aspect-ratio: 16/9; /* Maintain ratio */
    }
}
