/* ========================================================================
   VOVO MODERN GALLERY v2.7.2 – Frontend Styles
   Key fix: Images are visible by default. Lazy loading is a progressive
   enhancement (fade-in), NOT a hard requirement. Gallery works even if
   JavaScript fails entirely.

   Masonry v1.4.6: CSS column-count is the FALLBACK (visible if JS fails).
   When JS runs, it adds .mg-masonry-balanced and creates flex-row with
   block-level column containers for balanced heights.

   v2.7.1: Added "3D Flip Book" layout — realistic 3D flip book powered
   by StPageFlip library. Gallery images become book pages with page-curl
   animation, configurable spread/single mode, cover page, and bottom
   toolbar (prev/next, autoplay, zoom, fullscreen, page counter).
   Two visual styles: "realistic" (spine shadow, page depth) and
   "minimal" (clean flat).

   v2.5.1: Fixed Split Carousel layout — group height now explicitly set by JS
   to prevent images from overflowing. Fixed Showcase arrows — added
   position:absolute so arrows overlay the carousel instead of taking flow space.
   Side carousel items use aspect-ratio:auto (JS controls height).

   v2.5.0: Added "Split Carousel" layout — hero image on left (60%) with
   vertical carousel on right (40%). Configurable 2/3/4 visible side images.
   Up/down navigation arrows, responsive stacking on mobile.

   v2.4.0: Added "Showcase" layout (hero image + carousel for remaining).
   Added spotlight_side_stack control for 2 or 3 images on right side.
   Showcase carousel with prev/next navigation and touch support.

   v2.3.3: Fixed unwanted image zoom on hover — the "zoom" hover effect
   now shows only the overlay (with zoom icon) without scaling the image,
   matching the pre-v2.3.2 behavior. Changed hover CSS selectors from
   .mg-image:hover to wrapper:hover for consistency with pointer-events:none
   on overlay.

   v2.3.2: Fixed dropdown menu z-index conflict — gallery hover effects
   no longer interfere with header navigation dropdowns that overlap
   gallery images. Added pointer-events:none to overlay, z-index on
   wrapper, and JS-based hover suppression for overlapping elements.

   v2.3.1: Added responsive image height controls for tablet/mobile,
   TRUE image-level lazy loading (data-src, images only download when
   gallery scrolls into view), gallery-level lazy initialization styles.

   v2.3.0: Fixed watermark font-size/color with !important inline
   styles, full watermark typography via data attributes,
   small_image_height_mode (ratio vs height_only),
   simplified image dimension controls (height only).
   ======================================================================== */
:root {
    --mg-primary: #0073aa;
    --mg-primary-hover: #005a87;
    --mg-text: #333333;
    --mg-text-light: #666666;
    --mg-white: #ffffff;
    --mg-overlay: rgba(0,0,0,0.5);
    --mg-border-radius: 0px;
    --mg-speed: 0.35s;
    --mg-ease: cubic-bezier(0.25,0.46,0.45,0.94);
    --mg-shadow: 0 4px 15px rgba(0,0,0,0.1);
    --mg-shadow-hover: 0 8px 30px rgba(0,0,0,0.2);
}

/* ── WRAPPER ──────────────────────────────────────────────────────── */
.mg-gallery-wrapper { position: relative; z-index: 1; width: 100%; max-width: 100%; box-sizing: border-box; overflow-x: hidden; }
*, *::before, *::after { box-sizing: border-box; }

/* ── FILTER BAR ──────────────────────────────────────────────────── */
.mg-filter-bar { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin-bottom: 25px; }
.mg-filter-btn { background: none !important; border: none !important; cursor: pointer !important; font-size: 14px !important; font-weight: 500; padding: 8px 18px; color: var(--mg-text-light); transition: all var(--mg-speed) var(--mg-ease); position: relative; outline: none; white-space: nowrap; }
.mg-filter-btn:hover, .mg-filter-btn.active { color: var(--mg-primary); }
.mg-filter-tabs .mg-filter-btn { border-bottom: 2px solid transparent !important; padding-bottom: 6px; }
.mg-filter-tabs .mg-filter-btn:hover, .mg-filter-tabs .mg-filter-btn.active { border-bottom-color: var(--mg-primary) !important; }
.mg-filter-pills .mg-filter-btn { background-color: #f0f0f0 !important; border-radius: 50px !important; padding: 6px 20px; font-size: 13px !important; }
.mg-filter-pills .mg-filter-btn:hover { background-color: #e0e0e0 !important; }
.mg-filter-pills .mg-filter-btn.active { background-color: var(--mg-primary) !important; color: var(--mg-white) !important; }
.mg-filter-minimal .mg-filter-btn { font-size: 13px !important; text-transform: uppercase; letter-spacing: 1px; padding: 6px 14px; }
.mg-filter-minimal .mg-filter-btn::after { content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%) scaleX(0); width: 100%; height: 1px; background: var(--mg-primary); transition: transform var(--mg-speed) var(--mg-ease); }
.mg-filter-minimal .mg-filter-btn:hover::after, .mg-filter-minimal .mg-filter-btn.active::after { transform: translateX(-50%) scaleX(1); }

/* ── GALLERY CONTAINER ────────────────────────────────────────────── */
.mg-gallery { position: relative; box-sizing: border-box; }

/* Grid Layout */
.mg-layout-grid { display: grid; gap: var(--mg-gap, 10px); grid-template-columns: repeat(var(--mg-columns, 3), 1fr); }

/* Masonry Layout — CSS column-count as FALLBACK (works without JS)
   When JS runs, it adds .mg-masonry-balanced and creates a flex-row
   with block-level column containers for balanced column heights.
   If JS fails, CSS column-count still renders items correctly.
   Images show at NATURAL height (height: auto, no object-fit: cover). */
.mg-layout-masonry {
    column-count: var(--mg-columns, 3);
    column-gap: var(--mg-gap, 10px);
}
.mg-layout-masonry .mg-gallery-item {
    break-inside: avoid;
    margin-bottom: var(--mg-gap, 10px);
    display: inline-block;
    width: 100%;
}
.mg-layout-masonry .mg-image-wrapper {
    overflow: hidden;
}
.mg-layout-masonry .mg-image-wrapper img.mg-image {
    width: 100%;
    height: auto;
    display: block;
}

/* Masonry balanced mode — JS-driven flex row with block-level columns
   Gallery becomes flex-row. Each .mg-masonry-column is a block container
   that items stack in naturally. margin-bottom on items = vertical gap.
   Gallery gap = horizontal gap between columns. */
.mg-layout-masonry.mg-masonry-balanced {
    display: flex;
    column-count: auto;
    column-gap: normal;
}
.mg-layout-masonry.mg-masonry-balanced .mg-gallery-item {
    margin-bottom: 0; /* JS sets margin-bottom per item via inline style */
    break-inside: auto;
    display: block;
    width: 100%;
}

/* Column container: simple block div that takes equal flex space.
   Items inside stack naturally as block elements — no flex-column needed. */
.mg-masonry-column {
    flex: 1 1 0%;
    min-width: 0;
}
.mg-masonry-column .mg-gallery-item {
    width: 100%;
    break-inside: avoid;
}

/* CRITICAL: Masonry images must show at NATURAL aspect ratio.
   This overrides the default height:100% + object-fit:cover which
   is for grid layout and makes images look uniform (grid-like). */
.mg-masonry-column .mg-image-wrapper {
    overflow: hidden;
}
.mg-masonry-column .mg-image-wrapper img.mg-image {
    width: 100% !important;
    height: auto !important;
    display: block !important;
    object-fit: unset !important;
}

/* Justified Layout - no CSS gap, JS handles spacing via margins */
.mg-layout-justified { display: flex; flex-wrap: wrap; gap: 0 !important; }
.mg-layout-justified .mg-gallery-item { flex-shrink: 0; box-sizing: border-box; }

/* ── FEATURED LAYOUT ─────────────────────────────────────────────── */
.mg-layout-featured {
    display: grid;
    grid-template-columns: repeat(var(--mg-columns, 3), 1fr);
    gap: var(--mg-gap, 10px);
}
.mg-layout-featured .mg-gallery-item {
    overflow: hidden;
}
.mg-layout-featured .mg-image-wrapper {
    aspect-ratio: var(--mg-ratio, 1/1);
    overflow: hidden;
}
.mg-layout-featured .mg-image-wrapper img.mg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Featured balanced mode — JS-driven rows */
.mg-layout-featured.mg-hero-balanced {
    display: flex;
    flex-direction: column;
    gap: var(--mg-gap, 10px);
}
.mg-hero-row {
    display: flex;
    gap: var(--mg-gap, 10px);
}
.mg-hero-row .mg-gallery-item {
    flex: 1 1 0%;
    min-width: 0;
}
.mg-hero-row .mg-image-wrapper {
    aspect-ratio: var(--mg-ratio, 1/1);
    overflow: hidden;
}
.mg-hero-row .mg-image-wrapper img.mg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* Hero item spans full width */
.mg-hero-row-hero .mg-gallery-item {
    flex: 1 1 100%;
}
.mg-hero-row-hero .mg-image-wrapper {
    aspect-ratio: 16/9;
}
/* Equal row (2 items side by side) */
.mg-hero-row-equal .mg-gallery-item {
    flex: 1 1 0%;
}
.mg-hero-row-equal .mg-image-wrapper {
    aspect-ratio: 4/3;
}

/* ── SPOTLIGHT LAYOUT ────────────────────────────────────────────── */
.mg-layout-spotlight {
    display: grid;
    grid-template-columns: repeat(var(--mg-columns, 3), 1fr);
    gap: var(--mg-gap, 10px);
}
.mg-layout-spotlight .mg-gallery-item {
    overflow: hidden;
}
.mg-layout-spotlight .mg-image-wrapper {
    aspect-ratio: var(--mg-ratio, 1/1);
    overflow: hidden;
}
.mg-layout-spotlight .mg-image-wrapper img.mg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Spotlight balanced mode — JS-driven layout */
.mg-layout-spotlight.mg-hero-balanced {
    display: flex;
    flex-direction: column;
    gap: var(--mg-gap, 10px);
}
.mg-spotlight-hero-group {
    display: flex;
    gap: var(--mg-gap, 10px);
}
.mg-spotlight-hero-group .mg-spotlight-item-hero {
    flex: 2;
    min-width: 0;
}
.mg-spotlight-hero-group .mg-spotlight-item-hero .mg-gallery-item {
    width: 100%;
    height: 100%;
}
.mg-spotlight-hero-group .mg-spotlight-item-hero .mg-image-wrapper {
    height: 100%;
    aspect-ratio: auto;
    overflow: hidden;
}
.mg-spotlight-hero-group .mg-spotlight-item-hero .mg-image-wrapper img.mg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.mg-spotlight-side-stack {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--mg-gap, 10px);
    min-width: 0;
}
.mg-spotlight-side-stack .mg-gallery-item {
    flex: 1;
    min-height: 0;
    min-width: 0;
    width: 100%;
}
.mg-spotlight-side-stack .mg-gallery-item .mg-image-wrapper {
    height: 100%;
    aspect-ratio: auto;
    overflow: hidden;
}
.mg-spotlight-side-stack .mg-gallery-item .mg-image-wrapper img.mg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── SHOWCASE LAYOUT ────────────────────────────────────────────── */
/* v2.4.0: Hero image on top, remaining images in a horizontal carousel below.
   Falls back to grid if JS doesn't run. When JS runs, it adds
   .mg-hero-balanced and creates the hero row + carousel track. */
.mg-layout-showcase {
    display: grid;
    grid-template-columns: repeat(var(--mg-columns, 3), 1fr);
    gap: var(--mg-gap, 10px);
}
.mg-layout-showcase .mg-gallery-item {
    overflow: hidden;
}
.mg-layout-showcase .mg-image-wrapper {
    aspect-ratio: var(--mg-ratio, 1/1);
    overflow: hidden;
}
.mg-layout-showcase .mg-image-wrapper img.mg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Showcase balanced mode — JS-driven layout */
.mg-layout-showcase.mg-hero-balanced {
    display: flex;
    flex-direction: column;
    gap: var(--mg-gap, 10px);
}

/* Showcase carousel track — contains the horizontal scrollable row */
.mg-showcase-carousel-track {
    position: relative;
    overflow: hidden;
    width: 100%;
}
.mg-showcase-carousel-inner {
    display: flex;
    flex-wrap: nowrap;
    will-change: transform;
}
.mg-showcase-carousel-inner .mg-gallery-item {
    flex-shrink: 0;
    overflow: hidden;
}
.mg-showcase-carousel-inner .mg-gallery-item .mg-image-wrapper {
    aspect-ratio: var(--mg-ratio, 1/1);
    overflow: hidden;
}
.mg-showcase-carousel-inner .mg-gallery-item .mg-image-wrapper img.mg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Showcase carousel navigation arrows */
.mg-showcase-carousel-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
}
.mg-showcase-prev,
.mg-showcase-next {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    border-radius: 50% !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease;
    color: #ffffff !important;
    background-color: rgba(0,0,0,0.5) !important;
    font-size: 0 !important;
    line-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    text-decoration: none !important;
    outline: none !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
    z-index: 5 !important;
}
.mg-showcase-prev { left: 10px !important; }
.mg-showcase-next { right: 10px !important; }
.mg-showcase-prev svg,
.mg-showcase-next svg {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
    pointer-events: none !important;
}
.mg-showcase-prev:hover,
.mg-showcase-next:hover {
    background-color: rgba(0,0,0,0.75) !important;
    transform: translateY(-50%) scale(1.1) !important;
}
.mg-showcase-prev.mg-arrow-disabled,
.mg-showcase-next.mg-arrow-disabled {
    opacity: 0.3;
    cursor: default !important;
    pointer-events: none !important;
}

/* ── SPLIT CAROUSEL LAYOUT ────────────────────────────────────────── */
/* v2.5.1: Fixed — hero image on left (~60%), vertical carousel on right (~40%).
   The group has an explicit height set by JS (based on hero-image-height
   setting or auto-computed from container width). Without this, flex items
   would stretch to the natural image height causing massive overflows. */
.mg-split-carousel-group {
    display: flex;
    gap: var(--mg-gap, 10px);
    width: 100%;
    align-items: stretch;
    /* height is set by JS via inline style — never rely on auto here */
}
.mg-split-carousel-hero {
    flex: 0 0 60%;
    max-width: 60%;
    overflow: hidden;
    border-radius: var(--mg-border-radius, 0px);
    position: relative;
}
.mg-split-carousel-hero .mg-gallery-item {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}
.mg-split-carousel-hero .mg-image-wrapper {
    width: 100%;
    height: 100%;
    aspect-ratio: auto !important;
}
.mg-split-carousel-hero .mg-image-wrapper img.mg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.mg-split-carousel-side {
    flex: 0 0 calc(40% - var(--mg-gap, 10px));
    max-width: calc(40% - var(--mg-gap, 10px));
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.mg-split-carousel-inner {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    will-change: transform;
}
.mg-split-carousel-inner .mg-gallery-item {
    flex-shrink: 0;
    overflow: hidden;
}
.mg-split-carousel-inner .mg-gallery-item .mg-image-wrapper {
    width: 100%;
    /* aspect-ratio is NOT used — JS sets explicit height via inline style */
    aspect-ratio: auto !important;
    overflow: hidden;
}
.mg-split-carousel-inner .mg-gallery-item .mg-image-wrapper img.mg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Split Carousel vertical navigation arrows (up/down) */
.mg-split-carousel-prev,
.mg-split-carousel-next {
    position: absolute !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    border-radius: 50% !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 5 !important;
    transition: all 0.2s ease;
    color: #ffffff !important;
    background-color: rgba(0,0,0,0.5) !important;
    font-size: 0 !important;
    line-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    text-decoration: none !important;
    outline: none !important;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2) !important;
}
.mg-split-carousel-prev { top: 5px !important; }
.mg-split-carousel-next { bottom: 5px !important; }
.mg-split-carousel-prev svg,
.mg-split-carousel-next svg {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
    pointer-events: none !important;
}
.mg-split-carousel-prev:hover,
.mg-split-carousel-next:hover {
    background-color: rgba(0,0,0,0.75) !important;
    transform: translateX(-50%) scale(1.1) !important;
}
.mg-split-carousel-prev.mg-arrow-disabled,
.mg-split-carousel-next.mg-arrow-disabled {
    opacity: 0.3;
    cursor: default !important;
    pointer-events: none !important;
}

/* ── 3D FLIP BOOK LAYOUT ──────────────────────────────────────────── */
/* v2.7.1: Realistic 3D flip book powered by StPageFlip library.
   Images become pages in a book that users can flip with mouse/touch.
   Toolbar at the bottom provides navigation, autoplay, zoom, and
   fullscreen controls. Two visual styles: "realistic" (spine shadow,
   page depth) and "minimal" (clean, flat). */

/* Flip Book container — wraps the book + toolbar */
.mg-flipbook-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 20px 0;
}

/* The book element itself (StPageFlip target) */
.mg-flipbook-book {
    position: relative;
    display: block;
    margin: 0 auto;
    /* StPageFlip sets dimensions via JS — these are fallbacks */
    max-width: 100%;
}

/* Realistic style: add spine shadow, page depth, and book elevation */
.mg-flipbook-style-realistic .mg-flipbook-book {
    filter: drop-shadow(0 8px 30px rgba(0,0,0,0.25));
}
/* Realistic closed state: thicker shadow for closed book feel */
.mg-flipbook-style-realistic.mg-flipbook-state-closed .mg-flipbook-book {
    filter: drop-shadow(0 10px 35px rgba(0,0,0,0.35)) drop-shadow(0 2px 8px rgba(0,0,0,0.2));
}
/* Realistic open state: spread shadow with spine line */
.mg-flipbook-style-realistic.mg-flipbook-state-open .mg-flipbook-book {
    filter: drop-shadow(0 8px 30px rgba(0,0,0,0.25));
}

/* Page content inside the flip book — FIXED dimensions for consistent height */
.mg-flipbook-page {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #ffffff;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    box-sizing: border-box;
}

.mg-flipbook-page img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

/* StPageFlip page wrapper — enforce consistent sizing */
.stf__item {
    box-sizing: border-box;
}

/* Cover pages — hard density, dark styling */
.mg-flipbook-page.mg-flipbook-cover {
    background: #1a1a1a;
}
.mg-flipbook-page.mg-flipbook-cover img {
    object-fit: cover;
}

/* ── TITLE PAGE ────────────────────────────────────────── */
.mg-flipbook-title-page {
    color: #ffffff;
}
.mg-flipbook-title-page-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 30px;
    box-sizing: border-box;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
.mg-flipbook-title-page-border {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    bottom: 16px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    pointer-events: none;
}
.mg-flipbook-title-page-border::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 1px;
}
.mg-flipbook-title-page-content {
    text-align: center;
    z-index: 1;
    padding: 20px;
    max-width: 100%;
}
.mg-flipbook-cover-logo {
    margin: 0 auto 16px auto;
    max-width: 80px;
    max-height: 80px;
}
.mg-flipbook-cover-logo img {
    width: auto;
    height: auto;
    max-width: 80px;
    max-height: 80px;
    display: block;
    margin: 0 auto;
    object-fit: contain;
    opacity: 0.9;
}
.mg-flipbook-title-page-title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 10px 0;
    letter-spacing: 0.5px;
    color: #ffffff;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.mg-flipbook-title-page-subtitle {
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    margin: 0 0 8px 0;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 1px;
    text-transform: uppercase;
}
.mg-flipbook-title-page-description {
    font-size: 12px;
    font-weight: 400;
    line-height: 1.6;
    margin: 8px 0 0 0;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.3px;
}

/* ── BACK COVER ─────────────────────────────────────────── */
.mg-flipbook-page.mg-flipbook-back-cover {
    background: #1a1a1a;
}
.mg-flipbook-back-cover-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 30px;
    box-sizing: border-box;
    overflow: hidden;
}
.mg-flipbook-back-cover-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}
.mg-flipbook-back-cover-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.mg-flipbook-back-cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1;
}
.mg-flipbook-back-cover-content {
    text-align: center;
    z-index: 2;
    padding: 20px;
    position: relative;
}
.mg-flipbook-back-cover-inner .mg-flipbook-cover-logo {
    filter: brightness(2);
}
.mg-flipbook-back-cover-inner .mg-flipbook-title-page-title {
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.mg-flipbook-back-cover-inner .mg-flipbook-title-page-description {
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}


/* ── BACK COVER CONTACT PAGE ────────────────────────────── */
.mg-flipbook-contact-page-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 24px;
    box-sizing: border-box;
    overflow: hidden;
}

.mg-flipbook-contact-page-border {
    position: absolute;
    top: 14px;
    left: 14px;
    right: 14px;
    bottom: 14px;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    pointer-events: none;
}

.mg-flipbook-contact-page-content {
    text-align: center;
    z-index: 1;
    padding: 16px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.mg-flipbook-contact-logo {
    margin: 0 auto 6px auto;
    max-width: 64px;
    max-height: 64px;
}

.mg-flipbook-contact-logo img {
    width: auto;
    height: auto;
    max-width: 64px;
    max-height: 64px;
    display: block;
    margin: 0 auto;
    object-fit: contain;
    opacity: 0.95;
}

.mg-flipbook-contact-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    color: #ffffff;
    letter-spacing: 0.5px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.mg-flipbook-contact-business-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.3px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.mg-flipbook-contact-divider {
    width: 40px;
    height: 1.5px;
    background: rgba(255, 255, 255, 0.25);
    margin: 4px 0;
    border-radius: 1px;
}

.mg-flipbook-contact-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    width: 100%;
    max-width: 240px;
}

.mg-flipbook-contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.mg-flipbook-contact-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
}

.mg-flipbook-contact-icon svg {
    width: 14px;
    height: 14px;
    display: block;
}

.mg-flipbook-contact-text {
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.8);
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-align: left;
}

.mg-flipbook-contact-description {
    font-size: 10px;
    font-weight: 400;
    line-height: 1.5;
    margin: 6px 0 0 0;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.3px;
    font-style: italic;
}

/* Responsive: smaller text on mobile */
@media (max-width: 767px) {
    .mg-flipbook-contact-page-inner {
        padding: 16px;
    }
    .mg-flipbook-contact-title {
        font-size: 15px;
    }
    .mg-flipbook-contact-business-name {
        font-size: 12px;
    }
    .mg-flipbook-contact-text {
        font-size: 10px;
    }
    .mg-flipbook-contact-logo {
        max-width: 48px;
        max-height: 48px;
    }
    .mg-flipbook-contact-logo img {
        max-width: 48px;
        max-height: 48px;
    }
    .mg-flipbook-contact-details {
        max-width: 180px;
    }
    .mg-flipbook-contact-page-border {
        top: 8px;
        left: 8px;
        right: 8px;
        bottom: 8px;
    }
}

/* ── FLIP BOOK CENTERING STATES ────────────────────────── */
/* StPageFlip renders covers on the RIGHT (front) or LEFT (back) side.
   We use CSS transform to shift them to center.
   The transition is smooth and GPU-accelerated. */
.mg-flipbook-container .stf__parent {
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Closed state: cover is on RIGHT side → shifted LEFT to center */
.mg-flipbook-state-closed .stf__parent {
    /* transform is set dynamically via JS: translateX(-pageWidth/2) */
}

/* Open state: spread view → no shift needed */
.mg-flipbook-state-open .stf__parent {
    /* transform: translateX(0) */
}

/* Back cover state: last page on LEFT side → shifted RIGHT to center */
.mg-flipbook-state-back .stf__parent {
    /* transform is set dynamically via JS: translateX(pageWidth/2) */
}

/* Page number displayed on each page (optional) */
.mg-flipbook-page-number {
    position: absolute;
    bottom: 8px;
    font-size: 11px;
    color: rgba(0,0,0,0.3);
    pointer-events: none;
}

.mg-flipbook-page.mg-flipbook-cover .mg-flipbook-page-number {
    display: none;
}

/* ── FLIP BOOK TOOLBAR ─────────────────────────────────────────── */
.mg-flipbook-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 40px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    user-select: none;
    -webkit-user-select: none;
    z-index: 10;
    flex-wrap: wrap;
}

.mg-flipbook-toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
    outline: none;
    font-size: 0;
    line-height: 0;
    text-decoration: none;
}

.mg-flipbook-toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    transform: scale(1.1);
}

.mg-flipbook-toolbar-btn:active {
    transform: scale(0.95);
}

.mg-flipbook-toolbar-btn.mg-disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

.mg-flipbook-toolbar-btn svg {
    width: 20px;
    height: 20px;
    display: block;
    pointer-events: none;
}

/* Page counter text in toolbar */
.mg-flipbook-page-counter {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 500;
    padding: 0 10px;
    white-space: nowrap;
    min-width: 70px;
    text-align: center;
    letter-spacing: 0.3px;
}

/* Toolbar separator */
.mg-flipbook-toolbar-sep {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 4px;
}

/* Active state for autoplay button */
.mg-flipbook-toolbar-btn.mg-autoplay-active {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* ── FLIP BOOK ZOOM OVERLAY ────────────────────────────────────── */
.mg-flipbook-zoom-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.92);
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    cursor: zoom-out;
    overflow: auto;
}

.mg-flipbook-zoom-overlay.mg-zoom-visible {
    visibility: visible;
    opacity: 1;
}

.mg-flipbook-zoom-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    cursor: default;
}

.mg-flipbook-zoom-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 999999;
    padding: 0;
    font-size: 0;
    line-height: 0;
    outline: none;
}

.mg-flipbook-zoom-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.mg-flipbook-zoom-close svg {
    width: 22px;
    height: 22px;
    display: block;
    pointer-events: none;
}

/* ── FLIP BOOK FULLSCREEN ──────────────────────────────────────── */
.mg-flipbook-fullscreen-active .mg-flipbook-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999997;
    background: rgba(0, 0, 0, 0.95);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.mg-flipbook-fullscreen-active .mg-flipbook-book {
    flex: 1;
}

/* Hide gallery items that are used as flipbook page data */
.mg-layout-3d_flipbook .mg-gallery-item.mg-flipbook-page-item {
    display: none !important;
}

/* Flipbook container replaces gallery display */
.mg-flipbook-container + .mg-gallery.mg-layout-3d_flipbook {
    display: none !important;
}

/* ── FLIP BOOK RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 767px) {
    .mg-flipbook-toolbar {
        gap: 4px;
        padding: 8px 12px;
        border-radius: 30px;
    }
    .mg-flipbook-toolbar-btn {
        width: 34px;
        height: 34px;
        min-width: 34px;
        min-height: 34px;
    }
    .mg-flipbook-toolbar-btn svg {
        width: 18px;
        height: 18px;
    }
    .mg-flipbook-page-counter {
        font-size: 12px;
        padding: 0 6px;
        min-width: 60px;
    }
    .mg-flipbook-toolbar-sep {
        height: 20px;
        margin: 0 2px;
    }
    .mg-flipbook-container {
        padding: 12px 0;
        gap: 12px;
    }
    .mg-flipbook-title-page-title {
        font-size: 17px;
    }
    .mg-flipbook-title-page-subtitle {
        font-size: 11px;
    }
    .mg-flipbook-title-page-description {
        font-size: 10px;
    }
    .mg-flipbook-title-page-inner {
        padding: 18px;
    }
    .mg-flipbook-title-page-border {
        top: 10px;
        left: 10px;
        right: 10px;
        bottom: 10px;
    }
    .mg-flipbook-cover-logo {
        max-width: 50px;
        max-height: 50px;
    }
    .mg-flipbook-cover-logo img {
        max-width: 50px;
        max-height: 50px;
    }
}

/* StPageFlip library overrides for better integration and stability */
.stf__parent {
    margin: 0 auto;
    /* Prevent vertical jumping during flips */
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
.stf__parent .stf__item {
    background: #fff;
    /* Stabilize page elements to prevent jumping */
    will-change: transform, clip-path;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
.stf__parent .stf__block {
    /* Prevent visual shift during hover/interaction */
    perspective: 2000px;
}
.mg-flipbook-container .stf__wrapper {
    /* Stable height to prevent vertical jumping */
    overflow: visible;
}
.mg-flipbook-book {
    /* Fixed height container prevents page jumping */
    overflow: visible !important;
    position: relative;
}
/* Prevent hover-induced jitter on hard cover pages */
.mg-flipbook-page.mg-flipbook-cover {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
/* Soft inner pages: ensure stable sizing */
.mg-flipbook-page:not(.mg-flipbook-cover) {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Carousel Layout */
.mg-layout-carousel { display: flex; flex-wrap: nowrap; position: relative; gap: 0; will-change: transform; }

/* Slider Layout */
.mg-layout-slider { display: flex; flex-wrap: nowrap; position: relative; will-change: transform; }

/* ── GALLERY ITEM ─────────────────────────────────────────────────── */
.mg-gallery-item { position: relative; overflow: hidden; border-radius: var(--mg-border-radius, 0px); transition: transform var(--mg-speed) var(--mg-ease); cursor: pointer; box-sizing: border-box; }
.mg-gallery-item.mg-hidden { display: none !important; }
.mg-gallery-item.mg-filter-show { animation: mgFadeIn 0.5s var(--mg-ease) forwards; }
.mg-gallery-item.mg-filter-hide { animation: mgFadeOut 0.3s var(--mg-ease) forwards; }
@keyframes mgFadeIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
@keyframes mgFadeOut { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.9); } }

.mg-layout-carousel .mg-gallery-item,
.mg-layout-slider .mg-gallery-item { position: relative; flex-shrink: 0; }

/* ── IMAGE WRAPPER ────────────────────────────────────────────────── */
.mg-image-wrapper { position: relative; overflow: hidden; border-radius: var(--mg-border-radius, 0px); background: #f5f5f5; }
.mg-layout-grid .mg-image-wrapper { aspect-ratio: var(--mg-ratio, 1/1); }

/*
 * CRITICAL FIX v1.4.2: Images are VISIBLE by default.
 * Old versions used opacity:0 on [loading="lazy"] images, which meant
 * if JavaScript failed or was slow, galleries were completely invisible.
 * Now images are always visible. Lazy loading adds a subtle fade-in
 * as a progressive enhancement only.
 */
.mg-image-wrapper img.mg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 1;
    transition: transform var(--mg-speed) var(--mg-ease), filter var(--mg-speed) var(--mg-ease), opacity 0.4s ease;
}

.mg-layout-justified .mg-image-wrapper { height: 100%; }
.mg-layout-masonry .mg-image-wrapper img.mg-image { height: auto; }
.mg-masonry-column .mg-image-wrapper img.mg-image { height: auto !important; object-fit: unset !important; }

/* ── HOVER EFFECTS ────────────────────────────────────────────────── */
/* v2.3.3: Changed selectors from .mg-image:hover to :hover on the
   .mg-image-wrapper (which has the mg-hover-* class). This ensures
   consistent hover behavior regardless of overlay pointer-events.
   The "zoom" hover effect shows the overlay with a zoom icon — it
   does NOT scale the image (this matches the pre-v2.3.2 behavior
   where the overlay blocked :hover on the image). */
.mg-hover-zoom:hover .mg-image { transform: scale(1); }
.mg-hover-fade .mg-overlay { opacity: 0; transition: opacity var(--mg-speed) var(--mg-ease); }
.mg-hover-fade:hover .mg-overlay { opacity: 1; }
.mg-hover-slide .mg-overlay { transform: translateY(100%); transition: transform var(--mg-speed) var(--mg-ease); }
.mg-hover-slide:hover .mg-overlay { transform: translateY(0); }
.mg-hover-blur:hover .mg-image { filter: blur(3px); transform: scale(1.05); }
.mg-hover-rotate:hover .mg-image { transform: scale(1.08) rotate(2deg); }
.mg-hover-none .mg-overlay { display: none; }

/* ── WATERMARK ─────────────────────────────────────────────────────── */
.mg-watermark {
    position: absolute;
    pointer-events: none;
    z-index: 3;
    /* Default fallback values — inline styles with !important override these */
    opacity: 0.3;
    font-size: 24px;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    white-space: nowrap;
    user-select: none;
}
.mg-watermark.mg-wm-image img {
    max-height: 60px;
    width: auto;
    opacity: inherit;
    display: block;
}
.mg-watermark.mg-wm-center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.mg-watermark.mg-wm-top-left { top: 10px; left: 10px; }
.mg-watermark.mg-wm-top-right { top: 10px; right: 10px; }
.mg-watermark.mg-wm-bottom-left { bottom: 10px; left: 10px; }
.mg-watermark.mg-wm-bottom-right { bottom: 10px; right: 10px; }
/* Lightbox watermark — inline styles with !important override defaults */
.mg-lightbox-container { position: relative; }
.mg-lightbox-container > .mg-watermark {
    opacity: 0.3;
    font-size: 24px;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
    z-index: 5;
}
.mg-lightbox-container > .mg-watermark.mg-wm-center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.mg-lightbox-container > .mg-watermark.mg-wm-top-left { top: 10px; left: 10px; }
.mg-lightbox-container > .mg-watermark.mg-wm-top-right { top: 10px; right: 10px; }
.mg-lightbox-container > .mg-watermark.mg-wm-bottom-left { bottom: 10px; left: 10px; }
.mg-lightbox-container > .mg-watermark.mg-wm-bottom-right { bottom: 10px; right: 10px; }

/* ── OVERLAY ──────────────────────────────────────────────────────── */
.mg-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; background: var(--mg-overlay); opacity: 0; transition: opacity var(--mg-speed) var(--mg-ease); border-radius: var(--mg-border-radius, 0px); z-index: 2; pointer-events: none; }
.mg-gallery-item:hover .mg-overlay { opacity: 1; }
.mg-overlay-content { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 15px; text-align: center; }

/* ── CSS-ONLY ZOOM ICON (overlay) ─────────────────────────────────── */
.mg-icon { display: flex; align-items: center; justify-content: center; color: #fff; transition: transform var(--mg-speed) var(--mg-ease); }
.mg-icon:hover { transform: scale(1.15); }
.mg-icon-zoom { width: 28px; height: 28px; }
.mg-icon-zoom svg { width: 100%; height: 100%; display: block; pointer-events: none; }
.mg-caption-text { color: #ffffff; font-size: 14px; font-weight: 500; text-shadow: 0 1px 3px rgba(0,0,0,0.4); max-width: 90%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-caption-below { padding: 10px 5px 5px; display: flex; flex-direction: column; gap: 4px; }
.mg-caption-title { font-size: 14px; font-weight: 600; color: var(--mg-text); display: block; }
.mg-caption-desc { font-size: 12px; color: var(--mg-text-light); display: block; }

/* ══════════════════════════════════════════════════════════════════
   LIGHTBOX – all buttons use !important to override theme styles
   SVG icons are injected via JavaScript
   ══════════════════════════════════════════════════════════════════ */
.mg-lightbox-overlay {
    position: fixed !important; top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100vw !important; height: 100vh !important; max-width: 100vw !important; max-height: 100vh !important;
    z-index: 999999 !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
    visibility: hidden; opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    box-sizing: border-box !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch;
    margin: 0 !important; padding: 0 !important;
    overflow: hidden !important;
}
.mg-lightbox-overlay.mg-lightbox-visible { visibility: visible !important; opacity: 1 !important; }

/* Prevent body scroll when lightbox is open */
body.mg-lightbox-open { overflow: hidden !important; }

/* Lightbox Skins */
.mg-lightbox-overlay.mg-skin-dark { background: rgba(0,0,0,0.92) !important; }
.mg-lightbox-overlay.mg-skin-dark .mg-lightbox-nav,
.mg-lightbox-overlay.mg-skin-dark .mg-lightbox-close,
.mg-lightbox-overlay.mg-skin-dark .mg-lightbox-counter,
.mg-lightbox-overlay.mg-skin-dark .mg-lightbox-action-btn { color: #ffffff !important; }

.mg-lightbox-overlay.mg-skin-light { background: rgba(255,255,255,0.95) !important; }
.mg-lightbox-overlay.mg-skin-light .mg-lightbox-nav,
.mg-lightbox-overlay.mg-skin-light .mg-lightbox-close,
.mg-lightbox-overlay.mg-skin-light .mg-lightbox-counter,
.mg-lightbox-overlay.mg-skin-light .mg-lightbox-caption,
.mg-lightbox-overlay.mg-skin-light .mg-lightbox-action-btn { color: #333333 !important; }
.mg-lightbox-overlay.mg-skin-light .mg-lightbox-nav { background: rgba(0,0,0,0.1) !important; }
.mg-lightbox-overlay.mg-skin-light .mg-lightbox-nav:hover { background: rgba(0,0,0,0.2) !important; color: #111111 !important; }
.mg-lightbox-overlay.mg-skin-light .mg-lightbox-close { background: rgba(0,0,0,0.08) !important; }
.mg-lightbox-overlay.mg-skin-light .mg-lightbox-close:hover { background: rgba(0,0,0,0.18) !important; color: #111111 !important; }
.mg-lightbox-overlay.mg-skin-light .mg-lightbox-action-btn { background: rgba(0,0,0,0.08) !important; }
.mg-lightbox-overlay.mg-skin-light .mg-lightbox-action-btn:hover { background: rgba(0,0,0,0.15) !important; color: #111111 !important; }
.mg-lightbox-overlay.mg-skin-light .mg-lightbox-caption { background: rgba(0,0,0,0.06) !important; color: #333 !important; }
.mg-lightbox-overlay.mg-skin-light .mg-lightbox-counter { color: rgba(0,0,0,0.6) !important; }

.mg-lightbox-overlay.mg-skin-minimal { background: rgba(0,0,0,0.97) !important; }
.mg-lightbox-overlay.mg-skin-minimal .mg-lightbox-close { color: rgba(255,255,255,0.5) !important; }
.mg-lightbox-overlay.mg-skin-minimal .mg-lightbox-nav { color: rgba(255,255,255,0.4) !important; }

/* Lightbox Animations */
.mg-lightbox-overlay.mg-animate-fade .mg-lightbox-container { animation: mgLbFadeIn 0.3s ease forwards; }
.mg-lightbox-overlay.mg-animate-slide .mg-lightbox-container { animation: mgLbSlideIn 0.3s ease forwards; }
.mg-lightbox-overlay.mg-animate-zoom .mg-lightbox-container { animation: mgLbZoomIn 0.3s ease forwards; }
.mg-lightbox-overlay.mg-animate-bounce .mg-lightbox-container { animation: mgLbBounceIn 0.4s ease forwards; }
@keyframes mgLbFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes mgLbSlideIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes mgLbZoomIn { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: scale(1); } }
@keyframes mgLbBounceIn { 0% { opacity: 0; transform: scale(0.3); } 50% { opacity: 1; transform: scale(1.05); } 70% { transform: scale(0.95); } 100% { opacity: 1; transform: scale(1); } }

.mg-lightbox-container {
    position: relative; z-index: 1;
    max-width: calc(100vw - 120px); max-height: calc(100vh - 140px);
    display: flex; align-items: center; justify-content: center;
    box-sizing: border-box;
}
.mg-lightbox-image {
    max-width: calc(100vw - 120px); max-height: calc(100vh - 180px);
    object-fit: contain; border-radius: 4px; box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    user-select: none; transition: opacity 0.2s ease; display: block;
    /* Lightbox images are always full-size, fit to screen - NOT affected by gallery dimension settings */
    width: auto; height: auto;
}
.mg-lightbox-image.mg-loading { opacity: 0.3; }

/* ── LIGHTBOX CLOSE BUTTON (SVG icon) ─────────────────────────────── */
.mg-lightbox-close {
    position: absolute !important; top: 15px !important; right: 15px !important;
    width: 48px !important; height: 48px !important; min-width: 48px !important; min-height: 48px !important;
    background: rgba(255,255,255,0.1) !important;
    border: none !important; border-radius: 50% !important;
    color: #ffffff !important; cursor: pointer !important;
    font-size: 0 !important; line-height: 0 !important;
    z-index: 100 !important; display: flex !important;
    align-items: center !important; justify-content: center !important;
    transition: background 0.2s ease, transform 0.2s ease;
    pointer-events: auto !important;
    padding: 0 !important; margin: 0 !important;
    text-decoration: none !important;
    box-shadow: none !important;
    outline: none !important;
}
.mg-lightbox-close svg {
    width: 22px !important; height: 22px !important;
    display: block !important; pointer-events: none !important;
}
.mg-lightbox-close:hover { background: rgba(255,255,255,0.25) !important; transform: scale(1.1); }
.mg-skin-light .mg-lightbox-close:hover { background: rgba(0,0,0,0.18) !important; }

/* ── LIGHTBOX NAV ARROWS (SVG icons) ──────────────────────────────── */
.mg-lightbox-nav {
    position: absolute !important; top: 50% !important; transform: translateY(-50%) !important;
    width: 56px !important; height: 56px !important; min-width: 56px !important; min-height: 56px !important;
    background: rgba(255,255,255,0.1) !important;
    border: none !important; border-radius: 50% !important;
    color: #ffffff !important; cursor: pointer !important;
    font-size: 0 !important; line-height: 0 !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
    z-index: 100 !important; transition: background 0.2s ease, transform 0.2s ease;
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    pointer-events: auto !important;
    padding: 0 !important; margin: 0 !important;
    text-decoration: none !important;
    box-shadow: none !important;
    outline: none !important;
}
.mg-lightbox-nav svg {
    width: 24px !important; height: 24px !important;
    display: block !important; pointer-events: none !important;
}
.mg-lightbox-nav:hover { background: rgba(255,255,255,0.25) !important; transform: translateY(-50%) scale(1.1) !important; }
.mg-skin-light .mg-lightbox-nav:hover { background: rgba(0,0,0,0.2) !important; color: #111 !important; }
.mg-skin-minimal .mg-lightbox-nav:hover { background: rgba(255,255,255,0.12) !important; }
.mg-lightbox-prev { left: 15px !important; }
.mg-lightbox-next { right: 15px !important; }

/* ── LIGHTBOX ACTION BUTTONS (fullscreen on right side, before close) ── */
.mg-lightbox-actions {
    position: absolute !important; top: 15px !important; right: 75px !important;
    z-index: 100 !important; display: flex !important; gap: 8px !important;
}
.mg-lightbox-action-btn {
    width: 42px !important; height: 42px !important; min-width: 42px !important; min-height: 42px !important;
    border-radius: 50% !important;
    background: rgba(255,255,255,0.1) !important;
    border: none !important;
    color: #ffffff !important; cursor: pointer !important;
    font-size: 0 !important; line-height: 0 !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
    transition: background 0.2s ease, transform 0.2s ease;
    pointer-events: auto !important;
    padding: 0 !important; margin: 0 !important;
    text-decoration: none !important;
    box-shadow: none !important;
    outline: none !important;
}
.mg-lightbox-action-btn svg {
    width: 20px !important; height: 20px !important;
    display: block !important; pointer-events: none !important;
}
.mg-lightbox-action-btn:hover { background: rgba(255,255,255,0.25) !important; transform: scale(1.1); }
.mg-skin-light .mg-lightbox-action-btn:hover { background: rgba(0,0,0,0.18) !important; }

/* ── LIGHTBOX CAPTION / COUNTER ──────────────────────────────────── */
.mg-lightbox-caption {
    position: absolute !important; bottom: 60px !important; left: 50% !important; transform: translateX(-50%) !important;
    color: #ffffff !important; font-size: 14px !important; text-align: center !important;
    max-width: 80% !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5); background: rgba(0,0,0,0.4) !important;
    padding: 8px 20px !important; border-radius: 50px !important;
    backdrop-filter: blur(4px); z-index: 50 !important;
    margin: 0 !important; border: none !important;
    pointer-events: none !important;
}
.mg-lightbox-counter {
    position: absolute !important; bottom: 15px !important; left: 15px !important;
    color: rgba(255,255,255,0.7) !important; font-size: 13px !important; font-weight: 500 !important;
    z-index: 50 !important; pointer-events: none !important;
    background: rgba(0,0,0,0.35) !important; border: none !important; padding: 4px 12px !important;
    margin: 0 !important; border-radius: 20px !important; backdrop-filter: blur(4px);
}

/* ── LIGHTBOX THUMBNAIL STRIP ────────────────────────────────────── */
.mg-lightbox-thumbnails {
    position: absolute !important; bottom: 10px !important; left: 50% !important; transform: translateX(-50%) !important;
    display: flex !important; gap: 6px !important; padding: 6px 10px !important;
    background: rgba(0,0,0,0.4) !important; border-radius: 30px !important;
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    z-index: 50 !important; max-width: 90vw !important; overflow-x: auto !important;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.3) transparent;
    border: none !important; margin: 0 !important;
}
.mg-lightbox-thumbnails::-webkit-scrollbar { height: 4px; }
.mg-lightbox-thumbnails::-webkit-scrollbar-track { background: transparent; }
.mg-lightbox-thumbnails::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 2px; }

.mg-lightbox-thumb {
    width: 48px !important; height: 48px !important;
    border-radius: 6px !important;
    overflow: hidden; cursor: pointer !important; flex-shrink: 0;
    border: 2px solid transparent !important;
    transition: border-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
    opacity: 0.6; background: none !important; padding: 0 !important; margin: 0 !important;
    display: block !important;
}
.mg-lightbox-thumb:hover { opacity: 0.9; transform: scale(1.05); }
.mg-lightbox-thumb.active { border-color: #ffffff !important; opacity: 1; transform: scale(1.08); }
.mg-lightbox-thumb img { width: 100% !important; height: 100% !important; object-fit: cover; display: block; }
.mg-skin-light .mg-lightbox-thumbnails { background: rgba(0,0,0,0.08) !important; }
.mg-skin-light .mg-lightbox-thumb.active { border-color: #333333 !important; }

/* ── CAROUSEL / SLIDER WRAPPER ────────────────────────────────────── */
.mg-gallery-wrapper.mg-carousel-wrapper,
.mg-gallery-wrapper.mg-slider-wrapper { overflow: hidden !important; }

/* ── CAROUSEL ARROWS (SVG icons) ──────────────────────────────────── */
.mg-carousel-arrow {
    position: absolute !important; top: 50% !important; transform: translateY(-50%) !important;
    width: 48px !important; height: 48px !important; min-width: 48px !important; min-height: 48px !important;
    border-radius: 50% !important; border: none !important;
    cursor: pointer !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
    z-index: 5 !important;
    transition: all var(--mg-speed) var(--mg-ease); color: #ffffff !important;
    background-color: rgba(0,0,0,0.5) !important;
    font-size: 0 !important; line-height: 0 !important;
    backdrop-filter: blur(4px); box-shadow: 0 2px 10px rgba(0,0,0,0.2) !important;
    padding: 0 !important; margin: 0 !important;
    text-decoration: none !important;
    outline: none !important;
}
.mg-carousel-arrow svg {
    width: 24px !important; height: 24px !important;
    display: block !important; pointer-events: none !important;
}
.mg-carousel-arrow:hover { background-color: rgba(0,0,0,0.75) !important; transform: translateY(-50%) scale(1.1) !important; }
.mg-carousel-prev { left: 10px !important; }
.mg-carousel-next { right: 10px !important; }

.mg-carousel-dots { display: flex; justify-content: center; gap: 8px; margin-top: 15px; padding: 5px 0; }
.mg-carousel-dot {
    width: 10px !important; height: 10px !important;
    border-radius: 50% !important; border: none !important;
    cursor: pointer !important; background-color: #cccccc !important;
    transition: all 0.3s ease; padding: 0 !important; margin: 0 !important;
    display: inline-block !important; min-width: 10px !important; min-height: 10px !important;
    outline: none !important; box-shadow: none !important;
}
.mg-carousel-dot.active { background-color: var(--mg-primary) !important; transform: scale(1.2); }

/* Center mode */
.mg-gallery-wrapper[data-center-mode="true"] .mg-gallery-item { transition: opacity 0.3s ease, transform 0.3s ease; }
.mg-gallery-wrapper[data-center-mode="true"] .mg-gallery-item:not(.mg-center-slide) { opacity: 0.5; transform: scale(0.92); }
.mg-gallery-wrapper[data-center-mode="true"] .mg-gallery-item.mg-center-slide { opacity: 1; transform: scale(1); }

/* ── HERO ITEM MARKER ─────────────────────────────────────────── */
.mg-gallery-item.mg-hero-item {
    /* Marker class for JS hero item detection - no visual changes needed */
}

/* ── LOAD MORE ────────────────────────────────────────────────────── */
.mg-load-more-wrapper { text-align: center; margin-top: 30px; }
.mg-load-more-btn { display: inline-block; padding: 12px 36px; background: var(--mg-primary); color: var(--mg-white); border: none; border-radius: 50px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all var(--mg-speed) var(--mg-ease); text-transform: uppercase; letter-spacing: 1px; }
.mg-load-more-btn:hover { background: var(--mg-primary-hover); transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0,115,170,0.3); }
.mg-load-more-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }
.mg-load-more-btn.mg-loading::after { content: ''; display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; margin-left: 10px; animation: mgSpin 0.6s linear infinite; vertical-align: middle; }
@keyframes mgSpin { to { transform: rotate(360deg); } }

/* ── RESPONSIVE ───────────────────────────────────────────────────── */
@media (max-width: 1023px) {
    .mg-layout-grid { grid-template-columns: repeat(var(--mg-columns-tablet, 2), 1fr) !important; }
    .mg-layout-masonry:not(.mg-masonry-balanced) { column-count: var(--mg-columns-tablet, 2) !important; }
    .mg-layout-featured:not(.mg-hero-balanced) { grid-template-columns: repeat(var(--mg-columns-tablet, 2), 1fr) !important; }
    .mg-layout-spotlight:not(.mg-hero-balanced) { grid-template-columns: repeat(var(--mg-columns-tablet, 2), 1fr) !important; }
    .mg-layout-showcase:not(.mg-hero-balanced) { grid-template-columns: repeat(var(--mg-columns-tablet, 2), 1fr) !important; }
    .mg-hero-row-equal .mg-image-wrapper { aspect-ratio: 1/1; }
    .mg-showcase-prev, .mg-showcase-next { width: 36px !important; height: 36px !important; min-width: 36px !important; min-height: 36px !important; }
    /* Split Carousel: slightly smaller side on tablet */
    .mg-split-carousel-prev, .mg-split-carousel-next { width: 30px !important; height: 30px !important; min-width: 30px !important; min-height: 30px !important; }
    .mg-split-carousel-prev svg, .mg-split-carousel-next svg { width: 16px !important; height: 16px !important; }
    .mg-filter-bar { gap: 6px; }
    .mg-filter-btn { padding: 6px 14px !important; font-size: 13px !important; }
    .mg-lightbox-nav { width: 44px !important; height: 44px !important; min-width: 44px !important; min-height: 44px !important; }
    .mg-lightbox-nav svg { width: 20px !important; height: 20px !important; }
    .mg-lightbox-prev { left: 10px !important; }
    .mg-lightbox-next { right: 10px !important; }
    .mg-lightbox-thumb { width: 40px !important; height: 40px !important; }
    .mg-gallery-item { max-width: 100%; }
    .mg-image-wrapper { max-width: 100%; }
    .mg-watermark { font-size: 18px; }
    .mg-watermark.mg-wm-image img { max-height: 45px; }
}
@media (max-width: 767px) {
    .mg-layout-grid { grid-template-columns: repeat(var(--mg-columns-mobile, 1), 1fr) !important; }
    .mg-layout-masonry:not(.mg-masonry-balanced) { column-count: var(--mg-columns-mobile, 1) !important; }
    .mg-layout-featured:not(.mg-hero-balanced) { grid-template-columns: repeat(var(--mg-columns-mobile, 1), 1fr) !important; }
    .mg-layout-spotlight:not(.mg-hero-balanced) { grid-template-columns: repeat(var(--mg-columns-mobile, 1), 1fr) !important; }
    .mg-layout-showcase:not(.mg-hero-balanced) { grid-template-columns: repeat(var(--mg-columns-mobile, 1), 1fr) !important; }
    /* Spotlight hero group becomes vertical on mobile */
    .mg-spotlight-hero-group { flex-direction: column; }
    .mg-spotlight-hero-group .mg-spotlight-item-hero { flex: 1; }
    .mg-spotlight-hero-group .mg-spotlight-item-hero .mg-image-wrapper { aspect-ratio: 16/9; height: auto; }
    .mg-spotlight-side-stack { flex-direction: row; }
    .mg-spotlight-side-stack .mg-gallery-item .mg-image-wrapper { aspect-ratio: 1/1; height: auto; }
    /* Showcase: hero full width, carousel shows 1-2 items on mobile */
    .mg-showcase-carousel-inner .mg-gallery-item .mg-image-wrapper { aspect-ratio: 4/3; }
    .mg-showcase-prev, .mg-showcase-next { width: 32px !important; height: 32px !important; min-width: 32px !important; min-height: 32px !important; }
    /* Split Carousel: stack vertically on mobile */
    .mg-split-carousel-group { flex-direction: column; height: auto !important; }
    .mg-split-carousel-hero { flex: 1 1 auto !important; max-width: 100% !important; position: relative; }
    .mg-split-carousel-hero .mg-gallery-item { position: relative; }
    .mg-split-carousel-hero .mg-image-wrapper { aspect-ratio: 16/9; height: auto; }
    .mg-split-carousel-side { flex: 1 1 auto !important; max-width: 100% !important; flex-direction: row; overflow: hidden; }
    .mg-split-carousel-inner { flex-direction: row; }
    .mg-split-carousel-inner .mg-gallery-item { margin-right: var(--mg-gap, 10px); margin-bottom: 0 !important; }
    .mg-split-carousel-inner .mg-gallery-item .mg-image-wrapper { aspect-ratio: 1/1; }
    .mg-split-carousel-prev, .mg-split-carousel-next { width: 28px !important; height: 28px !important; min-width: 28px !important; min-height: 28px !important; top: 50% !important; transform: translateY(-50%) !important; }
    .mg-split-carousel-prev { left: 5px !important; bottom: auto !important; }
    .mg-split-carousel-next { right: 5px !important; bottom: auto !important; }
    /* Hero rows: items wrap on mobile */
    .mg-hero-row { flex-wrap: wrap; }
    .mg-hero-row .mg-gallery-item { flex: 1 1 45%; min-width: 45%; }
    .mg-hero-row-hero .mg-gallery-item { flex: 1 1 100%; min-width: 100%; }
    .mg-hero-row-equal .mg-gallery-item { flex: 1 1 45%; min-width: 45%; }
    .mg-filter-bar { gap: 4px; margin-bottom: 15px; }
    .mg-filter-btn { padding: 5px 12px !important; font-size: 12px !important; }
    .mg-carousel-arrow { width: 36px !important; height: 36px !important; min-width: 36px !important; min-height: 36px !important; }
    .mg-carousel-arrow svg { width: 18px !important; height: 18px !important; }
    .mg-carousel-prev { left: 5px !important; }
    .mg-carousel-next { right: 5px !important; }

    /* Lightbox mobile */
    .mg-lightbox-container { max-width: calc(100vw - 30px) !important; max-height: calc(100vh - 100px) !important; }
    .mg-lightbox-image { max-width: calc(100vw - 30px) !important; max-height: calc(100vh - 150px) !important; }
    .mg-lightbox-close { top: 8px !important; right: 8px !important; width: 40px !important; height: 40px !important; min-width: 40px !important; min-height: 40px !important; }
    .mg-lightbox-close svg { width: 18px !important; height: 18px !important; }
    .mg-lightbox-nav { width: 42px !important; height: 42px !important; min-width: 42px !important; min-height: 42px !important; }
    .mg-lightbox-nav svg { width: 18px !important; height: 18px !important; }
    .mg-lightbox-prev { left: 5px !important; }
    .mg-lightbox-next { right: 5px !important; }
    .mg-lightbox-caption { font-size: 12px !important; max-width: 90% !important; padding: 6px 16px !important; bottom: 55px !important; }
    .mg-lightbox-counter { bottom: 8px !important; left: 8px !important; font-size: 12px !important; }
    .mg-lightbox-actions { top: 8px !important; right: 55px !important; }
    .mg-lightbox-action-btn { width: 36px !important; height: 36px !important; min-width: 36px !important; min-height: 36px !important; }
    .mg-lightbox-action-btn svg { width: 16px !important; height: 16px !important; }
    .mg-lightbox-thumb { width: 36px !important; height: 36px !important; }
    .mg-lightbox-thumbnails { bottom: 5px !important; padding: 4px 8px !important; gap: 4px !important; max-width: 95vw !important; }
    .mg-gallery-item { max-width: 100%; overflow: hidden; }
    .mg-image-wrapper { max-width: 100%; overflow: hidden; }
    .mg-watermark { font-size: 14px; }
    .mg-watermark.mg-wm-image img { max-height: 36px; }
}
@media (max-width: 479px) {
    .mg-layout-grid { grid-template-columns: 1fr !important; }
    .mg-layout-masonry:not(.mg-masonry-balanced) { column-count: 1 !important; }
    .mg-layout-featured:not(.mg-hero-balanced) { grid-template-columns: 1fr !important; }
    .mg-layout-spotlight:not(.mg-hero-balanced) { grid-template-columns: 1fr !important; }
    .mg-layout-showcase:not(.mg-hero-balanced) { grid-template-columns: 1fr !important; }
    /* Everything 1 per row */
    .mg-hero-row { flex-wrap: wrap; }
    .mg-hero-row .mg-gallery-item { flex: 1 1 100% !important; min-width: 100% !important; }
    .mg-spotlight-side-stack { flex-direction: column; }
    .mg-spotlight-side-stack .mg-gallery-item .mg-image-wrapper { aspect-ratio: 4/3; height: auto; }
    .mg-filter-btn { padding: 4px 10px !important; font-size: 11px !important; }
    .mg-overlay-content { gap: 6px; padding: 10px; }
    .mg-caption-text { font-size: 12px; }
    .mg-load-more-btn { padding: 10px 28px; font-size: 13px; }
    .mg-lightbox-container { max-width: calc(100vw - 10px) !important; }
    .mg-lightbox-image { max-width: calc(100vw - 10px) !important; max-height: calc(100vh - 120px) !important; }
    .mg-carousel-arrow { width: 32px !important; height: 32px !important; min-width: 32px !important; min-height: 32px !important; }
    .mg-carousel-arrow svg { width: 14px !important; height: 14px !important; }
    .mg-watermark { font-size: 12px; }
    .mg-watermark.mg-wm-image img { max-height: 30px; }
}

/* ── GALLERY LAZY LOADING ──────────────────────────────────────── */
/* Pending state: gallery not yet initialized, shows spinner */
.mg-gallery-wrapper.mg-lazy-pending {
    min-height: 200px;
    position: relative;
    opacity: 0.6;
    transition: opacity 0.4s ease;
}
.mg-gallery-wrapper.mg-lazy-pending::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 3px solid rgba(0,115,170,0.2);
    border-top-color: var(--mg-primary);
    border-radius: 50%;
    animation: mgSpin 0.6s linear infinite;
}
/* Ready state: gallery initialized, images loading */
.mg-gallery-wrapper.mg-lazy-ready {
    opacity: 1;
}

/* Image lazy loading: images start invisible, fade in when loaded */
.mg-image-wrapper img.mg-image.mg-img-lazy {
    opacity: 0;
    transition: opacity 0.3s ease;
}
.mg-image-wrapper img.mg-image.mg-loaded {
    opacity: 1;
}

/* Noscript fallback - hide the noscript images when JS works */
.mg-gallery-wrapper script + noscript > img {
    display: none !important;
}

/* ── HOVER SUPPRESSION (dropdown menu conflict fix) ──────────────── */
/* When an overlapping element (e.g. header dropdown) is detected on
   top of a gallery item, JS adds .mg-hover-suppressed to prevent
   hover effects from interfering with the overlapping element. */
.mg-gallery-item.mg-hover-suppressed .mg-overlay { opacity: 0 !important; }
.mg-gallery-item.mg-hover-suppressed .mg-image { transform: none !important; filter: none !important; }
.mg-gallery-item.mg-hover-suppressed { cursor: default !important; }

/* ── ACCESSIBILITY ────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .mg-gallery-item, .mg-image-wrapper img, .mg-overlay, .mg-filter-btn,
    .mg-carousel-arrow, .mg-lightbox-overlay, .mg-lightbox-image,
    .mg-lightbox-nav, .mg-lightbox-close, .mg-lightbox-container { transition: none !important; animation: none !important; }
}
.mg-filter-btn:focus-visible, .mg-carousel-arrow:focus-visible, .mg-carousel-dot:focus-visible,
.mg-lightbox-nav:focus-visible, .mg-lightbox-close:focus-visible, .mg-gallery-item:focus-visible,
.mg-lightbox-action-btn:focus-visible, .mg-lightbox-thumb:focus-visible {
    outline: 2px solid var(--mg-primary); outline-offset: 2px;
}

/* ── PRINT ────────────────────────────────────────────────────────── */
@media print {
    .mg-filter-bar, .mg-overlay, .mg-carousel-arrow, .mg-carousel-dots,
    .mg-lightbox-overlay, .mg-load-more-wrapper { display: none !important; }
    .mg-gallery { display: grid !important; grid-template-columns: repeat(3, 1fr) !important; gap: 5px !important; }
    .mg-gallery-item { position: relative !important; break-inside: avoid; }
}
