div:has(> .wp-block-social-links ~ .ugallery-trigger) {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
}

div:has(> .wp-block-social-links ~ .ugallery-trigger) .ugallery-trigger {
    margin-top: 0 !important;
    margin-left: 0.5rem !important;
}

.ugallery-trigger {
    display: inline-flex !important;
    align-items: center;
    gap: 0.5em;
    padding: 0.4em 1.8rem;
    margin-top: 0 !important;
    margin-block-start: 0 !important;
    margin-left: 0.67rem !important;
    background: #cf2e2e;
    color: #fff;
    border: none;
    border-radius: 99px;
    font-size: 0.9rem;
    font: inherit;
    font-weight: 500;
    text-transform: capitalize;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

@media (max-width: 480px) {
    .ugallery-trigger {
        margin-left: 0 !important;
        margin-top: 10px !important;
    }
}

.ugallery-trigger:hover,
.ugallery-trigger:focus-visible {
    background: #cf2e2e;
    transform: scale(1.02);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    outline: none;
}


.ugallery-modal {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba( 0, 0, 0, 0.85 );
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    box-sizing: border-box;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.ugallery-modal[hidden] {
    display: none;
}

.ugallery-modal.is-open {
    opacity: 1;
}

.ugallery-modal__inner {
    position: relative;
    background: rgb(36, 0, 0);
    border-radius: 10px;
    padding: 2.5rem 1.5rem 1.5rem;
    width: 100%;
    max-width: 1100px;
    max-height: 90vh;
    overflow-y: auto;
    box-sizing: border-box;
    box-shadow: 0 16px 60px rgba( 0, 0, 0, 0.7 );
    transform: translateY( 24px );
    transition: transform 0.25s ease;
}

.ugallery-modal.is-open .ugallery-modal__inner {
    transform: translateY( 0 );
}


.ugallery-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px; 
    height: 50px;
    background: #522323;
    border-radius: 50%;
    
}

.ugallery-modal__close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 44px;
    height: 44px;
    font-size: 2.25rem;
    
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 0;
}

.ugallery-modal__close:hover {
    background: rgba( 255, 255, 255, 0.2 );
    outline: 2px solid #cf2e2e;
}


.ugallery-grid {
    display: grid;
    grid-template-columns: repeat( var( --ugallery-columns, 3 ), 1fr );
    gap: 10px;
    width: 100%;
    margin-top: 0.5rem;
}

.ugallery-grid br,
.ugallery-grid p {
    display: none !important;
}

.ugallery-item {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    text-align: left;

    display: block;
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    overflow: hidden;
    background: rgba(8, 0, 0, 0.95);
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ugallery-item:hover,
.ugallery-item:focus-visible {
    transform: scale( 1.04 );
    box-shadow: 0 4px 16px rgba( 0, 0, 0, 0.5 );
    outline: 3px solid #cf2e2e;
    outline-offset: 2px;
    z-index: 1;
}

.ugallery-item img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
}

@media ( max-width: 768px ) {
    .ugallery-grid { grid-template-columns: repeat( 2, 1fr ); }
}

@media ( max-width: 480px ) {
    .ugallery-grid { grid-template-columns: 1fr; }
}

.ugallery-error,
.ugallery-empty {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    font-size: 0.95rem;
}

.ugallery-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

.ugallery-empty {
    background: #f9fafb;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}


.ugallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;

    z-index: 999999;

    background: rgba(36, 0, 0, 0.95);

    display: flex;
    align-items: center;
    justify-content: center;

    opacity: 0;
    transition: opacity 0.2s ease;
}

.ugallery-lightbox[hidden] {
    display: none;
}

.ugallery-lightbox.is-open {
    opacity: 1;
}

.ugallery-lightbox__stage {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 90vh;
}

.ugallery-lightbox__img {
    display: block;
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba( 0, 0, 0, 0.6 );
    transition: opacity 0.15s ease;
}

.ugallery-lightbox__img.is-loading {
    opacity: 0;
}

.ugallery-lightbox__close,
.ugallery-lightbox__prev,
.ugallery-lightbox__next {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px; 
    height: 50px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}

.ugallery-lightbox__close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 44px;
    height: 44px;
    font-size: 2.25rem;
    
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 0;
}

.ugallery-lightbox__close br {
    display: none !important;
}

.ugallery-lightbox__prev,
.ugallery-lightbox__next {
    position: absolute;
    top: 50%;
    transform: translateY( -50% );
    font-size: 3rem;
    width: 52px;
    height: 52px;
    background: rgba( 255, 255, 255, 0.1 );
}

.ugallery-lightbox__prev { left: 16px; }
.ugallery-lightbox__next { right: 16px; }

.ugallery-lightbox__close:hover,
.ugallery-lightbox__close:focus-visible,
.ugallery-lightbox__prev:hover,
.ugallery-lightbox__prev:focus-visible,
.ugallery-lightbox__next:hover,
.ugallery-lightbox__next:focus-visible {
    background: rgba( 255, 255, 255, 0.2 );
    outline: 2px solid #cf2e2e;
}

.ugallery-lightbox.is-single .ugallery-lightbox__prev,
.ugallery-lightbox.is-single .ugallery-lightbox__next {
    display: none;
}
