/* ── Sacred Gallery – Frontend CSS ── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=Playfair+Display:wght@600&display=swap');

/* ── Grid ── */
.sglr-gallery-wrap {
    --sglr-gap: 16px;
    --sglr-cols-d: 4;
    --sglr-cols-t: 2;
    --sglr-cols-m: 1;
    --sglr-aspect: 4/3;
    --sglr-accent: #e63946;
    font-family: 'DM Sans', sans-serif;
    width: 100%;
    box-sizing: border-box;
}

.sglr-grid {
    display: grid;
    grid-template-columns: repeat(var(--sglr-cols-d), 1fr);
    gap: var(--sglr-gap);
    width: 100%;
}

@media (max-width: 768px) {
    .sglr-grid { grid-template-columns: repeat(var(--sglr-cols-t), 1fr); }
}
@media (max-width: 480px) {
    .sglr-grid { grid-template-columns: repeat(var(--sglr-cols-m), 1fr); }
}

/* ── Album Card ── */
.sglr-album-card,
.sglr-img-card {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
    transition: transform .25s ease, box-shadow .25s ease;
}
.sglr-album-card:hover,
.sglr-img-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 28px rgba(0,0,0,.16);
}

/* ── Thumbnail ── */
.sglr-album-thumb {
    position: relative;
    overflow: hidden;
    aspect-ratio: var(--sglr-aspect, 4/3);
    background: #f0f0f0;
}
.sglr-album-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .4s ease;
}
.sglr-album-card:hover .sglr-album-thumb img,
.sglr-img-card:hover .sglr-album-thumb img {
    transform: scale(1.06);
}

/* Overlay */
.sglr-album-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .25s ease;
}
.sglr-album-card:hover .sglr-album-overlay,
.sglr-img-card:hover .sglr-album-overlay {
    opacity: 1;
}
.sglr-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-size: .875rem;
    font-weight: 600;
    letter-spacing: .04em;
    border: 2px solid rgba(255,255,255,.8);
    border-radius: 100px;
    padding: 8px 16px;
    backdrop-filter: blur(4px);
    transition: background .2s;
}
.sglr-view-btn:hover { background: rgba(255,255,255,.15); }

/* No Thumb */
.sglr-no-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
}
.sglr-no-thumb .dashicons { font-size: 48px; width:48px;height:48px; }

/* Caption */
.sglr-album-caption {
    padding: 12px 14px 14px;
    flex: 1;
}
.sglr-album-title {
    font-family: 'DM Sans', sans-serif;
    font-size: .95rem;
    font-weight: 600;
    margin: 0 0 4px;
    color: #1a1a1a;
    line-height: 1.3;
}
.sglr-album-date {
    font-size: .78rem;
    color: #888;
    font-weight: 500;
}
.sglr-img-cap {
    font-size: .82rem;
    color: #555;
    margin: 0;
}

/* Empty */
.sglr-empty {
    text-align: center;
    padding: 48px 24px;
    color: #999;
    font-size: 1rem;
    background: #fafafa;
    border: 2px dashed #e0e0e0;
    border-radius: 12px;
}

/* ════════════════════════════
   LIGHTBOX
═══════════════════════════════ */
.sglr-lightbox {
    --sglr-overlay: rgba(0,0,0,.88);
    --sglr-accent: #e63946;
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
}
.sglr-lightbox.sglr-lb-open {
    opacity: 1;
    pointer-events: all;
}

.sglr-lb-backdrop {
    position: absolute;
    inset: 0;
    background: var(--sglr-overlay);
    cursor: pointer;
}

.sglr-lb-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
    z-index: 1;
    padding: 60px 72px 80px;
    box-sizing: border-box;
    justify-content: center;
}

/* ── Image container ── */
.sglr-lb-img-wrap {
    position: relative;
    max-width: 100%;
    max-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
}

.sglr-lb-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
    transition: opacity .25s ease, transform .25s ease;
}

/* Animation states */
.sglr-lb-img.sglr-entering { opacity: 0; transform: scale(.94); }
.sglr-lb-img.sglr-visible  { opacity: 1; transform: scale(1); }
.sglr-lb-img.sglr-exiting  { opacity: 0; transform: scale(.94); }

/* Slide animations */
.sglr-lb-img.sglr-slide-in-right { animation: sglrSlideInRight .28s ease forwards; }
.sglr-lb-img.sglr-slide-in-left  { animation: sglrSlideInLeft  .28s ease forwards; }
.sglr-lb-img.sglr-slide-out-left { animation: sglrSlideOutLeft .22s ease forwards; }
.sglr-lb-img.sglr-slide-out-right{ animation: sglrSlideOutRight.22s ease forwards; }
/* Flip */
.sglr-lb-img.sglr-flip-in  { animation: sglrFlipIn  .3s ease forwards; }
.sglr-lb-img.sglr-flip-out { animation: sglrFlipOut .2s ease forwards; }

@keyframes sglrSlideInRight  { from { opacity:0; transform:translateX(60px);  } to { opacity:1; transform:translateX(0);    } }
@keyframes sglrSlideInLeft   { from { opacity:0; transform:translateX(-60px); } to { opacity:1; transform:translateX(0);    } }
@keyframes sglrSlideOutLeft  { from { opacity:1; transform:translateX(0);    } to { opacity:0; transform:translateX(-60px); } }
@keyframes sglrSlideOutRight { from { opacity:1; transform:translateX(0);    } to { opacity:0; transform:translateX(60px);  } }
@keyframes sglrFlipIn  { from { opacity:0; transform:perspective(600px) rotateY(-90deg); } to { opacity:1; transform:perspective(600px) rotateY(0); } }
@keyframes sglrFlipOut { from { opacity:1; transform:perspective(600px) rotateY(0);      } to { opacity:0; transform:perspective(600px) rotateY(90deg); } }

/* ── Close button ── */
.sglr-lb-close {
    position: absolute;
    top: 16px; right: 16px;
    background: rgba(255,255,255,.12);
    border: none;
    color: #fff;
    width: 44px; height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, transform .2s;
    backdrop-filter: blur(4px);
    z-index: 10;
}
.sglr-lb-close:hover { background: rgba(255,255,255,.25); transform: rotate(90deg); }

/* ── Nav arrows ── */
.sglr-lb-prev,
.sglr-lb-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,.12);
    border: none;
    color: #fff;
    width: 52px; height: 52px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, transform .2s;
    backdrop-filter: blur(4px);
    z-index: 10;
}
.sglr-lb-prev { left: 14px; }
.sglr-lb-next { right: 14px; }
.sglr-lb-prev:hover { background: var(--sglr-accent); transform: translateY(-50%) scale(1.08); }
.sglr-lb-next:hover { background: var(--sglr-accent); transform: translateY(-50%) scale(1.08); }
.sglr-lb-prev.sglr-hidden,
.sglr-lb-next.sglr-hidden { opacity: .3; pointer-events: none; }

/* ── Footer ── */
.sglr-lb-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding-top: 12px;
    min-height: 40px;
}
.sglr-lb-caption {
    color: rgba(255,255,255,.85);
    font-size: .9rem;
    margin: 0;
    text-align: center;
    font-family: 'DM Sans', sans-serif;
    letter-spacing: .02em;
}
.sglr-lb-counter {
    color: rgba(255,255,255,.5);
    font-size: .78rem;
    font-family: 'DM Sans', sans-serif;
}

/* ── Dots ── */
.sglr-lb-dots {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 300px;
    padding-top: 8px;
}
.sglr-lb-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: rgba(255,255,255,.3);
    cursor: pointer;
    border: none;
    padding: 0;
    transition: background .2s, transform .2s;
    flex-shrink: 0;
}
.sglr-lb-dot.active {
    background: var(--sglr-accent);
    transform: scale(1.3);
}

/* ── Spinner ── */
.sglr-lb-spinner {
    display: none;
    position: absolute;
    width: 48px; height: 48px;
}
.sglr-lb-spinner.active { display: block; }
.sglr-lb-spinner div {
    box-sizing: border-box;
    display: block;
    position: absolute;
    width: 38px; height: 38px;
    margin: 5px;
    border: 4px solid var(--sglr-accent);
    border-radius: 50%;
    animation: sglrSpin 1.2s cubic-bezier(.5,0,.5,1) infinite;
    border-color: var(--sglr-accent) transparent transparent transparent;
}
.sglr-lb-spinner div:nth-child(1) { animation-delay: -.45s; }
.sglr-lb-spinner div:nth-child(2) { animation-delay: -.3s; }
.sglr-lb-spinner div:nth-child(3) { animation-delay: -.15s; }
@keyframes sglrSpin { to { transform: rotate(360deg); } }

/* ── Mobile ── */
@media (max-width: 600px) {
    .sglr-lb-inner { padding: 52px 48px 72px; }
    .sglr-lb-prev  { left: 4px; }
    .sglr-lb-next  { right: 4px; }
    .sglr-lb-prev, .sglr-lb-next { width: 40px; height: 40px; }
    .sglr-lb-img-wrap { max-height: calc(100vh - 180px); }
}
@media (max-width: 400px) {
    .sglr-lb-inner { padding: 48px 40px 68px; }
    .sglr-lb-dots  { max-width: 220px; }
}

/* ── Touch swipe hint ── */
.sglr-swipe-hint {
    position: absolute;
    bottom: 52px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,.35);
    font-size: .72rem;
    letter-spacing: .08em;
    pointer-events: none;
    white-space: nowrap;
}
