/* Popups — PC + mobile responsive, stacked from top-left on PC, centered on mobile */

.popup-stack {
  position: fixed;
  top: 80px;
  left: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: row;          /* PC: 두 팝업 나란히(원본과 동일) */
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
  justify-content: flex-start;
  pointer-events: none;
}
.popup {
  pointer-events: auto;
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(10,20,40,.18), 0 4px 12px rgba(10,20,40,.08);
  width: 420px;
  max-width: 90vw;
  overflow: hidden;
  animation: popupIn .25s ease-out;
  display: flex;
  flex-direction: column;
}
@keyframes popupIn {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.popup.closing { animation: popupOut .2s ease-in forwards; }
@keyframes popupOut {
  to { transform: translateY(20px); opacity: 0; }
}
.popup-body { flex: 1; }
.popup-body img {
  width: 100%; height: auto; display: block;
  object-fit: cover; object-position: center;
}
.popup-title {
  margin: 0; padding: 16px 20px 4px;
  font-size: 18px; font-weight: 600;
}
.popup-content {
  padding: 0 20px 12px;
  color: #444; font-size: 14px; line-height: 1.6;
}
.popup-cta {
  display: inline-block;
  margin: 0 20px 16px;
  padding: 8px 16px;
  background: var(--c-primary, #0b3d91);
  color: #fff !important;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}
.popup-cta:hover { text-decoration: none; opacity: .9; }

.popup-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: #f6f8fb;
  border-top: 1px solid rgba(0,0,0,.05);
  font-size: 13px;
}
.popup-foot label {
  display: flex; align-items: center; gap: 6px;
  color: #555;
  cursor: pointer;
}
.popup-close {
  background: transparent; border: 0;
  padding: 6px 10px;
  cursor: pointer;
  font-weight: 600;
  color: #333;
  border-radius: 4px;
  font-family: inherit;
}
.popup-close:hover { background: rgba(0,0,0,.06); }

/* When a popup closes, the next one in the stack remains visible (popup-stack uses flex,
   so removing an element naturally promotes the next. CSS handles smooth re-flow.) */
.popup-stack > .popup { transition: margin .25s ease, opacity .25s ease; }

/* PC: 두 팝업 높이를 동일하게 — 이미지 높이를 고정하고 폭은 비율대로(잘림 없음) */
@media (min-width: 769px) {
  .popup { width: auto; max-width: 38vw; }
  .popup-body { display: flex; align-items: center; justify-content: center; }
  .popup-body img {
    height: clamp(420px, 56vh, 560px);          /* 두 팝업 동일 높이 */
    width: auto; max-width: 100%;
    object-fit: contain; display: block;
  }
}

/* 모바일: 화면 중앙 + 화면 안에 전체가 보이도록(이미지+닫기 푸터). JS가 하나씩 표시(닫으면 다음).
   주소창 때문에 vh가 실제보다 커서 잘리던 문제 → inset:0 고정 컨테이너 기준 100%로 맞춤. */
@media (max-width: 768px) {
  .popup-stack {
    top: 0; left: 0; right: 0; bottom: 0;   /* = 보이는 뷰포트 높이 */
    flex-direction: column;
    align-items: center; justify-content: center;
    gap: 0; padding: 14px;
    background: rgba(8, 17, 28, .55);        /* 딤 배경 */
  }
  .popup {
    width: auto; max-width: 90vw;
    max-height: 100%;                        /* 컨테이너(뷰포트-패딩) 안에 */
    display: flex; flex-direction: column;
  }
  .popup-body {
    flex: 1 1 auto; min-height: 0; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
  }
  .popup-body img {
    width: auto; height: auto;
    max-width: 100%; max-height: 100%;       /* 남는 높이에 맞춰 contain → 잘림 없음 */
    object-fit: contain;
  }
  .popup-foot { flex: none; }                /* 닫기 줄 항상 보이게 */
}
