/* Kaleidoscl v9.1 */

.kal-wrap {
    position: relative;
    width: 100%;
    height: 550px;
    display: block;
    overflow: hidden;
    background: #0d0d2b;
    /* NO transform here — transform creates stacking context which breaks
       z-index of catcher div in body. iOS perf handled by will-change on canvas. */
}
.kal-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: block;
    cursor: grab;
    will-change: transform; /* GPU hint for iOS without creating stacking context on wrap */
}
.kal-canvas:active { cursor: grabbing; }

.kal-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    transition: background .4s ease;
    z-index: 2;
}

/* Lightbox trigger — always visible when pinned (opacity controlled via JS float btn) */
.kal-lb-btn {
    position: absolute;
    bottom: 1rem; right: 1rem;
    z-index: 10;
    width: 2.4rem; height: 2.4rem;
    border: none; border-radius: 50%;
    background: rgba(0,0,0,.55); color: #fff;
    cursor: pointer; padding: .4rem;
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity .25s, background .2s;
    backdrop-filter: blur(4px);
}
.kal-wrap:hover .kal-lb-btn { opacity: 1; }
.kal-lb-btn svg { width: 100%; height: 100%; }

/* Float button (cloned to body for pinned mode) */
.kal-lb-float {
    position: fixed;
    bottom: 1.2rem; right: 1.2rem;
    z-index: 102;
    width: 2.8rem; height: 2.8rem;
    border: none; border-radius: 50%;
    background: rgba(0,0,0,.65); color: #fff;
    cursor: pointer; padding: .45rem;
    align-items: center; justify-content: center;
    transition: opacity .3s, background .2s;
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 12px rgba(0,0,0,.4);
    display: none; /* shown via JS when scene is visible */
}
.kal-lb-float:hover { background: rgba(0,0,0,.9); }
.kal-lb-float svg { width: 100%; height: 100%; }

/* Lightbox overlay */
.kal-lightbox {
    position: fixed; inset: 0; z-index: 999999;
    display: none; align-items: center; justify-content: center;
}
.kal-lightbox.is-open { display: flex; }
.kal-lb-back {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.9);
    backdrop-filter: blur(8px);
    cursor: pointer;
}
.kal-lb-inner {
    position: relative; z-index: 1;
    display: flex; align-items: center; justify-content: center;
}
.kal-lb-track { display: grid; grid-template-areas: "s"; }
.kal-lb-slide {
    grid-area: s; margin: 0;
    opacity: 0; pointer-events: none;
    transition: opacity .3s ease;
    display: flex; flex-direction: column; align-items: center;
}
.kal-lb-slide.is-active { opacity: 1; pointer-events: auto; }
.kal-lb-slide img {
    max-width: 88vw; max-height: 82vh;
    object-fit: contain; border-radius: 4px;
    box-shadow: 0 8px 48px rgba(0,0,0,.7);
    display: block;
}
.kal-lb-slide figcaption {
    margin-top: .6rem; color: rgba(255,255,255,.75);
    font-size: .875rem; text-align: center; max-width: 60ch;
}
.kal-lb-close,
.kal-lb-prev,
.kal-lb-next {
    position: absolute; border: none;
    background: rgba(255,255,255,.1); color: #fff;
    font-size: 1.3rem; cursor: pointer; border-radius: 50%;
    width: 2.6rem; height: 2.6rem;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s; backdrop-filter: blur(4px); z-index: 2;
    line-height: 1;
}
.kal-lb-close:hover, .kal-lb-prev:hover, .kal-lb-next:hover { background: rgba(255,255,255,.25); }
.kal-lb-close { top: -3.2rem; right: 0; }
.kal-lb-prev  { left: -3.2rem; top: 50%; transform: translateY(-50%); }
.kal-lb-next  { right: -3.2rem; top: 50%; transform: translateY(-50%); }

@media (max-width: 767px) {
    .kal-lb-prev { left: -2.4rem; }
    .kal-lb-next { right: -2.4rem; }
    .kal-lb-close { top: -2.6rem; }
}
@media (prefers-reduced-motion: reduce) {
    .kal-canvas { animation: none !important; }
}

/* Lightbox: pointer cursor when clicking scene opens gallery */
.kal-wrap[data-kal-lb="1"] .kal-canvas,
.kal-catcher-lb { cursor: pointer !important; }

/* Video slide in lightbox */
.kal-lb-slide--video {
    display: flex;
    align-items: center;
    justify-content: center;
}
.kal-lb-slide--video video {
    max-width: 88vw;
    max-height: 82vh;
}
