/* --- 基本リセット --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    padding: 50px 15px;
    background-color: #fff;
    font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", sans-serif;
}

.container {
    max-width: 790px; /* デスクトップ時の基準幅（画像3列分） */
    margin: 0 auto;
}

/* --- カテゴリーバー --- */
.category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 15px; 
    margin-bottom: 40px;
    width: 100%;
}

.category-item {
    width: calc((100% - (15px * 2)) / 3); /* 3列 */
    height: 35px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    color: #444;
    cursor: pointer;
    transition: 0.2s;
}

.category-item.active {
    background-color: #333;
    color: #fff;
    border-color: #333;
}

/* --- ギャラリー --- */
.gallery-container {
    display: flex;
    flex-wrap: wrap;
    gap: 25px 20px; /* 縦の隙間25px、横の隙間20px */
    width: 100%;
}

.gallery-item {
    width: 250px; /* PC版固定幅 */
}

.image-wrapper {
    width: 100%;
    height: 230px;
    overflow: hidden;
    border-radius: 20px;
    background-color: #eee;
    margin-bottom: 8px; 
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
    transition: 0.3s;
}

.image-wrapper img:hover { opacity: 0.8; }

.caption {
    font-size: 14px;
    color: #333;
    line-height: 1.4;
    text-align: left; /* 左揃え */
}

/* --- スマホ対応 (2カラム) --- */
@media (max-width: 768px) {
    .container { max-width: 100%; }
    
    .category-nav { gap: 10px 10px; }
    .category-item { width: calc((100% - 10px) / 2); } /* スマホナビも2列（任意） */

    .gallery-container { gap: 20px 10px; }
    .gallery-item { width: calc((100% - 10px) / 2); } /* 画像2列化 */
    
    .image-wrapper { height: auto; aspect-ratio: 1 / 1; border-radius: 15px; }
}

/* --- モーダル --- */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}
.modal.active { opacity: 1; visibility: visible; }
.modal-body { display: flex; flex-direction: column; align-items: center; max-width: 80%; }
.modal-content { max-width: 100%; max-height: 70vh; border: 2px solid #fff; }
.modal-caption-text { color: #fff; margin-top: 15px; text-align: center; }

.modal-arrow {
    position: absolute; top: 50%; transform: translateY(-50%);
    color: #fff; font-size: 40px; cursor: pointer; padding: 20px; z-index: 10002;
    opacity: 0.6; transition: 0.3s;
}
.modal-arrow:hover { opacity: 1; }
.modal-arrow.prev { left: 10px; }
.modal-arrow.next { right: 10px; }
.modal-close { position: absolute; top: 20px; right: 20px; color: #fff; font-size: 40px; cursor: pointer; }