/*
 * 슬라이더 팝업 (사이트 공통 기능)
 * 아래 바(하루동안 보지 않기 · 닫기)와 글꼴(Pretendard)은 레이어 팝업과 같은 css/popup_common.css 를 쓴다.
 * 선택된 이름 버튼은 사이트 테마 컬러(/css/theme_color.css 의 --theme-color, 없으면 #333)를 쓴 제안값이다.
 */

.slide_popup {
    --slide-popup-point: var(--theme-color, #333);
    --slide-popup-point-text: var(--theme-color-text, #fff);
    --slide-popup-names: 160px;  /* 버튼 세로형 : 이름 목록 폭 */
    position: fixed;
    top: 50%;
    left: 50%;
    box-sizing: border-box;
    width: min(var(--slide-popup-width, 500px), calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow: hidden;
    border-radius: 0 0 10px 10px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    transform: translate(-50%, -50%);
    font-size: 14px;
    line-height: 1.4;
    color: #222;
}

/* 위치 직접 지정 : 기본 레이어 팝업처럼 페이지 기준 좌표 */
.slide_popup.is-custom {
    position: absolute;
    top: var(--slide-popup-top, 10px);
    left: var(--slide-popup-left, 10px);
    transform: none;
}

/* 버튼 세로형은 이름 목록만큼 넓힌다. (지정 폭 = 슬라이더 폭) */
.slide_popup--name_side {
    width: min(calc(var(--slide-popup-width, 500px) + var(--slide-popup-names)), calc(100vw - 32px));
}

.slide_popup *,
.slide_popup *::before,
.slide_popup *::after {
    box-sizing: border-box;
}

.slide_popup_dim {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.slide_popup__body {
    position: relative;
}

.slide_popup__slider {
    position: relative;
    overflow: hidden;
}

/* 버튼 세로형 : 이름 목록은 슬라이더 높이에 맞추고, 넘치면 목록만 스크롤 */
.slide_popup--name_side .slide_popup__slider {
    margin-right: var(--slide-popup-names);
}

.slide_popup__link {
    display: block;
}

.slide_popup__img {
    display: block;
    width: 100%;
    height: auto;
}

/* 숫자형 : 오른쪽 아래 1 / n */
.slide_popup__fraction {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 2;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: #fff;
    pointer-events: none;
}

/* 이름 버튼 목록 */
.slide_popup__names {
    display: flex;
    margin: 0;
    padding: 0;
    background: #f4f4f4;
    scrollbar-width: thin;
}

.slide_popup--name_side .slide_popup__names {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--slide-popup-names);
    flex-direction: column;
    overflow-y: auto;
}

.slide_popup--name_bottom .slide_popup__names {
    overflow-x: auto;
}

.slide_popup__name {
    flex: 1 0 auto;
    min-width: 0;
    margin: 0;
    padding: 12px 14px;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    text-align: left;
    cursor: pointer;
}

.slide_popup--name_side .slide_popup__name {
    flex: 0 0 auto;
    border-bottom: 1px solid #e5e5e5;
}

.slide_popup--name_bottom .slide_popup__name {
    max-width: 180px;
    text-align: center;
}

/* 긴 이름 : 한 줄 말줄임 (전체 이름은 title 로 보여 줌) */
.slide_popup__name span {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.slide_popup__name:hover {
    color: #222;
}

.slide_popup__name.is-active {
    background: var(--slide-popup-point);
    color: var(--slide-popup-point-text);
}

.slide_popup__name:focus-visible {
    outline: 2px solid var(--theme-color-accent, var(--slide-popup-point));
    outline-offset: -2px;
}

/* 모바일 : 위치 지정과 관계없이 가운데, 버튼 세로형은 이름 목록을 아래로 */
@media (max-width: 767px) {
    .slide_popup,
    .slide_popup.is-custom {
        position: fixed;
        top: 50%;
        left: 50%;
        width: min(var(--slide-popup-width, 500px), calc(100vw - 32px));
        transform: translate(-50%, -50%);
    }

    .slide_popup--name_side .slide_popup__slider {
        margin-right: 0;
    }

    .slide_popup--name_side .slide_popup__names {
        position: static;
        width: auto;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .slide_popup--name_side .slide_popup__name {
        flex: 1 0 auto;
        max-width: 180px;
        border-bottom: 0;
        text-align: center;
    }
}
