/* 재사용 롤링 배너 — 위치 무관 공통 스타일 (모바일·Android WebView 호환) */
.nx-banner-carousel {
    position: relative;
    width: 100%;
    max-width: 1200px;
    min-width: 0;
    margin: 0 auto;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    background: #f0f0f0;
    box-sizing: border-box;
    /* 컨트롤 크기를 배너 실제 너비에 맞춤 */
    container-type: inline-size;
}

/* 높이: aspect-ratio 대신 padding % (구형 WebView·iframe에서 높이 0 방지) */
.nx-banner-carousel .nx-bc-viewport {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 0;
    padding-bottom: var(--nx-bc-aspect-pad, 25%);
    overflow: hidden;
    box-sizing: border-box;
    z-index: 0;
}

.nx-banner-carousel .nx-bc-stack {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
    z-index: 1;
}

.nx-banner-carousel .nx-bc-slide {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.55s ease;
    pointer-events: none;
}

.nx-banner-carousel .nx-bc-slide.is-active {
    opacity: 1;
    z-index: 1;
    pointer-events: auto;
}

/* 전역 img{ height:auto } 등과 무관하게 슬라이드 박스에 맞춤 — absolute 로 레이아웃 박스 고정 */
.nx-banner-carousel .nx-bc-slide-link {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* 클래스 유무와 관계없이 슬라이드 이미지에 적용 (AJAX 이전 HTML·캐시 대비) */
.nx-banner-carousel .nx-bc-slide img.nx-bc-slide-img,
.nx-banner-carousel .nx-bc-slide > img {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    display: block;
    box-sizing: border-box;
    object-fit: cover;
    object-position: center;
    -webkit-object-fit: cover;
}

/* 기본(넓은 배너): 큰 컨트롤 — 뷰포트 기준(슬라이드·contain 이미지와 동일 박스) */
.nx-banner-carousel .nx-bc-viewport .nx-bc-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.nx-banner-carousel .nx-bc-btn {
    margin: 0;
    padding: 0 6px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.nx-banner-carousel .nx-bc-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.nx-banner-carousel .nx-bc-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 1px;
}

.nx-banner-carousel .nx-bc-counter {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    min-width: 3em;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
}

/* cqw 지원: 배너 너비에 비례해 버튼·카운터·여백이 연속적으로 축소 */
@supports (width: 1cqw) {
    .nx-banner-carousel .nx-bc-viewport .nx-bc-controls {
        top: clamp(4px, 1.4cqw, 10px);
        right: clamp(4px, 1.4cqw, 10px);
        gap: clamp(2px, 0.7cqw, 6px);
        padding: clamp(2px, 0.55cqw, 5px) clamp(4px, 1cqw, 8px);
        border-radius: clamp(4px, 1.2cqw, 8px);
    }

    .nx-banner-carousel .nx-bc-btn {
        font-size: clamp(14px, 4.5cqw, 22px);
        padding: 0 clamp(2px, 1cqw, 6px);
    }

    .nx-banner-carousel .nx-bc-counter {
        font-size: clamp(9px, 2.8cqw, 13px);
        min-width: clamp(2.4em, 18cqw, 3.2em);
    }
}

/* 좁은 배너(임베드·사이드 등): 한 단계 더 작게 */
@container (max-width: 560px) {
    .nx-banner-carousel .nx-bc-viewport .nx-bc-controls {
        top: 6px;
        right: 6px;
        gap: 3px;
        padding: 2px 5px;
        border-radius: 6px;
    }

    .nx-banner-carousel .nx-bc-btn {
        font-size: 16px;
        padding: 0 3px;
    }

    .nx-banner-carousel .nx-bc-counter {
        font-size: 11px;
        min-width: 2.6em;
    }
}

@container (max-width: 400px) {
    .nx-banner-carousel .nx-bc-viewport .nx-bc-controls {
        top: 4px;
        right: 4px;
        gap: 2px;
        padding: 1px 4px;
        border-radius: 5px;
    }

    .nx-banner-carousel .nx-bc-btn {
        font-size: 14px;
        padding: 0 2px;
    }

    .nx-banner-carousel .nx-bc-counter {
        font-size: 10px;
        min-width: 2.4em;
    }

    .nx-banner-carousel .nx-bc-sep {
        font-size: 0.9em;
    }
}

/* WebView 등 @container 미지원 시: 뷰포트 너비 기준 보조 */
@media (max-width: 480px) {
    .nx-banner-carousel .nx-bc-viewport .nx-bc-controls {
        top: 4px;
        right: 4px;
        gap: 2px;
        padding: 1px 4px;
        border-radius: 5px;
    }

    .nx-banner-carousel .nx-bc-btn {
        font-size: 14px;
        padding: 0 2px;
    }

    .nx-banner-carousel .nx-bc-counter {
        font-size: 10px;
        min-width: 2.4em;
    }
}

@media (max-width: 649px) {
    /* 세로비: CSS 고정 16:9 제거 → JS가 활성 이미지 natural 비율로 --nx-bc-aspect-pad 설정 */

    /* 가로형 프로모: cover는 좌우가 잘려 보일 수 있음 — 모바일에선 전체가 보이게 contain */
    .nx-banner-carousel .nx-bc-slide img.nx-bc-slide-img,
    .nx-banner-carousel .nx-bc-slide > img {
        object-fit: contain;
        -webkit-object-fit: contain;
        background-color: inherit;
    }

    /* contain 시 레터박스와 이미지 박스 불일치 — JS가 뷰포트에 --nx-bc-ctrl-* 설정 */
    .nx-banner-carousel .nx-bc-viewport .nx-bc-controls {
        top: var(--nx-bc-ctrl-top, 8px) !important;
        right: var(--nx-bc-ctrl-right, 8px) !important;
    }

    .nx-banner-carousel {
        background-color: transparent;
    }

    .nx-banner-carousel .nx-bc-viewport {
        background-color: #f0f0f0;
        border-radius: inherit;
    }
}
