/* ギャラリー全体の設定 */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: auto; /* 行の高さを自動に */
    gap: 10px;
    max-height: 800px; /* スクロールする高さの制限 */
    overflow-y: auto;  /* 縦スクロール */
}


/* テキスト全体のスタイルは左揃え */
.gallery-item p {
    margin: 0;
    font-size: calc((100vw - 320px) / 140 + 10px);
    color: #333;
    text-align: left;
}

/* 1行目を中央揃えにする */
.gallery-item p .first-line {
    display: block;
    text-align: center;
    font-weight: bold;
}

/* 2行目以降は左揃え */
.gallery-item p .rest-lines {
    display: block;
    text-align: left;
}

/* 画像とテキストの設定 */
.gallery-item img {
    width: 100%;
    height: auto;
    object-fit: cover;
    margin-bottom: 5px;
}

/* アイテム全体の高さを確保 */
.gallery-item {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    text-align: center;
}

.gallery-item p {
    margin: 0;
    font-size: calc((100vw - 320px) / 140 + 10px);
    color: #333;
}


/* レスポンシブ対応 */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}