/* ─────────────────────────────────────────────
   FluidTrail56 — Frontend Styles
   ───────────────────────────────────────────── */

/* Wrapper */
.ft56-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    /* ensure canvas sits over grid */
    isolation: isolate;
}

/* Offscreen Canvas Overlay */
.ft56-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    border-radius: inherit;
    /* mix-mode so trail blends with background */
    mix-blend-mode: multiply;
    opacity: 1;
    will-change: contents;
}

/* Grid */
.ft56-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    z-index: 1;
    width: 100%;
}

/* Gallery Item */
.ft56-item {
    position: relative;
    overflow: hidden;
    cursor: crosshair;
    border-radius: 8px;
    background: #111;
    transform: translateZ(0);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.35s ease;
    will-change: transform;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.ft56-item:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.ft56-item img {
    display: block;
    width: 100%;
    height: 260px;
    object-fit: cover;
    pointer-events: none;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    border-radius: inherit;
}

/* Float animation when fluid is near */
.ft56-item.ft56-floating {
    transform: translateY(-6px) scale(1.025);
    box-shadow: 0 20px 60px rgba(0,0,0,0.35), 0 8px 20px rgba(0,0,0,0.2);
}

.ft56-item.ft56-floating img {
    transform: scale(1.04);
}

/* Caption overlay */
.ft56-caption {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 10px 14px;
    background: linear-gradient(transparent, rgba(0,0,0,0.72));
    color: #fff;
    font-size: 0.85rem;
    font-family: inherit;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    border-radius: 0 0 inherit inherit;
}

.ft56-item:hover .ft56-caption,
.ft56-item:focus-visible .ft56-caption {
    opacity: 1;
    transform: translateY(0);
}

/* ── Lightbox ── */
.ft56-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.ft56-lb-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    animation: ft56FadeIn 0.35s ease forwards;
}

/* Dive-in open animation */
@keyframes ft56FadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes ft56ScaleIn {
    from { opacity: 0; transform: scale(0.8) translateY(30px); }
    to   { opacity: 1; transform: scale(1)   translateY(0); }
}

@keyframes ft56Dive {
    from { opacity: 1; transform: scale(1)   translateY(0); }
    to   { opacity: 0; transform: scale(1.15) translateY(-20px); }
}

.ft56-lb-inner {
    position: relative;
    z-index: 1;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: ft56ScaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.ft56-lb-inner.ft56-closing {
    animation: ft56Dive 0.35s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}

/* Close button */
.ft56-lb-close {
    position: absolute;
    top: -42px;
    right: 0;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    width: 38px; height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s ease;
    padding: 0;
}

.ft56-lb-close:hover {
    background: rgba(255,255,255,0.28);
}

/* Image wrapper — enables pinch-zoom on mobile */
.ft56-lb-img-wrap {
    overflow: hidden;
    border-radius: 10px;
    touch-action: pinch-zoom;
    cursor: zoom-in;
}

.ft56-lb-img {
    display: block;
    max-width: 90vw;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 30px 90px rgba(0,0,0,0.6);
    /* allow touch-zoom via CSS zoom hack on mobile */
    touch-action: pinch-zoom;
    user-select: none;
    -webkit-user-drag: none;
}

/* Caption in lightbox */
.ft56-lb-caption {
    color: rgba(255,255,255,0.78);
    font-size: 0.9rem;
    margin-top: 12px;
    text-align: center;
    max-width: 70vw;
    font-family: inherit;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .ft56-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .ft56-item img {
        height: 180px;
    }
    .ft56-lb-img {
        max-width: 98vw;
        max-height: 75vh;
    }
    .ft56-lb-close {
        top: -46px;
        right: -4px;
    }
}

@media (max-width: 480px) {
    .ft56-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .ft56-item img {
        height: 220px;
    }
}

/* Elementor editor helper */
.elementor-editor-active .ft56-canvas {
    pointer-events: none;
}
