/*
  포스트 연결형 하단 고정 팝업 (inc/popup.php)

  팝업을 출력하는 페이지에서만 불러오는 별도 스타일시트라 style.scss 에 합치지 않고
  독립 파일로 컴파일한다. 출력 위치는 .vscode/settings.json 의 savePath("~/..") 규칙에
  따라 테마 루트의 popup.css 가 된다.

  폭 = 그리드 N단 중 span 단
    1단 폭  = (컨테이너 폭 - margin×2 - gutter×(단수-1)) ÷ 단수
    팝업 폭 = 1단 폭 × span + gutter × (span-1)
*/
.yg-popup {
  --yg-cols: 12;
  --yg-margin: 20px;
  --yg-gutter: 20px;
  --yg-span: 3;
  /* position: fixed 의 % 는 스크롤바를 뺀 화면 폭 기준 (100vw 사용 금지) */
  --yg-col: calc((100% - var(--yg-margin) * 2 - var(--yg-gutter) * (var(--yg-cols) - 1)) / var(--yg-cols));
  position: fixed;
  top: auto;
  left: auto;
  right: var(--yg-margin);
  bottom: var(--yg-margin);
  /* 본문(최대 200)보다 위, 헤더/전체 메뉴/검색 오버레이(1000)보다 아래 */
  z-index: 900;
  width: calc(var(--yg-col) * var(--yg-span) + var(--yg-gutter) * (var(--yg-span) - 1));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  margin: 0;
  padding: 0;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 300ms ease-out, transform 300ms ease-out;
}
@media (max-width: 1024px) {
  .yg-popup {
    --yg-span: 4;
  }
}
@media (max-width: 780px) {
  .yg-popup {
    --yg-cols: 6;
    --yg-margin: 10px;
    --yg-gutter: 10px;
    --yg-span: 3;
    inset: 0;
    margin: auto;
    height: fit-content;
    transform: none;
    transition: opacity 300ms ease-out;
  }
  .yg-popup::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(0, 0, 0, 0.4);
  }
}
@media (max-width: 480px) {
  .yg-popup {
    --yg-span: 6;
  }
}
.yg-popup[hidden] {
  display: none;
}
.yg-popup.is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (max-width: 780px) {
  .yg-popup.is-visible {
    transform: none;
  }
}
.yg-popup.is-closing {
  transition-duration: 200ms;
  pointer-events: none;
}

.yg-popup__close,
.yg-popup__close:hover,
.yg-popup__close:focus {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 8px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #000;
  line-height: 0;
  box-shadow: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.yg-popup__close svg {
  display: block;
  width: 12px;
  height: 12px;
}
.yg-popup__close:focus-visible {
  outline: 2px solid #000;
  outline-offset: 2px;
}

.yg-popup__card,
.yg-popup__card:hover,
.yg-popup__card:focus {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
  background: #fff;
  color: #000;
  text-decoration: none;
  box-shadow: none;
  /* JS 실행 전/실패 시 기본 모서리. 스쿼클 적용 후에는 clip-path 가 대신한다 */
  border-radius: 15px;
  overflow: hidden;
}
.yg-popup__card.is-squircle {
  border-radius: 0;
}
.yg-popup__card:focus-visible {
  outline: 2px solid #000;
  outline-offset: -2px;
}

.yg-popup__thumb {
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 407/272;
  overflow: hidden;
}

.yg-popup__image {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}
@media (hover: hover) and (pointer: fine) and (min-width: 1025px) {
  .yg-popup__image {
    transition: transform 500ms cubic-bezier(0.22, 0.61, 0.36, 1);
  }
  .yg-popup__card:hover .yg-popup__image {
    transform: scale(1.05);
  }
}

.yg-popup__title {
  /* 여백은 padding 대신 margin: line-clamp 로 잘린 4번째 줄이 padding 영역에 비치는 것 방지 */
  margin: 0 15px 15px;
  padding: 0;
  font-family: "Pretendard", sans-serif;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.4;
  color: #000;
  text-transform: uppercase;
  letter-spacing: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .yg-popup {
    transform: none;
    transition: none;
  }
  .yg-popup__image,
  .yg-popup__card:hover .yg-popup__image {
    transform: none;
    transition: none;
  }
}
