/* =====================================================
   OKT Gallery Widget
   ===================================================== */

/* ── Wrapper ─────────────────────────────────────── */
.okt-gallery-wrapper {
    width: 100%;
}

/* ── Grid layout ─────────────────────────────────── */
.okt-gallery-grid {
    --okt-gallery-columns: 3;
    --okt-gallery-gap: 12px;
    --okt-gallery-ratio: none;
}

.okt-gallery-layout--grid {
    display: grid;
    grid-template-columns: repeat( var(--okt-gallery-columns), 1fr );
    gap: var(--okt-gallery-gap);
}

/* ── Masonry layout ──────────────────────────────── */
.okt-gallery-layout--masonry {
    /* Packery takes over; just needs relative positioning */
    position: relative;
}

.okt-gallery-layout--masonry .okt-gallery-item {
    width: calc( ( 100% - ( var(--okt-gallery-columns) - 1 ) * var(--okt-gallery-gap) ) / var(--okt-gallery-columns) );
    margin-bottom: var(--okt-gallery-gap);
    float: left; /* fallback before Packery inits */
}

.okt-gallery-masonry-sizer {
    width: calc( ( 100% - ( var(--okt-gallery-columns) - 1 ) * var(--okt-gallery-gap) ) / var(--okt-gallery-columns) );
}

.okt-gallery-masonry-gutter {
    width: var(--okt-gallery-gap);
}

/* Clear float fallback */
.okt-gallery-layout--masonry::after {
    content: '';
    display: table;
    clear: both;
}

/* ── Item inner ──────────────────────────────────── */
.okt-gallery-item__inner {
    position: relative;
    overflow: hidden;
    display: block;
    width: 100%;
}

/* ── Aspect ratio (grid only) ────────────────────── */
.okt-gallery-layout--grid[style*="--okt-gallery-ratio"] .okt-gallery-item__inner {
    aspect-ratio: var(--okt-gallery-ratio);
}

.okt-gallery-layout--grid[style*="--okt-gallery-ratio"] .okt-gallery-item__inner img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Natural height (no ratio) ───────────────────── */
.okt-gallery-item__inner img {
    display: block;
    width: 100%;
    height: auto;
}

/* ── Link ────────────────────────────────────────── */
.okt-gallery-item__link {
    display: block;
    line-height: 0;
}

/* ── Overlay ─────────────────────────────────────── */
.okt-gallery-item__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: rgba(0, 0, 0, 0.4);
    transition: opacity 0.3s ease;
    pointer-events: none;
}

/* On hover */
.okt-gallery-wrapper[data-overlay-show="hover"] .okt-gallery-item__overlay {
    opacity: 0;
}
.okt-gallery-wrapper[data-overlay-show="hover"] .okt-gallery-item:hover .okt-gallery-item__overlay {
    opacity: 1;
}

/* Always */
.okt-gallery-wrapper[data-overlay-show="always"] .okt-gallery-item__overlay {
    opacity: 1;
}

/* ── Overlay icon ────────────────────────────────── */
.okt-gallery-item__overlay-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    line-height: 1;
}

/* ── Caption (inside overlay) ────────────────────── */
.okt-gallery-item__caption {
    display: block;
    color: #fff;
    font-size: 14px;
    text-align: center;
    padding: 4px 12px;
    line-height: 1.4;
}

/* Caption below image (no overlay) */
.okt-gallery-item__caption--below {
    position: static;
    color: inherit;
    padding: 6px 0 0;
}

/* ── Hidden items (load more) ────────────────────── */
.okt-gallery-item--hidden {
    display: none !important;
}

/* ── Load More button wrapper ────────────────────── */
.okt-gallery-load-more-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 32px;
}

/* ── Load More button ────────────────────────────── */
.okt-gallery-load-more {
    display: inline-block;
    cursor: pointer;
    border: 1px solid currentColor;
    background: transparent;
    padding: 10px 28px;
    font-size: 14px;
    line-height: 1.5;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.okt-gallery-load-more:hover {
    opacity: 0.8;
}
