.ggallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--ggallery-columns, 4), 1fr);
    gap: 12px;
    margin: 1rem 0;
}

.ggallery-details {
    display: block;
    position: relative;
}

.ggallery-item {
    display: block;
    overflow: hidden;
    border-radius: 4px;
    background: #f2f2f2;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    list-style: none;
}

.ggallery-item::-webkit-details-marker {
    display: none;
}

.ggallery-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ggallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.ggallery-empty {
    grid-column: 1 / -1;
    color: #888;
    font-style: italic;
}

@media (max-width: 768px) {
    .ggallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.ggallery-details[open] {
    position: fixed;
    z-index: 99999;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.ggallery-details[open] > .ggallery-item {
    position: absolute;
    top: 16px;
    right: 24px;
    z-index: 3;
    width: auto;
    height: auto;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.ggallery-details[open] > .ggallery-item:hover {
    transform: none;
    box-shadow: none;
}

.ggallery-details[open] > .ggallery-item img {
    display: none;
}

.ggallery-details[open] > .ggallery-item::after {
    content: "×";
    color: #fff;
    font-size: 36px;
    font-weight: 300;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.ggallery-details[open] > .ggallery-item:hover::after {
    opacity: 1;
}

.ggallery-modal {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ggallery-modal-backdrop {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.ggallery-modal-content {
    position: relative;
    z-index: 2;
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
