/* ギャラリーコンテナ */
.gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 60px 20px;
    background-color: #ffffff;
}

/* フィルターコントロール */
.filter-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 25px;
    background-color: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.filter-btn:hover {
    background-color: #e0e0e0;
}

.filter-btn.active {
    background-color: #333;
    color: #fff;
    border-color: #333;
}

/* ギャラリーグリッド */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    grid-auto-flow: dense;
}

/* ギャラリーアイテム */
.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: #f9f9f9;
    aspect-ratio: 3/4;
}

.gallery-item.landscape {
    aspect-ratio: 4/3;
}

.gallery-item.zine {
    aspect-ratio: 1/1.4;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* Zineバッジ */
.gallery-item.zine::before {
    content: 'ZINE';
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    z-index: 2;
}

/* リンクアイコン */
.gallery-link {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(255, 255, 255, 0.9);
    color: #333;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    text-decoration: none;
    z-index: 3;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.gallery-link:hover {
    background-color: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Lightbox（画像用） */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.lightbox.active {
    display: flex;
}

.lightbox-image {
    max-width: 90%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 30px;
    cursor: pointer;
    padding: 10px 20px;
    border-radius: 5px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.lightbox-close {
    top: 20px;
    right: 20px;
}

.lightbox-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-caption {
    display: none;
}

/* Book Viewer（Zine用 - 見開き形式） */
.book-viewer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    flex-direction: column;
}

.book-viewer.active {
    display: flex;
}

.book-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: rgba(0, 0, 0, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
    gap: 15px;
}

.book-close {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 30px;
    cursor: pointer;
    padding: 5px 15px;
    border-radius: 5px;
    transition: all 0.3s ease;
    line-height: 1;
}

.book-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.book-navigation {
    display: flex;
    align-items: center;
    gap: 15px;
}

.book-prev,
.book-next {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 8px 15px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.book-prev:hover,
.book-next:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.book-prev:disabled,
.book-next:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.book-page-info {
    color: white;
    font-size: 16px;
    font-weight: 500;
    min-width: 100px;
    text-align: center;
}

.book-content {
    flex: 1;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.book-spread {
    display: flex;
    gap: 0;
    align-items: center;
    justify-content: center;
    perspective: 1500px;
    max-width: 95vw;
    max-height: 80vh;
}

.book-page {
    background: white;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.book-page-left {
    border-right: none;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
}

.book-page-right {
    border-left: none;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.3);
}

.book-spine {
    width: 2px;
    height: 100%;
    background: linear-gradient(to right,
        rgba(0, 0, 0, 0.4),
        rgba(0, 0, 0, 0.2),
        rgba(0, 0, 0, 0.4));
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

#bookCanvasLeft,
#bookCanvasRight {
    display: block;
    max-width: 45vw;
    max-height: 75vh;
    width: auto;
    height: auto;
}

.book-caption {
    display: none;
}

/* アニメーション */
.gallery-item.hidden {
    display: none;
}

.gallery-item.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }

    .filter-controls {
        gap: 10px;
    }

    .filter-btn {
        padding: 8px 18px;
        font-size: 12px;
    }

    .book-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .book-spread {
        flex-direction: column;
        gap: 10px;
    }

    .book-spine {
        width: 100%;
        height: 2px;
        background: linear-gradient(to bottom,
            rgba(0, 0, 0, 0.4),
            rgba(0, 0, 0, 0.2),
            rgba(0, 0, 0, 0.4));
    }

    #bookCanvasLeft,
    #bookCanvasRight {
        max-width: 90vw;
        max-height: 40vh;
    }

    .book-page-left,
    .book-page-right {
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
    }
}

@media (max-width: 480px) {
    .gallery-container {
        padding: 40px 15px;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .book-content {
        padding: 10px;
    }

    .book-controls {
        padding: 10px 15px;
    }

    #bookCanvasLeft,
    #bookCanvasRight {
        max-width: 95vw;
        max-height: 35vh;
    }
}