/* =====================================================
   Simple Gallery — Frontend Styles
===================================================== */

.sg-wrap {
    width: 100%;
    margin: 0 auto 40px;
    font-family: inherit;
    box-sizing: border-box;
}

/* ── Title ── */
.sg-title {
    text-align: center;
    font-size: 2.2em;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    margin-bottom: 18px;
}

/* ── Filter Tabs ── */
.sg-filters {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 36px;
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 0;
}

.sg-filter {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: .82em;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 10px 22px 12px;
    color: #999;
    margin-bottom: -1px;
    transition: color .25s, border-color .25s;
    outline: none;
    font-family: inherit;
    line-height: 1;
}
.sg-filter:hover {
    color: #333;
}
.sg-filter.active {
    color: #c0392b;
    border-bottom-color: #c0392b;
}
/* "All" button — accent color when active */
.sg-filter[data-filter="all"].active {
    color: #c0392b;
    border-bottom-color: #c0392b;
}
.sg-filter[data-filter="all"] {
    color: #c0392b;
}

/* ── Masonry Grid Container ── */
.sg-masonry {
    position: relative;
    width: 100%;
    /* height set by JS */
}

/* ── Grid Item ──
   KEY: overflow:hidden on the ITEM clips the image zoom correctly
   without clipping the item itself from outside
── */
.sg-item {
    position: absolute;
    overflow: hidden;          /* clips hover zoom to image edges — no bleed */
    transition:
        opacity   .55s ease,
        transform .55s cubic-bezier(.4, 0, .2, 1),
        left      .6s  cubic-bezier(.4, 0, .2, 1),
        top       .6s  cubic-bezier(.4, 0, .2, 1),
        width     .6s  cubic-bezier(.4, 0, .2, 1);
    transform-origin: center top;
    will-change: opacity, transform, top, left;
}

.sg-item.sg-hidden {
    opacity: 0 !important;
    transform: scale(.82) !important;
    pointer-events: none;
}

/* ── Image link — full block, no decoration ── */
.sg-wrap .sg-trigger {
    display: block;
    position: relative;
    text-decoration: none !important;
    line-height: 0;
    cursor: pointer;
}

/* ── Image — fills item ── */
.sg-wrap .sg-trigger img {
    display: block;
    width: 100%;
    height: auto;
    -webkit-transition: -webkit-transform .55s cubic-bezier(.25, 1, .5, 1);
    transition: transform .55s cubic-bezier(.25, 1, .5, 1);
    margin: 0;
    padding: 0;
}

.sg-wrap .sg-trigger img.sg-img-zoom {
    -webkit-transform: scale(1.06);
    transform: scale(1.06);
}

/* ── Hover overlay — dark tint ── */
.sg-wrap .sg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, .32);
    opacity: 0 !important;
    visibility: hidden !important;
    transition: opacity .4s ease, visibility .4s ease;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    pointer-events: none;
    z-index: 2;
}

.sg-wrap .sg-overlay.sg-overlay-visible {
    opacity: 1 !important;
    visibility: visible !important;
}

/* ── no icon — overlay only ── */

/* ── Loading state — grid invisible until JS lays out ── */
.sg-masonry {
    opacity: 0;
    transition: opacity .35s ease;
}
.sg-wrap.sg-ready .sg-masonry {
    opacity: 1;
}

/* =====================================================
   LIGHTBOX
===================================================== */

.sg-lb {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
}
.sg-lb.sg-lb-open {
    display: flex;
}

/* Backdrop */
.sg-lb-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.92);
    opacity: 0;
    transition: opacity .55s ease;
}
.sg-lb.sg-lb-anim .sg-lb-backdrop {
    opacity: 1;
}

/* Content panel */
.sg-lb-panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90vw;
    max-height: 90vh;
    opacity: 0;
    transform: translateY(26px) scale(.93);
    transition:
        opacity   .55s cubic-bezier(.4, 0, .2, 1) .07s,
        transform .62s cubic-bezier(.34, 1.35, .64, 1) .07s;
}
.sg-lb.sg-lb-anim .sg-lb-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* The image */
.sg-lb-img {
    display: block;
    max-width: 88vw;
    max-height: 80vh;
    object-fit: contain;
    box-shadow:
        0 4px 14px  rgba(0,0,0,.35),
        0 16px 50px rgba(0,0,0,.55),
        0 40px 90px rgba(0,0,0,.3);
    opacity: 0;
    transition: opacity .3s ease;
}
.sg-lb-img.sg-lb-img-visible {
    opacity: 1;
}

/* Accent line above image */
.sg-lb-img-wrap {
    position: relative;
    line-height: 0;
}
.sg-lb-img-wrap::before {
    content: '';
    position: absolute;
    top: -3px; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
    opacity: 0;
    transition: opacity .5s ease .4s;
}
.sg-lb.sg-lb-anim .sg-lb-img-wrap::before {
    opacity: 1;
}

/* Caption */
.sg-lb-caption {
    margin-top: 12px;
    color: rgba(255,255,255,.55);
    font-size: .78em;
    letter-spacing: .08em;
    text-transform: uppercase;
    text-align: center;
    min-height: 1em;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .4s ease .3s, transform .4s ease .3s;
}
.sg-lb.sg-lb-anim .sg-lb-caption {
    opacity: 1;
    transform: translateY(0);
}

/* Counter */
.sg-lb-counter {
    position: fixed;
    top: 18px;
    left: 22px;
    color: rgba(255,255,255,.45);
    font-size: .78em;
    letter-spacing: .05em;
    z-index: 2;
}

/* Close button */
.sg-lb-close {
    position: fixed;
    top: 14px;
    right: 18px;
    background: none;
    border: none;
    color: rgba(255,255,255,.5);
    font-size: 1.9em;
    line-height: 1;
    cursor: pointer;
    padding: 6px 10px;
    z-index: 2;
    transition: color .2s, transform .3s ease;
    font-family: inherit;
}
.sg-lb-close:hover {
    color: #fff;
    transform: rotate(90deg);
}

/* Arrows */
.sg-lb-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255,255,255,.35);
    font-size: 3em;
    width: 60px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    z-index: 2;
    opacity: 0;
    transition: color .25s, opacity .3s ease, transform .28s ease;
    font-family: inherit;
}
.sg-lb-arrow:hover              { color: #fff; }
.sg-lb.sg-lb-anim:hover .sg-lb-arrow { opacity: 1; }
.sg-lb-prev { left: 8px; }
.sg-lb-next { right: 8px; }
.sg-lb-prev:hover { transform: translateY(-50%) translateX(-4px); }
.sg-lb-next:hover { transform: translateY(-50%) translateX(4px); }
.sg-lb-arrow[hidden] { display: none !important; }

/* Image swap fade */
.sg-lb-img.sg-leaving {
    opacity: 0;
    transform: scale(.97);
    transition: opacity .25s ease, transform .25s ease;
}

@media (max-width: 600px) {
    .sg-lb-arrow { font-size: 2em; width: 38px; opacity: 1 !important; }
    .sg-lb-prev  { left: 2px; }
    .sg-lb-next  { right: 2px; }
}
