/* ---------------------------------------------------------------
 * 팝업 스타일
 * --------------------------------------------------------------- */

/* ── 팝업 초기 숨김 (FOUC 방지) ──────────────────── */
.mfp-hide { display: none; }

/* ── 팝업 공통 ─────────────────────────────────────── */
@keyframes jsPopupFadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.js-popup-item {
    position: relative;
    background: var(--surface-modal);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    border-radius: var(--border-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    animation: jsPopupFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.js-popup-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    line-height: 32px;
    font-size: 26px;
    color: var(--muted-color);
    opacity: 0.7;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    text-align: center;
    z-index: 10;
    transition: all 0.2s ease;
}
.js-popup-close:hover { 
    color: var(--color); 
    opacity: 1;
}
.js-popup-title {
    padding: 28px 56px 0 28px;
    font-size: 24px;
    font-weight: 700;
    font-family: var(--font-serif);
    color: var(--color);
    line-height: 1.3;
    flex-shrink: 0;
}
.js-popup-body {
    padding: 20px 28px 28px;
    overflow-y: auto;
    font-size: 16px;
    color: var(--muted-color);
    line-height: 1.6;
    flex: 1;
}
/* 제목 바로 다음에 본문이 올 경우 상단 패딩 축소 */
.js-popup-title + .js-popup-body {
    padding-top: 16px;
}

/* 제목이 없을 경우 닫기 버튼과 겹치지 않게 상단 여백 확보 */
.js-popup-close + .js-popup-body {
    padding-top: 48px;
}
/* 스크롤바 스타일링 (선택적) */
.js-popup-body::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.js-popup-body::-webkit-scrollbar-track {
    background: transparent;
}
.js-popup-body::-webkit-scrollbar-thumb {
    background: rgba(128,128,128,0.2);
    border-radius: 3px;
}
.js-popup-body::-webkit-scrollbar-thumb:hover {
    background: rgba(128,128,128,0.4);
}

.js-popup-body img { max-width: 100%; height: auto; display: block; border-radius: 12px; margin-bottom: 16px; }
/* reset.css의 * { margin: 0 } 으로 제거된 단락 여백 복원 */
.js-popup-body p { margin-bottom: 16px; }
.js-popup-body p:last-child { margin-bottom: 0; }
.js-popup-body ul,
.js-popup-body ol { padding-left: 24px; margin-bottom: 16px; }
.js-popup-body ul { list-style: disc outside; }
.js-popup-body ol { list-style: decimal outside; }
.js-popup-body li { margin-bottom: 4px; list-style-position: outside; }
.js-popup-body table { width: 100%; border-collapse: collapse; margin-bottom: 16px; font-size: 15px; }
.js-popup-body th,
.js-popup-body td { border: 1px solid var(--border-color); padding: 8px 11px; text-align: left; vertical-align: top; }
.js-popup-body th { background: var(--subtle); font-weight: 700; }
.js-popup-body blockquote { border-left: 3px solid var(--primary-color); padding: 10px 16px; margin: 0 0 16px; background: var(--primary-glow-color); }
.js-popup-body blockquote p:last-child { margin-bottom: 0; }
.js-popup-body hr { border: 0; border-top: 1px solid var(--border-color); margin: 16px 0; }
.js-popup-body a { color: var(--primary-color); text-decoration: underline; }
.js-popup-body h1,.js-popup-body h2,.js-popup-body h3,.js-popup-body h4,.js-popup-body h5,.js-popup-body h6 { margin: 16px 0 6px; }
.js-popup-body h1:first-child,.js-popup-body h2:first-child,.js-popup-body h3:first-child { margin-top: 0; }
.js-popup-body > *:last-child { margin-bottom: 0; }
.js-popup-body::after { content: ''; display: table; clear: both; }
.js-popup-body code { background: var(--subtle); padding: 2px 6px; border-radius: 3px; font-family: "SF Mono", Consolas, monospace; font-size: 14px; }
.js-popup-body pre { background: var(--subtle); color: var(--color); border: 1px solid var(--border-color); padding: 13px 16px; border-radius: 6px; overflow-x: auto; margin-bottom: 16px; font-size: 14px; line-height: 1.5; }
.js-popup-body pre code { background: none; padding: 0; border-radius: 0; font-size: inherit; color: inherit; }
.js-popup-body figure { margin: 0 0 16px; }
.js-popup-body figcaption { margin-top: 6px; font-size: 14px; color: var(--muted-color); text-align: center; }
.js-popup-body strong,.js-popup-body b { font-weight: 700; }
.js-popup-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    padding: 12px 28px;
    border-top: 1px solid var(--border-color);
    background: var(--subtle);
    flex-shrink: 0;
}
.js-popup-hide-today,
.js-popup-hide-week {
    font-size: 14px;
    color: var(--muted-color);
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 0;
    text-decoration: underline;
    transition: color 0.2s ease;
}
.js-popup-hide-today:hover,
.js-popup-hide-week:hover { color: var(--color); }

/* ── 팝업 오버레이 ─────────────────────────────────── */
.js-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99990;
    background: rgba(11,11,11,0.8);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.js-popup-overlay.is-visible { opacity: 1; }
.js-popup-overlay--transparent {
    pointer-events: none;
    background: transparent;
}

/* ── 팝업 프레임 공통 ──────────────────────────────── */
.js-popup-frame { position: fixed; }

/* 정중앙 */
.js-popup-frame.js-pf-center {
    top: 50%;
    left: 50%;
    transform: translate(
        calc(-50% + var(--js-off, 0px)),
        calc(-50% + var(--js-off, 0px))
    );
}

/* 좌측 상단 */
.js-popup-frame.js-pf-top-left {
    top:  calc(32px + var(--js-off, 0px));
    left: calc(32px + var(--js-off, 0px));
}

/* 우측 상단 */
.js-popup-frame.js-pf-top-right {
    top:   calc(32px + var(--js-off, 0px));
    right: calc(32px + var(--js-off, 0px));
}

/* 좌측 중앙 */
.js-popup-frame.js-pf-center-left {
    top:  50%;
    left: calc(32px + var(--js-off, 0px));
    transform: translateY(calc(-50% + var(--js-off, 0px)));
}

/* 우측 중앙 */
.js-popup-frame.js-pf-center-right {
    top:   50%;
    right: calc(32px + var(--js-off, 0px));
    transform: translateY(calc(-50% + var(--js-off, 0px)));
}

/* 좌측 하단 */
.js-popup-frame.js-pf-bottom-left {
    bottom: calc(32px + var(--js-off, 0px));
    left:   calc(32px + var(--js-off, 0px));
}

/* 우측 하단 */
.js-popup-frame.js-pf-bottom-right {
    bottom: calc(32px + var(--js-off, 0px));
    right:  calc(32px + var(--js-off, 0px));
}

/* ── 모바일 반응형 ─────────────────────────────────── */
@media (max-width: 768px) {
    .js-popup-title {
        padding: 20px 48px 0 20px;
        font-size: 20px;
    }
    .js-popup-body {
        padding: 16px 20px 20px;
    }
    .js-popup-footer {
        padding: 10px 20px;
    }
    .js-popup-close {
        top: 10px;
        right: 10px;
        width: 28px;
        height: 28px;
        line-height: 28px;
        font-size: 20px;
    }
    /* 제목이 없을 경우의 닫기 버튼 겹침 방지 */
    .js-popup-close + .js-popup-body {
        padding-top: 40px;
    }
}
