/* DocMedia Gallery — стили для вывода галереи на фронте */

.docmedia-gallery {
    margin: 1.5rem 0;
}

.docmedia-gallery__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.docmedia-gallery__item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #f5f5f5;
    aspect-ratio: 1;
}

.docmedia-gallery__item a {
    display: block;
    height: 100%;
    text-decoration: none;
}

.docmedia-gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease;
}

.docmedia-gallery__item a:hover img {
    transform: scale(1.05);
}

.docmedia-gallery__item figcaption {
    padding: 0.5rem;
    font-size: 0.875rem;
    color: #555;
}

/* Видео-карточка */
.docmedia-gallery__item--video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease;
}

.docmedia-gallery__item--video a:hover video {
    transform: scale(1.05);
}

.docmedia-gallery__play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.docmedia-gallery__play::after {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 20px 0 20px 36px;
    border-color: transparent transparent transparent rgba(255, 255, 255, 0.9);
    margin-left: 6px;
}

/* Файл-карточка */
.docmedia-gallery__item--file a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    color: #333;
}

.docmedia-gallery__file-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 0.5rem;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23666'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zm4 18H6V4h7v5h5v11z'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
}

.docmedia-gallery__file-label {
    font-size: 0.75rem;
    text-align: center;
    word-break: break-word;
}

/* Lightbox overlay */
.docmedia-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.docmedia-lightbox.is-open {
    display: flex;
}

.docmedia-lightbox__content {
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.docmedia-lightbox__img,
.docmedia-lightbox__video {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
}

.docmedia-lightbox__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 50%;
    line-height: 1;
}

.docmedia-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.3);
}
