/* =============================================
   LANNKIN Gallery — Frontend Styles v1.2.0
   Uses scoped CSS variables injected per gallery
   ============================================= */

.mpg-gallery-wrapper {
    --mpg-primary:        #2c449c;
    --mpg-accent:         #ffcd57;
    --mpg-btn-text:       #ffffff;
    --mpg-btn-radius:     30px;
    --mpg-filter-justify: center;
    --mpg-arrow-radius:   50%;
    --mpg-lightbox-bg:    rgba(0, 0, 0, 0.90);
    width: 100%;
    position: relative;
    margin: 0 auto;
}

.mpg-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    justify-content: var(--mpg-filter-justify);
}

.mpg-filter-btn {
    padding: 9px 22px;
    border: 2px solid #ddd;
    border-radius: var(--mpg-btn-radius);
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    transition: all 0.25s ease;
    line-height: 1.2;
}

.mpg-filter-btn:hover {
    border-color: var(--mpg-primary);
    color: var(--mpg-primary);
    background: rgba(0,0,0,0.02);
}

.mpg-filter-btn.active {
    background: var(--mpg-primary);
    border-color: var(--mpg-primary);
    color: var(--mpg-btn-text);
}

.mpg-item { transition: opacity 0.3s ease, transform 0.3s ease; }
.mpg-item.mpg-hidden { display: none; }

.mpg-grid {
    display: grid;
    gap: var(--mpg-gap, 10px);
    grid-template-columns: repeat(var(--mpg-columns, 3), 1fr);
}

.mpg-img-wrap { overflow: hidden; position: relative; display: block; background: #eee; }
.mpg-img-wrap a { display: block; }
.mpg-img-wrap img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease, opacity 0.4s ease; }

.mpg-hover-zoom .mpg-img-wrap:hover img { transform: scale(1.08); }
.mpg-hover-fade .mpg-img-wrap:hover img { opacity: 0.75; }
.mpg-hover-none .mpg-img-wrap img { transition: none; }

.mpg-caption {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,0.55); color: #fff; padding: 8px 12px;
    font-size: 13px; line-height: 1.4;
}

.mpg-carousel-outer { position: relative; overflow: hidden; }
.mpg-carousel-track-wrap { overflow: hidden; }
.mpg-carousel-track { display: flex; transition: transform 0.4s ease; will-change: transform; }
.mpg-carousel-slide { flex: 0 0 auto; box-sizing: border-box; padding: 0 calc(var(--mpg-gap, 10px) / 2); }
.mpg-carousel-slide:first-child { padding-left: 0; }
.mpg-carousel-slide:last-child  { padding-right: 0; }

.mpg-carousel-prev,
.mpg-carousel-next {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 10;
    background: rgba(0,0,0,0.55); color: #fff; border: none;
    width: 42px; height: 42px;
    border-radius: var(--mpg-arrow-radius);
    font-size: 30px; line-height: 40px; text-align: center;
    cursor: pointer; padding: 0; transition: background 0.2s, color 0.2s;
}
.mpg-carousel-prev { left: 8px; }
.mpg-carousel-next { right: 8px; }
.mpg-carousel-prev:hover,
.mpg-carousel-next:hover { background: var(--mpg-primary); color: var(--mpg-btn-text); }
.mpg-carousel-prev:disabled,
.mpg-carousel-next:disabled { opacity: 0.35; cursor: default; }

.mpg-carousel-dots { display: flex; justify-content: center; gap: 7px; margin-top: 14px; }
.mpg-carousel-dot {
    width: 9px; height: 9px; border-radius: 50%; background: #ccc;
    border: none; cursor: pointer; padding: 0; transition: background 0.2s, transform 0.2s;
}
.mpg-carousel-dot.active { background: var(--mpg-primary); transform: scale(1.35); }

.mpg-lightbox-overlay {
    position: fixed; inset: 0;
    background: var(--mpg-lightbox-bg, rgba(0,0,0,0.9));
    z-index: 99999; display: flex; align-items: center; justify-content: center;
    opacity: 0; animation: mpgFadeIn 0.25s ease forwards;
}
@keyframes mpgFadeIn { to { opacity: 1; } }

.mpg-lightbox-inner {
    position: relative; max-width: 90vw; max-height: 90vh;
    display: flex; flex-direction: column; align-items: center;
}
.mpg-lightbox-inner img { max-width: 90vw; max-height: 80vh; object-fit: contain; border-radius: 4px; display: block; }
.mpg-lightbox-caption { color: rgba(255,255,255,0.85); font-size: 14px; margin-top: 10px; text-align: center; }
.mpg-lightbox-counter { position: absolute; top: -36px; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,0.6); font-size: 13px; white-space: nowrap; }

.mpg-lightbox-close {
    position: fixed; top: 18px; right: 22px; background: none; border: none;
    color: #fff; font-size: 38px; cursor: pointer; line-height: 1; opacity: 0.75;
    transition: opacity 0.2s; padding: 0;
}
.mpg-lightbox-close:hover { opacity: 1; }

.mpg-lightbox-prev,
.mpg-lightbox-next {
    position: fixed; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.1); border: none; color: #fff;
    font-size: 44px; cursor: pointer; padding: 10px 18px;
    border-radius: 4px; transition: background 0.2s; line-height: 1;
}
.mpg-lightbox-prev { left: 12px; }
.mpg-lightbox-next { right: 12px; }
.mpg-lightbox-prev:hover,
.mpg-lightbox-next:hover { background: rgba(255,255,255,0.22); }

@media (max-width: 768px) {
    .mpg-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .mpg-filter-btn { padding: 7px 16px; font-size: 13px; }
    .mpg-lightbox-prev, .mpg-lightbox-next { font-size: 28px; padding: 8px 12px; }
}
@media (max-width: 480px) {
    .mpg-grid { grid-template-columns: repeat(1, 1fr) !important; }
    .mpg-carousel-prev, .mpg-carousel-next { width: 34px; height: 34px; font-size: 22px; line-height: 32px; }
    .mpg-filter-bar { gap: 6px; }
}

/* ── Video — Grid play overlay ───────────────── */
.mpg-video-grid-btn {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    overflow: hidden;
}

.mpg-video-grid-btn img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease, filter 0.3s ease;
}

.mpg-video-grid-btn:hover img {
    transform: scale(1.05);
    filter: brightness(0.75);
}

.mpg-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.25s;
}

.mpg-play-overlay:hover,
.mpg-video-grid-btn:hover .mpg-play-overlay {
    background: rgba(0,0,0,0.25);
}

.mpg-play-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    padding-left: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.35);
    transition: transform 0.2s, background 0.2s;
}

.mpg-video-grid-btn:hover .mpg-play-icon {
    transform: scale(1.12);
    background: #fff;
}

/* ── Video — Carousel inline ────────────────── */
.mpg-video-inline-wrap {
    width: 100%;
    position: relative;
}

.mpg-video-inline {
    display: block;
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: inherit;
    background: #000;
}

.mpg-video-embed-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    overflow: hidden;
    cursor: pointer;
}

.mpg-video-embed-wrap img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.3s;
}

.mpg-video-embed-wrap:hover img {
    filter: brightness(0.75);
}

.mpg-play-inline {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
}

.mpg-play-inline span {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    padding-left: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    transition: transform 0.2s, background 0.2s;
}

.mpg-play-inline:hover span {
    transform: scale(1.12);
    background: #fff;
}

.mpg-embed-iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ── Lightbox — Video player ────────────────── */
.mpg-lightbox-media-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 80vh;
}

.mpg-lightbox-media-wrap img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}

.mpg-lightbox-video {
    max-width: 90vw;
    max-height: 78vh;
    width: 900px;
    border-radius: 6px;
    background: #000;
    display: block;
    outline: none;
}

.mpg-lightbox-iframe {
    width: min(900px, 90vw);
    height: min(506px, 50vh);
    border: none;
    border-radius: 6px;
    display: block;
}

/* ── Admin — video badge on thumbnail ─────────── */
