/* ===== 레이어 ===== */
#popup-layer{
  position: absolute; /* 좌표 기준점이 페이지(문서)여도 OK */
  top: 0;
  left: 0;

  /* 레이어 자체는 크기 의미 없음. 다만 클릭은 팝업만 받게 */
  width: 0;
  height: 0;

  z-index: 2147483647; /* 최대치로 올림 */
  pointer-events: none; /* 레이어는 클릭 막고 */
}

/* ===== 팝업 ===== */
.popup{
  position: absolute;
  background: #fff;
  border: 1px solid #323232;
  box-shadow: 0 12px 30px rgba(0,0,0,0.18);
  border-radius: 10px;
  overflow: hidden;

  display: flex;
  flex-direction: column;

  pointer-events: auto; /* 팝업만 클릭 가능 */

  /* JS로 height 계산하기 전엔 숨겨서 찌그러진 상태 노출 방지 */
  visibility: hidden;
}

/* JS가 height 세팅 후 보여줄 때 사용할 클래스 (원하면 JS에서 추가) */
.popup.is-ready{ visibility: visible; }

/* 닫기 버튼 */
.popup__close{
  position: absolute;
  top: 8px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(0,0,0,0.45);
  color: #fff;
  border-radius: 999px;
  cursor: pointer;
  z-index: 10;
  line-height: 28px;
  font-size: 16px;
  padding: 0;
}

/* ===== 이미지 영역: footer 제외한 나머지 공간을 차지 ===== */
.popup__imgLink{
  display:block;
  line-height:0;
  flex: 1 1 auto;
  min-height: 0;
  background:#000;
}

.popup__img{
  width:100%;
  height:100%;
  display:block;
  object-fit:cover; /* PC는 cover */
}

/* footer는 높이가 고정이면 JS 계산도 더 안정적이라 고정 추천 */
.popup__footer{
  flex: 0 0 auto;
  background: #101010;
  color: #fff;
  padding: 10px 12px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.popup__today{
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  user-select: none;
}

.popup__todayCheck{
  margin: 0;
  cursor: pointer;
  position: relative;
  top: 2px;
}

/* ===== 모바일: 모달형 (좌표 무시) ===== */
@media (max-width: 768px){
  #popup-layer{
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    background: rgba(0,0,0,0.55);
    pointer-events: auto; /* 배경 클릭 처리(필요하면) */
    display: none;        /* JS에서 팝업 있을 때만 block */
  }

.popup{
    position: absolute;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%);
    width: min(92vw, 420px) !important;

    /* 모바일에서는 height 자동(이미지 기준) */
    height: fit-content !important;
    max-height: 86vh;

    visibility: visible !important; /* 모바일은 계산 전 숨김 필요 없음(원하면 유지 가능) */
  }

.popup__imgLink{
    flex: 0 0 auto;              /* ✅ 남는 공간 채우지 않게(검은 여백 방지) */
    /* 모바일은 이미지가 세로로 길어질 수 있어서 contain 추천 */
    background: #000;
  }

.popup__img{
    width: 100%;
    height: auto !important;
    max-height: 70vh;
    object-fit: contain !important;
  }
}