/* Mediband_BlogEnhancement — Related Posts sidebar widget
   ----------------------------------------------------------------
   CSS-Grid card layout. Cards auto-fit by column width so the number per
   row adapts naturally: sidebar narrow → 1 per row; iPad/wider sidebar →
   2 per row; very wide → more. Mobile is locked to 2 per row.
*/

.block-mediband-related-posts {
    margin-bottom: 20px;
}

.block-mediband-related-posts .block-title {
    margin: 0 0 16px;
    padding: 0 0 12px;
    border-bottom: 1px solid #ececec;
}

.block-mediband-related-posts .block-title strong {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
    text-transform: none;
    letter-spacing: 0;
}

/* Card grid — auto-fit by column width.
   minmax(140px, 1fr) means: never narrower than 140px; otherwise share the row. */
.block-mediband-related-posts .block-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    align-items: stretch;
}

.block-mediband-related-posts .item {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0;
    border: 0;
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.block-mediband-related-posts .item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(16, 16, 16, 0.08);
}

/* Image container — padding-bottom trick (works on every browser including
   older iPad Safari that doesn't support `aspect-ratio`). 75% = 4:3.
   Square source images are cropped top/bottom to fill the card width. */
.block-mediband-related-posts .post-image {
    position: relative;
    width: 100%;
    padding-bottom: 75%;
    overflow: hidden;
    border-radius: 10px;
    background: #f6f6f6;
}

.block-mediband-related-posts .post-image a {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
}

/* Force img to fill container regardless of intrinsic width/height attrs
   or any vendor stylesheet (max-width:100%, height:auto, etc.). */
.block-mediband-related-posts .post-image img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center center !important;
    display: block !important;
    transition: transform 0.4s ease;
}

.block-mediband-related-posts .item:hover .post-image img {
    transform: scale(1.04);
}

.block-mediband-related-posts .post-item-title {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 600;
    color: #160808;
    text-decoration: none;
    margin: 0 4px 6px;
    transition: color 0.15s ease;
    word-break: break-word;
}

.block-mediband-related-posts .post-item-title:hover,
.block-mediband-related-posts .post-item-title:focus {
    color: #cb6913;
    text-decoration: none;
}

/* iPad / tablet (768–1024px): sidebar widens a bit — let grid auto-fit more cards */
@media (min-width: 768px) and (max-width: 1024px) {
    .block-mediband-related-posts .block-content {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 14px;
    }
    .block-mediband-related-posts .post-item-title {
        font-size: 13.5px;
    }
}

/* Mobile (≤767px): force exactly 2 cards per row (always) */
@media (max-width: 767px) {
    .block-mediband-related-posts .block-title strong {
        font-size: 18px;
    }
    .block-mediband-related-posts .block-content {
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }
    .block-mediband-related-posts .post-item-title {
        font-size: 14px;
        -webkit-line-clamp: 3;
        margin: 0 2px 6px;
    }
}

/* Tiny phones (≤360px): still 2-up but tighter gaps */
@media (max-width: 360px) {
    .block-mediband-related-posts .block-content {
        gap: 10px;
    }
    .block-mediband-related-posts .post-item-title {
        font-size: 13px;
    }
}
