/* ============================================================
 *  Akashi Dungeon — Universal Lightbox
 *  Файл: assets/lightbox.css
 * ============================================================ */

/* ── Оверлей ── */
#akashi-lb {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, .92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity .22s ease, visibility .22s ease;
}
#akashi-lb.akashi-lb--open {
    opacity: 1;
    visibility: visible;
}

/* ── Внутренняя обёртка ── */
.akashi-lb-wrap {
    display: flex;
    width: 100%;
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
    pointer-events: none; /* клик по wrap = клик на backdrop */
}

/* ── Панель миниатюр (левая колонка) ── */
.akashi-lb-panel {
    width: 90px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 60px 8px 20px;
    pointer-events: all;
    overflow: hidden;
}

.akashi-lb-thumb-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    scrollbar-width: none;
    padding-right: 2px;
}
.akashi-lb-thumb-list::-webkit-scrollbar { display: none; }

.akashi-lb-thumb {
    width: 72px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 4px;
    border: 2px solid transparent;
    background-size: cover;
    background-position: center;
    background-color: #1a1a2e;
    cursor: pointer;
    transition: border-color .15s, opacity .15s, transform .15s;
    opacity: .55;
    padding: 0;
}
.akashi-lb-thumb:hover {
    opacity: .85;
    transform: scale(1.04);
}
.akashi-lb-thumb.active {
    border-color: #aa2518;
    opacity: 1;
}

/* ── Основная область ── */
.akashi-lb-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 50px 20px 20px;
    pointer-events: all;
    min-width: 0;
}

/* ── Кнопка закрытия ── */
.akashi-lb-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.15);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, transform .15s;
    line-height: 1;
}
.akashi-lb-close:hover {
    background: rgba(170, 37, 24, .6);
    border-color: #aa2518;
    transform: scale(1.1);
}

/* ── Кнопки навигации ── */
.akashi-lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 66px;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, border-color .15s;
    padding: 0;
}
.akashi-lb-nav svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: block;
}
.akashi-lb-nav:hover {
    background: rgba(170, 37, 24, .5);
    border-color: rgba(170, 37, 24, .7);
}
.akashi-lb-prev { left: 10px; }
.akashi-lb-next { right: 10px; }

/* ── Обёртка изображения ── */
.akashi-lb-img-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    min-height: 0;
}

/* ── Основное изображение ── */
.akashi-lb-img {
    max-width: 100%;
    max-height: calc(100vh - 140px);
    object-fit: contain;
    border-radius: 4px;
    transition: opacity .18s ease;
    display: block;
    box-shadow: 0 8px 40px rgba(0,0,0,.6);
    user-select: none;
}

/* ── Спиннер загрузки ── */
.akashi-lb-spinner {
    position: absolute;
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255,255,255,.15);
    border-top-color: #aa2518;
    border-radius: 50%;
    animation: akashi-lb-spin .7s linear infinite;
    display: none;
}
@keyframes akashi-lb-spin {
    to { transform: rotate(360deg); }
}

/* ── Футер: подпись + счётчик ── */
.akashi-lb-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 4px 0;
    gap: 12px;
    min-height: 32px;
}

.akashi-lb-caption {
    font-size: 14px;
    color: rgba(255,255,255,.88);
    font-style: italic;
    line-height: 1.45;
    flex: 1;
    text-shadow: 0 1px 4px rgba(0,0,0,.5);
}

.akashi-lb-counter {
    font-size: 12px;
    color: rgba(255,255,255,.5);
    flex-shrink: 0;
    letter-spacing: .06em;
    font-variant-numeric: tabular-nums;
}

/* ============================================================
 *  ГАЛЕРЕЯ — фронтенд (.akashi-gallery)
 * ============================================================ */

.akashi-gallery {
    display: grid;
    gap: 8px;
    margin: 1.2em 0;
}
.akashi-gallery--cols-2 { grid-template-columns: repeat(2, 1fr); }
.akashi-gallery--cols-3 { grid-template-columns: repeat(3, 1fr); }
.akashi-gallery--cols-4 { grid-template-columns: repeat(4, 1fr); }

.akashi-gal-item {
    position: relative;
    overflow: hidden;
    border-radius: 5px;
    cursor: zoom-in;
    background: #0d0d14;
    aspect-ratio: 4 / 3;
}
.akashi-gal-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease, opacity .2s;
}
.akashi-gal-item:hover img {
    transform: scale(1.04);
}

/* Лёгкое затемнение при hover — без иконки */
.akashi-gal-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.18);
    opacity: 0;
    transition: opacity .2s;
}
.akashi-gal-item:hover::after {
    opacity: 1;
}

/* ============================================================
 *  СЛАЙДЕР — фронтенд (.akashi-slider)
 * ============================================================ */

.akashi-slider {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    margin: 1.2em 0;
    background: #0d0d14;
    user-select: none;
}

.akashi-sl-track {
    display: flex;
    transition: transform .38s cubic-bezier(.4, 0, .2, 1);
    will-change: transform;
}

.akashi-sl-slide {
    flex: 0 0 100%;
    width: 100%;
    position: relative;
    cursor: zoom-in;
}
.akashi-sl-slide img {
    width: 100%;
    display: block;
    max-height: 520px;
    object-fit: cover;
}

/* Подпись внутри слайда */
.akashi-sl-caption {
    position: absolute;
    bottom: 0;
    left: 0; right: 0;
    padding: 24px 16px 12px;
    background: linear-gradient(transparent, rgba(0,0,0,.65));
    color: rgba(255,255,255,.85);
    font-size: 13px;
    font-style: italic;
    pointer-events: none;
}

/* Навигационные стрелки слайдера */
.akashi-sl-prev,
.akashi-sl-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 52px;
    background: rgba(0,0,0,.45);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 5px;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    padding: 0;
    line-height: 1;
}
.akashi-sl-prev:hover,
.akashi-sl-next:hover { background: rgba(170, 37, 24, .55); }
.akashi-sl-prev { left: 8px; }
.akashi-sl-next { right: 8px; }

/* Точки */
.akashi-sl-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 5;
}
.akashi-sl-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,.35);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background .15s, transform .15s;
}
.akashi-sl-dot.active {
    background: #aa2518;
    transform: scale(1.3);
}

/* Кнопка play/pause */
.akashi-sl-play {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,.5);
    border: 1px solid rgba(255,255,255,.2);
    color: rgba(255,255,255,.75);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: background .15s;
    padding: 0;
    line-height: 1;
}
.akashi-sl-play:hover { background: rgba(170, 37, 24, .55); }

/* ============================================================
 *  АДАПТИВ
 * ============================================================ */

@media (max-width: 768px) {
    /* Панель миниатюр уходит вниз */
    .akashi-lb-wrap {
        flex-direction: column;
    }
    .akashi-lb-panel {
        width: 100%;
        height: 72px;
        flex-direction: row;
        padding: 6px 8px;
        order: 2; /* панель под основной областью */
        border-top: 1px solid rgba(255,255,255,.08);
    }
    .akashi-lb-thumb-list {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 5px;
    }
    .akashi-lb-thumb {
        width: 52px;
        height: 52px;
        flex-shrink: 0;
    }
    .akashi-lb-main {
        padding: 44px 8px 8px;
        order: 1;
    }
    .akashi-lb-img {
        max-height: calc(100vh - 200px);
    }
    .akashi-lb-nav {
        width: 36px;
        height: 52px;
        font-size: 22px;
    }

    /* Галерея на мобильном */
    .akashi-gallery--cols-3,
    .akashi-gallery--cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    .akashi-gallery--cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .akashi-gallery--cols-2,
    .akashi-gallery--cols-3,
    .akashi-gallery--cols-4 {
        grid-template-columns: 1fr;
    }
}