[data-aos] #text-mask-path {
  stroke-dasharray: 1540;
  stroke-dashoffset: 1540;
}

[data-aos].is-animated #text-mask-path {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1.2s var(--transition-timing-md);
}

main {
  z-index: auto;
  padding-top: calc(var(--header-height) * 2);
}

.main-bg {
  background-image: url(./../images/customize/overview_bg_top.png), url(./../images/customize/overview_bg.png);
  background-position: top center, top center;
  background-size: 200% auto, 200% auto;
  background-repeat: no-repeat, repeat;
}

@media (min-width: 640px) {
  .main-bg {
    background-size: 150% auto, 150% auto;
  }
}

@media (min-width: 1024px) {
  .main-bg {
    background-size: 100% auto, 100% auto;
  }
}

.section-head__title {
  --svg-size: 28.125rem;
}

.carousel {
  width: 100%;
}

.carousel-container {
  --aos-duration: 1000ms;
  width: 100%;
  overflow: hidden;
  -webkit-mask-image: url("./../images/works/carousel-mask.png");
          mask-image: url("./../images/works/carousel-mask.png");
  -webkit-mask-size: 100% 100%;
          mask-size: 100% 100%;
}

.carousel-swiper {
  --slides-width: 17.5rem;
}

@media (min-width: 768px) {
  .carousel-swiper {
    --slides-width: 20rem;
  }
}

@media (min-width: 1024px) {
  .carousel-swiper {
    --slides-width: 22.5rem;
  }
}

@media (min-width: 1440px) {
  .carousel-swiper {
    --slides-width: 24.875rem;
  }
}

.carousel-swiper {
  width: 109%;
  margin-left: -4.5%;
  perspective: 1000px;
}

.carousel-swiper .swiper-wrapper {
  transform-style: preserve-3d;
}

.carousel-swiper .swiper-slide {
  width: var(--slides-width);
  overflow: hidden;
  transform-style: preserve-3d;
}

.carousel-swiper .swiper-slide:not(.swiper-slide-active) .works-image::before {
  opacity: 1;
}

.carousel-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 1.5rem;
}

@media (min-width: 768px) {
  .carousel-pagination {
    margin-top: 2.5rem;
  }
}

.works-image {
  position: relative;
  width: 100%;
  aspect-ratio: 398 / 586;
}

.works-image::before {
  content: '';
  position: absolute;
  z-index: 1;
  inset: 0;
  background-color: color-mix(in srgb, #2F2F2F 70%, transparent);
  opacity: 0;
  transition: opacity var(--duration-300) var(--transition-timing-md);
}

.works {
  --works-flex-wrap: wrap;
  --works-justify-content: center;
  --works-container-max-width: 100%;
  --works-swiper-max-width: 100%;
  --section-padding-y: 3rem;
}

@media (min-width: 768px) {
  .works {
    --works-flex-wrap: nowrap;
    --works-justify-content: space-between;
    --works-container-max-width: 59.375rem;
    --works-swiper-max-width: 28.75rem;
    --section-padding-y: 3.75rem;
  }
}

.works {
  padding-bottom: calc(var(--section-padding-y) * 3);
}

.works-container {
  display: flex;
  flex-wrap: var(--works-flex-wrap);
  justify-content: var(--works-justify-content);
  gap: 2.5rem;
  max-width: var(--works-container-max-width);
  margin-left: auto;
  margin-right: auto;
}

.works-swiper {
  max-width: var(--works-swiper-max-width);
}

@media (min-width: 768px) {
  .works-swiper {
    flex: 1;
  }
}

@media (min-width: 768px) {
  .works-item__swiper--next {
    order: 3;
  }
}

.works .swiper-btn {
  flex-shrink: 0;
}

/* 預設先隱藏 */
.works-swiper .swiper-slide {
  opacity: 0 !important;
  transition: opacity 0.5s; /* 想要漸變就留著 */
}

/* 只有 active 的 slide 顯示 */
.works-swiper .swiper-slide.swiper-slide-active {
  opacity: 1 !important;
  z-index: 2; /* 確保在最上層 */
}

/* 如果有 loop，需要把 duplicate 的 active slide 也算進去 */
.works-swiper .swiper-slide.swiper-slide-duplicate-active {
  opacity: 1 !important;
  z-index: 2;
}
