/* ===== Galerie Lightbox Plugin ===== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@300;400&family=DM+Sans:wght@300;400&display=swap');

.gl-plugin {
    font-family: 'DM Sans', sans-serif;
    margin: 2rem 0;
}

/* --- Header --- */
.gl-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.gl-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 0.05em;
    color: inherit;
}

.gl-count {
    font-size: 0.7rem;
    color: #888;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* --- Grid --- */
.gl-grid {
    display: grid;
    grid-template-columns: repeat( var(--gl-cols, 3), 1fr );
    gap: 8px;
}

/* --- Grid Item --- */
.gl-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 6px;
    border: none;
    padding: 0;
    background: #f0ede8;
    cursor: pointer;
    display: block;
    width: 100%;
    transition: transform 0.25s ease;
}

.gl-item:hover {
    transform: scale(1.02);
}

.gl-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.gl-item:hover img {
    transform: scale(1.07);
}

.gl-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.45) 0%, transparent 55%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    padding: 10px 12px;
    pointer-events: none;
}

.gl-item:hover .gl-overlay {
    opacity: 1;
}

.gl-img-caption {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.9);
    letter-spacing: 0.05em;
    font-weight: 300;
}

.gl-zoom-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255,255,255,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: #333;
    pointer-events: none;
}

.gl-item:hover .gl-zoom-icon {
    opacity: 1;
}

/* --- Lightbox --- */
.gl-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.gl-lightbox[hidden] { display: none; }

.gl-lightbox.active {
    animation: gl-fade-in 0.2s ease;
}

@keyframes gl-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.gl-lb-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8,8,8,0.88);
}

.gl-lb-inner {
    position: relative;
    max-width: 860px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    z-index: 1;
}

.gl-lb-img-wrap {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: #111;
    max-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gl-lb-img {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    display: block;
}

.gl-lb-img.gl-lb-anim {
    animation: gl-zoom-in 0.3s ease;
}

@keyframes gl-zoom-in {
    from { opacity: 0; transform: scale(0.93); }
    to   { opacity: 1; transform: scale(1); }
}

.gl-lb-info {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gl-lb-caption {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    font-weight: 300;
    color: rgba(255,255,255,0.85);
    letter-spacing: 0.03em;
}

.gl-lb-counter {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.1em;
}

/* Nav buttons */
.gl-lb-nav {
    position: absolute;
    top: calc(50% - 2rem);
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.12);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
    z-index: 2;
    line-height: 1;
}

.gl-lb-nav svg {
    display: block;
    flex-shrink: 0;
    stroke: #ffffff;
    fill: none;
}

.gl-lb-nav:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.7);
}

.gl-lb-prev { left: -60px; }
.gl-lb-next { right: -60px; }

/* Close */
.gl-lb-close {
    position: absolute;
    top: -52px;
    right: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.12);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
}

.gl-lb-close svg {
    display: block;
    flex-shrink: 0;
    stroke: #ffffff;
    fill: none;
}

.gl-lb-close:hover {
    background: rgba(255,255,255,0.28);
}

/* Zoom icon in grid */
.gl-zoom-icon svg {
    display: block;
    stroke: #333333;
    fill: none;
}

.gl-zoom-icon {
    color: #333333;
}

/* Dots */
.gl-lb-dots {
    display: flex;
    gap: 6px;
}

.gl-lb-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    border: none;
    padding: 0;
    background: rgba(255,255,255,0.25);
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.gl-lb-dot.active {
    background: white;
    transform: scale(1.4);
}

/* --- Editor styles --- */
.gl-editor-wrap {}

.gl-item--editor {
    pointer-events: none;
}

.gl-item--editor .gl-editor-remove {
    pointer-events: all;
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.6);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.gl-item--editor:hover .gl-editor-remove {
    opacity: 1;
}

.gl-editor-btn {
    margin-top: 12px !important;
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .gl-grid {
        grid-template-columns: repeat( 2, 1fr ) !important;
    }

    .gl-lb-prev { left: -16px; }
    .gl-lb-next { right: -16px; }

    .gl-lb-nav {
        width: 36px;
        height: 36px;
    }
}
