/**
 * Product Gallery
 *
 * Sections are ordered from the page gallery to its thumbnail controls and
 * then to PhotoSwipe's lightbox-specific overrides.
 */

/* Gallery layout */
.product-gallery {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    gap: 0.75rem;
}

.product-gallery__main {
    width: 100%;
    min-width: 0;
}

.product-gallery__main:not(.slick-initialized) .product-gallery__slide:not(:first-child) {
    display: none;
}

.product-gallery__main-image {
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* Thumbnail grid */
.product-gallery__thumbs {
    position: relative;
}

.product-gallery__thumbs:not(.slick-initialized) {
    display: flex;
    flex-wrap: wrap;
}

/* 0.2rem padding keeps the visible image at the pre-Slick size:
   20% - 2*0.2rem - border matches the old flex-basis calc(20% - 0.4rem) */
.product-gallery__thumb {
    position: relative;
    box-sizing: border-box;
    width: 20%;
    aspect-ratio: 1 / 1;
    padding: 0.2rem;
    border: 2px solid transparent;
    background: none;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s ease, border-color 0.2s ease;
}

.product-gallery__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-gallery__thumb.is-active {
    opacity: 1;
}

.product-gallery__thumbs .slick-arrow {
    position: absolute;
    top: 50%;
    z-index: 1;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transform: translateY(-50%);
}

.product-gallery__thumbs .slick-prev {
    left: 0;
}

.product-gallery__thumbs .slick-next {
    right: 0;
}

.product-gallery__thumbs .slick-disabled {
    cursor: default;
    opacity: 0;
    pointer-events: none;
}

/* Hero links and media indicators */
.product-gallery__hero-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    cursor: zoom-in;
}

.product-gallery__hero-link--video {
    aspect-ratio: 4 / 3;
    background: #f5f5f5;
    cursor: pointer;
}

.product-gallery__thumb--video {
    background: none;
}

.product-gallery__thumb-video-placeholder {
    display: block;
    width: 100%;
    height: 100%;
    background: #c8c8c8;
}

.product-gallery__play-icon,
.product-gallery__thumb-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #515151;
    pointer-events: none;
    transform: translate(-50%, -50%);
}

.product-gallery__play-icon {
    width: 4rem;
    height: 4rem;
    font-size: 2.5rem;
}

.product-gallery__thumb-play-icon {
    width: 2rem;
    height: 2rem;
    font-size: 1.25rem;
}

/* PhotoSwipe video content */
.pswp {
    --pswp-bg: #000;
}

.pswp__vlite-video-container {
    position: relative;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.pswp__vlite-video-container > video,
.pswp__vlite-video-container > .v-vlite {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: auto;
}

.pswp__vlite-video-container > .v-vlite {
    --vlite-colorPrimary: var(--kopp-blue);
}

/* Match PhotoSwipe's fitted media sizing outside the Fullscreen API. */
.pswp:not(.pswp--fullscreen-api) .pswp__vlite-video-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.pswp:not(.pswp--fullscreen-api) .pswp__vlite-video-container > video,
.pswp:not(.pswp--fullscreen-api) .pswp__vlite-video-container > .v-vlite {
    width: 100%;
    height: auto;
    max-height: 100%;
    aspect-ratio: 16 / 9;
}

/* PhotoSwipe controls */
.pswp__button--close,
.pswp__button--arrow--prev,
.pswp__button--arrow--next,
.pswp__button--fullscreen-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hide default PhotoSwipe SVG icons. */
.pswp__button--close svg,
.pswp__button--arrow--prev svg,
.pswp__button--arrow--next svg {
    display: none;
}

.pswp__button--close::before,
.pswp__button--arrow--prev::before,
.pswp__button--arrow--next::before {
    font-family: "Font Awesome 7 Free";
    font-weight: 900;
    font-size: 16px;
    color: #fff;
    opacity: 0.85;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* FontAwesome icons for the built-in PhotoSwipe buttons. */
.pswp__button--close::before {
    content: "\f00d";
}

.pswp__button--arrow--prev::before {
    content: "\f060";
}

.pswp__button--arrow--next::before {
    content: "\f061";
}

.pswp__button--close:hover::before,
.pswp__button--arrow--prev:hover::before,
.pswp__button--arrow--next:hover::before {
    opacity: 1;
}

.pswp__button--fullscreen-toggle {
    width: 44px;
    height: 44px;
    cursor: pointer;
}

.pswp__button--fullscreen-toggle .fa-solid {
    font-size: 16px;
    color: #fff;
    opacity: 0.85;
}

.pswp__button--fullscreen-toggle:hover .fa-solid {
    opacity: 1;
}

/* PhotoSwipe captions */
.hidden-caption-content {
    display: none;
}

.pswp__custom-caption {
    position: absolute;
    left: 50%;
    bottom: 16px;
    width: calc(100% - 32px);
    max-width: 400px;
    padding: 8px 16px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 16px;
    text-align: center;
    transform: translateX(-50%);
}

.pswp__custom-caption:empty {
    display: none;
}

/* YouTube consent notice (Borlabs Cookie) */
.pswp__vlite-video-container .product-gallery__consent-notice {
    position: absolute;
    top: 50%;
    left: 50%;
    box-sizing: border-box;
    width: min(32rem, calc(100% - 2rem));
    padding: clamp(1.25rem, 4vw, 2rem);
    pointer-events: auto;
    border: 1px solid var(--kopp-light-gray);
    border-left: 3px solid var(--kopp-blue);
    background: var(--kopp-white);
    box-shadow: 0 0.75rem 2rem var(--kopp-shadow-10);
    color: var(--kopp-blue);
    font-family: 'Open Sans', sans-serif;
    text-align: left;
    transform: translate(-50%, -50%);
}

.product-gallery__consent-notice[hidden] {
    display: none;
}

.product-gallery__consent-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    margin-bottom: 1.25rem;
    border-radius: 50%;
    background: var(--kopp-blue);
    color: var(--kopp-white);
    font-size: 1rem;
}

.product-gallery__consent-notice .brlbs-cmpnt-cb-main {
    display: block;
    padding: 0;
    background: transparent;
}

.product-gallery__consent-notice .brlbs-cmpnt-cb-content,
.product-gallery__consent-notice .brlbs-cmpnt-cb-description {
    display: block;
    margin: 0;
    color: var(--kopp-blue);
    font-size: 1rem;
    line-height: 1.625;
    text-align: left;
}

.product-gallery__consent-notice .brlbs-cmpnt-cb-provider-toggle {
    display: inline-block;
    margin-top: 0.5rem;
    color: var(--kopp-blue);
    font-size: 0.875rem;
    text-decoration: underline;
}

.product-gallery__consent-notice .brlbs-cmpnt-cb-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.product-gallery__consent-notice .brlbs-cmpnt-cb-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 44px;
    padding: 0.6rem 1.25rem;
    border: 1px solid var(--kopp-blue);
    background: var(--kopp-white);
    color: var(--kopp-blue);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.product-gallery__consent-notice .brlbs-cmpnt-cb-btn[data-borlabs-cookie-accept-service],
.product-gallery__consent-notice .brlbs-cmpnt-cb-btn:hover {
    background: var(--kopp-blue);
    color: var(--kopp-white);
}

.product-gallery__consent-notice .brlbs-cmpnt-cb-btn[data-borlabs-cookie-accept-service]:hover {
    background: var(--kopp-white);
    color: var(--kopp-blue);
}

.product-gallery__consent-notice a:focus-visible {
    outline: 2px solid var(--kopp-blue);
    outline-offset: 2px;
}
