.rg-gallery { margin: 1.5em 0; }

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

.rg-layout-masonry {
    column-count: var(--rg-cols, 3);
    column-gap: 12px;
}
.rg-layout-masonry .rg-item { break-inside: avoid; margin-bottom: 12px; }

.rg-layout-carousel {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}
.rg-car-track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    flex: 1;
}
.rg-car-track::-webkit-scrollbar { display: none; }
.rg-layout-carousel .rg-item {
    flex: 0 0 calc((100% - (var(--rg-cols, 3) - 1) * 12px) / var(--rg-cols, 3));
    scroll-snap-align: start;
}
.rg-car-btn {
    flex: 0 0 auto;
    width: 40px; height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
}
.rg-car-btn:hover { background: rgba(0,0,0,.85); }

.rg-item {
    margin: 0;
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    background: #f0f0f0;
}
.rg-item a { display: block; line-height: 0; }
.rg-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    transition: transform .25s ease;
}
.rg-layout-masonry .rg-item img { aspect-ratio: auto; }
.rg-item:hover img { transform: scale(1.04); }
.rg-item figcaption {
    font-size: 13px;
    padding: 6px 8px;
    background: rgba(0,0,0,.55);
    color: #fff;
    position: absolute;
    bottom: 0; left: 0; right: 0;
    line-height: 1.4;
}

.rg-more-wrap { text-align: center; margin: 12px 0 0; }
.rg-load-more {
    padding: 9px 22px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}
.rg-load-more:hover { background: #135e96; }

@media (max-width: 768px) {
    .rg-layout-grid { grid-template-columns: repeat(2, 1fr); }
    .rg-layout-masonry { column-count: 2; }
    .rg-layout-carousel .rg-item { flex-basis: calc((100% - 12px) / 2); }
}
@media (max-width: 480px) {
    .rg-layout-grid { grid-template-columns: 1fr; }
    .rg-layout-masonry { column-count: 1; }
    .rg-layout-carousel .rg-item { flex-basis: 100%; }
}

/* Lightbox */
.rg-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0,0,0,.9);
    align-items: center;
    justify-content: center;
}
.rg-lightbox.rg-open { display: flex; }
.rg-lightbox figure { max-width: 90vw; max-height: 90vh; margin: 0; text-align: center; overflow: auto; }
.rg-lightbox img { max-width: 100%; max-height: 80vh; object-fit: contain; transition: transform .2s ease; cursor: zoom-in; }
.rg-lightbox.rg-zoom img { transform: scale(1.9); cursor: zoom-out; }
.rg-lightbox figcaption { color: #ccc; margin-top: 10px; font-size: 14px; }
.rg-lightbox .rg-count { opacity: .6; margin-right: 8px; }
.rg-lightbox button {
    position: absolute;
    background: rgba(255,255,255,.12);
    border: none;
    color: #fff;
    font-size: 24px;
    width: 48px; height: 48px;
    cursor: pointer;
    border-radius: 50%;
}
.rg-lightbox button:hover { background: rgba(255,255,255,.28); }
.rg-lb-close { top: 18px; right: 18px; }
.rg-lb-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.rg-lb-next { right: 18px; top: 50%; transform: translateY(-50%); }
.rg-lb-zoom { bottom: 18px; right: 78px; }
.rg-lb-fs { bottom: 18px; right: 18px; }

/* Frontend submission form */
.rpu-form { max-width: 640px; margin: 1.5em 0; }
.rpu-form label { display: block; font-weight: 600; margin: 14px 0 4px; }
.rpu-form select, .rpu-form input[type="text"], .rpu-form textarea {
    width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px;
}
.rpu-form textarea { font-family: monospace; font-size: 13px; }
.rpu-hint { display: block; font-size: 12px; color: #777; margin-top: 4px; }
.rpu-submit {
    margin-top: 16px; padding: 10px 26px;
    background: #2271b1; color: #fff; border: none; border-radius: 4px;
    cursor: pointer; font-size: 15px;
}
.rpu-submit:hover { background: #135e96; }
.rpu-msg-ok { background: #e7f6e7; border: 1px solid #a8d5a2; padding: 10px 14px; border-radius: 4px; }
.rpu-msg-err { background: #fdeaea; border: 1px solid #e5a3a3; padding: 10px 14px; border-radius: 4px; }
.rpu-form-msg { color: #777; }

.rg-block-placeholder { color: #888; font-style: italic; }
