.hc-gallery-board {
    width: 100%;
    margin: 40px 0;
}

.hc-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(260px, 1fr));
    gap: 30px 26px;
    max-width: 1280px;
    margin: 0 auto;
    justify-content: center;
}

.gallery-item {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.07);
    padding: 0 0 15px 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    overflow: hidden !important;
}

.gallery-thumb {
    width: 100%;
    height: 230px;
    overflow: hidden !important;
    border-radius: 16px 16px 0 0;
    background: #eaeef1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit; /* 부모 border-radius와 동일하게 유지 */
    display: block;
    position: absolute; /* 이미지를 명시적으로 절대 위치로 잡아 overflow 처리 보장 */
    top: 0;
    left: 0;
}

.gallery-title {
    font-weight: bold;
    font-size: 1.05em;
    margin: 13px 15px 0 15px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    text-align: center;
}

.hc-gallery-empty {
    grid-column: 1/-1;
    text-align: center;
    color: #888;
    font-size: 17px;
    padding: 70px 0 80px 0;
    width: 100%;
}

.hc-gallery-pagination {
    margin: 36px 0 0 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 6px;
    align-items: center;
    font-size: 0;
}

.hc-gallery-page-num {
    display: inline-block;
    min-width: 34px;
    margin: 0 2px;
    padding: 7px 13px;
    border-radius: 6px;
    background: #f4f4f7;
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
    font-size: 17px;
    transition: background 0.13s;
    text-align: center;
    box-sizing: border-box;
    vertical-align: middle;
}

.hc-gallery-page-num.active,
.hc-gallery-page-num:hover {
    background: #0073aa;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
}

.hc-gallery-page-arrow {
    font-size: 20px;
    padding: 7px 10px;
}

.hc-gallery-page-dot {
    display: inline-block;
    min-width: 14px;
    text-align: center;
    color: #888;
    font-size: 17px;
    user-select: none;
    vertical-align: middle;
}

.hc-gallery-page-num.disabled {
    background: #e2e5e9;
    color: #b4b6b9;
    cursor: not-allowed;
    pointer-events: none;
}

@media (max-width: 1100px) {
    .hc-gallery-grid {
        grid-template-columns: repeat(2, minmax(200px, 1fr));
    }
}

@media (max-width: 700px) {
    .hc-gallery-grid {
        grid-template-columns: 1fr;
    }

    .hc-gallery-board {
        padding: 0 2vw;
    }

    .gallery-thumb {
        height: 150px;
    }
}

.hc-gallery-modal {
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.hc-gallery-modal-bg {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.74);
    z-index: 1;
}

.hc-gallery-modal-inner {
    position: relative;
    z-index: 2;
    background: #fff;
    border-radius: 16px;
    width: 950px;
    max-width: 95vw;
    height: 800px;
    max-height: 95vh;
    box-shadow: 0 8px 50px 0 rgba(0, 0, 0, 0.23);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hc-gallery-modal-close {
    position: absolute;
    right: 18px;
    top: 16px;
    font-size: 2.0em;
    color: #333;
    font-weight: 700;
    cursor: pointer;
    z-index: 3;
    background: none;
    border: none;
}

.hc-gallery-modal-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden; /* 중요 추가사항 */
}

.hc-gallery-modal-image {
    max-width: 100%;
    max-height: 100%;
    border-radius: 16px; /* 적절한 radius 설정 */
    object-fit: contain;
    background: #f8f9fa;
    user-select: none;
    -webkit-user-drag: none;
    box-shadow: 0 2px 18px rgba(60, 60, 70, 0.08);
}


.hc-gallery-modal-prev,
.hc-gallery-modal-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.7em;
    color: #333;
    background: rgba(255, 255, 255, 0.48);
    border: none;
    cursor: pointer;
    z-index: 2;
    padding: 4px 12px;
    border-radius: 40px;
    transition: background 0.15s;
}

.hc-gallery-modal-prev:hover,
.hc-gallery-modal-next:hover {
    background: #0073aa;
    color: #fff;
}

.hc-gallery-modal-prev {
    left: 10px; /* 컨테이너 안쪽으로 이동 */
}

.hc-gallery-modal-next {
    right: 10px; /* 컨테이너 안쪽으로 이동 */
}

.hc-gallery-modal-title {
    font-size: 1.16em;
    font-weight: bold;
    margin-bottom: 6px;
    text-align: center;
    width: 100%;
}

.hc-gallery-modal-date {
    color: #aaa;
    font-size: .98em;
    margin-bottom: 10px;
    text-align: center;
}

.hc-gallery-modal-desc {
    font-size: 1em;
    color: #444;
    text-align: center;
    white-space: pre-line;
    margin-bottom: 8px;
    width: 100%;
}

.hc-gallery-modal-index {
    margin-top: 4px;
    color: #7a7a7a;
    font-size: .98em;
    text-align: center;
    width: 100%;
}

@media (max-width: 900px) {
    .hc-gallery-modal-inner {
        width: 98vw;
        min-width: 0;
        height: 65vw;
        max-height: 85vh;
        padding: 12px 2vw 18px 2vw;
    }

    .hc-gallery-modal-content {
        height: 36vw;
        min-height: 140px;
    }

    .hc-gallery-modal-image {
        max-width: 97vw;
        max-height: 34vw;
    }

    .hc-gallery-modal-prev,
    .hc-gallery-modal-next {
        font-size: 2em;
        left: -22px;
        right: -22px;
    }
}

@media (max-width: 600px) {
    .hc-gallery-modal-inner {
        width: 99vw;
        height: 78vw;
        padding: 7px 1vw 13px 1vw;
    }

    .hc-gallery-modal-content {
        height: 34vw;
        min-height: 100px;
    }

    .hc-gallery-modal-image {
        max-width: 97vw;
        max-height: 34vw;
    }
}