/* ===================================================
   JSÍ Lightbox
   =================================================== */

/* Image alignment — left/right/center */
.entry-content .alignleft {
    float: left;
    margin: .25rem 1.5rem 1rem 0;
    max-width: 50%;
}

.entry-content .alignright {
    float: right;
    margin: .25rem 0 1rem 1.5rem;
    max-width: 50%;
}

.entry-content .aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
    clear: both;
}

.entry-content .alignnone {
    margin: 1.5rem 0;
}

/* Figures / captions */
.entry-content figure.alignleft,
.entry-content figure.alignright {
    margin-top: .5rem;
}

.entry-content figcaption,
.entry-content .wp-caption-text {
    font-size: .8rem;
    color: var(--color-gray-500);
    margin-top: .4rem;
    line-height: 1.4;
    text-align: center;
}

.entry-content .wp-caption {
    max-width: 100%;
}

.entry-content .wp-caption.alignleft {
    float: left;
    margin: .25rem 1.5rem 1rem 0;
}

.entry-content .wp-caption.alignright {
    float: right;
    margin: .25rem 0 1rem 1.5rem;
}

/* Clickable images cursor */
.entry-content a > img,
.entry-content a:has(> img) {
    cursor: zoom-in;
}

/* Gallery grid */
.entry-content .gallery {
    display: grid;
    gap: .5rem;
    margin: 1.5rem 0;
    clear: both;
}

.entry-content .gallery-columns-1 { grid-template-columns: 1fr; }
.entry-content .gallery-columns-2 { grid-template-columns: repeat(2, 1fr); }
.entry-content .gallery-columns-3 { grid-template-columns: repeat(3, 1fr); }
.entry-content .gallery-columns-4 { grid-template-columns: repeat(4, 1fr); }
.entry-content .gallery-columns-5 { grid-template-columns: repeat(5, 1fr); }
.entry-content .gallery-columns-6 { grid-template-columns: repeat(6, 1fr); }

.entry-content .gallery .gallery-item {
    margin: 0;
}

.entry-content .gallery .gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    cursor: zoom-in;
    transition: transform .2s ease, box-shadow .2s ease;
}

.entry-content .gallery .gallery-item img:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

.entry-content .gallery .gallery-caption {
    font-size: .75rem;
    color: var(--color-gray-500);
    padding: .35rem .25rem 0;
    text-align: center;
}

/* WP Block Gallery (Gutenberg) */
.entry-content .wp-block-gallery {
    gap: .5rem;
    margin: 1.5rem 0;
}

.entry-content .wp-block-gallery .wp-block-image img {
    border-radius: var(--radius-sm);
    cursor: zoom-in;
    transition: transform .2s ease, box-shadow .2s ease;
}

.entry-content .wp-block-gallery .wp-block-image img:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

/* Clearfix after floats */
.entry-content::after {
    content: '';
    display: table;
    clear: both;
}

@media (max-width: 768px) {
    .entry-content .alignleft,
    .entry-content .alignright,
    .entry-content .wp-caption.alignleft,
    .entry-content .wp-caption.alignright {
        float: none;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        margin-bottom: 1rem;
    }

    .entry-content .gallery-columns-4,
    .entry-content .gallery-columns-5,
    .entry-content .gallery-columns-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .entry-content .gallery-columns-3,
    .entry-content .gallery-columns-4,
    .entry-content .gallery-columns-5,
    .entry-content .gallery-columns-6 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===================================================
   LIGHTBOX OVERLAY
   =================================================== */
.jsi-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 15, 26, .92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
    cursor: zoom-out;
}

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

/* Image container */
.jsi-lightbox__image-wrap {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    cursor: default;
}

.jsi-lightbox__image-wrap img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0,0,0,.4);
    opacity: 0;
    transform: scale(.95);
    transition: opacity .3s ease, transform .3s ease;
}

.jsi-lightbox.is-active .jsi-lightbox__image-wrap img {
    opacity: 1;
    transform: scale(1);
}

/* Caption */
.jsi-lightbox__caption {
    position: absolute;
    bottom: -2.5rem;
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(255,255,255,.65);
    font-size: .85rem;
    line-height: 1.4;
    pointer-events: none;
}

/* Counter */
.jsi-lightbox__counter {
    position: absolute;
    top: 1.25rem;
    left: 1.5rem;
    color: rgba(255,255,255,.5);
    font-size: .85rem;
    font-weight: 600;
    letter-spacing: .03em;
    pointer-events: none;
}

/* Close button */
.jsi-lightbox__close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: background .2s ease;
    z-index: 2;
}

.jsi-lightbox__close:hover {
    background: rgba(255,255,255,.2);
}

.jsi-lightbox__close svg {
    width: 20px;
    height: 20px;
}

/* Prev / Next arrows */
.jsi-lightbox__prev,
.jsi-lightbox__next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: all .2s ease;
    z-index: 2;
}

.jsi-lightbox__prev { left: 1.25rem; }
.jsi-lightbox__next { right: 1.25rem; }

.jsi-lightbox__prev:hover,
.jsi-lightbox__next:hover {
    background: var(--color-red, #C8102E);
    border-color: var(--color-red, #C8102E);
}

.jsi-lightbox__prev svg,
.jsi-lightbox__next svg {
    width: 22px;
    height: 22px;
}

/* Hide arrows when only one image */
.jsi-lightbox__prev.is-hidden,
.jsi-lightbox__next.is-hidden,
.jsi-lightbox__counter.is-hidden {
    display: none;
}

/* Loading spinner */
.jsi-lightbox__spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,.15);
    border-top-color: #fff;
    border-radius: 50%;
    animation: jsi-spin .7s linear infinite;
    pointer-events: none;
}

.jsi-lightbox__spinner.is-hidden { display: none; }

@keyframes jsi-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .jsi-lightbox__prev,
    .jsi-lightbox__next {
        width: 42px;
        height: 42px;
    }

    .jsi-lightbox__prev { left: .5rem; }
    .jsi-lightbox__next { right: .5rem; }

    .jsi-lightbox__image-wrap img {
        max-width: 95vw;
        max-height: 80vh;
    }

    .jsi-lightbox__counter {
        top: .75rem;
        left: 1rem;
        font-size: .78rem;
    }
}
