/* Lumix Gallery widget styles */
.elementor-widget-lumix-gallery {
    margin: 0;
}

.lumix-gallery-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.lumix-gallery-filters .filter-button {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.06);
    padding: .4rem .6rem;
    border-radius: 6px;
    cursor: pointer;
}

.lumix-gallery-grid {
    display: grid;
    gap: 1rem;
}

.lumix-gallery-cols-1 {
    grid-template-columns: 1fr;
}

.lumix-gallery-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.lumix-gallery-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.lumix-gallery-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.lumix-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

/* Uniform thumbnail aspect: use aspect-ratio so all gallery tiles share the same height/crop.
   Modern browsers support this; it keeps layout stable and avoids JS resizing. */
.lumix-gallery-link {
    display: block;
    width: 100%;
    /* default desktop thumbnail ratio (wider cinematic) */
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--color-surface);
}

.lumix-gallery-link img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    transition: transform .35s ease;
}

.lumix-gallery-item:hover .lumix-gallery-link img {
    transform: scale(1.02);
}

/* Lightbox modal styles (scoped minimal) */
.lumix-gallery-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 2rem;
}

.lumix-gallery-modal {
    position: relative;
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lumix-gallery-modal img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 6px;
    object-fit: contain;
}

.lumix-gallery-modal .lumix-gallery-caption {
    margin-top: .6rem;
    color: var(--color-surface);
    text-align: center;
    font-family: var(--font-primary);
}

.lumix-gallery-modal .lumix-gallery-nav {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
    z-index: 100001;
    padding: 0 12px;
}

.lumix-gallery-modal .lumix-gallery-nav button {
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.6);
    color: var(--color-surface);
    border: none;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    transition: transform .18s ease, background-color .12s ease, opacity .12s ease;
}

.lumix-gallery-modal .lumix-gallery-nav button:hover:not(:disabled) {
    transform: translateY(-2px);
    background: rgba(0, 0, 0, 0.75);
}

.lumix-gallery-modal .lumix-gallery-nav button:disabled {
    cursor: not-allowed;
    opacity: 0.3;
    transform: none;
}

.lumix-gallery-modal .lumix-gallery-nav button:active:not(:disabled) {
    transform: translateY(0);
}

.lumix-gallery-modal .lumix-gallery-nav button:focus {
    outline: 3px solid rgba(255, 255, 255, 0.12);
    outline-offset: 3px;
}

/* Close button styling: slightly smaller and centered visually */
.lumix-gallery-close {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Unified control positions: prev/next vertically centered on sides; close on top-right. Works across sizes. */
.lumix-gallery-modal {
    position: relative;
}

.lumix-gallery-modal .lumix-gallery-prev,
.lumix-gallery-modal .lumix-gallery-next {
    /* reset previous page-level positioning; navigation will be positioned relative to the image wrapper */
    position: static;
    left: auto;
    right: auto;
    top: auto;
    transform: none;
    z-index: auto;
}

/* Image wrapper: this ensures prev/next are positioned relative to the image size */
.lumix-gallery-image-wrap {
    /* shrink-wrap to the image so controls align with the image edges */
    position: relative;
    display: inline-block;
    width: auto;
    max-width: 100%;
    vertical-align: middle;
}

.lumix-gallery-image-wrap img {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

.lumix-gallery-image-wrap .lumix-gallery-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none; /* container ignores pointer, buttons themselves accept clicks */
    padding: 0 8px;
    z-index: 100005; /* ensure nav sits above the image */
}

.lumix-gallery-image-wrap .lumix-gallery-nav button {
    pointer-events: auto; /* enable clicks for buttons inside the nav */
}

.lumix-gallery-modal .lumix-gallery-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 100003;
    width: 44px;
    height: 44px;
}

body.lumix-gallery-open {
    overflow: hidden;
}

/* Carousel styles */
.lumix-gallery-carousel {
    position: relative;
    overflow: hidden;
}

.lumix-carousel-track {
    display: flex;
    transition: transform .45s cubic-bezier(.22, .9, .31, 1);
    will-change: transform;
}

.lumix-carousel-slide {
    flex: 0 0 100%;
    box-sizing: border-box;
    padding: 0 .4rem;
}

.lumix-carousel-slide img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

/* Carousel arrows: larger circular buttons with decent hit area */
.lumix-carousel-arrows {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    padding: 0 6px;
    z-index: 1000;
}

.lumix-carousel-arrows button {
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.55);
    color: var(--color-surface);
    border: none;
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    transition: transform .12s ease, background .12s ease, opacity .12s ease;
    margin: 0 1rem;
}

.lumix-carousel-arrows button:hover:not(:disabled) {
    transform: translateY(-2px);
    background: rgba(0, 0, 0, 0.7);
}

.lumix-carousel-arrows button:disabled {
    cursor: not-allowed;
    opacity: 0.3;
    transform: none;
}

.lumix-carousel-arrows button:focus {
    outline: 3px solid rgba(255, 255, 255, 0.12);
    outline-offset: 3px;
}

/* SVG icons inside buttons should inherit color and be sized appropriately */
.lumix-gallery-modal .lumix-gallery-nav button svg,
.lumix-carousel-arrows button svg {
    width: 18px;
    height: 18px;
    display: block;
    fill: currentColor;
}

.lumix-carousel-dots {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 12px;
    display: flex;
    gap: .45rem;
    z-index: 1000;
}

.lumix-carousel-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    transition: transform .12s ease, background .12s ease;
}

.lumix-carousel-dot:hover {
    transform: translateY(-2px);
}

.lumix-carousel-dot.active {
    background: var(--color-accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* make grid gutters match carousel padding */
.lumix-gallery-grid {
    gap: 0.8rem;
}

/* Make carousel slides use the same thumbnail crop behavior as grid items */
.lumix-carousel-slide img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
}

/* Responsive overrides: square thumbnails on small screens for tighter layout */
@media (max-width: 768px) {
    .lumix-gallery-link,
    .lumix-carousel-slide img {
        aspect-ratio: 1 / 1;
    }
}

@media (max-width: 768px) {
    .lumix-carousel-arrows button {
        padding: .45rem .6rem;
    }
}

@media (max-width: 768px) {

    .lumix-gallery-cols-4,
    .lumix-gallery-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {

    .lumix-gallery-cols-2,
    .lumix-gallery-cols-3,
    .lumix-gallery-cols-4 {
        grid-template-columns: 1fr;
    }
}