/* ========================================
   最新活動頁面 (Events / Promotions)
   對齊 Figma 設計稿 — 白色明亮主題
   ======================================== */

/* ---- Hero Banner（全寬背景 + 居中覆蓋） ---- */
.events-hero {
  margin-top: var(--header-height);
  position: relative;
  width: 100%;
  height: 505px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.events-hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  transition: opacity 0.35s ease;
}

.events-hero-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 1;
}

.events-hero-center {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}

.events-hero-en {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--color-accent-light);
  letter-spacing: 2px;
}

.events-hero-title {
  font-family: "Noto Serif TC", serif;
  font-size: 56px;
  font-weight: 700;
  color: var(--color-white);
  line-height: 1.2;
  margin: 4px 0 2px;
}

.events-hero-subtitle {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 22px;
  font-weight: 400;
  color: var(--color-yellow);
  margin-bottom: 12px;
}

/* ---- Countdown Container & Layout ---- */
.events-countdown-container {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 24px;
  margin-bottom: 12px;
}

.events-countdown {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  padding: 22px 36px 40px; /* 底部留白讓按鈕壓在邊線上 */
  width: fit-content;
  min-width: 300px;
  max-width: 90vw;
  box-sizing: border-box;
}

.countdown-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
}

.countdown-number {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 40px;
  font-weight: 700;
  color: var(--color-white);
  line-height: 1;
}

.countdown-label {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 11px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 2.5px;
  text-align: center;
  margin-top: 8px;
}

.countdown-sep {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 32px;
  font-weight: 400;
  color: var(--color-white);
  line-height: 1;
  margin: 0 6px;
  transform: translateY(-8px); /* 向上微調以對齊數字中心 */
}

/* ---- Hero CTA Button ---- */
.events-hero-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 180px;
  height: 40px;
  background: var(--color-white);
  color: var(--color-primary); /* 橘紅色字型 */
  font-family: "Noto Sans TC", sans-serif;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* 當倒數計時啟用時，按鈕絕對定位並壓在邊框底部 */
.events-countdown .events-hero-cta {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 50%);
  margin-bottom: 0;
}

/* 沒有倒數時的獨立 CTA 樣式 */
.events-hero-cta.no-countdown {
  margin-top: 24px;
}

.events-hero-cta:hover {
  background: var(--color-primary);
  color: var(--color-white);
  box-shadow: 0 6px 15px
    color-mix(in srgb, var(--color-primary) 40%, transparent);
}

/* ---- Hero Banner（行動裝置專屬） ---- */
.events-hero-mobile {
  display: none;
}

.events-hero-mobile-inner {
  position: relative;
  width: 100%;
  aspect-ratio: 375 / 190;
  overflow: hidden;
}

.events-hero-mobile-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.35s ease;
  object-position: center;
}

.events-hero-mobile-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 1;
}

.events-hero-mobile-center {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 16px 10px;
  gap: 4px;
}

.events-hero-mobile-en {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 10px;
  font-weight: 400;
  color: var(--color-accent-light);
  letter-spacing: 1px;
  line-height: 1.2;
}

.events-hero-mobile-title {
  font-family: "Noto Serif TC", serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-white);
  line-height: 1.2;
  margin: 0;
}

.events-hero-mobile-subtitle {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 10px;
  font-weight: 400;
  color: var(--color-yellow);
  line-height: 1.3;
  margin: 0;
  max-width: 280px;
}

.events-countdown-container--mobile {
  margin: 10px 0 0;
  width: 100%;
}

.events-countdown--mobile {
  position: relative;
  width: fit-content;
  min-width: 220px;
  max-width: calc(100% - 32px);
  padding: 10px 24px 22px;
  gap: 6px;
  border-color: rgba(255, 255, 255, 0.8);
}

.events-countdown--mobile .countdown-number {
  font-size: 18px;
}

.events-countdown--mobile .countdown-label {
  font-size: 8px;
  letter-spacing: 1px;
  margin-top: 2px;
}

.events-countdown--mobile .countdown-sep {
  font-size: 14px;
  margin: 0 2px;
  transform: translateY(-4px);
}

.events-hero-cta--mobile {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 50%);
  width: 100px;
  height: 28px;
  font-size: 12px;
  margin: 0;
}

.events-hero-cta--mobile.no-countdown {
  position: static;
  transform: none;
  margin-top: 6px;
}

/* ---- Listing Section（白色背景）---- */
.events-listing {
  background: var(--color-white);
  padding: 50px 0 60px;
  /* ::before 的定位基準；overflow 讓裝飾圖切齊左邊界不撐出橫向捲軸 */
  position: relative;
  overflow: hidden;
}

/* 左下角裝飾圖。桌機與手機是兩張不同的圖、兩個獨立的自訂器欄位。
   共用外框寫在這裡，實際要不要顯示、用哪一張，由下面兩段各自決定 ——
   沒設定就不會有對應的 class，也就不會顯示。 */
.events-listing--has-decor::before,
.events-listing--has-mobile-decor::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  background-repeat: no-repeat;
  background-position: left bottom;
  background-size: contain;
  z-index: 0;
  pointer-events: none;
  /* 預設不顯示，避免只填了其中一邊時，另一邊跑出一個沒有圖的空盒子 */
  display: none;
}

@media (min-width: 769px) {
  .events-listing--has-decor::before {
    display: block;
    width: 1033px;
    height: 100%;
    background-image: var(--events-decor, none);
  }
}

.events-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 50px;
  /* 疊在裝飾圖之上 */
  position: relative;
  z-index: 1;
}

/* ---- Tabs（方形矩形按鈕）---- */
.events-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 30px;
}

.events-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 40px;
  padding: 11px 18px;
  font-family: "Noto Sans TC", sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-primary);
  background: var(--color-white);
  border: 1px solid var(--color-primary);
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

@media (hover: hover) and (pointer: fine) {
  .events-tab:hover {
    background: var(--color-primary);
    color: var(--color-white);
  }
}

.events-tab.active {
  background: var(--color-primary);
  color: var(--color-white);
}

/* ---- Section Title ---- */
.events-section-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
}

.events-section-title {
  align-self: stretch;
  color: var(--color-text);
  text-align: center;
  font-family: "Noto Sans TC", sans-serif;
  font-size: 24px;
  font-style: normal;
  font-weight: 400;
  line-height: normal;
}

.events-section-title-line {
  width: 200px;
  height: 0;
  flex-shrink: 0;
  background-color: transparent;
  border: none;
  border-top: 2px solid var(--color-primary);
  transition: border-color 0.3s ease;
}

/* 篇數。字級與顏色同商品列表的 .pl-subtitle。 */
.events-section-count {
  margin: 0;
  font-family: "Noto Sans TC", sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--color-text-light);
  text-align: center;
}

/* ---- Event Cards Grid ---- */
.events-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 29px;
  margin-bottom: 50px;
}

.event-card {
  background-color: var(--color-bg-grey);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

/* 深色底圖的配色。只有自訂器放了底圖才會加上 --dark-cards，
   否則深色底上會壓著原本的深色字，整張卡看不見。 */
.events-listing--dark-cards .event-card-date {
  color: var(--color-border);
}

.events-listing--dark-cards .event-card-desc {
  color: var(--color-yellow);
}

/* 底圖沒載到時的備援底色。放在共用區塊，兩個斷點一致 ——
   原本只寫在手機版，桌機沒有，等於兩邊的卡片內容底不同。 */
.events-listing--dark-cards .event-card-body {
  background-color: var(--color-secondary);
}

.events-listing--dark-cards .event-card-title {
  color: var(--color-white);
}

.events-listing--dark-cards .event-card-price del {
  color: var(--color-border);
}

.event-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.event-card.hidden {
  display: none;
}

.event-card.page-hidden {
  display: none;
}

/* ---- Card Image ---- */
.event-card-image {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
}

.event-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.event-card:hover .event-card-image img {
  transform: scale(1.05);
}

.event-card-image-link {
  display: block;
  width: 100%;
  height: 100%;
}

/* Badge（左上角分類標籤）*/
.event-card-badge {
  position: absolute;
  top: 0;
  left: 0;
  padding: 7px 21px;
  font-family: "Noto Sans TC", sans-serif;
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  z-index: 2;
  /* 輪播的起點：紫底白字。沒對應到任何 cat-* 時也是這個。 */
  background: var(--color-accent);
  color: var(--color-white);
}

/* 分類徽章配色輪播（page-events.php 的 $badge_classes，依分類 term_id 取模）。
   原本 cat-sale 與 cat-new 都是紅色、cat-gift 根本沒定義顏色
   （桌機變透明，只有手機靠基礎規則的紅底補上），
   cat-free 則定義了卻從來不在輪播清單裡。 */
.event-card-badge.cat-sale {
  background: var(--color-accent);
  color: var(--color-white);
}

.event-card-badge.cat-new {
  background: var(--color-secondary);
  color: var(--color-white);
}

.event-card-badge.cat-gift {
  background: var(--color-pink);
  color: var(--color-text);
}

.event-card-badge.cat-exclusive {
  background: var(--color-yellow);
  color: var(--color-text);
}

/* 倒數標籤（右上角）*/
.event-card-countdown {
  position: absolute;
  top: 0;
  right: 0;
  padding: 7px 23px;
  background: var(--color-black);
  font-family: "Noto Sans TC", sans-serif;
  font-size: 11px;
  font-weight: 400;
  color: var(--color-white);
  white-space: nowrap;
  z-index: 2;
}

/* ---- Card Body ---- */
.event-card-body {
  padding: 21px 21px 27px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  /* 底圖由 page-events.php 以 --event-card-bg 帶入（自訂器「卡片底圖」）。
     掛在內容區而不是整張卡片 —— 卡片是 347x404、內容區只有 347x204，
     底圖 360x180 掛在卡片上時 cover 會放大 2.24 倍（以高度為準），
     只看得到中間被拉大的一小條。掛在內容區是 1.13 倍，接近原尺寸。 */
  background-image: var(--event-card-bg, none);
  background-size: cover;
  background-position: center;
}

.event-card-date {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-light);
}

.event-card-title {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--color-black);
  line-height: 1.3;
}

.event-card-title a {
  color: inherit;
  text-decoration: none;
}

.event-card-price {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
}

.event-card-price del {
  margin-left: 6px;
  font-size: 13px;
  font-weight: 400;
  color: var(--color-text-light);
}

.event-card-price ins {
  text-decoration: none;
}

.event-card-desc {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

/* ---- Card Button（統一金色方形）---- */
.event-card-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 38px;
  background: var(--color-white);
  color: var(--color-text);
  font-family: "Noto Sans TC", sans-serif;
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
  margin-top: auto;
  transition: all 0.3s ease;
}

.event-card-btn:hover {
  background: var(--color-pink);
  color: var(--color-text);
  opacity: 1;
}

/* ---- Pagination（圓形 + 膠囊 Next）---- */
.events-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 40px;
  border: none;
}

/* 分頁點：紫色系，跟同一頁的分類頁籤（.events-tab）同一組代號。
   原本整組用 --color-secondary（近黑），跟設計稿不符。 */
.events-pagination .page-num {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: 100px;
  font-family: "Noto Sans TC", sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-primary);
  background: var(--color-white);
  border: 1px solid var(--color-primary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.events-pagination .page-num:hover {
  color: var(--color-white);
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.events-pagination .page-num.active {
  color: var(--color-white);
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.events-pagination .page-prev,
.events-pagination .page-next {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  height: 28px;
  padding: 0 16px;
  border-radius: 100px;
  font-family: "Noto Sans TC", sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-primary);
  background: var(--color-white);
  border: 1px solid var(--color-primary);
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
}

.events-pagination .page-prev:hover,
.events-pagination .page-next:hover {
  color: var(--color-white);
  background: var(--color-primary);
  border-color: var(--color-primary);
  opacity: 1;
}

/* 這裡原本有兩條「隱藏頁尾預設訂閱區塊（僅此頁面）」的規則：
   .footer-newsletter 與 .footer-divider:nth-of-type(2)，都帶 !important。
   活動頁以前自己有一份訂閱區，所以要把頁尾那個藏起來；
   現在全站共用 template-parts/newsletter.php，沒有重複、不需要隱藏。
   而且 :nth-of-type 數的是 <div> 的序號 —— 訂閱區換成 <section>、
   又移除一條分隔線之後，它會改成命中剩下那條底部分隔線並把它藏掉。 */

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .events-hero-title {
    font-size: 40px;
  }

  .events-hero-subtitle {
    font-size: 18px;
  }

  .events-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .events-container {
    padding: 0 30px;
  }

  .events-tabs {
    flex-wrap: wrap;
    gap: 12px;
  }

  .events-tab {
    width: auto;
    padding: 10px 18px;
  }

  .events-countdown:not(.events-countdown--mobile) {
    padding: 20px 32px 38px;
    min-width: 280px;
  }

  .countdown-number {
    font-size: 34px;
  }
}

@media (max-width: 768px) {
  /* 手機版用另一張、靠版面下方（設計稿是這樣）。
     桌機那張 520px 寬，壓在 375px 的版面上會蓋掉整排卡片。 */
  .events-listing--has-mobile-decor::before {
    display: block;
    width: 200px;
    height: 380px;
    background-image: var(--events-decor-mobile, none);
  }

  .events-hero {
    display: none !important;
  }

  .events-hero-mobile {
    display: block;
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    margin-top: var(--header-height);
    overflow: hidden;
  }

  .events-hero-mobile-inner {
    width: 100%;
    aspect-ratio: 375 / 190;
  }

  .events-countdown--mobile {
    width: fit-content;
    min-width: 220px;
    padding: 10px 24px 22px;
    gap: 6px;
  }

  .events-tabs {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 8px;
    margin-bottom: 24px;
  }

  .events-tab {
    flex: 0 0 calc((100% - 16px) / 3);
    width: calc((100% - 16px) / 3);
    max-width: calc((100% - 16px) / 3);
    height: 36px;
    padding: 0 6px;
    font-size: 13px;
    box-sizing: border-box;
  }

  .events-section-title-wrap {
    gap: 8px;
    margin-bottom: 24px;
  }

  .events-section-title {
    align-self: stretch;
    color: var(--color-text);
    text-align: center;
    font-family: Inter, sans-serif;
    font-size: 13px;
    font-style: normal;
    font-weight: 600;
    line-height: 22px;
  }

  .events-section-title-line {
    width: 110.854px;
    height: 0;
    flex-shrink: 0;
    border-top: 1.109px solid var(--color-primary);
  }

  .events-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 32px;
  }

  .events-container {
    padding: 0 20px;
  }

  .events-listing {
    padding: 32px 0 40px;
  }

  /* 底色不在這裡覆寫 —— 桌機是 --color-bg-grey、手機原本是白色，
     兩個斷點的卡片底不一樣。統一沿用桌機那一組。 */
  .event-card {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    border-radius: 0;
    max-width: 335px;
    margin: 0 auto;
    width: 100%;
  }

  .event-card:hover {
    transform: none;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  }

  .event-card-image {
    height: 210px;
    background: var(--color-border-light);
  }

  .event-card-image img {
    object-fit: cover;
  }

  .event-card:hover .event-card-image img {
    transform: none;
  }

  /* 只改尺寸。原本這裡把所有分類都硬設成紅底，
     等於把桌機的配色輪播整組蓋掉。 */
  .event-card-badge {
    padding: 7px 16px;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.2;
  }

  .event-card-countdown {
    padding: 7px 16px;
    font-size: 10px;
    line-height: 1.2;
    background: var(--color-black);
  }

  .event-card-body {
    padding: 16px 18px 22px;
    align-items: flex-start;
    text-align: left;
    gap: 8px;
    /* background-color 而不是 background 簡寫 ——
       簡寫會把共用區塊設定的 background-image（卡片底圖）重設成 none，
       手機版就只剩下深色底、看不到底圖。 */
    background-color: var(--color-bg-grey);
  }

  .event-card-date {
    width: 100%;
    font-size: 12px;
    line-height: 1.4;
    color: var(--color-text-light);
    text-align: left;
  }

  .event-card-title {
    width: 100%;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.45;
    color: var(--color-black);
    text-align: left;
    margin: 0;
  }

  .event-card-desc {
    width: 100%;
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-text-muted);
    margin: 0 0 12px;
    text-align: left;
  }

  /* 只改尺寸與字重，配色沿用桌機的白底黑字 */
  .event-card-btn {
    align-self: center;
    width: 68%;
    min-width: 148px;
    max-width: 200px;
    height: 38px;
    margin: 4px auto 0;
    border-radius: 0;
    font-size: 14px;
    font-weight: 700;
  }

  .events-pagination {
    gap: 8px;
    margin-top: 8px;
  }

  .events-pagination .page-num {
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    font-size: 11px;
  }

  .events-pagination .page-prev,
  .events-pagination .page-next {
    min-width: 52px;
    height: 24px;
    padding: 0 14px;
    font-size: 11px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .events-hero {
    height: 660px;
  }
}

@media (max-width: 640px) {
  .events-hero-title {
    font-size: 30px;
  }

  .events-hero-subtitle {
    font-size: 16px;
  }

  .events-countdown:not(.events-countdown--mobile) {
    padding: 18px 28px 34px;
    gap: 10px;
    min-width: 260px;
  }

  .countdown-number {
    font-size: 28px;
  }

  .countdown-sep {
    font-size: 24px;
    transform: translateY(-6px);
  }

  .countdown-label {
    font-size: 10px;
    letter-spacing: 1.5px;
    margin-top: 6px;
  }

  .events-countdown .events-hero-cta {
    width: 140px;
    height: 32px;
    font-size: 14px;
  }

  .events-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .events-container {
    padding: 0 16px;
  }

  .events-listing {
    padding: 35px 0 45px;
  }

  .events-hero-cta {
    width: 140px;
    height: 30px;
    font-size: 14px;
  }
}
