/* =========================================
   Masonry Gallery Plugin — Frontend Styles
   ========================================= */

/* --- Reset / wrapper --- */
.mgp-gallery-wrap *,
.mgp-gallery-wrap *::before,
.mgp-gallery-wrap *::after {
    box-sizing: border-box;
}

.mgp-gallery-wrap {
    --mgp-accent:    #1a73e8;
    --mgp-overlay:   rgba(0, 0, 0, 0.55);
    --mgp-caption-bg: rgba(0, 0, 0, 0.72);
    --mgp-radius:    6px;
    --mgp-transition: 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    --mgp-lb-bg:     rgba(10, 10, 10, 0.94);
    width: 100%;
    font-family: inherit;
}

.mgp-empty {
    color: #777;
    font-style: italic;
}

/* --- Filter bar --- */
.mgp-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.mgp-filter-btn {
    background: transparent;
    border: 2px solid #ddd;
    border-radius: 999px;
    color: #555;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 6px 18px;
    transition: var(--mgp-transition);
    text-transform: uppercase;
}

.mgp-filter-btn:hover {
    border-color: var(--mgp-accent);
    color: var(--mgp-accent);
}

.mgp-filter-btn.active {
    background: var(--mgp-accent);
    border-color: var(--mgp-accent);
    color: #fff;
}

/* --- Masonry grid --- */
.mgp-masonry {
    column-gap: var(--mgp-gutter, 15px);
    column-count: var(--mgp-columns, 3);
}

@media (max-width: 900px) {
    .mgp-masonry { column-count: 2 !important; }
}

@media (max-width: 540px) {
    .mgp-masonry { column-count: 1 !important; }
}

/* --- Gallery item --- */
.mgp-item {
    break-inside: avoid;
    margin-bottom: var(--mgp-gutter, 15px);
    display: block;
}


.mgp-item.mgp-hidden {
    display: none;
}

.mgp-item-inner {
    position: relative;
    overflow: hidden;
    border-radius: var(--mgp-radius);
    display: block;
    background: #f0f0f0;
    cursor: pointer;
}

/* --- Image --- */
.mgp-img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform var(--mgp-transition);
    opacity: 1;
    border-radius: var(--mgp-radius);
}


/* --- Hover effects --- */
.mgp-hover-zoom:hover .mgp-img {
    transform: scale(1.07);
}

.mgp-hover-fade .mgp-overlay,
.mgp-hover-slide .mgp-caption,
.mgp-hover-zoom .mgp-overlay {
    /* handled per effect below */
}

/* Overlay */
.mgp-overlay {
    position: absolute;
    inset: 0;
    background: var(--mgp-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--mgp-transition);
    border-radius: var(--mgp-radius);
}

.mgp-item-inner:hover .mgp-overlay {
    opacity: 1;
}

.mgp-hover-none .mgp-overlay {
    display: none;
}

.mgp-icon-zoom {
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    transform: scale(0.7);
    transition: transform var(--mgp-transition);
}

.mgp-item-inner:hover .mgp-icon-zoom {
    transform: scale(1);
}

/* Caption */
.mgp-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--mgp-caption-bg);
    color: #fff;
    padding: 10px 14px;
    font-size: 0.82rem;
    line-height: 1.4;
    border-radius: 0 0 var(--mgp-radius) var(--mgp-radius);
    transition: opacity var(--mgp-transition), transform var(--mgp-transition);
}

.mgp-hover-slide .mgp-caption {
    transform: translateY(100%);
    opacity: 0;
}

.mgp-hover-slide:hover .mgp-caption {
    transform: translateY(0);
    opacity: 1;
}

.mgp-hover-fade .mgp-caption,
.mgp-hover-zoom .mgp-caption {
    opacity: 0;
}

.mgp-hover-fade:hover .mgp-caption,
.mgp-hover-zoom:hover .mgp-caption {
    opacity: 1;
}

.mgp-caption p {
    margin: 0;
}

/* --- Item link --- */
.mgp-item-link {
    display: block;
    text-decoration: none;
    position: relative;
}

/* --- Item animations --- */
@keyframes mgp-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes mgp-slide-up {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes mgp-zoom-in {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

.mgp-gallery-wrap[data-animation="fade"] .mgp-item {
    animation: mgp-fade-in 0.5s ease both;
}

.mgp-gallery-wrap[data-animation="slide-up"] .mgp-item {
    animation: mgp-slide-up 0.5s ease both;
}

.mgp-gallery-wrap[data-animation="zoom-in"] .mgp-item {
    animation: mgp-zoom-in 0.5s ease both;
}

/* Staggered delay for first few items */
.mgp-item:nth-child(1)  { animation-delay: 0.04s; }
.mgp-item:nth-child(2)  { animation-delay: 0.08s; }
.mgp-item:nth-child(3)  { animation-delay: 0.12s; }
.mgp-item:nth-child(4)  { animation-delay: 0.16s; }
.mgp-item:nth-child(5)  { animation-delay: 0.20s; }
.mgp-item:nth-child(6)  { animation-delay: 0.24s; }
.mgp-item:nth-child(7)  { animation-delay: 0.28s; }
.mgp-item:nth-child(8)  { animation-delay: 0.32s; }
.mgp-item:nth-child(9)  { animation-delay: 0.36s; }

/* --- Load More --- */
.mgp-load-more-wrap {
    text-align: center;
    margin-top: 24px;
}

.mgp-load-more-btn {
    background: var(--mgp-accent);
    border: none;
    border-radius: 999px;
    color: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 12px 34px;
    transition: background var(--mgp-transition), transform var(--mgp-transition), box-shadow var(--mgp-transition);
    box-shadow: 0 2px 10px rgba(26,115,232,0.25);
}

.mgp-load-more-btn:hover {
    background: #1557b0;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(26,115,232,0.35);
}

.mgp-load-more-btn:active {
    transform: translateY(0);
}

.mgp-load-more-btn:disabled {
    background: #ccc;
    cursor: default;
    box-shadow: none;
    transform: none;
}

.mgp-remaining {
    font-weight: 400;
    opacity: 0.8;
    font-size: 0.82em;
    margin-left: 6px;
}

/* =========================================
   Lightbox
   ========================================= */
.mgp-lightbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 2147483647 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(10, 10, 10, 0.96) !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
    -webkit-tap-highlight-color: transparent;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    box-sizing: border-box !important;
}

.mgp-lightbox.mgp-lb-open {
    opacity: 1;
    pointer-events: auto;
}

.mgp-lb-inner {
    position: relative;
    max-width: 92vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mgp-lb-img-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 82vh;
}

.mgp-lb-img {
    max-width: 92vw;
    max-height: 82vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 60px rgba(0,0,0,0.7);
    display: block;
    transition: opacity 0.22s ease;
}

.mgp-lb-img.mgp-lb-loading {
    opacity: 0.3;
}

.mgp-lb-caption {
    color: rgba(255,255,255,0.85);
    font-size: 0.88rem;
    margin-top: 12px;
    text-align: center;
    max-width: 600px;
    line-height: 1.5;
}

.mgp-lb-close {
    position: fixed;
    top: 18px;
    right: 22px;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    font-size: 1.1rem;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
    line-height: 1;
    padding: 0;
    aspect-ratio: 1;
}

.mgp-lb-close:hover { background: rgba(255,255,255,0.3); }

.mgp-lb-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    font-size: 1.2rem;
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    z-index: 10;
    padding: 0;
    aspect-ratio: 1;
}

.mgp-lb-nav:hover { background: rgba(255,255,255,0.3); }
.mgp-lb-prev { left: 16px; }
.mgp-lb-next { right: 16px; }
.mgp-lb-prev:hover { transform: translateY(-50%) translateX(-2px); }
.mgp-lb-next:hover { transform: translateY(-50%) translateX(2px); }

.mgp-lb-counter {
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.6);
    font-size: 0.82rem;
    letter-spacing: 0.05em;
}

/* Keyboard hint */
.mgp-lb-hint {
    position: fixed;
    bottom: 18px;
    right: 22px;
    color: rgba(255,255,255,0.35);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
}

/* Filter hidden */
.mgp-item.mgp-filter-hidden {
    display: none;
}

/* Focus visible for accessibility */
.mgp-filter-btn:focus-visible,
.mgp-lb-close:focus-visible,
.mgp-lb-nav:focus-visible,
.mgp-item-link:focus-visible {
    outline: 3px solid var(--mgp-accent);
    outline-offset: 2px;
}

/* ── Video canvas (GIF-like display) ── */
.mgp-video-canvas {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--mgp-radius);
}

/* Transparent shield sits above the video — blocks the theme's player
   play-button overlay and control bar from receiving pointer events.
   z-index 100 ensures it sits above any player chrome the theme injects. */
.mgp-video-shield {
    position: absolute;
    inset: 0;
    z-index: 100;
    background: transparent;
    pointer-events: auto;
}




/* Lightbox video — mirrors .mgp-lb-img sizing */
.mgp-lb-video {
    max-width: 92vw;
    max-height: 82vh;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}
