/* =========================================================
   MPU POST GRID – full-width gallery grid
   Modelled after RS Gallery Widget "MPU" layout.
   5 columns · square cells · no gap · first card = 2×2 hero
   ========================================================= */

/* ── Grid container (each batch is its own block) ────────── */
.posts_container.mpu-grid_wrap {
    --mpu-cols: 5;

    /* Full-width breakout regardless of sidebar / content-wrap width */
    width: 100vw;
    margin-left:  calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    max-width: none !important;

    display: grid;
    grid-template-columns: repeat(var(--mpu-cols), minmax(0, 1fr));
    grid-auto-rows: calc(100vw / var(--mpu-cols));
    gap: 0;
    grid-auto-flow: row dense;
    align-items: stretch;
}

/* ── Hero: first item of each batch spans 2 columns × 2 rows ─ */
.mpu_grid_item.mpu_grid_first {
    grid-column: span 2;
    grid-row: span 2;
}

/* ── Grid item wrapper ───────────────────────────────────── */
.mpu_grid_item {
    position: relative;
    min-height: 0;
    overflow: hidden;
}

/* Strip all default theme chrome from the article */
.mpu_grid_item .post_item {
    height: 100%;
    margin:     0 !important;
    padding:    0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border:     none !important;
}

/* ── Card (anchor or div) ────────────────────────────────── */
.mpu-grid-card {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    text-decoration: none !important;
    background: #111;
    color: inherit;
}

/* ── Featured image fills the cell ──────────────────────── */
.mpu-grid-card__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.mpu-grid-card__image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover !important;
    transition: transform 0.55s ease;
}

.mpu-grid-card:hover .mpu-grid-card__image img {
    transform: scale(1.06);
}

/* ── Bottom gradient overlay ─────────────────────────────── */
.mpu-grid-card__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.75) 0%,
        rgba(0, 0, 0, 0.25) 40%,
        transparent 100%
    );
    z-index: 1;
    pointer-events: none;
}

/* ── Title (bottom-left, small-caps, uppercase) ──────────── */
.mpu-grid-card__content {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: 10px 12px;
}

.mpu-grid-card__title {
    margin: 0;
    padding: 0;
    font-size: 11px;
    line-height: 1.3;
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.6);
}

.mpu_grid_first .mpu-grid-card__title {
    font-size: 15px;
    letter-spacing: 0.03em;
}

/* ── Sidebar removal & full-width content area ───────────── */
body.has-mpu-post-grid {
    overflow-x: hidden;
}

body.has-mpu-post-grid .sidebar {
    display: none !important;
}

body.has-mpu-post-grid .content_wrap,
body.has-mpu-post-grid .content {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* ── Loading spinner between grid blocks ─────────────────── */
.mpu-post-grid-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 48px 0;
    width: 100%;
}

.mpu-post-grid-loader span {
    display: inline-block;
    width: 34px;
    height: 34px;
    border: 3px solid rgba(0, 0, 0, 0.15);
    border-top-color: #555;
    border-radius: 50%;
    animation: mpu-spin 0.75s linear infinite;
}

@keyframes mpu-spin {
    to { transform: rotate(360deg); }
}
