/* HONGDRICK Gallery Carousel */

.wp-block-gallery.hd-carousel-ready {
    display: block !important;   /* 코어 갤러리의 flex 레이아웃 강제 해제 */
    margin: 24px 0;
}

.hd-carousel {
    outline: none;
    width: 100%;
}

/* 메인 뷰포트: 사진 1장 크기 */
.hd-carousel-stage {
    position: relative;
    display: block;
    width: -moz-fit-content;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;            /* 이미지 크기에 맞춰 가운데 정렬 */
    background: transparent;   /* 검은 여백 제거 */
    border-radius: 8px;
    overflow: hidden;
    line-height: 0;            /* 인라인 여백 제거 */
    font-size: 0;
}

.hd-carousel-img {
    display: block;
    /* 외부(워드프레스 코어 갤러리 등) CSS가 폭/높이를 강제하지 못하게 잠금 */
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 70vh;   /* 세로로 긴 이미지가 지나치게 길어지지 않도록 상한 */
    max-height: 70dvh;  /* 모바일 주소창을 제외한 실제 보이는 높이 기준 (지원 브라우저) */
    object-fit: contain;
    flex: none !important;
    margin: 0 !important;   /* .single-content img margin 상속 제거 */
    border-radius: 0;
}

/* 캡션 */
.hd-carousel-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.5;
    color: #fff;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    text-align: center;
}

/* 카운터 */
.hd-carousel-counter {
    position: absolute;
    top: 10px;
    right: 12px;
    padding: 3px 9px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 999px;
}

/* 좌우 화살표 */
.hd-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    line-height: 1;
    color: #fff;
    background: rgba(0, 0, 0, 0.45);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s ease;
    z-index: 2;
}
.hd-carousel-arrow:hover {
    background: rgba(0, 0, 0, 0.75);
}
.hd-carousel-prev { left: 10px; }
.hd-carousel-next { right: 10px; }

/* 썸네일 목록 */
.hd-carousel-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-bottom: 4px;
    overflow-x: auto;
    scrollbar-width: thin;
}
.hd-carousel-thumb {
    flex: 0 0 auto;
    width: 74px;
    height: 54px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    background: none;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s ease, border-color 0.15s ease;
}
.hd-carousel-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    margin: 0;          /* 테마의 .single-content img margin 상속 제거 (아래로 밀려 잘리던 문제) */
    border-radius: 0;
}
.hd-carousel-thumb:hover { opacity: 0.85; }
.hd-carousel-thumb.is-active {
    opacity: 1;
    border-color: #3b5bdb;
}

/* 다크모드 대응 */
body.dark-mode .hd-carousel-thumb.is-active {
    border-color: #6b8cff;
}

/* 모바일 */
@media (max-width: 600px) {
    /* 화살표: 터치하기 편한 크기(44px 권장 터치 타깃) */
    .hd-carousel-arrow { width: 44px; height: 44px; font-size: 24px; }
    .hd-carousel-thumb { width: 60px; height: 44px; }

    /* 캡션: 이미지를 덮는 대신 이미지 아래 띠로 표시 */
    .hd-carousel-caption {
        position: static;
        background: rgba(0, 0, 0, 0.75);
        padding: 8px 12px;
    }
}
