/* Kunstmotor Gallery 1.1.8 — Modern ZOneTheme design, no third-party dependencies. */

:root {
    --kmg-transition-ms: 260ms;
    --kmg-list-transition-ms: 420ms;
    --kmg-border: rgba(17, 24, 39, 0.12);
    --kmg-border-strong: rgba(17, 24, 39, 0.88);
    --kmg-surface: #fff;
    --kmg-surface-soft: #f7f7f8;
    --kmg-overlay: rgba(10, 10, 12, 0.94);
    --kmg-shadow-soft: 0 4px 18px rgba(17, 24, 39, 0.08);
    --kmg-shadow-float: 0 10px 30px rgba(17, 24, 39, 0.16);
}

/* Product-list image swap ------------------------------------------------ */
.kmg-list-image-host {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    aspect-ratio: 1 / 1;
    overflow: hidden !important;
    isolation: isolate;
    background: #fff !important;
}

.kmg-list-picture,
.kmg-list-image-host .kmg-list-picture {
    position: relative !important;
    z-index: 1;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    overflow: hidden !important;
    margin: 0 !important;
    background: #fff !important;
}

.kmg-list-picture > img {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    object-fit: cover !important;
    object-position: center center !important;
}

.kmg-list-image-host .kmg-list-picture {
    position: absolute !important;
    inset: 0 !important;
    height: 100% !important;
}

.kmg-list-image-host .kmg-list-primary,
.kmg-list-image-host .kmg-list-secondary {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    object-fit: cover !important;
    object-position: center !important;
    backface-visibility: hidden;
    transform: none !important;
    will-change: opacity;
    transition: opacity var(--kmg-list-transition-ms) cubic-bezier(.22, .61, .36, 1) !important;
}

.kmg-list-image-host .kmg-list-primary {
    z-index: 1;
    opacity: 1 !important;
    visibility: visible !important;
}

.kmg-list-image-host .kmg-list-secondary {
    z-index: 2;
    opacity: 0 !important;
    visibility: visible !important;
    pointer-events: none;
}

.kmg-list-image-host .kmg-list-native-extra {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Cancel native ZOneTheme hover zoom/background effects. */
.kmg-list-image-host,
.kmg-list-image-host:hover,
.kmg-list-image-host:focus {
    background-image: none !important;
    transform: none !important;
}

.kmg-list-image-host::before,
.kmg-list-image-host::after {
    background-image: none !important;
}

@media (hover: hover) and (pointer: fine) {
    /* Bild 1 bleibt vollständig sichtbar und Bild 2 blendet sich darüber ein.
       Dadurch gibt es während des Übergangs keinen weißen Zwischenblitz. */
    html.kmg-is-desktop .kmg-has-second-image .kmg-list-image-host:hover .kmg-list-secondary {
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
    }
}


/* AJAX pagination in PrestaShop/ZOneTheme injects raw cover images that do
   not pass through the module's server-side HTML filter. Hide those raw
   mobile cards immediately; JavaScript replaces the same img with image 2
   before revealing it. The selector is active before the next browser paint. */
html.kmg-is-mobile .product-miniature:not([data-kmg-server-ready="1"]):not([data-kmg-no-second="1"]):not(.kmg-mobile-image-ready) .product-cover-link {
    background-image: none !important;
    background-color: #fff !important;
}

html.kmg-is-mobile .product-miniature:not([data-kmg-server-ready="1"]):not([data-kmg-no-second="1"]):not(.kmg-mobile-image-ready) .product-cover-link img {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Mobile Kategoriebilder: Bild 2 steht direkt im img-src. Das einzige
   source-Element gilt ausschließlich für Desktop. Mobil findet daher kein
   nachträglicher Quellenwechsel vom Titelbild auf Bild 2 statt. */
html.kmg-is-mobile .product-miniature .product-thumbnail a.product-cover-link {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    overflow: hidden !important;
    background: #fff !important;
}

html.kmg-is-mobile .product-miniature .product-thumbnail a.product-cover-link > img,
html.kmg-is-mobile .kmg-list-image-host .kmg-list-picture,
html.kmg-is-mobile .kmg-list-image-host .kmg-list-primary,
html.kmg-is-mobile .kmg-list-image-host .kmg-list-secondary {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    object-fit: contain !important;
    object-position: center center !important;
    transform: none !important;
    background-color: #fff !important;
}

/* Bei serverseitigen Mobile-Direktbildern ist das primäre img bereits Bild 2.
   Ein zusätzliches Overlay-Bild wird mobil nicht benötigt. */
html.kmg-is-mobile .kmg-mobile-source-ready .kmg-list-primary {
    opacity: 1 !important;
    visibility: visible !important;
}

html.kmg-is-mobile .kmg-mobile-source-ready .kmg-list-secondary {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Nur als Fallback für Produktkarten, die nachträglich von Fremdmodulen per
   JavaScript eingefügt werden und nicht durch den HTML-Filter gelaufen sind. */
html.kmg-is-mobile .kmg-mobile-image-pending .kmg-list-primary,
html.kmg-is-mobile .kmg-mobile-image-pending .kmg-list-secondary {
    opacity: 0 !important;
}

html.kmg-is-mobile .kmg-mobile-image-ready .kmg-list-primary {
    opacity: 0 !important;
    visibility: hidden !important;
}

html.kmg-is-mobile .kmg-mobile-image-ready .kmg-list-secondary {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* AJAX pagination in 1.1.8 writes image 2 directly into the primary img.
   This more specific rule overrides the legacy overlay fallback above. */
html.kmg-is-mobile .kmg-mobile-image-ready.kmg-mobile-direct-ready .kmg-list-primary {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

html.kmg-is-mobile .kmg-mobile-image-ready.kmg-mobile-direct-ready .kmg-list-secondary {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

.kmg-native-gallery-hidden {
    display: none !important;
}

/* Neutralise restrictive ZOneTheme gallery sizing. */
.page-product .images-container,
.page-product .images-container-wrapper,
.page-product .kmg-gallery-host,
.images-container > .kmg-gallery-host {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
}

/* Must override the more specific ZOneTheme wrapper rule above. */
.page-product .images-container > .kmg-native-gallery-hidden,
.page-product .images-container .images-container-wrapper.kmg-native-gallery-hidden,
.images-container > [data-kmg-native-gallery="1"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

/* Product page ----------------------------------------------------------- */
.kmg-gallery-host {
    --kmg-thumb-size: 82px;
    width: 100%;
    max-width: 100%;
}

.kmg-gallery {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: stretch;
    gap: 14px;
    width: 100%;
    min-width: 0;
}

.kmg-thumb-rail {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    width: 92px;
    min-width: 0;
    min-height: 0;
}

.kmg-thumb-scroll {
    appearance: none;
    -webkit-appearance: none;
    display: grid;
    place-items: center;
    flex: 0 0 28px;
    width: 42px;
    height: 28px;
    margin: 0 auto;
    padding: 0;
    border: 0;
    border-radius: 999px;
    color: #24272c;
    background: transparent;
    cursor: pointer;
    opacity: 0.72;
    transition:
        opacity var(--kmg-transition-ms) ease,
        background var(--kmg-transition-ms) ease,
        transform var(--kmg-transition-ms) ease;
}

.kmg-thumb-scroll svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.kmg-thumb-scroll:hover,
.kmg-thumb-scroll:focus-visible {
    opacity: 1;
    background: rgba(17, 24, 39, 0.07);
    outline: none;
}

.kmg-thumb-scroll:active {
    transform: scale(0.94);
}

.kmg-thumb-scroll:disabled {
    opacity: 0.12;
    cursor: default;
    pointer-events: none;
}

.kmg-thumb-rail.is-static .kmg-thumb-scroll {
    visibility: hidden;
}

.kmg-thumbs {
    display: flex;
    flex: 0 1 auto;
    flex-direction: column;
    gap: 9px;
    width: 92px;
    max-height: calc((var(--kmg-thumb-size) + 9px) * var(--kmg-visible-thumbs, 6) - 9px);
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
    scrollbar-width: none;
    padding: 3px 5px;
}

.kmg-thumbs::-webkit-scrollbar,
.kmg-lightbox-thumbs::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.kmg-thumb,
.kmg-lightbox-thumb {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    flex: 0 0 auto;
    margin: 0;
    padding: 3px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--kmg-surface);
    cursor: pointer;
    box-shadow: 0 1px 5px rgba(17, 24, 39, 0.09);
    transition:
        border-color var(--kmg-transition-ms) ease,
        box-shadow var(--kmg-transition-ms) ease,
        transform var(--kmg-transition-ms) ease,
        opacity var(--kmg-transition-ms) ease;
}

.kmg-thumb {
    width: var(--kmg-thumb-size);
    height: var(--kmg-thumb-size);
}

.kmg-thumb img,
.kmg-lightbox-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 5px;
    object-fit: contain;
    object-position: center;
    background: #fff;
}

.kmg-thumb:hover,
.kmg-thumb:focus-visible,
.kmg-lightbox-thumb:hover,
.kmg-lightbox-thumb:focus-visible {
    border-color: rgba(17, 24, 39, 0.38);
    box-shadow: 0 5px 16px rgba(17, 24, 39, 0.14);
    transform: translateY(-1px);
    outline: none;
}

.kmg-thumb.is-active,
.kmg-lightbox-thumb.is-active {
    border-color: var(--kmg-border-strong);
    box-shadow: 0 0 0 1px var(--kmg-border-strong), 0 5px 16px rgba(17, 24, 39, 0.13);
    opacity: 1;
}

.kmg-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    height: auto;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 7px;
    background: var(--kmg-surface-soft);
    box-shadow: 0 1px 0 rgba(17, 24, 39, 0.04);
    isolation: isolate;
}

.kmg-main-button {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: inherit;
    background: transparent;
    cursor: zoom-in;
    overflow: hidden;
}

.kmg-main-image {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    opacity: 1;
    transform: scale(1);
    transform-origin: 50% 50%;
    transition:
        opacity var(--kmg-transition-ms) cubic-bezier(.22, .61, .36, 1),
        transform calc(var(--kmg-transition-ms) + 70ms) cubic-bezier(.22, .61, .36, 1);
    will-change: transform, opacity;
    user-select: none;
    -webkit-user-drag: none;
}

.kmg-main-image.is-switching,
.kmg-lightbox-image.is-switching {
    opacity: 0.14;
}

html.kmg-is-desktop .kmg-stage.is-zoomed .kmg-main-image {
    transform: scale(var(--kmg-zoom-scale, 2));
}

.kmg-open-hint {
    position: absolute;
    right: 14px;
    bottom: 14px;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: 999px;
    color: #17191d;
    background: rgba(255, 255, 255, 0.84);
    box-shadow: var(--kmg-shadow-float);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: none;
    transition:
        opacity var(--kmg-transition-ms) ease,
        transform var(--kmg-transition-ms) ease;
}

.kmg-open-hint svg {
    display: block;
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.kmg-main-button:hover .kmg-open-hint {
    transform: translateY(-2px);
}

html.kmg-is-desktop .kmg-stage.is-zoomed .kmg-open-hint {
    opacity: 0;
    transform: scale(0.86);
}

/* Lightbox --------------------------------------------------------------- */
body.kmg-lightbox-open {
    overflow: hidden;
}

.kmg-lightbox[hidden] {
    display: none !important;
}

.kmg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: grid;
    place-items: center;
    opacity: 0;
    transition: opacity var(--kmg-transition-ms) ease;
}

.kmg-lightbox.is-open {
    opacity: 1;
}

.kmg-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: var(--kmg-overlay);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.kmg-lightbox-dialog {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 72px;
    grid-template-rows: minmax(0, 1fr) 96px;
    width: min(97vw, 1580px);
    height: min(96vh, 1080px);
    color: #fff;
}

.kmg-lightbox-stage {
    position: relative;
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    touch-action: pan-y;
}

.kmg-lightbox-image {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    opacity: 1;
    transform: scale(1);
    transform-origin: 50% 50%;
    transition:
        opacity var(--kmg-transition-ms) ease,
        transform var(--kmg-transition-ms) cubic-bezier(.22, .61, .36, 1);
    user-select: none;
    -webkit-user-drag: none;
}

.kmg-lightbox-stage.is-image-zoomed {
    touch-action: none;
}

.kmg-lightbox-stage.is-image-zoomed .kmg-lightbox-image {
    transform: scale(2);
}

.kmg-lightbox-close,
.kmg-lightbox-nav {
    appearance: none;
    -webkit-appearance: none;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 999px;
    color: #fff;
    background: rgba(255, 255, 255, 0.09);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    transition:
        background var(--kmg-transition-ms) ease,
        border-color var(--kmg-transition-ms) ease,
        transform var(--kmg-transition-ms) ease;
}

.kmg-lightbox-close:hover,
.kmg-lightbox-nav:hover,
.kmg-lightbox-close:focus-visible,
.kmg-lightbox-nav:focus-visible {
    border-color: rgba(255, 255, 255, 0.46);
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.05);
    outline: none;
}

.kmg-lightbox-close {
    position: absolute;
    z-index: 4;
    top: 10px;
    right: 10px;
    width: 48px;
    height: 48px;
    font-size: 32px;
    font-weight: 300;
    line-height: 1;
}

.kmg-lightbox-nav {
    align-self: center;
    width: 52px;
    height: 52px;
    font-size: 42px;
    font-weight: 300;
    line-height: 1;
}

.kmg-lightbox-prev {
    grid-column: 1;
    grid-row: 1;
    justify-self: center;
}

.kmg-lightbox-next {
    grid-column: 3;
    grid-row: 1;
    justify-self: center;
}

.kmg-lightbox-thumbs {
    grid-column: 1 / 4;
    grid-row: 2;
    display: flex;
    justify-content: center;
    gap: 9px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 11px 8px 4px;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.kmg-lightbox-thumb {
    width: 72px;
    height: 72px;
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: none;
    opacity: 0.66;
}

.kmg-lightbox-thumb.is-active {
    border-color: #fff;
    box-shadow: 0 0 0 1px #fff;
    opacity: 1;
}

.kmg-lightbox-counter {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.44);
    color: #fff;
    font-size: 12px;
    letter-spacing: 0.02em;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: none;
}

/* Mobile ----------------------------------------------------------------- */
html.kmg-is-mobile .kmg-gallery-host {
    --kmg-thumb-size: 72px;
    margin-bottom: 24px;
}

html.kmg-is-mobile .kmg-gallery {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

html.kmg-is-mobile .kmg-stage {
    order: 1;
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 1 / 1;
    border-radius: 6px;
}

html.kmg-is-mobile .kmg-main-button {
    cursor: pointer;
}

html.kmg-is-mobile .kmg-thumb-rail {
    order: 2;
    display: block;
    width: 100%;
}

html.kmg-is-mobile .kmg-thumb-scroll {
    display: none;
}

html.kmg-is-mobile .kmg-thumbs {
    flex-direction: row;
    width: 100%;
    max-width: 100%;
    height: calc(var(--kmg-thumb-size) + 8px);
    max-height: none;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 3px 4px 5px;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 4px;
    -webkit-overflow-scrolling: touch;
}

html.kmg-is-mobile .kmg-thumb {
    flex: 0 0 var(--kmg-mobile-thumb-basis, calc((100% - 24px) / 4));
    width: var(--kmg-mobile-thumb-basis, calc((100% - 24px) / 4));
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: 7px;
    scroll-snap-align: start;
}

html.kmg-is-mobile .kmg-lightbox-dialog {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) 84px;
    width: 100vw;
    height: 100dvh;
    max-height: 100vh;
}

html.kmg-is-mobile .kmg-lightbox-stage {
    grid-column: 1;
    grid-row: 1;
    padding: 56px 8px 8px;
    touch-action: pan-y;
}

html.kmg-is-mobile .kmg-lightbox-thumbs {
    grid-column: 1;
    grid-row: 2;
    justify-content: flex-start;
    padding: 7px 9px;
    scroll-snap-type: x proximity;
}

html.kmg-is-mobile .kmg-lightbox-thumb {
    width: 66px;
    height: 66px;
    scroll-snap-align: center;
}

html.kmg-is-mobile .kmg-lightbox-nav {
    display: none;
}

html.kmg-is-mobile .kmg-lightbox-close {
    top: 8px;
    right: 8px;
    width: 42px;
    height: 42px;
    font-size: 29px;
}

html.kmg-is-mobile .kmg-open-hint {
    right: 9px;
    bottom: 9px;
    width: 38px;
    height: 38px;
}

@media (min-width: 768px) and (max-width: 1199px) {
    .kmg-gallery-host {
        --kmg-thumb-size: 72px;
    }

    .kmg-gallery {
        grid-template-columns: 82px minmax(0, 1fr);
        gap: 11px;
    }

    .kmg-thumb-rail,
    .kmg-thumbs {
        width: 82px;
    }
}

@media (max-width: 575px) {
    html.kmg-is-mobile .kmg-gallery-host {
        --kmg-thumb-size: 66px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .kmg-list-image-host .kmg-list-primary,
    .kmg-list-image-host .kmg-list-secondary,
    .kmg-main-image,
    .kmg-lightbox-image,
    .kmg-lightbox,
    .kmg-thumb,
    .kmg-lightbox-thumb,
    .kmg-thumb-scroll,
    .kmg-open-hint {
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
