/* 活動資訊頁 */
.events-page {
  position: relative;
  width: 100%;
  padding: clamp(2rem, 5vw, 3.5rem) clamp(1.25rem, 4vw, 5rem)
    clamp(4rem, 8vw, 6rem);
  overflow-x: clip;
}

.events-page::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 14% 20%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1px 1px at 82% 16%, rgba(120, 180, 255, 0.4), transparent),
    radial-gradient(1px 1px at 48% 78%, rgba(255, 255, 255, 0.28), transparent);
}

.events-page__inner {
  position: relative;
  z-index: 1;
  max-width: 80rem;
  margin: 0 auto;
}

.events-page__breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-bottom: clamp(1.5rem, 4vw, 2rem);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.45);
}

.events-page__breadcrumb a {
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  transition: color 0.2s ease;
}

.events-page__breadcrumb a:hover {
  color: #fff;
}

.events-page__breadcrumb [aria-current="page"] {
  color: rgba(255, 255, 255, 0.75);
}

.events-page__head {
  margin-bottom: clamp(1.5rem, 4vw, 2rem);
  text-align: left;
}

.events-page__eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1.4;
  color: #63c0ae;
}

.events-page__title {
  margin: 0 0 1rem;
  font-size: clamp(1.75rem, 4.5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.35;
  color: #fff;
}

.events-page__line {
  display: block;
  width: min(7.5rem, 40%);
  height: 3px;
  margin: 0 0 1rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(90deg, #2066b1 0%, #63c0ae 45.67%, #75c4ec 100%);
}

.events-page__intro {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.7;
  color: #c0c4cc;
}

.events-page__card {
  border: 1px solid #0997F733;
  border-radius: 1rem;
  background: #15324E4D;
  overflow: hidden;
  min-width: 0;
}

.events-page__section {
  padding: clamp(1.25rem, 3vw, 1.75rem) clamp(1.25rem, 3vw, 2rem);
}

.events-page__info > .events-page__section + .events-page__section,
.events-page__info > .events-page__section:not(:first-child) {
  padding-top: 0;
}

.events-page__info > .events-page__section + .events-page__section::before {
  content: "";
  display: block;
  grid-column: 1 / -1;
  height: 1px;
  margin-bottom: 1.5rem;
  background: rgba(255, 255, 255, 0.08);
}

.events-page__section-title {
  margin: 0 0 clamp(1rem, 2.5vw, 1.25rem);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.45;
  color: #fff;
}

.events-page__info {
  min-width: 0;
}

.events-page__info > .events-page__section {
  min-width: 0;
}

.events-page__rows {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.events-page__row {
  display: grid;
  grid-template-columns: minmax(5.5rem, 7.5rem) minmax(0, 1fr);
  column-gap: clamp(1rem, 3vw, 2rem);
  align-items: baseline;
}

.events-page__row-label {
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.5;
  color: #c0c4cc;
}

.events-page__row-value {
  margin: 0;
  min-width: 0;
  font-size: 1.125rem;
  line-height: 1.5;
  color: #c0c4cc;
  text-align: left;
  overflow-wrap: break-word;
}

.events-page__row-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.events-page__row-detail {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.5;
  color: #c0c4cc;
}

.events-page__rich-text {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.events-page__rich-text :is(div, li, ul) {
  min-width: 0;
  max-width: 100%;
}

.events-page__rich-text hr {
  display: block;
  width: 100%;
  height: 1px;
  margin: 1.5rem 0;
  padding: 0;
  border: none;
  background: rgba(255, 255, 255, 0.08);
}

.events-page__rich-text :is(img, video, iframe) {
  max-width: 100%;
}

.events-page__table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 1rem 0;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

.events-page__table-wrap + .events-page__table-wrap {
  margin-top: 1.25rem;
}

.events-page__rich-text table {
  display: table;
  width: max-content;
  min-width: 100%;
  margin: 0;
  border-collapse: collapse;
  border: none;
  background: transparent;
  table-layout: auto;
}

.events-page__rich-text table + table {
  margin-top: 1.25rem;
}

.events-page__rich-text :is(th, td) {
  padding: 0.65rem 0.75rem;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 1.125rem;
  line-height: 1.5;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.events-page__rich-text th {
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
}

.events-page__rich-text thead th {
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.events-page__rich-text tbody td:first-child {
  font-weight: 600;
}

.events-page__rich-text tbody tr:last-child :is(th, td) {
  border-bottom: none;
}

/* 活動時間列表（CMS: ul > li > span 標題 + div 內容） */
.events-page__rich-text ul:not(:has(> li > h4)) {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.events-page__rich-text ul:not(:has(> li > h4)) > li {
  display: grid;
  grid-template-columns: minmax(5.5rem, 7.5rem) minmax(0, 1fr);
  column-gap: clamp(1rem, 3vw, 2rem);
  align-items: start;
  padding: clamp(1rem, 2.5vw, 1.5rem) 0;
}

.events-page__rich-text ul:not(:has(> li > h4)) > li > span:first-child {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.5;
}

.events-page__rich-text ul:not(:has(> li > h4)) > li > span:not(:first-child) {
  display: none;
}

.events-page__rich-text ul:not(:has(> li > h4)) > li > div {
  min-width: 0;
}

.events-page__rich-text ul:not(:has(> li > h4)) > li > div > span:first-of-type {
  display: block;
  margin: 0 0 0.35rem;
  font-size: 1.125rem;
  line-height: 1.5;
}

.events-page__rich-text ul:not(:has(> li > h4)) > li > div > p {
  margin: 0 0 1rem;
  font-size: 1.125rem;
  line-height: 1.7;
}

.events-page__rich-text ul:not(:has(> li > h4)) > li > div > p:last-child {
  margin-bottom: 0;
}

.events-page__rich-text ul:not(:has(> li > h4)) .events-page__table-wrap {
  margin: 0.75rem 0 0;
}

.events-page__rich-text ul:not(:has(> li > h4)) .events-page__table-wrap + .events-page__table-wrap {
  margin-top: 0.75rem;
}

.events-page__rich-text h2 {
  margin: clamp(1.25rem, 3vw, 1.75rem) 0 clamp(0.75rem, 2vw, 1rem);
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  font-weight: 700;
  line-height: 1.45;
  color: #fff;
  scroll-margin-top: 8rem;
}

.events-page__rich-text h2:first-child {
  margin-top: 0;
}

/* 得獎獎金（與首頁 .awards__content 相同，CMS: h2 + ul > li > h4 + p） */
.events-page__rich-text h2:has(+ ul > li > h4) {
  margin: clamp(1.5rem, 3vw, 2rem) 0 1rem;
  font-size: clamp(1.375rem, 3.5vw, 2rem);
  font-weight: 700;
  line-height: 1.4;
  color: #fff;
  text-align: center;
}

.events-page__rich-text ul:has(> li > h4) {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.75rem, 1.75vw, 1rem);
  width: 100%;
  max-width: 85%;
  margin: 0 auto clamp(1rem, 2.5vw, 1.5rem);
  padding: 0;
  list-style: none;
}

.events-page__rich-text ul:has(> li > h4) > li {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.75rem, 2vw, 1rem);
  min-height: clamp(5.5rem, 14vw, 6.5rem);
  padding: clamp(1.25rem, 3vw, 1.5rem) clamp(1rem, 2vw, 1.25rem);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.875rem;
  text-align: center;
  background: rgba(8, 18, 40, 0.75);
}

.events-page__rich-text ul:has(> li > h4) > li h4 {
  margin: 0;
  font-size: clamp(1rem, 2.2vw, 1.125rem);
  font-weight: 700;
  line-height: 1.45;
  color: #fff;
}

.events-page__rich-text ul:has(> li > h4) > li h4 :is(span, font) {
  color: inherit !important;
  font-size: inherit !important;
}

.events-page__rich-text ul:has(> li > h4) > li p:nth-of-type(1) {
  margin: 0;
  display: inline-block;
  max-width: 100%;
  font-size: clamp(1.125rem, 3vw, 1.625rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
}

.events-page__rich-text ul:has(> li > h4) > li:nth-child(1) p:nth-of-type(1),
.events-page__rich-text ul:has(> li > h4) > li:nth-child(1) p:nth-of-type(1) :is(span, font) {
  background-image: linear-gradient(
    90deg,
    #0997f7 0%,
    #029ef5 7.14%,
    #00a4f2 14.29%,
    #00abf0 21.43%,
    #00b1ed 28.57%,
    #00b8ea 35.71%,
    #00bee8 42.86%,
    #00c4e5 50%,
    #00cae2 57.14%,
    #00d0de 64.29%,
    #00d6db 71.43%,
    #00dcd8 78.57%,
    #00e2d4 85.71%,
    #00e8d0 92.86%,
    #09eecc 100%
  );
  background-size: 100%;
  background-repeat: repeat;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.events-page__rich-text ul:has(> li > h4) > li:nth-child(2) p:nth-of-type(1),
.events-page__rich-text ul:has(> li > h4) > li:nth-child(2) p:nth-of-type(1) :is(span, font) {
  background-image: linear-gradient(
    90deg,
    #036fd9 0%,
    #0372db 7.14%,
    #0375dd 14.29%,
    #0378df 21.43%,
    #037ae2 28.57%,
    #037de4 35.71%,
    #0480e6 42.86%,
    #0483e8 50%,
    #0486ea 57.14%,
    #0589ec 64.29%,
    #068cee 71.43%,
    #068ef1 78.57%,
    #0791f3 85.71%,
    #0894f5 92.86%,
    #0997f7 100%
  );
  background-size: 100%;
  background-repeat: repeat;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.events-page__rich-text ul:has(> li > h4) > li:nth-child(3) p:nth-of-type(1),
.events-page__rich-text ul:has(> li > h4) > li:nth-child(3) p:nth-of-type(1) :is(span, font) {
  background-image: linear-gradient(
    90deg,
    #50a0fb 0%,
    #52a3fb 7.14%,
    #55a7fb 14.29%,
    #57aafb 21.43%,
    #59adfb 28.57%,
    #5cb1fb 35.71%,
    #5eb4fb 42.86%,
    #61b7fa 50%,
    #63bbfa 57.14%,
    #66befa 64.29%,
    #68c1fa 71.43%,
    #6bc4fa 78.57%,
    #6ec8fa 85.71%,
    #70cbf9 92.86%,
    #73cef9 100%
  );
  background-size: 100%;
  background-repeat: repeat;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.events-page__rich-text ul:has(> li > h4) > li:nth-child(n + 4) p:nth-of-type(1),
.events-page__rich-text ul:has(> li > h4) > li:nth-child(n + 4) p:nth-of-type(1) :is(span, font) {
  background-image: linear-gradient(
    90deg,
    #73cef9 0%,
    #7acff9 14.29%,
    #81d1f9 28.57%,
    #87d2f9 42.86%,
    #8dd3fa 57.14%,
    #93d4fa 71.43%,
    #99d6fa 85.71%,
    #9fd7fa 100%
  );
  background-size: 100%;
  background-repeat: repeat;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .events-page__rich-text ul:has(> li > h4) > li:nth-child(1) p:nth-of-type(1),
  .events-page__rich-text ul:has(> li > h4) > li:nth-child(1) p:nth-of-type(1) :is(span, font) {
    color: #09eecc;
    background: none;
    -webkit-text-fill-color: currentColor;
  }

  .events-page__rich-text ul:has(> li > h4) > li:nth-child(2) p:nth-of-type(1),
  .events-page__rich-text ul:has(> li > h4) > li:nth-child(2) p:nth-of-type(1) :is(span, font) {
    color: #0997f7;
    background: none;
    -webkit-text-fill-color: currentColor;
  }

  .events-page__rich-text ul:has(> li > h4) > li:nth-child(3) p:nth-of-type(1),
  .events-page__rich-text ul:has(> li > h4) > li:nth-child(3) p:nth-of-type(1) :is(span, font) {
    color: #73cef9;
    background: none;
    -webkit-text-fill-color: currentColor;
  }

  .events-page__rich-text ul:has(> li > h4) > li:nth-child(n + 4) p:nth-of-type(1),
  .events-page__rich-text ul:has(> li > h4) > li:nth-child(n + 4) p:nth-of-type(1) :is(span, font) {
    color: #9fd7fa;
    background: none;
    -webkit-text-fill-color: currentColor;
  }
}

.events-page__rich-text ul:has(> li > h4) > li p:nth-of-type(2),
.events-page__rich-text ul:has(> li > h4) > li p:nth-of-type(2) :is(span, font) {
  margin: 0;
  width: 100%;
  font-size: 0.8125rem;
  line-height: 1.5;
  text-align: center;
  color: rgba(255, 255, 255, 0.5) !important;
}

/* CMS 多餘空段落（如佳作末尾 <p><br></p>） */
.events-page__rich-text ul:has(> li > h4) > li p:nth-of-type(n + 3) {
  display: none;
  margin: 0;
}

.events-page__row-value--prize {
  display: grid;
  grid-template-columns: 7.75rem minmax(0, 1fr);
  column-gap: 0.5rem;
  align-items: baseline;
}

.events-page__row-value--prize > span:first-child {
  font-variant-numeric: tabular-nums;
}

.events-page__row-quota {
  font-size: 1rem;
  line-height: 1.5;
  color: #606267;
  white-space: nowrap;
}

.events-page__map-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: fit-content;
  margin-top: 0.875rem;
  padding: 0.625rem 1.1rem;
  border: 1px solid rgba(94, 179, 255, 0.45);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  color: #63c0ae;
  text-decoration: none;
  background: rgba(43, 127, 255, 0.18);
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
  vertical-align: middle;
}

.events-page__map-btn > span[aria-hidden="true"] {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  flex-shrink: 0;
}

.events-page__rich-text .events-page__map-btn:where(:link, :visited) {
  color: #63c0ae;
}

.events-page__map-btn:hover {
  color: #fff;
  border-color: rgba(94, 179, 255, 0.7);
  background: linear-gradient(
    90deg,
    rgba(43, 127, 255, 0.45) 0%,
    rgba(0, 184, 219, 0.35) 100%
  );
}

.events-page__map-btn:hover > span[aria-hidden="true"] {
  color: #63c0ae;
}

.events-page__note {
  margin: 1rem 0 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.4);
}

.events-page__back {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: min(100%, 14rem);
  margin: clamp(1.75rem, 4vw, 2.5rem) auto 0;
  padding: 0.65rem 1.25rem;
  border: 1px solid #0997f74d;
  border-radius: 999px;
  background: #0997f71a;
  color: #ecf2f7;
  font-size: 1rem;
  line-height: 1.4;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.events-page__back:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 1100px) {
  .events-page__rich-text ul:has(> li > h4) {
    max-width: 95%;
  }
}

@media (max-width: 768px) {
  .events-page__head {
    text-align: center;
  }

  .events-page__line {
    margin-inline: auto;
  }

  .events-page__intro {
    margin-inline: auto;
  }

  .events-page__row {
    grid-template-columns: 1fr;
    row-gap: 0.25rem;
  }

  .events-page__row-value {
    text-align: left;
  }

  .events-page__rich-text ul:has(> li > h4) {
    grid-template-columns: 1fr;
  }

  .events-page__rich-text ul:not(:has(> li > h4)) > li {
    grid-template-columns: 1fr;
    row-gap: 0.75rem;
  }

  .events-page__rich-text h2 {
    scroll-margin-top: 6rem;
  }
}
