/* ════════════════════════════════════════════
   팝업 모달 (Swiper 기반 · 모바일 우선 · 360px~1280px)
   ════════════════════════════════════════════ */

/* ── 오버레이 ────────────────────────────── */
.hyoo-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.hyoo-modal-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

body.hyoo-modal-open {
    overflow: hidden;
}

/* ── 모달 컨테이너 ───────────────────────── */
.hyoo-modal {
    background: #fff;
    border-radius: 8px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .25);
    transform: translateY(16px);
    transition: transform 0.25s ease;
}

.hyoo-modal-overlay.is-visible .hyoo-modal {
    transform: translateY(0);
}

/* ── 헤더: 제목 + 카운터 ─────────────────── */
.hyoo-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .875rem 1.25rem;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
    gap: .5rem;
    min-height: 52px;
    box-sizing: border-box;
}

.hyoo-modal-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.4;
    margin: 0;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hyoo-modal-counter {
    flex-shrink: 0;
    font-size: 13px;
    color: #888;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* ── Swiper 래퍼 ─────────────────────────── */
.hyoo-modal-swiper {
    width: 100%;
    overflow: hidden;   /* Swiper 필수 */
    flex-shrink: 0;
}

/* autoHeight 전환 부드럽게 */
.hyoo-modal-swiper .swiper-wrapper {
    align-items: flex-start;
}

/* ── 슬라이드 ────────────────────────────── */
.hyoo-modal-slide {
    display: flex;
    flex-direction: column;
    height: auto;   /* Swiper autoHeight 필수 */
    box-sizing: border-box;
}

/* 이미지 없는 슬라이드 최소 높이 */
.hyoo-modal-slide.no-img {
    min-height: 220px;
    justify-content: center;
}

/* ── 이미지 (자연 높이) ──────────────────── */
.hyoo-modal-img-link {
    display: block;
    width: 100%;
    line-height: 0;
    flex-shrink: 0;
}

.hyoo-modal-img-link img,
.hyoo-modal-slide > img {
    width: 100%;
    height: auto;
    display: block;
}

.hyoo-modal-img-link:focus-visible {
    outline: 3px solid #b5837c;
    outline-offset: -3px;
}

/* ── 본문 텍스트 ─────────────────────────── */
.hyoo-modal-body {
    padding: 1.25rem;
    font-size: 15px;
    line-height: 1.9;
    color: #333;
}

.hyoo-modal-body p {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── 링크 버튼 ───────────────────────────── */
.hyoo-modal-footer {
    padding: 0 1.25rem 1rem;
}

.hyoo-modal-link-btn {
    display: inline-block;
    padding: .45rem 1rem;
    background: #b5837c;
    color: #fff;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}

.hyoo-modal-link-btn:hover         { background: #9e6e67; color: #fff; }
.hyoo-modal-link-btn:focus-visible { outline: 2px solid #b5837c; outline-offset: 2px; }

/* ── 하단 바 ─────────────────────────────── */
.hyoo-modal-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1.25rem;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
    gap: .5rem;
}

/* 이전 / 다음 버튼 */
.hyoo-modal-nav-btns {
    display: flex;
    gap: .4rem;
    align-items: center;
    flex-shrink: 0;
}

.hyoo-modal-prev,
.hyoo-modal-next {
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: .3rem .7rem;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, opacity 0.15s;
    line-height: 1;
}

.hyoo-modal-prev:hover,
.hyoo-modal-next:hover             { background: #f8f9fa; }

.hyoo-modal-prev.is-disabled,
.hyoo-modal-next.is-disabled       { opacity: .35; cursor: default; pointer-events: none; }

.hyoo-modal-prev:focus-visible,
.hyoo-modal-next:focus-visible     { outline: 2px solid #b5837c; outline-offset: 2px; }

/* 오른쪽 액션 그룹 */
.hyoo-modal-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-shrink: 0;
}

/* 하루 안 보기 */
.hyoo-modal-dismiss {
    background: none;
    border: none;
    padding: .3rem .2rem;
    font-size: 13px;
    color: #999;
    cursor: pointer;
    text-decoration: underline;
    white-space: nowrap;
    line-height: 1;
}

.hyoo-modal-dismiss:hover          { color: #555; }
.hyoo-modal-dismiss:focus-visible  { outline: 2px solid #aaa; outline-offset: 2px; }

/* 닫기 버튼 */
.hyoo-modal-close {
    background: #495057;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: .35rem .9rem;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
    line-height: 1;
}

.hyoo-modal-close:hover            { background: #343a40; }
.hyoo-modal-close:focus-visible    { outline: 2px solid #495057; outline-offset: 2px; }

/* Swiper 기본 스타일 덮어쓰기 (불필요한 UI 제거) */
.hyoo-modal-swiper .swiper-button-prev,
.hyoo-modal-swiper .swiper-button-next,
.hyoo-modal-swiper .swiper-pagination { display: none; }

/* ════════════════════════════════════════════
   반응형
   ════════════════════════════════════════════ */
@media (min-width: 480px) {
    .hyoo-modal { max-width: 520px; }
}

@media (max-width: 480px) {
    .hyoo-modal { max-height: 95vh; }
}

@media (max-width: 360px) {
    .hyoo-modal-overlay  { padding: .5rem; }
    .hyoo-modal-header   { padding: .75rem 1rem; }
    .hyoo-modal-title    { font-size: 14px; }
    .hyoo-modal-body     { padding: 1rem; font-size: 14px; }
    .hyoo-modal-footer   { padding: 0 1rem .875rem; }
    .hyoo-modal-bottom   { padding: .625rem 1rem; }
    .hyoo-modal-prev,
    .hyoo-modal-next     { padding: .25rem .55rem; font-size: 12px; }
    .hyoo-modal-dismiss  { font-size: 12px; }
    .hyoo-modal-close    { padding: .3rem .75rem; font-size: 12px; }
}
