/* ── Gallery wrapper ───────────────────────────────────────────────────────── */
.mg-wrapper {
    width: 100%;
    padding: 0.5rem;
}

/* ── Empty state ────────────────────────────────────────────────────────────── */
.mg-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 3rem 1rem;
    color: var(--dx-color-text-secondary, #6c757d);
    font-size: 0.875rem;
}

/* ── Grid ───────────────────────────────────────────────────────────────────── */
.mg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}

/* ── Tile ───────────────────────────────────────────────────────────────────── */
.mg-tile {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: var(--dx-color-surface-secondary, #f3f4f6);
    border: 1px solid rgba(var(--midgrey), 0.35);
	overflow: hidden;
	box-shadow: 0 0 0px 0px rgba(var(--primary), 0.35);
    transition: border-color 0.15s ease, box-shadow 0.3s ease, transform 0.15s ease;
}

.mg-tile:hover {
    border-color: rgba(var(--primary), 0.5);
    box-shadow: 0 0 0px 2px rgba(var(--primary), 0.35);
    transform: translateY(-2px);
}

.mg-tile:active {
    transform: translateY(0);
}

/* ── Tile image ─────────────────────────────────────────────────────────────── */
.mg-tile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
	
}

/* ── Tile icon (non-image files) ────────────────────────────────────────────── */
.mg-tile-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dx-color-text-secondary, #6c757d);
}

/* ── Tile overlay label ─────────────────────────────────────────────────────── */
.mg-tile-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.55));
    padding: 0.5rem 0.35rem 0.3rem;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.mg-tile:hover .mg-tile-overlay {
    opacity: 1;
}

.mg-tile-date {
    font-size: 0.65rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* ── Skeleton loader ────────────────────────────────────────────────────────── */
.mg-skeleton {
    width: 100%;
    height: 100%;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.mg-skeleton-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.55) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: mg-shimmer 1.4s infinite linear;
}

@keyframes mg-shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}

/* ── Lightbox darkbg ──────────────────────────────────────────────────────────── */
.dxbl-popup:has(.mg-lightbox-body) {
	background: transparent !important;
}
.dxbl-modal-content:has(.mg-lightbox-body) {
	background-color: rgba(0,0,0, 0.75) !important;
	border: 2px solid rgba(var(--lighttext), 0.6);
	color: var(--site-lighttext) !important;
}
.dxbl-modal-content:has(.mg-lightbox-body) svg {
	filter: var(--icon-filter-white);
}
/* ── Lightbox body ──────────────────────────────────────────────────────────── */
.dxbl-modal-content:has(.mg-lightbox-body) .dxbl-modal-header {
	padding: 10px 20px !important;
	background: transparent !important;
}
.dxbl-modal > .dxbl-modal-root > .dxbl-popup > .dxbl-modal-content:has(.mg-lightbox-body) > .dxbl-modal-header .dxbl-popup-header-button:not(.dxbl-disabled):not(:disabled):hover {
	background: var(--site-primary);
}
.mg-lightbox-img-wrapper {
	min-height: 70vh;
}
.mg-lightbox-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    min-height: 320px;
	padding-bottom: 20px !important;
}

/* ── Lightbox image ─────────────────────────────────────────────────────────── */
.mg-lightbox-img-wrapper {
    width: 100%;
    max-height: 70vh;
    display: block;
    /* align-items: center; */
    /* justify-content: center; */
    overflow: hidden;
	background-size: contain !important;
}

.mg-lightbox-img {
    width: 100%;
	/* height: auto; */
	display: block;
	margin: 0px auto;
	max-height: 70vh;
	opacity: 0;
	
    /* object-fit: contain; */
    /* border-radius: 10px; */
}

/* ── Lightbox non-image file ────────────────────────────────────────────────── */
.mg-lightbox-file {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
}

.mg-lightbox-file-icon {
    color: var(--dx-color-text-secondary, #6c757d);
}

.mg-lightbox-file-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.mg-lightbox-filename {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dx-color-text-primary, #212529);
    word-break: break-all;
    text-align: center;
}

.mg-lightbox-date {
    font-size: 0.8rem;
    color: var(--dx-color-text-secondary, #6c757d);
}

.mg-lightbox-download {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
}

/* ── Lightbox navigation ────────────────────────────────────────────────────── */
.mg-lightbox-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
	background-color: rgba(0,0,0,0.5);
	padding: 5px;
	border-radius: 30px;
	border: 1px solid rgba(255,255,255,0.25);
}

.mg-nav-btn {
    background: none;
    border: 1px solid rgba(var(--midgrey), 0.35);
    border-radius: 30px;
    padding: 3px;
    cursor: pointer;
    color: var(--dx-color-text-primary, #212529);
    transition: background 0.15s ease;
    display: flex;
    align-items: center;
}

.mg-nav-btn:hover:not(:disabled) {
    background: rgba(var(--primary), 1);
}
.mg-nav-btn:hover:not(:disabled) svg {
	filter: var(--icon-filter-white);
}

.mg-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.mg-nav-counter {
    font-size: 0.85rem;
    color: var(--dx-color-text-secondary, #6c757d);
    min-width: 48px;
    text-align: center;
}


@media screen and (max-width:550px){
	.mg-lightbox-img {
  width: 100%;
	}
	.dxbl-modal > .dxbl-modal-root > .dxbl-popup:has(.mg-lightbox-body) {
		margin: 20px !important;
	}
}