.gallery-page-wrapper {
    width: 100%;
}

.gallery-page-main {
    min-width: 0;
}

.gallery-media-page {
    width: 100%;
}

.gallery-media-list-title {
    margin: 0 0 1rem;
    font-size: 1.35rem;
}

.gallery-media-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 1.25rem;
}

.gallery-media-cats a {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #444;
    font-size: 0.85rem;
}

.gallery-media-cats a.active,
.gallery-media-cats a:hover {
    background: #1c69d4;
    border-color: #1c69d4;
    color: #fff;
}

.gallery-media-albums {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.gallery-media-album {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.2s;
}

.gallery-media-album:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.gallery-media-album__thumb {
    aspect-ratio: 4/3;
    background: #f0f0f0;
    display: block;
    overflow: hidden;
}

.gallery-media-album__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-media-album__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #aaa;
    font-size: 2rem;
}

.gallery-media-album__body {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    color: #666;
}

.gallery-media-album__body strong {
    color: #222;
    font-size: 0.95rem;
}

.gallery-media-header h1 {
    margin: 0.5rem 0;
}

.gallery-media-back {
    color: #1c69d4;
    text-decoration: none;
    font-size: 0.9rem;
}

.gallery-media-meta {
    color: #666;
    margin: 0 0 1rem;
}

.gallery-media-description {
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.media-detail-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin: 0 0 1.25rem;
}

.media-detail-tags__label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #555;
}

.media-detail-tags__list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.media-detail-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border: 1px solid rgba(28, 105, 212, 0.25);
    border-radius: 999px;
    background: rgba(28, 105, 212, 0.06);
    color: #1c69d4;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.media-detail-tag:hover {
    background: rgba(28, 105, 212, 0.12);
    text-decoration: none;
}

.gallery-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.gallery-media-item {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 4px;
    background: #f5f5f5;
    cursor: zoom-in;
}

.gallery-media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
    pointer-events: none;
}

.gallery-media-item:hover img {
    transform: scale(1.03);
}

.gallery-media-empty {
    padding: 2rem;
    text-align: center;
    color: #666;
    background: #f9f9f9;
    border-radius: 6px;
}

/* Lightbox */
body.gallery-lightbox-open {
    overflow: hidden;
}

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    box-sizing: border-box;
}

.gallery-lightbox[hidden] {
    display: none !important;
}

.gallery-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 8, 8, 0.88);
}

.gallery-lightbox__dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(98vw, 1680px);
    height: min(96vh, 940px);
    max-height: 96vh;
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.gallery-lightbox__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #222;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #f2f2f2;
}

.gallery-lightbox__album {
    margin: 0;
    flex: 1;
    min-width: 0;
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-lightbox__counter {
    margin: 0;
    flex-shrink: 0;
    font-size: 0.85rem;
    color: #aaa;
    font-variant-numeric: tabular-nums;
}

.gallery-lightbox__download {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border: none;
    border-radius: 8px;
    background: rgba(28, 105, 212, 0.85);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease;
}

.gallery-lightbox__download:hover {
    background: rgba(28, 105, 212, 1);
    color: #fff;
    text-decoration: none;
}

.gallery-lightbox__download-label {
    white-space: nowrap;
}

.gallery-lightbox__close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.gallery-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.16);
}

.gallery-lightbox__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 148px;
    min-height: 0;
    flex: 1;
    overflow: hidden;
}

.gallery-lightbox__stage {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #111;
}

.gallery-lightbox__figure {
    position: absolute;
    inset: 20px 56px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.gallery-lightbox__image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center center;
    border-radius: 4px;
}

.gallery-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    z-index: 2;
}

.gallery-lightbox__nav:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.22);
}

.gallery-lightbox__nav:disabled {
    opacity: 0.35;
    cursor: default;
}

.gallery-lightbox__nav--prev {
    left: 12px;
}

.gallery-lightbox__nav--next {
    right: 12px;
}

.gallery-lightbox__sidebar {
    min-height: 0;
    background: #2a2a2a;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.gallery-lightbox__thumbs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
    padding: 10px 8px;
    overflow-y: auto;
    box-sizing: border-box;
}

.gallery-lightbox__thumb {
    flex-shrink: 0;
    width: 100%;
    aspect-ratio: 1;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    background: #111;
    cursor: pointer;
    opacity: 0.72;
    transition: opacity 0.15s ease, border-color 0.15s ease;
}

.gallery-lightbox__thumb:hover {
    opacity: 1;
}

.gallery-lightbox__thumb.is-active {
    opacity: 1;
    border-color: #1c69d4;
    box-shadow: 0 0 0 1px rgba(28, 105, 212, 0.35);
}

.gallery-lightbox__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 768px) {
    .gallery-lightbox {
        padding: 0;
    }

    .gallery-lightbox__dialog {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .gallery-lightbox__body {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) auto;
    }

    .gallery-lightbox__figure {
        inset: 12px 44px;
    }

    .gallery-lightbox__sidebar {
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    .gallery-lightbox__thumbs {
        flex-direction: row;
        max-height: 108px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 8px 10px;
    }

    .gallery-lightbox__thumb {
        width: 72px;
        height: 72px;
        aspect-ratio: auto;
    }

    .gallery-lightbox__download {
        width: 36px;
        padding: 0;
        justify-content: center;
    }

    .gallery-lightbox__download-label {
        display: none;
    }
}
