/* ═══════════════════════════════════════════════════
   TEXTURE CAROUSEL — 雙軌分類輪播（基本款式 / 創作款式）
   每個分類 = 一張全螢幕背景圖 + Ken Burns + 淺遮罩 + 白字
   ═══════════════════════════════════════════════════ */

/* 重置 #textures 外層容器：移除 sections-v2 的 padding/grid，讓輪播滿版 */
.texture-grid {
  display: block;
  padding: 0;
  max-width: none;
  background: var(--dark);
}

/* ── Container ── */
.texture-carousel {
  position: relative;
  width: 100%;
  height: 90vh;
  min-height: 640px;
  overflow: hidden;
  background: var(--dark);
  isolation: isolate;
}

.texture-carousel + .texture-carousel {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ── Slides ── */
.texture-slides {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.texture-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.2s var(--ease-out, ease-out);
  will-change: opacity;
}

.texture-slide.active {
  opacity: 1;
}

.texture-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(1.05);
  transition: transform 8s linear;
  will-change: transform;
}

.texture-slide.active img {
  transform: scale(1.12);
}

/* ── Overlay：確保左下文字 / 右上按鈕可讀 ── */
.texture-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(
      to top right,
      rgba(28, 27, 24, 0.78) 0%,
      rgba(28, 27, 24, 0.55) 40%,
      rgba(28, 27, 24, 0.30) 70%,
      rgba(28, 27, 24, 0.45) 100%
    );
}

/* ── Header：左上 tag / 標題 / 副標 ── */
.texture-carousel-header {
  position: absolute;
  top: 8%;
  left: 6%;
  z-index: 3;
  max-width: 640px;
  color: #fff;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.5);
}

.texture-carousel-header .tag {
  display: inline-block;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.45em;
  color: var(--accent, #9a8456) !important;
  text-transform: uppercase;
  margin-bottom: 18px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.texture-carousel-header .title-lg,
.texture-carousel-header .title-lg--light {
  font-family: 'Noto Serif TC', serif;
  font-size: clamp(1.8rem, 3.2vw, 2.2rem);
  font-weight: 500;
  color: #ffffff;
  letter-spacing: 0.22em;
  line-height: 1.5;
  margin: 0 0 16px;
  text-shadow: 0 4px 22px rgba(0, 0, 0, 0.55);
}

.texture-carousel-header .subtitle,
.texture-carousel-header .subtitle--light {
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.78);
  letter-spacing: 0.08em;
  line-height: 1.9;
  margin: 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* ── 進入型錄 按鈕（右上） ── */
.texture-enter-btn {
  position: absolute;
  top: 36px;
  right: 36px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.2em;
  color: #ffffff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition:
    background 0.35s var(--ease-out, ease-out),
    border-color 0.35s var(--ease-out, ease-out),
    color 0.35s var(--ease-out, ease-out),
    transform 0.35s var(--ease-out, ease-out);
  cursor: pointer;
}

.texture-enter-btn:hover,
.texture-enter-btn:focus-visible {
  background: var(--accent, #9a8456);
  border-color: var(--accent, #9a8456);
  color: #fff;
  transform: translateX(2px);
  outline: none;
}

.texture-enter-btn .arrow-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.35s var(--ease-out, ease-out);
}

.texture-enter-btn:hover .arrow-icon {
  transform: translateX(4px);
}

/* ── Content：左下分類清單 ── */
.texture-content {
  position: absolute;
  bottom: 12%;
  left: 6%;
  z-index: 3;
  width: min(420px, 45%);
  max-width: 460px;
}

.texture-cat-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.texture-cat-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: baseline;
  gap: 12px;
  padding: 10px 12px 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition:
    background 0.3s var(--ease-out, ease-out),
    padding 0.3s var(--ease-out, ease-out),
    border-color 0.3s var(--ease-out, ease-out);
  outline: none;
}

.texture-cat-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10%;
  bottom: 10%;
  width: 2px;
  background: transparent;
  transition: background 0.3s var(--ease-out, ease-out);
}

.texture-cat-item .cat-zh {
  font-family: 'Noto Serif TC', serif;
  font-size: 16px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.12em;
  transition: color 0.3s var(--ease-out, ease-out), font-weight 0.3s var(--ease-out, ease-out);
}

.texture-cat-item .cat-en {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  white-space: nowrap;
}

.texture-cat-item .cat-count {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 11px;
  color: var(--accent, #9a8456);
  letter-spacing: 0.15em;
  min-width: 26px;
  text-align: right;
}

.texture-cat-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.texture-cat-item:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

.texture-cat-item.active {
  background: rgba(154, 132, 86, 0.14);
  padding-left: 18px;
}

.texture-cat-item.active::before {
  background: var(--accent, #9a8456);
}

.texture-cat-item.active .cat-zh {
  color: #ffffff;
  font-weight: 500;
}

.texture-cat-item.active .cat-en {
  color: rgba(255, 255, 255, 0.72);
}

/* ── Dots：底部橫排置中 ── */
.texture-dots {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  flex-direction: row;
  gap: 10px;
}

.texture-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: transparent;
  padding: 0;
  cursor: pointer;
  transition:
    background 0.3s var(--ease-out, ease-out),
    border-color 0.3s var(--ease-out, ease-out),
    width 0.3s var(--ease-out, ease-out);
}

.texture-dot.active {
  background: var(--accent, #9a8456);
  border-color: var(--accent, #9a8456);
  width: 22px;
  border-radius: 4px;
}

.texture-dot:hover:not(.active) {
  border-color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.25);
}

/* ── 響應式 ── */
@media (max-width: 960px) {
  .texture-carousel {
    height: 80vh;
    min-height: 600px;
  }

  .texture-content {
    width: min(380px, 55%);
  }
}

@media (max-width: 768px) {
  .texture-carousel {
    height: auto;
    min-height: 0;
  }

  .texture-slides {
    position: absolute;
    inset: 0;
  }

  /* 手機：把可讀區域展開、背景自然填滿 */
  .texture-carousel {
    padding: 120px 0 96px;
  }

  .texture-carousel-header {
    position: relative;
    top: auto;
    left: auto;
    margin: 0 6%;
    max-width: none;
    padding-bottom: 32px;
  }

  .texture-carousel-header .title-lg,
  .texture-carousel-header .title-lg--light {
    font-size: clamp(1.5rem, 6vw, 1.8rem);
    letter-spacing: 0.16em;
    line-height: 1.7;
  }

  .texture-carousel-header .subtitle,
  .texture-carousel-header .subtitle--light {
    font-size: 13px;
    line-height: 1.85;
  }

  .texture-enter-btn {
    top: 20px;
    right: 20px;
    padding: 9px 16px;
    font-size: 11.5px;
    letter-spacing: 0.15em;
    gap: 8px;
  }

  .texture-enter-btn .arrow-icon {
    width: 14px;
    height: 14px;
  }

  /* 手機：cat-list 改橫向滾動（避免直排太高） */
  .texture-content {
    position: relative;
    bottom: auto;
    left: auto;
    width: 100%;
    max-width: none;
    padding: 0 0 0 6%;
    margin-top: 8px;
  }

  .texture-cat-list {
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 6% 16px 0;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .texture-cat-list::-webkit-scrollbar {
    display: none;
  }

  .texture-cat-item {
    flex: 0 0 auto;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 2px;
    scroll-snap-align: start;
    background: rgba(0, 0, 0, 0.25);
  }

  .texture-cat-item::before {
    display: none;
  }

  .texture-cat-item.active {
    padding-left: 14px;
    background: rgba(154, 132, 86, 0.24);
    border-color: var(--accent, #9a8456);
  }

  .texture-cat-item .cat-zh {
    font-size: 14px;
    letter-spacing: 0.08em;
  }

  .texture-cat-item .cat-en {
    font-size: 10px;
    letter-spacing: 0.2em;
  }

  .texture-cat-item .cat-count {
    display: none;
  }

  .texture-dots {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    margin: 20px auto 0;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .texture-carousel-header .tag {
    font-size: 10.5px;
    letter-spacing: 0.35em;
    margin-bottom: 14px;
  }

  .texture-carousel-header .title-lg,
  .texture-carousel-header .title-lg--light {
    font-size: 1.35rem;
    letter-spacing: 0.12em;
  }

  .texture-enter-btn span {
    display: none;
  }

  .texture-enter-btn {
    padding: 9px 12px;
  }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .texture-slide,
  .texture-slide img,
  .texture-enter-btn,
  .texture-enter-btn .arrow-icon,
  .texture-cat-item,
  .texture-cat-item .cat-zh,
  .texture-dot {
    transition: none !important;
    animation: none !important;
  }
  .texture-slide.active img {
    transform: none;
  }
}
