/* ============================================================
   LM Simple Lightbox — v1.0.0
   Lightweight responsive lightbox for WordPress / Divi
   ============================================================ */

/* Trigger link reset */
a.lm-slb-trigger {
    display: inline-block;
    cursor: zoom-in;
    border: none;
    text-decoration: none;
    line-height: 0;
}

/* ---- Overlay ---- */
#lm-slb-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, .92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    -webkit-tap-highlight-color: transparent;
}
#lm-slb-overlay.lm-open {
    opacity: 1;
    pointer-events: all;
}

/* ---- Stage ---- */
#lm-slb-stage {
    position: relative;
    max-width: 92vw;
    max-height: 88vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- Image ---- */
#lm-slb-img {
    display: block;
    max-width: 92vw;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0,0,0,.6);
    transition: opacity .22s ease, transform .22s ease;
    user-select: none;
    -webkit-user-drag: none;
}

/* Fade animation */
#lm-slb-overlay.anim-fade #lm-slb-img.lm-entering  { opacity: 0; }
#lm-slb-overlay.anim-fade #lm-slb-img.lm-visible   { opacity: 1; }

/* Slide animation */
#lm-slb-overlay.anim-slide #lm-slb-img.lm-entering  { opacity: 0; transform: translateX(60px); }
#lm-slb-overlay.anim-slide #lm-slb-img.lm-leaving   { opacity: 0; transform: translateX(-60px); }
#lm-slb-overlay.anim-slide #lm-slb-img.lm-visible   { opacity: 1; transform: translateX(0); }

/* Zoom animation */
#lm-slb-overlay.anim-zoom #lm-slb-img.lm-entering   { opacity: 0; transform: scale(.82); }
#lm-slb-overlay.anim-zoom #lm-slb-img.lm-visible    { opacity: 1; transform: scale(1); }

/* ---- Loader spinner ---- */
#lm-slb-loader {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: lm-spin .7s linear infinite;
    display: none;
}
#lm-slb-overlay.lm-loading #lm-slb-loader { display: block; }
#lm-slb-overlay.lm-loading #lm-slb-img    { opacity: 0; }

@keyframes lm-spin {
    to { transform: rotate(360deg); }
}

/* ---- Buttons ---- */
.lm-slb-btn {
    position: fixed;
    background: rgba(255,255,255,.1);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .18s ease, transform .18s ease;
    z-index: 1000001;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}
.lm-slb-btn:hover { background: rgba(255,255,255,.22); }
.lm-slb-btn:active { transform: scale(.93); }

/* Close */
#lm-slb-close {
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
}

/* Arrows */
#lm-slb-prev,
#lm-slb-next {
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 64px;
    border-radius: 4px;
    font-size: 28px;
}
#lm-slb-prev { left: 10px; }
#lm-slb-next { right: 10px; }
#lm-slb-prev:hover { transform: translateY(-50%) translateX(-2px); }
#lm-slb-next:hover { transform: translateY(-50%) translateX(2px); }

/* Single image — hide arrows */
#lm-slb-overlay.lm-single #lm-slb-prev,
#lm-slb-overlay.lm-single #lm-slb-next { display: none; }

/* ---- Footer bar (caption + counter) ---- */
#lm-slb-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 60px;
    background: linear-gradient(transparent, rgba(0,0,0,.65));
    color: #e8e8e8;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
    pointer-events: none;
    min-height: 44px;
    z-index: 1000000;
}
#lm-slb-caption { flex: 1; }
#lm-slb-counter {
    flex-shrink: 0;
    font-size: 12px;
    opacity: .7;
    white-space: nowrap;
}

/* ---- Touch drag hint ---- */
#lm-slb-overlay.lm-dragging { cursor: grabbing; }

/* ---- Responsive ---- */
@media (max-width: 600px) {
    #lm-slb-prev { left: 4px; width: 38px; height: 54px; font-size: 22px; }
    #lm-slb-next { right: 4px; width: 38px; height: 54px; font-size: 22px; }
    #lm-slb-close { top: 8px; right: 8px; width: 36px; height: 36px; font-size: 18px; }
    #lm-slb-footer { font-size: 13px; padding: 8px 48px; }
    #lm-slb-img { max-height: 75vh; }
}

/* ---- Accessibility: reduced-motion ---- */
@media (prefers-reduced-motion: reduce) {
    #lm-slb-overlay,
    #lm-slb-img { transition: none !important; }
}
