.nld-mhe {
  --nld-mhe-bg: #f1f1f1;
  --nld-mhe-text: #000;
  --nld-mhe-muted: rgba(0, 0, 0, .18);
  --nld-mhe-active: #fff;
  --nld-mhe-image-muted-opacity: .18;
  --nld-mhe-shade: .12;
  --nld-mhe-speed-top: 58s;
  --nld-mhe-speed-middle: 64s;
  --nld-mhe-speed-bottom: 60s;
  --nld-mhe-font-size: clamp(64px, 6.35vw, 124px);
  --nld-mhe-font-size-mobile: clamp(46px, 14vw, 82px);
  --nld-mhe-display-image-height: .78em;
  --nld-mhe-display-image-height-mobile: .78em;
  --nld-mhe-ease: cubic-bezier(.22, 1, .36, 1);
  --nld-mhe-bg-transition: .8s;
  --nld-mhe-height-desktop: 800px;
  --nld-mhe-height-tablet: 700px;
  --nld-mhe-height-mobile: 600px;
  --nld-mhe-padding-desktop: 96px;
  --nld-mhe-padding-tablet: 80px;
  --nld-mhe-padding-mobile: 72px;
  --nld-mhe-row-gap-desktop: 36px;
  --nld-mhe-row-gap-tablet: 30px;
  --nld-mhe-row-gap-mobile: 24px;
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background: var(--nld-mhe-bg);
  color: var(--nld-mhe-text);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.nld-mhe,
.nld-mhe * {
  box-sizing: border-box;
}

.nld-mhe--height-custom {
  min-height: var(--nld-mhe-height-desktop);
}

.nld-mhe--height-auto {
  min-height: 0;
}

.nld-mhe--height-auto .nld-mhe__wrap {
  min-height: 0;
}

.nld-mhe--size-small {
  --nld-mhe-font-size: clamp(48px, 5vw, 92px);
  --nld-mhe-font-size-mobile: clamp(36px, 11vw, 64px);
}

.nld-mhe--size-medium {
  --nld-mhe-font-size: clamp(64px, 6.35vw, 124px);
  --nld-mhe-font-size-mobile: clamp(46px, 14vw, 82px);
  --nld-mhe-display-image-height: .78em;
  --nld-mhe-display-image-height-mobile: .78em;
}

.nld-mhe--size-large {
  --nld-mhe-font-size: clamp(80px, 7.8vw, 152px);
  --nld-mhe-font-size-mobile: clamp(56px, 17vw, 104px);
}

.nld-mhe--size-xlarge {
  --nld-mhe-font-size: clamp(96px, 9.4vw, 184px);
  --nld-mhe-font-size-mobile: clamp(66px, 20vw, 126px);
}

.nld-mhe__image-stage {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  min-height: 100%;
  z-index: 0;
  pointer-events: none;
  background: #111;
  opacity: 0;
  transition: opacity .55s var(--nld-mhe-ease);
}

.nld-mhe.is-hovering .nld-mhe__image-stage {
  opacity: 1;
}

.nld-mhe__bg {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  min-height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.035);
  transition: opacity var(--nld-mhe-bg-transition, .8s) var(--nld-mhe-ease), transform 1.2s var(--nld-mhe-ease);
}

.nld-mhe__bg.is-active {
  opacity: 1;
  transform: scale(1);
}

.nld-mhe--bg-display-cover .nld-mhe__bg {
  object-fit: cover;
}

.nld-mhe--bg-display-contain .nld-mhe__bg {
  object-fit: contain;
}

.nld-mhe__image-shade {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, var(--nld-mhe-shade));
}

.nld-mhe__wrap {
  position: relative;
  z-index: 10;
  min-height: inherit;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--nld-mhe-row-gap-desktop);
  padding: var(--nld-mhe-padding-desktop) 0;
}

.nld-mhe__row {
  width: 100%;
  overflow: visible;
  white-space: nowrap;
}

.nld-mhe__track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  color: var(--nld-mhe-text);
}

.nld-mhe__group {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.nld-mhe__link,
.nld-mhe__sep {
  display: inline-block;
  font-size: var(--nld-mhe-font-size-custom, var(--nld-mhe-font-size));
  font-weight: 800;
  letter-spacing: -0.065em;
  line-height: .9;
  color: currentColor;
}


.nld-mhe__link--image {
  line-height: 1;
  letter-spacing: normal;
  vertical-align: middle;
  opacity: 1;
  transition: opacity .35s var(--nld-mhe-ease), filter .35s var(--nld-mhe-ease), transform .35s var(--nld-mhe-ease);
}

.nld-mhe__mobile-cta {
  display: none;
}

.nld-mhe__display-image-wrap {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  line-height: 0;
}

.nld-mhe__display-image-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  display: block;
  pointer-events: none;
  background: var(--nld-mhe-muted);
  -webkit-mask-image: var(--nld-mhe-display-image-url);
  mask-image: var(--nld-mhe-display-image-url);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  opacity: 0;
  transition: opacity .35s var(--nld-mhe-ease);
}

.nld-mhe__display-image {
  display: block;
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain;
  vertical-align: middle;
}

/* 高度模式：只指定高度，寬度依圖片原始比例自動。 */
.nld-mhe--image-size-height .nld-mhe__display-image-wrap,
.nld-mhe--image-size-height .nld-mhe__display-image {
  height: var(--nld-mhe-display-image-height-custom, var(--nld-mhe-display-image-height)) !important;
  width: auto !important;
}

/* 寬度模式：只指定寬度，高度依圖片原始比例自動。 */
.nld-mhe--image-size-width .nld-mhe__display-image-wrap,
.nld-mhe--image-size-width .nld-mhe__display-image {
  width: var(--nld-mhe-display-image-width-custom, min(42vw, 520px)) !important;
  height: auto !important;
}

.nld-mhe__link {
  margin: 0 28px;
  cursor: pointer;
  text-decoration: none;
  transition: color .35s var(--nld-mhe-ease), opacity .35s var(--nld-mhe-ease), transform .35s var(--nld-mhe-ease);
}

.nld-mhe__link:focus,
.nld-mhe__link:focus-visible,
.nld-mhe__link:active {
  outline: none !important;
  box-shadow: none !important;
}

.nld-mhe__sep {
  margin: 0 9px;
  flex: 0 0 auto;
  position: relative;
  z-index: 3;
  font-weight: 400;
  letter-spacing: -.08em;
  color: var(--nld-mhe-text);
  opacity: 1;
  visibility: visible;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.nld-mhe.is-hovering .nld-mhe__track {
  color: var(--nld-mhe-muted);
}

.nld-mhe.is-hovering .nld-mhe__link.is-active {
  color: var(--nld-mhe-active);
  opacity: 1;
  transform: translateY(-2px);
  text-shadow: 0 8px 26px rgba(0, 0, 0, .16);
}

.nld-mhe.is-hovering .nld-mhe__link--image:not(.is-active) .nld-mhe__display-image {
  opacity: 0;
}

.nld-mhe.is-hovering .nld-mhe__link--image:not(.is-active) .nld-mhe__display-image-wrap::after {
  opacity: 1;
}

.nld-mhe.is-hovering .nld-mhe__link--image.is-active .nld-mhe__display-image {
  opacity: 1;
}

.nld-mhe.is-hovering .nld-mhe__link--image.is-active .nld-mhe__display-image-wrap::after {
  opacity: 0;
}

.nld-mhe.is-hovering .nld-mhe__sep {
  /* Hover 時與其他非作用中項目一起淡化。 */
  color: var(--nld-mhe-muted);
  opacity: 1;
}

.nld-mhe .move-left {
  animation: nldMheMoveLeft linear infinite;
}

.nld-mhe .move-right {
  animation: nldMheMoveRight linear infinite;
}

.nld-mhe .speed-top { animation-duration: var(--nld-mhe-speed-top); }
.nld-mhe .speed-middle { animation-duration: var(--nld-mhe-speed-middle); }
.nld-mhe .speed-bottom { animation-duration: var(--nld-mhe-speed-bottom); }

@keyframes nldMheMoveLeft {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-50%, 0, 0); }
}

@keyframes nldMheMoveRight {
  from { transform: translate3d(-50%, 0, 0); }
  to { transform: translate3d(0, 0, 0); }
}


@media (hover: none), (pointer: coarse) {
  .nld-mhe__link.is-mobile-cta-link {
    color: var(--nld-mhe-active);
  }

  .nld-mhe__link.is-mobile-cta-link .nld-mhe__mobile-cta {
    display: block;
    margin-top: 8px;
    letter-spacing: -0.04em;
    line-height: 1;
    color: var(--nld-mhe-active);
    font-size: var(--nld-mhe-mobile-cta-font-size-custom, var(--nld-mhe-font-size-mobile-custom, var(--nld-mhe-font-size-mobile)));
  }

  .nld-mhe__link--image.is-mobile-cta-link {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
  }

  .nld-mhe__link:not(.nld-mhe__link--image).is-mobile-cta-link {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
  }

  /* 手機點擊預覽時，非作用中圖片同樣套用後台設定的遮罩色。 */
  .nld-mhe__display-image-wrap::after {
    display: block;
    transition-duration: .16s;
  }

  .nld-mhe.is-hovering .nld-mhe__link--image:not(.is-active) .nld-mhe__display-image {
    opacity: 0;
  }

  .nld-mhe.is-hovering .nld-mhe__link--image:not(.is-active) .nld-mhe__display-image-wrap::after {
    opacity: 1;
  }

  .nld-mhe.is-hovering .nld-mhe__link--image.is-active .nld-mhe__display-image {
    opacity: 1;
  }

  .nld-mhe.is-hovering .nld-mhe__link--image.is-active .nld-mhe__display-image-wrap::after {
    opacity: 0;
  }

  /* 遮罩顯示期間暫停輪播，避免手機持續重繪 mask 造成卡頓。 */
  .nld-mhe.is-touch-preview .nld-mhe__track {
    animation-play-state: paused;
  }

  .nld-mhe.is-hovering .nld-mhe__link.is-active {
    transform: none;
    text-shadow: none;
  }

  .nld-mhe__image-stage,
  .nld-mhe__bg,
  .nld-mhe__link,
  .nld-mhe__link--image,
  .nld-mhe__display-image {
    transition-duration: .2s;
  }

  .nld-mhe__bg,
  .nld-mhe__bg.is-active {
    transform: none;
  }
}



@media (max-width: 1024px) {
  .nld-mhe--height-custom { min-height: var(--nld-mhe-height-tablet); }
  .nld-mhe__wrap { gap: var(--nld-mhe-row-gap-tablet); padding: var(--nld-mhe-padding-tablet) 0; }

  .nld-mhe__link,
  .nld-mhe__sep {
    font-size: var(--nld-mhe-font-size-tablet-custom, var(--nld-mhe-font-size-custom, var(--nld-mhe-font-size)));
  }

  .nld-mhe--image-size-height .nld-mhe__display-image-wrap,
  .nld-mhe--image-size-height .nld-mhe__display-image {
    height: var(--nld-mhe-display-image-height-tablet-custom, var(--nld-mhe-display-image-height-custom, var(--nld-mhe-display-image-height))) !important;
    width: auto !important;
  }

  .nld-mhe--image-size-width .nld-mhe__display-image-wrap,
  .nld-mhe--image-size-width .nld-mhe__display-image {
    width: var(--nld-mhe-display-image-width-tablet-custom, var(--nld-mhe-display-image-width-custom, min(56vw, 520px))) !important;
    height: auto !important;
  }
}

@supports (height: 100dvh) {
  .nld-mhe--height-fullscreen {
    min-height: 100dvh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nld-mhe__track {
    animation: none !important;
  }
}

@media (max-width: 900px) {
  .nld-mhe--height-custom { min-height: var(--nld-mhe-height-mobile); }

  .nld-mhe__wrap {
    gap: var(--nld-mhe-row-gap-mobile);
    padding: var(--nld-mhe-padding-mobile) 0;
  }

  .nld-mhe__link,
  .nld-mhe__sep {
    font-size: var(--nld-mhe-font-size-mobile-custom, var(--nld-mhe-font-size-mobile));
  }

  .nld-mhe__link {
    margin: 0 18px;
  }

  .nld-mhe--image-size-height .nld-mhe__display-image-wrap,
  .nld-mhe--image-size-height .nld-mhe__display-image {
    height: var(--nld-mhe-display-image-height-mobile-custom, var(--nld-mhe-display-image-height-tablet-custom, var(--nld-mhe-display-image-height-custom, var(--nld-mhe-display-image-height-mobile)))) !important;
    width: auto !important;
  }

  .nld-mhe--image-size-width .nld-mhe__display-image-wrap,
  .nld-mhe--image-size-width .nld-mhe__display-image {
    width: var(--nld-mhe-display-image-width-mobile-custom, var(--nld-mhe-display-image-width-tablet-custom, var(--nld-mhe-display-image-width-custom, min(72vw, 420px)))) !important;
    height: auto !important;
  }
}


/* v1.1.0 mobile sizing and animation performance */
.nld-mhe__group,
.nld-mhe__display-image-wrap,
.nld-mhe__display-image {
  flex: 0 0 auto;
}

@media (max-width: 900px) {
  .nld-mhe__row {
    contain: layout style;
  }

  .nld-mhe__track {
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
  }

  /* 不再同時鎖住外層與圖片尺寸，避免手機瀏覽器在動畫中算出 0 寬高。 */
  .nld-mhe__display-image-wrap {
    min-width: 1px;
    min-height: 1px;
    overflow: visible;
  }

  .nld-mhe__display-image {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
  }
}


/* 非互動模式：僅停用 Hover／背景預覽；連結仍可正常點擊。 */
.nld-mhe--noninteractive .nld-mhe__link {
  pointer-events: auto;
  cursor: pointer;
}

.nld-mhe--noninteractive .nld-mhe__image-stage {
  display: none;
}

.nld-mhe--noninteractive .nld-mhe__display-image-wrap::after {
  display: none !important;
  opacity: 0 !important;
}


/* v1.1.4：修正 iOS／手機瀏覽器在 GPU 輪播合成時，首尾排分隔符偶發不繪製。 */
@media (max-width: 900px), (hover: none), (pointer: coarse) {
  .nld-mhe__sep {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: .38em;
    line-height: 1;
    isolation: isolate;
    contain: none;
    -webkit-font-smoothing: antialiased;
  }

  .nld-mhe.is-hovering .nld-mhe__sep {
    color: var(--nld-mhe-muted) !important;
    opacity: 1 !important;
    visibility: visible !important;
  }
}
