.image-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    /* 데스크탑 기본 5개의 컬럼 */
    max-width: 1200px;
    /* 최대 너비 설정 */
    padding: 20px 20px 50px 20px;
    margin: 0 auto;
    gap: 15px;
}

.image-box {
    position: relative;
    max-height: 250px;
    max-width: 250px;
    overflow: hidden;
}

#caption {
    color: #ccc;
    padding: 10px 0;
    height: 30px;
}

.image-box img {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    /* 포인터 커서로 변경 */
}




/* 모달 스타일 */
.modal {
    display: none;
    /* 기본적으로 숨김 */
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    /* 반투명한 배경 */
    overflow: auto;
}

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 2% auto;
    padding: 50px;
    max-width: 80%; /* 모달 최대 너비 */
    min-width: 80%;
    min-height: 80%;
    background-color: #222222;
    text-align: center;
    align-items: center;
    border-radius: 6px;
}




.modal-image {
    max-width: 100%;
    max-height: 100%;
   margin-top: 20px;
    /* 모달 창 내 이미지 최대 높이 설정 */
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 20px;
    cursor: pointer;
    font-size: 30px;
    color: #aaa;
}

.prev,
.next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -50px;
    color: white;
    font-weight: bold;
    font-size: 20px;
    transition: 0.3s;
    user-select: none;
}

.prev {
    left: 0;
}

.next {
    right: 0;
}

.prev:hover,
.next:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

#caption{
    display: block;
    width: 100%;  
    height: 13px;  
}

.modal-image-wrap{
    max-height: 90%;
    min-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center; /* 수직 중앙 정렬 */
    justify-content: center; /* 수평 중앙 정렬 (옵션) */
    height: 100vh; /* 컨테이너의 높이를 설정 */
}

.clearfix::after {
    content: "";
    display: block;
    clear: both;
  }



/* 태블릿에서 4개의 컬럼 */
@media (max-width: 768px) {
    .image-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 모바일에서 2개의 컬럼 */
@media (max-width: 576px) {
    .image-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .image-box {
        position: relative;
        min-width: 100%;
        min-height: 100%;
        max-height: 200px;
        max-width: 200px;
        overflow: hidden;
    }

    .modal-content {
        margin: 10% auto;
        max-height: 700px;
        min-width: 50%;
        min-height: 50%;
    }

    
}