.gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 60px 16px;
    padding: 16px;
    justify-content: center;
}

.gallery-item-wrapper {
    text-align: center;
    width: calc(33.333% - 32px);
    box-sizing: border-box;
}

.gallery-item {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
    cursor: pointer;
    position: relative;
}

.gallery-item:hover {
    transform: translateY(-5px);
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.3s;
}

.gallery-item img.secondary {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
}

.gallery-item:hover img.secondary {
    opacity: 1;
}

.gallery-item:hover img.primary {
    opacity: 0;
}

.gallery-item-title {
	padding: 20px 0 50px 0;
	font-size: 24px;
	font-weight: bold;
	text-align: center;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

.modal-content {
    background-color: #fff;
    width: 80%;
    max-height: 80%;
    overflow-y: auto;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
}

.modal-close {
    position: fixed;
    top: 5%;
    right: 5%;
    background: none;
    border: none;
    font-size: 27px;
    color: #fff;
    cursor: pointer;
    z-index: 1000;
}

/* 화면 크기가 768px 이하일 때 (가로 2개 항목) */
@media (max-width: 768px) {
    .gallery-item-wrapper {
        width: calc(50% - 32px);
    }
}

/* 화면 크기가 480px 이하일 때 (가로 1개 항목) */
@media (max-width: 480px) {
    .gallery-item-wrapper {
        width: calc(100% - 32px);
    }
}