.events-page {
  position: relative;
}

.events-page__photo {
  position: relative;
  min-height: 500px;
  border-radius: 60px 60px 0 0;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: flex-end;
  padding: 0 56px 56px;
}


.events-page__title {
  position: relative;
  z-index: 1;
  font-size: 56px;
  font-weight: 800;
  color: #fff;
  margin: 0 0 1rem;
}

.events-page__panel {
  position: relative;
  z-index: 33;
  background: #fff;
  border-radius: 70px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .06);
  padding: 40px 48px 56px;
  margin: -60px auto 0;
}

/* ---------------- events-page__toolbar ---------------- */
.events-page__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid #ececec;
}

.events-filter {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
}

.events-filter__item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 16px;
  color: #4d4a49;
  user-select: none;
}

.events-filter__item input {
  appearance: none;
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  border: 1.5px solid #4d4a49;
  border-radius: 50%;
  margin: 0;
  position: relative;
  flex: 0 0 auto;
  cursor: pointer;
  transition: border-color .2s ease;
}

.events-filter__item input:checked {
  border-color: var(--ink-soft);
}

.events-filter__item input:checked::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: url('../img/checked-icon.png') no-repeat center / cover;
}

.events-filter__item:has(input:checked) {
  color: var(--ink-soft);
  font-weight: 400;
}

.events-sort {
  position: relative;
  flex: 0 0 auto;
}

.events-sort__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  font-size: 15px;
  font-weight: 400;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 6px 4px;
}

.events-sort__dot {
  background-image: url(../img/news-by-year-plus.png);
  background-size: cover;
  background-position: center;
  width: 15px;
  height: 15px;
  display: inline-block;
}

.events-sort__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #f1f1f1;
  border-radius: 10px;
  min-width: 170px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .1);
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
  z-index: 5;
}

.events-sort.open .events-sort__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.events-sort__option {
  background: none;
  border: none;
  text-align: left;
  font-size: 16px;
  color: #727171;
  padding: 12px 16px;
  border-radius: 6px;
  cursor: pointer;
}

.events-sort__option:hover {
  background: #e9eaed;
}

.events-sort__option.is-active {
  color: #727171;
  font-weight: 400;
  background: #eaf6fd;
}

/* ---------------- 卡片格狀列表 ---------------- */
.events-page__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}

/* ---------------- events-pagination ---------------- */
.events-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 80px;
}

.events-pagination__arrow,
.events-pagination__page {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: none;
  color: #4d4a49;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

.events-pagination__page.is-active {
  color: var(--ink-soft);
  font-weight: 400;
  text-decoration: underline;
}

.events-pagination__page:hover:not(.is-active) {
  background: #f0f0f0;
  color: var(--ink-soft);
}

.events-pagination__arrow:hover {
  color: var(--ink-soft);
}

.events-pagination__ellipsis {
  color: #b3b3b3;
  padding: 0 4px;
  letter-spacing: 1px;
}

.events-card-box {
  padding: 20px 0;
}

/* ---------------- 卡片本身 ---------------- */
.events-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #E3E4EA;
  border-radius: 18px;
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease;
  padding: 1.2rem;
}

.events-card:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .08);
}

/* 蓋住整張卡片的透明連結，點卡片任何地方（除了 Register 按鈕）都會進內頁 */
.events-card__link {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.events-card__body {
  position: relative;
  z-index: 0;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

/* 標籤：獨立在最上面，跟日期時間分開 */
.events-tag {
  display: inline-block;
  align-self: flex-start;
  padding: 2px 10px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 400;
  color: #fff;
  margin-bottom: 14px;
}

.events-tag.tag-webinar {
  background: #9F9FA0;
}

.events-tag.tag-handson {
  background: #8EC31F;
}

.events-tag.tag-exhibition {
  background: #907FBF;
}

.events-tag.tag-banquet {
  background: #907FBF;
}

.events-card__body h3 {
  font-size: 22px;
  font-weight: 800;
  color: #4d4a49;
  margin: 0 0 14px;
  line-height: 1.4;
  /* 標題最多兩行，超過就裁掉，保持卡片高度一致 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 61px;
}

/* 標題下面的分隔線 */
.events-card__divider {
  height: 1px;
  background: #c9cad0;
  margin-bottom: 16px;
}

.events-card__body p {
  font-size: 15px;
  line-height: 1.8;
  color: #4d4a49;
  margin: 0 0 18px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* JS 量測「不裁切狀態下的完整高度」時暫時套用，量完就拿掉。
   用 !important 是為了保證一定蓋過上面 line-clamp 那組規則，
   不依賴 JS 去猜 style.webkitLineClamp 這個屬性名稱對不對。 */
.events-card__body p.is-measuring {
  -webkit-line-clamp: unset !important;
  display: block !important;
}

/* 接在內文最後面的「…more」；有沒有顯示由 JS 判斷實際內容是否超過 5 行 */
.events-more {
  color: #4d4a49;
  font-weight: 400;
  white-space: nowrap;
}

/* 日期／時間／地點：移到內文下面，一行一項 */
.events-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
}

.events-meta span {
  font-size: 15px;
  color: #4d4a49;
  line-height: 1.5;
}

/* Register Now 按鈕：永遠貼在卡片最下面，不管上面內容多寡 */
.events-register-btn {
  z-index: 2;
  margin-top: auto;
  display: block;
  text-align: center;
  background: #1168A3;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  padding: 8px 20px;
  border-radius: 6px;
  transition: background .2s ease;
}

.events-register-btn:hover {
  background: #164c6a;
  color: #fff;
}

.events-card-nav {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 1199px) {
  .events-page__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 991px) {
  .events-page__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .events-page__photo {
    min-height: 280px;
    padding: 0 28px 32px;
    border-radius: 40px 40px 0 0;
  }

  .events-sort__menu {
    right: auto;
    left: 0;
  }

  .events-page__title {
    font-size: 34px;
  }

  .events-page__panel {
    padding: 28px 0.5rem 50px;
    margin-top: -40px;
    border-radius: 28px;
  }

  .events-page__toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .events-pagination {
    padding-bottom: 0;
    margin-top: 2rem;
  }
}

@media (max-width: 767px) {
  .events-page__grid {
    grid-template-columns: 1fr;
  }

  .events-filter {
    gap: 9px;
  }
}


@media (max-width: 575px) {
  .events-page__photo {
    min-height: 210px;
  }
}