/* =========================================================
   BioCell12 – Styles
   ========================================================= */

.biocell12-wrapper {
    --bio-transition: 600ms cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    width: 100%;
}

.biocell12-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
}

.biocell12-item {
    position: relative;
    width: 100%;
    height: 480px;
    overflow: hidden;
    border-radius: 0;
    background: #0c0f0d;
    cursor: pointer;
    isolation: isolate;
    touch-action: pan-y; /* erlaubt vertikales Scrollen, Horizontal/Pinch für Widget reserviert */
}

.biocell12-source-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0; /* Quellbild bleibt unsichtbar, dient nur als Texturquelle für Canvas */
    pointer-events: none;
    user-select: none;
}

.biocell12-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    transform: translateZ(0);
    will-change: transform, opacity;
    transition: filter var(--bio-transition);
}

/* Eintritts-Animation: Canvas blendet sanft ein, Zellen wachsen via JS von 0 */
.biocell12-item.has-entrance .biocell12-canvas {
    opacity: 0;
    transition: opacity 500ms ease;
}
.biocell12-item.has-entrance.is-visible .biocell12-canvas {
    opacity: 1;
}

/* Mikro-Tooltip pro Zelle */
.biocell12-tooltip {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    padding: 4px 10px;
    font-size: 12px;
    line-height: 1.4;
    color: #08130d;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 999px;
    white-space: nowrap;
    transform: translate(-50%, calc(-100% - 10px));
    opacity: 0;
    transition: opacity 150ms ease;
    backdrop-filter: blur(2px);
}

.biocell12-item.tooltip-active .biocell12-tooltip {
    opacity: 1;
}

/* Ladezustand: dezenter Organik-Puls, bevor Canvas bereit ist */
.biocell12-item:not(.is-ready) .biocell12-canvas {
    animation: biocell12-loading-pulse 1.8s ease-in-out infinite;
    background: radial-gradient(circle at 50% 50%, rgba(120,200,160,0.25), rgba(10,15,12,0.6));
}

@keyframes biocell12-loading-pulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 0.85; }
}

/* Burst-Overlay: weicher Lichtimpuls beim "Platzen" einer Zelle */
.biocell12-burst-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at var(--burst-x, 50%) var(--burst-y, 50%), rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.0) 45%);
    opacity: 0;
    mix-blend-mode: screen;
    transform: scale(0.6);
    transition: opacity 280ms ease-out, transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 3;
}

.biocell12-item.is-bursting .biocell12-burst-overlay {
    opacity: 1;
    transform: scale(2.4);
}

.biocell12-item.is-bursting .biocell12-canvas {
    filter: blur(2px) brightness(1.15);
}

.biocell12-item.is-leaving .biocell12-canvas,
.biocell12-item.is-leaving .biocell12-burst-overlay {
    opacity: 0;
    transition: opacity 350ms ease-in;
}

/* Caption */
.biocell12-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 14px 18px;
    font-size: 15px;
    line-height: 1.4;
    color: #fff;
    background: linear-gradient(to top, rgba(0,0,0,0.55), rgba(0,0,0,0));
    z-index: 4;
    pointer-events: none;
    transform: translateY(0);
    transition: transform 400ms ease, opacity 400ms ease;
}

.biocell12-item.is-bursting .biocell12-caption {
    opacity: 0;
    transform: translateY(12px);
}

/* =========================================================
   Lightbox
   ========================================================= */
.biocell12-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 420ms ease, visibility 420ms ease;
}

.biocell12-lightbox.is-active {
    opacity: 1;
    visibility: visible;
}

.biocell12-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 10, 8, 0.92);
    backdrop-filter: blur(6px);
}

.biocell12-lightbox-content {
    position: relative;
    max-width: 92vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: scale(0.85);
    opacity: 0;
    transition: transform 520ms cubic-bezier(0.16, 1, 0.3, 1), opacity 420ms ease;
}

.biocell12-lightbox.is-active .biocell12-lightbox-content {
    transform: scale(1);
    opacity: 1;
}

.biocell12-lightbox-img {
    max-width: 92vw;
    max-height: 78vh;
    border-radius: 6px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.6);
    object-fit: contain;
}

.biocell12-lightbox-caption {
    margin-top: 14px;
    color: #f1f1f1;
    font-size: 15px;
    text-align: center;
    max-width: 80vw;
}

.biocell12-lightbox-close {
    position: absolute;
    top: -42px;
    right: -8px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 200ms ease, transform 200ms ease;
}

.biocell12-lightbox-close:hover {
    background: rgba(255,255,255,0.25);
    transform: rotate(90deg);
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1024px) {
    .biocell12-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .biocell12-item {
        height: 380px;
    }
}

@media (max-width: 767px) {
    .biocell12-grid {
        grid-template-columns: 1fr;
    }
    .biocell12-item {
        height: 320px;
    }
    .biocell12-lightbox-close {
        top: -48px;
        right: 0;
    }
}

/* Reduzierte Bewegung – Barrierefreiheit */
@media (prefers-reduced-motion: reduce) {
    .biocell12-canvas,
    .biocell12-burst-overlay,
    .biocell12-lightbox-content,
    .biocell12-caption {
        transition: none !important;
        animation: none !important;
    }
}
