/**
 * ============================================================
 *  MvSlider — 엔진 기본 CSS
 * ============================================================
 *  슬라이더 인프라 스타일만 담당. 시각 디자인은 전환/레이아웃/토큰이 담당.
 */

/* ─── 컨테이너 ─────────────────────────── */
[data-mv-slider] {
    position: relative;
    overflow: hidden;
    width: 100%;
}

[data-mv-slider] *,
[data-mv-slider] *::before,
[data-mv-slider] *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ─── 슬라이드 기본 ────────────────────── */
[data-mv-slide] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    z-index: 1;
    pointer-events: none;
}

[data-mv-slide].active {
    opacity: 1;
    z-index: 5;
    pointer-events: auto;
}

/* 나가는 슬라이드: 새 슬라이드 위에서 서서히 사라짐 */
[data-mv-slide].mv-leaving {
    opacity: 1;
    z-index: 10;
    pointer-events: none;
    animation: mv-fadeOut 2.5s ease forwards;
}

/* 나가는 슬라이드 내부 요소도 함께 페이드아웃 */
[data-mv-slide].mv-leaving .mv-overlay,
[data-mv-slide].mv-leaving .mv-bg,
[data-mv-slide].mv-leaving .mv-texbox {
    transition: none;
}

@keyframes mv-fadeOut {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}

/* ─── 닷 내비게이션 ────────────────────── */
.mv-dots {
    position: absolute;
    z-index: 100;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    align-items: center;
}

.mv-dot {
    width: 28px;
    height: 3px;
    border: none;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease;
}

.mv-dot:hover {
    background: rgba(255, 255, 255, 0.4);
}

.mv-dot.active {
    background: #fff;
    width: 48px;
}

/* ─── 카운터 ───────────────────────────── */
.mv-counter {
    position: absolute;
    z-index: 100;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    font-family: 'Montserrat', monospace, sans-serif;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 3px;
}

.mv-counter-cur {
    color: #fff;
    font-weight: 600;
}

/* ─── 프로그레스 바 ────────────────────── */
.mv-progress {
    position: absolute;
    z-index: 100;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
}

.mv-progress-bar {
    height: 100%;
    width: 0;
    background: rgba(255, 255, 255, 0.5);
    transition: width 0.08s linear;
}

/* ─── 자동재생 토글 ────────────────────── */
.mv-playpause {
    position: absolute;
    z-index: 100;
    bottom: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    padding: 0;
}

.mv-playpause:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Play icon (triangle) */
.mv-playpause.paused .mv-pp-icon {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 0 6px 10px;
    border-color: transparent transparent transparent #fff;
    margin-left: 2px;
}

/* Pause icon (two bars) */
.mv-playpause.playing .mv-pp-icon {
    width: 10px;
    height: 12px;
    border-left: 3px solid #fff;
    border-right: 3px solid #fff;
}

/* ─── 화살표 공통 ──────────────────────── */
[data-mv-prev],
[data-mv-next] {
    position: absolute;
    z-index: 100;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s, background 0.3s;
    padding: 0;
}

[data-mv-slider]:hover [data-mv-prev],
[data-mv-slider]:hover [data-mv-next] {
    opacity: 1;
}

[data-mv-prev]:hover,
[data-mv-next]:hover {
    background: rgba(255, 255, 255, 0.25);
}

[data-mv-prev] { left: 0; }
[data-mv-next] { right: 0; }

[data-mv-prev] span,
[data-mv-next] span {
    position: absolute;
    width: 14px;
    height: 2px;
    background: #fff;
}

[data-mv-prev] span { transform-origin: left; }
[data-mv-prev] span:first-child { transform: rotate(-45deg); }
[data-mv-prev] span:last-child { transform: rotate(45deg); }

[data-mv-next] span { transform-origin: right; }
[data-mv-next] span:first-child { transform: rotate(45deg); }
[data-mv-next] span:last-child { transform: rotate(-45deg); }

/* ─── 닷이 있을 때 프로그레스 바 위치 조정 ── */
[data-mv-slider]:has(.mv-dots) .mv-progress {
    bottom: 35px;
}

/* ─── prefers-reduced-motion ───────────── */
.mv-reduced-motion [data-mv-slide] {
    transition: opacity 0.2s ease !important;
}

.mv-reduced-motion [data-mv-slide] * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

/* ─── 배경 이미지 유틸 ─────────────────── */
.mv-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* YouTube 비디오 배경 */
.mv-bg-video {
    overflow: hidden;
    background-color: #000;
}
.mv-bg-video iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 56.25vw; /* 16:9 비율 */
    min-height: 100%;
    min-width: 177.78vh; /* 100 * 16/9 */
    transform: translate(-50%, -50%);
    pointer-events: none;
    border: none;
}

/* 영상 고정 배경 모드 — section 레벨 */
.mv-fixed-video {
    position: absolute;
    inset: 0;
    z-index: 2;
    overflow: hidden;
    background-color: #000;
    pointer-events: none;
    will-change: transform; /* GPU 컴포지팅 강제 */
}
.mv-fixed-video iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 56.25vw;
    min-height: 100%;
    min-width: 177.78vh;
    transform: translate(-50%, -50%);
    pointer-events: none;
    border: none;
}

/* ── 고정 영상 모드: 슬라이드 레이어 제어 ── */

/* 모든 슬라이드: 배경 완전 제거 */
[data-mv-fixed-video="true"] [data-mv-slide] .mv-bg {
    display: none !important;
}

/* 모든 슬라이드: 슬라이드 자체 배경 투명 */
[data-mv-fixed-video="true"] [data-mv-slide] {
    background: transparent !important;
    background-color: transparent !important;
}

/* 커튼/전환 요소도 투명 (영상이 비쳐야 함) */
[data-mv-fixed-video="true"] [data-mv-slide] .mv-curtain {
    background: transparent !important;
}

/* 비활성 슬라이드: 완전 숨김 */
[data-mv-fixed-video="true"] [data-mv-slide]:not(.active):not(.mv-leaving) {
    visibility: hidden !important;
    z-index: 1 !important;
}

/* 활성 슬라이드: 영상 위에 표시 */
[data-mv-fixed-video="true"] [data-mv-slide].active {
    z-index: 5 !important;
    visibility: visible !important;
}

/* 나가는 슬라이드 */
[data-mv-fixed-video="true"] [data-mv-slide].mv-leaving {
    z-index: 10 !important;
    visibility: visible !important;
}

/* 고정 영상 모드: 슬라이드별 오버레이 숨김 (고정 오버레이로 대체) */
[data-mv-fixed-video="true"] [data-mv-slide] .mv-overlay {
    display: none !important;
}

/* 고정 오버레이 — 영상 위, 텍스트 아래 */
.mv-fixed-overlay {
    position: absolute;
    inset: 0;
    z-index: 3;
    background: #000;
    pointer-events: none;
}

/* 오버레이 유틸 */
.mv-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
}

/* 텍스트 박스 유틸 */
.mv-texbox {
    position: absolute;
    z-index: 30;
    overflow: hidden;
}

/* 전체화면 중앙정렬 유틸 */
.mv-center {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
}
