/* 首頁活動彈窗（index.html 的 #homePopup，開關邏輯在 js/home-popup.js）
   直式螢幕（手機）用直圖、橫式螢幕（電腦）用橫圖，切換條件寫在 <source media>。 */

.home-popup {
  position: fixed;
  inset: 0;
  /* 要蓋過右下角浮動按鈕 .ga-btn（2147483646） */
  z-index: 2147483647;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.home-popup.is-open {
  display: flex;
}

.home-popup__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  cursor: pointer;
  animation: homePopupFadeIn 0.3s ease-out;
}

.home-popup__dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  animation: homePopupScaleIn 0.3s ease-out;
}
/* 打開時焦點放在這裡（js/home-popup.js），不用顯示外框 */
.home-popup__dialog:focus {
  outline: none;
}

/* 關閉按鈕：放在圖片右上方外側，不蓋到海報內容 */
.home-popup__close {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 18px 0 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.home-popup__close:hover,
.home-popup__close:focus-visible {
  background: #fff;
  color: #111;
}
.home-popup__close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}
.home-popup__close svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.home-popup__link {
  display: block;
}
.home-popup__img {
  display: block;
  width: auto;
  height: auto;
  /* 上方扣掉關閉按鈕 44px＋間距 12px */
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 88px);
  max-height: calc(100dvh - 88px);
  border-radius: 6px;
  outline: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}
@media (min-width: 1024px) {
  .home-popup__img {
    max-width: min(1100px, calc(100vw - 96px));
    max-height: calc(100vh - 140px);
  }
}

.home-popup.is-closing .home-popup__overlay {
  animation: homePopupFadeOut 0.25s ease-in forwards;
}
.home-popup.is-closing .home-popup__dialog {
  animation: homePopupScaleOut 0.25s ease-in forwards;
}

@keyframes homePopupFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes homePopupFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes homePopupScaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes homePopupScaleOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.96); }
}

@media (prefers-reduced-motion: reduce) {
  .home-popup__overlay,
  .home-popup__dialog,
  .home-popup.is-closing .home-popup__overlay,
  .home-popup.is-closing .home-popup__dialog {
    animation: none;
  }
}
