.mg-empty {
    text-align: center;
    color: var(--assoc-text-muted, #6e7573);
    padding: 20px 0;
}

/* ---------------- Wall style (grid + lightbox) ---------------- */
.mg-wall {
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(4, 1fr);
}
.mg-wall.mg-columns-2 { grid-template-columns: repeat(2, 1fr); }
.mg-wall.mg-columns-3 { grid-template-columns: repeat(3, 1fr); }
.mg-wall.mg-columns-4 { grid-template-columns: repeat(4, 1fr); }
.mg-wall.mg-columns-5 { grid-template-columns: repeat(5, 1fr); }
.mg-wall.mg-columns-6 { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 700px) {
    .mg-wall { grid-template-columns: repeat(2, 1fr) !important; }
}

.mg-item {
    position: relative;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    aspect-ratio: 1/1;
    overflow: hidden;
    border-radius: 2px;
}
.mg-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease, opacity 0.15s ease;
}
.mg-item:hover img { transform: scale(1.04); opacity: 0.92; }

/* ---------------- Cards style (titled, optionally carousel/linked) ---------------- */
.mg-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(4, 1fr);
}
.mg-grid.mg-columns-1 { grid-template-columns: 1fr; }
.mg-grid.mg-columns-2 { grid-template-columns: repeat(2, 1fr); }
.mg-grid.mg-columns-3 { grid-template-columns: repeat(3, 1fr); }
.mg-grid.mg-columns-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
    .mg-grid:not(.mg-columns-1) { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 560px) {
    .mg-grid { grid-template-columns: 1fr !important; }
}

.mg-card {
    background: none;
    display: flex;
    flex-direction: column;
}
.mg-card-link {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    text-decoration: none;
    color: inherit;
}
.mg-card-image {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 4px;
    background: var(--assoc-primary, #008751);
    margin-bottom: 12px;
}
.mg-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}
.mg-card:hover .mg-card-image img { transform: scale(1.03); }
.mg-card-body { display: flex; flex-direction: column; flex-grow: 1; }
.mg-card-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--assoc-text, #1c1c1a);
    transition: color 0.15s ease;
}
.mg-card:hover .mg-card-title { color: var(--assoc-primary, #008751); }

/* ---------------- Carousel (horizontal scroll-snap) ---------------- */
.mg-carousel { position: relative; }
.mg-carousel-track {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 4px 4px 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.mg-carousel-track::-webkit-scrollbar { display: none; }
.mg-carousel-item { flex: 0 0 auto; width: 260px; scroll-snap-align: start; }

.mg-carousel-arrow {
    position: absolute;
    top: 40%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: #ffffff;
    color: var(--assoc-primary, #008751);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.mg-carousel-arrow:hover { background: var(--assoc-primary, #008751); color: #fff; }
.mg-carousel-prev { left: -6px; }
.mg-carousel-next { right: -6px; }

@media (max-width: 600px) {
    .mg-carousel-item { width: 220px; }
    .mg-carousel-arrow { width: 32px; height: 32px; font-size: 1.1rem; }
}

/* ---------------- Lightbox (created dynamically by JS) ---------------- */
.mg-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(20,20,18,0.95);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 9999;
    padding: 24px;
}
.mg-lightbox.is-open { display: flex; }
.mg-lightbox img { max-width: 90vw; max-height: 80vh; object-fit: contain; border-radius: 2px; }
.mg-lightbox-caption { color: rgba(255,255,255,0.75); margin-top: 16px; font-size: 0.9rem; letter-spacing: 0.01em; }
.mg-lightbox-close {
    position: absolute;
    top: 24px;
    right: 28px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s ease;
}
.mg-lightbox-close:hover { color: #ffffff; }

.mg-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.08);
    border: none;
    color: rgba(255,255,255,0.85);
    font-size: 2.4rem;
    line-height: 1;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}
.mg-lightbox-nav:hover { background: rgba(255,255,255,0.18); color: #fff; }
.mg-lightbox-prev { left: 20px; }
.mg-lightbox-next { right: 20px; }

@media (max-width: 600px) {
    .mg-lightbox-nav { width: 42px; height: 42px; font-size: 2rem; }
    .mg-lightbox-prev { left: 8px; }
    .mg-lightbox-next { right: 8px; }
}
