/**
 * ギャラリーライトボックスCSS
 * - モーダル表示スタイル
 * - 高級感のあるヌメッとしたアニメーション
 * - レスポンシブ対応
 */

/* ========================================
   モーダル本体
   ======================================== */
.gallery-lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-lightbox-modal.active {
    display: block;
    animation: modalFadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* オーバーレイ */
.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(14, 14, 14, 0.95);
    backdrop-filter: blur(10px);
    animation: overlayFadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* コンテンツエリア */
.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px 80px 20px;
}

/* 画像コンテナ */
.lightbox-image-container {
    max-width: 90%;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    opacity: 1;
    transform: scale(1);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 画像切り替え時のアニメーション */
.lightbox-image.changing {
    opacity: 0;
    transform: scale(0.95);
}

/* ========================================
   ボタン - 共通スタイル
   ======================================== */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(200, 164, 93, 0.2);
    border: 1px solid rgba(200, 164, 93, 0.4);
    color: #C8A45D;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100001;
    backdrop-filter: blur(5px);
    opacity: 0;
    animation: buttonFadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.3s forwards;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(200, 164, 93, 0.35);
    border-color: rgba(200, 164, 93, 0.7);
    transform: scale(1.08);
    box-shadow: 0 4px 20px rgba(200, 164, 93, 0.3);
}

.lightbox-close:active,
.lightbox-prev:active,
.lightbox-next:active {
    transform: scale(0.92);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 閉じるボタン */
.lightbox-close {
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.lightbox-close i {
    font-size: 1.2rem;
}

/* 前へ・次へボタン */
.lightbox-prev,
.lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    transform: translateY(-50%) scale(1.05);
}

.lightbox-prev:active,
.lightbox-next:active {
    transform: translateY(-50%) scale(0.95);
}

.lightbox-prev i,
.lightbox-next i {
    font-size: 1.5rem;
}

/* ========================================
   カウンター
   ======================================== */
.lightbox-counter {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(14, 14, 14, 0.8);
    color: #C8A45D;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 300;
    letter-spacing: 0.05em;
    border: 1px solid rgba(200, 164, 93, 0.3);
    backdrop-filter: blur(5px);
    opacity: 0;
    animation: counterSlideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.4s forwards;
}

/* ========================================
   レスポンシブ - モバイル最適化
   ======================================== */
@media (max-width: 768px) {
    .lightbox-content {
        padding: 80px 15px 100px 15px;
    }

    .lightbox-image-container {
        max-width: 95%;
        max-height: 70vh;
    }

    .lightbox-image {
        max-height: 70vh;
    }

    /* ボタンサイズ調整 */
    .lightbox-close {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
    }

    .lightbox-close i {
        font-size: 1.1rem;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 44px;
        height: 44px;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    .lightbox-prev i,
    .lightbox-next i {
        font-size: 1.3rem;
    }

    .lightbox-counter {
        bottom: 20px;
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}

/* ========================================
   375px幅対応
   ======================================== */
@media (max-width: 375px) {
    .lightbox-content {
        padding: 70px 10px 90px 10px;
    }

    .lightbox-image-container {
        max-width: 100%;
        max-height: 65vh;
    }

    .lightbox-image {
        max-height: 65vh;
    }

    /* ボタンサイズ縮小 */
    .lightbox-close {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
    }

    .lightbox-close i {
        font-size: 1rem;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
    }

    .lightbox-prev {
        left: 5px;
    }

    .lightbox-next {
        right: 5px;
    }

    .lightbox-prev i,
    .lightbox-next i {
        font-size: 1.2rem;
    }

    .lightbox-counter {
        bottom: 15px;
        padding: 6px 14px;
        font-size: 0.8rem;
    }
}

/* ========================================
   320px幅対応
   ======================================== */
@media (max-width: 320px) {
    .lightbox-content {
        padding: 60px 5px 80px 5px;
    }

    .lightbox-image-container {
        max-height: 60vh;
    }

    .lightbox-image {
        max-height: 60vh;
    }

    /* ボタンさらに縮小 */
    .lightbox-close {
        top: 8px;
        right: 8px;
        width: 32px;
        height: 32px;
    }

    .lightbox-close i {
        font-size: 0.9rem;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 36px;
        height: 36px;
    }

    .lightbox-prev {
        left: 3px;
    }

    .lightbox-next {
        right: 3px;
    }

    .lightbox-prev i,
    .lightbox-next i {
        font-size: 1.1rem;
    }

    .lightbox-counter {
        bottom: 10px;
        padding: 5px 12px;
        font-size: 0.75rem;
    }
}

/* ========================================
   アニメーション（高級感のあるヌメッとした動き）
   ======================================== */

/* モーダル全体のフェードイン */
@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* オーバーレイのフェードイン */
@keyframes overlayFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(10px);
    }
}

/* ボタンのフェードイン（遅延付き） */
@keyframes buttonFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* カウンターのスライドアップ */
@keyframes counterSlideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* 画像の初回表示アニメーション */
@keyframes imageFadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.gallery-lightbox-modal.active .lightbox-image {
    animation: imageFadeInScale 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
}
