/* ── Denutivo Gallery — Frontend ─────────────────────────────────────────── */

.dgg-gallery { width: 100%; }

/* ── Grid layout ─────────────────────────────────────────────────────────── */

.dgg-layout--grid {
    display: grid;
    grid-template-columns: repeat( var(--dgg-cols, 3), 1fr );
    gap: var(--dgg-gap, 8px);
}

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

/* ── Masonry layout (CSS columns) ────────────────────────────────────────── */

.dgg-layout--masonry {
    columns: var(--dgg-cols, 3);
    column-gap: var(--dgg-gap, 8px);
}
.dgg-layout--masonry .dgg-item {
    break-inside: avoid;
    margin-bottom: var(--dgg-gap, 8px);
    display: block;
    width: 100%;
}
@media (max-width: 768px) { .dgg-layout--masonry { columns: var(--dgg-cols-t, 2); } }
@media (max-width: 480px) { .dgg-layout--masonry { columns: var(--dgg-cols-m, 1); } }

/* ── Justified layout ────────────────────────────────────────────────────── */

.dgg-layout--justified {
    display: flex;
    flex-wrap: wrap;
    gap: var(--dgg-gap, 8px);
}
.dgg-layout--justified .dgg-item {
    flex: 1 1 200px;
    min-width: 0;
}

/* ── Items ───────────────────────────────────────────────────────────────── */

.dgg-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    background: #f1f5f9;
    border: none;
    padding: 0;
    display: block;
    width: 100%;
    font-family: inherit;
}

button.dgg-item { text-align: left; }

.dgg-item__media { position: relative; overflow: hidden; width: 100%; }

/* Aspect ratios (grid + justified) */
.dgg-aspect--square   .dgg-layout--grid    .dgg-item__media,
.dgg-aspect--square   .dgg-layout--justified .dgg-item__media { aspect-ratio: 1; }
.dgg-aspect--landscape .dgg-layout--grid   .dgg-item__media,
.dgg-aspect--landscape .dgg-layout--justified .dgg-item__media { aspect-ratio: 4/3; }
.dgg-aspect--portrait  .dgg-layout--grid   .dgg-item__media,
.dgg-aspect--portrait  .dgg-layout--justified .dgg-item__media { aspect-ratio: 3/4; }

/* Self-contained aspect classes */
.dgg-aspect--square   .dgg-item__media { aspect-ratio: 1; }
.dgg-aspect--landscape .dgg-item__media { aspect-ratio: 4/3; }
.dgg-aspect--portrait  .dgg-item__media { aspect-ratio: 3/4; }

.dgg-item__media img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    transition: transform .4s ease;
}

.dgg-item:hover .dgg-item__media img { transform: scale(1.04); }

/* Caption */
.dgg-item__caption {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 20px 10px 8px;
    background: linear-gradient(transparent, rgba(0,0,0,.55));
    color: #fff; font-size: 12px; line-height: 1.4;
    opacity: 0; transition: opacity .25s;
}
.dgg-item:hover .dgg-item__caption,
.dgg-has-captions .dgg-item__caption { opacity: 1; }

/* Fade last preview item */
.dgg-item--fade .dgg-item__media::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(to bottom, transparent 30%, rgba(255,255,255,.85) 100%);
    pointer-events: none;
}

/* ── Gate ────────────────────────────────────────────────────────────────── */

.dgg-gate {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px 8px;
}

.dgg-layout--masonry .dgg-gate,
.dgg-layout--justified .dgg-gate {
    width: 100%;
    break-inside: avoid;
    flex: 1 1 100%;
}

.dgg-gate__box {
    max-width: 420px;
    width: 100%;
    text-align: center;
    background: #fff;
    border: 1px solid #e8eaf2;
    border-radius: 20px;
    padding: 36px 32px;
    box-shadow: 0 8px 40px rgba(0,10,40,.08);
}

.dgg-gate__icon {
    width: 60px; height: 60px; border-radius: 50%;
    background: linear-gradient(135deg, rgba(13,98,255,.1), rgba(42,0,205,.1));
    color: #0d62ff;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
}

.dgg-gate__heading {
    font-size: 1.25rem; font-weight: 800; color: #0f172a;
    margin: 0 0 8px; line-height: 1.3;
}

.dgg-gate__count {
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(13,98,255,.07); color: #0d62ff;
    border: 1px solid rgba(13,98,255,.15);
    border-radius: 999px; font-size: 12px; font-weight: 600;
    padding: 4px 12px; margin: 0 0 14px;
}

.dgg-gate__text {
    font-size: .95rem; color: #64748b; line-height: 1.65;
    margin: 0 0 22px;
}

.dgg-gate__btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 12px 28px;
    background: linear-gradient(90deg, #2a00cd -20%, #0d62ff 120%);
    color: #fff; border: none; border-radius: 999px;
    font-size: .95rem; font-weight: 600; font-family: inherit;
    cursor: pointer; text-decoration: none;
    transition: opacity .2s, transform .2s;
}
.dgg-gate__btn:hover { opacity: .88; transform: translateY(-1px); color: #fff; }

/* ── Lightbox ─────────────────────────────────────────────────────────────── */

.dgg-lb {
    position: fixed; inset: 0; z-index: 99999;
    background: rgba(0,0,0,.92);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity .25s;
    pointer-events: none;
}
.dgg-lb.is-open { opacity: 1; pointer-events: auto; }

.dgg-lb__img-wrap {
    position: relative; max-width: 90vw; max-height: 85vh;
    display: flex; align-items: center; justify-content: center;
}

.dgg-lb__img {
    max-width: 90vw; max-height: 82vh;
    object-fit: contain; display: block;
    border-radius: 6px;
    transition: opacity .2s;
}
.dgg-lb__img.is-loading { opacity: 0; }

.dgg-lb__caption {
    position: absolute; bottom: -30px; left: 0; right: 0;
    text-align: center; color: rgba(255,255,255,.7);
    font-size: 13px; line-height: 1.4;
}

.dgg-lb__btn {
    position: fixed; top: 50%; transform: translateY(-50%);
    width: 48px; height: 48px; border-radius: 50%;
    background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.15);
    color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(6px); transition: background .15s;
}
.dgg-lb__btn:hover { background: rgba(255,255,255,.22); }
.dgg-lb__btn--prev { left: 20px; }
.dgg-lb__btn--next { right: 20px; }
.dgg-lb__btn--close {
    position: fixed; top: 16px; right: 16px;
    transform: none;
}

.dgg-lb__counter {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    color: rgba(255,255,255,.5); font-size: 13px;
}

/* Lightbox gate slide — shown instead of image when content is locked */
.dgg-lb__gate-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    min-width: min(360px, 80vw);
}

.dgg-lb__gate-box {
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.14);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 18px;
    padding: 36px 32px;
    text-align: center;
    max-width: 360px;
    width: 100%;
}

.dgg-lb__gate-icon {
    display: flex; align-items: center; justify-content: center;
    width: 58px; height: 58px; border-radius: 50%;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.16);
    color: rgba(255,255,255,.75);
    margin: 0 auto 16px;
}

.dgg-lb__gate-heading {
    font-size: 1.1rem; font-weight: 700; color: #fff;
    margin: 0 0 10px; line-height: 1.3;
}

.dgg-lb__gate-text {
    font-size: .875rem; color: rgba(255,255,255,.55);
    line-height: 1.65; margin: 0 0 22px;
}

.dgg-lb__gate-btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 26px;
    background: rgba(255,255,255,.13);
    border: 1px solid rgba(255,255,255,.25);
    color: #fff; border-radius: 999px;
    font-size: .875rem; font-weight: 600;
    text-decoration: none;
    transition: background .15s, border-color .15s;
}
.dgg-lb__gate-btn:hover {
    background: rgba(255,255,255,.24);
    border-color: rgba(255,255,255,.4);
    color: #fff;
}

/* ── Placeholder (editor) ─────────────────────────────────────────────────── */
.dgg-placeholder {
    background: #f8fafc; border: 2px dashed #e2e8f0; border-radius: 12px;
    padding: 32px; text-align: center; color: #94a3b8;
}
