/* ─── 安可首頁橫幅輪播 (Encore Home Hero Carousel) ─── */

/* 首頁有輪播時，清掉 main 的內距讓橫幅全寬滿版 */
.site-main:has(> .encore-hero),
#main:has(> .encore-hero) {
  padding: 0 !important;
}

.encore-hero {
  position: relative;
  width: 100%;
  border-bottom: 1px solid var(--encore-border, #e2e8f0);
  background: var(--encore-surface, #ffffff);
}

.encore-hero-viewport {
  position: relative;
  overflow: hidden;
  max-width: 1680px;
  margin-inline: auto;
  transition: height 0.5s var(--encore-ease, cubic-bezier(0.16, 1, 0.3, 1));
}

/* 底部條紋裝飾 */
.encore-hero-viewport::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  z-index: 3;
  background: repeating-linear-gradient(90deg,
    color-mix(in oklch, var(--encore-accent, #B00000) 58%, white) 0 22px,
    color-mix(in oklch, var(--encore-accent, #B00000) 22%, white) 22px 44px);
}

.encore-hero-track {
  display: flex;
  align-items: flex-start;
  transition: transform 0.72s var(--encore-ease, cubic-bezier(0.16, 1, 0.3, 1));
  will-change: transform;
}

.encore-hero-slide {
  flex: 0 0 100%;
  min-width: 0;
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: stretch;
  min-height: var(--encore-hero-h, 680px);
  background: color-mix(in oklch, var(--encore-fg, #0f172a) 92%, var(--encore-accent, #B00000));
}

.encore-hero-slide.is-noimg {
  background: linear-gradient(120deg,
    color-mix(in oklch, var(--encore-accent, #B00000) 86%, black),
    var(--encore-accent, #B00000));
}

/* 依圖片原始比例自動高度（全圖不裁切） */
.encore-hero-slide.is-auto {
  min-height: 0;
  aspect-ratio: var(--encore-hero-ar);
}

.encore-hero-bg {
  grid-area: 1 / 1;
  position: relative;
  overflow: hidden;
}

/* 左側白色漸層：讓文字可讀（濃度由 --encore-hero-overlay 控制） */
.encore-hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(90deg,
    rgba(255, 255, 255, var(--encore-hero-overlay, 0.7)) 0%,
    rgba(255, 255, 255, calc(var(--encore-hero-overlay, 0.7) * 0.54)) 38%,
    rgba(255, 255, 255, calc(var(--encore-hero-overlay, 0.7) * 0.086)) 66%,
    transparent 82%);
}

.encore-hero-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--encore-hero-focus, center);
  filter: saturate(0.98) contrast(0.98) brightness(1.06);
  transform: scale(1.045);
  transition: transform 8s var(--encore-ease, cubic-bezier(0.16, 1, 0.3, 1));
}

.encore-hero-slide.is-in .encore-hero-photo {
  transform: scale(1);
}

.encore-hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--encore-hero-focus, center);
  filter: saturate(0.98) contrast(0.98) brightness(1.06);
  background: #000;
}

.encore-hero-inner {
  position: relative;
  z-index: 2;
  grid-area: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  padding-inline: clamp(28px, 6vw, 120px);
}

.encore-hero-copy {
  position: relative;
  max-width: 30rem;
  text-align: left;
}

/* 整張橫幅連結：覆蓋圖片區域，文字層可點擊穿透 */
.encore-hero-slide-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  cursor: pointer;
}

.encore-hero-slide-link:focus-visible {
  outline: 2px solid var(--encore-accent, #B00000);
  outline-offset: -4px;
}

.encore-hero-slide.has-slide-link .encore-hero-inner {
  pointer-events: none;
}

.encore-hero-slide.has-slide-link .encore-hero-btn {
  pointer-events: auto;
}

.encore-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: var(--encore-fg, #0f172a);
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.78), 0 2px 12px rgba(255, 255, 255, 0.58);
}

.encore-hero-eyebrow::before {
  content: '';
  flex: none;
  width: 22px;
  height: 2px;
  margin-right: 10px;
  border-radius: 2px;
  background: var(--encore-accent, #B00000);
}

.encore-hero-title {
  max-width: 13ch;
  margin: 0 0 26px;
  font-family: var(--encore-font-display, -apple-system, 'Noto Sans TC', sans-serif);
  font-size: clamp(30px, 4.4vw, 56px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--encore-fg, #0f172a);
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.78), 0 2px 12px rgba(255, 255, 255, 0.58);
}

.encore-hero-title .hl {
  white-space: nowrap;
  color: var(--encore-fg, #0f172a);
  text-decoration: underline;
  text-decoration-color: var(--encore-accent, #B00000);
  text-decoration-thickness: 0.13em;
  text-underline-offset: 0.13em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.encore-hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.encore-hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 14px 26px;
  border-radius: 999px;
  background: var(--encore-accent, #B00000);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  line-height: 1;
  box-shadow: 0 16px 34px -20px color-mix(in oklch, var(--encore-fg, #0f172a) 72%, transparent);
  transition: transform 0.2s var(--encore-ease, ease), background 0.2s ease;
}

.encore-hero-btn:hover {
  background: color-mix(in oklch, var(--encore-accent, #B00000) 86%, black);
  transform: translateY(-1px);
}

.encore-hero-btn-ic {
  width: 18px;
  height: 18px;
  transition: transform 0.2s var(--encore-ease, ease);
}

.encore-hero-btn:hover .encore-hero-btn-ic {
  transform: translateX(3px);
}

/* 文字進場動畫 */
.encore-hero-slide .encore-hero-copy > * {
  opacity: 0;
}

.encore-hero-slide.is-in .encore-hero-copy > * {
  animation: encoreHeroIn 0.72s var(--encore-ease, cubic-bezier(0.16, 1, 0.3, 1)) both;
}

.encore-hero-slide.is-in .encore-hero-copy > *:nth-child(2) {
  animation-delay: 0.08s;
}

.encore-hero-slide.is-in .encore-hero-copy > *:nth-child(3) {
  animation-delay: 0.16s;
}

@keyframes encoreHeroIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

/* ─── 控制列 ─────────────────────────────────────────────── */
.encore-hero-bar {
  border-top: 1px solid var(--encore-border, #e2e8f0);
  background: linear-gradient(180deg,
    color-mix(in oklch, var(--encore-accent, #B00000) 5%, var(--encore-surface, #fff)),
    var(--encore-surface, #fff));
}

.encore-hero-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 60px;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding-inline: clamp(20px, 3vw, 48px);
  box-sizing: border-box;
}

.encore-hero-meta {
  display: flex;
  align-items: center;
  gap: clamp(14px, 3vw, 32px);
  min-width: 0;
}

.encore-hero-cap {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--encore-fg, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.encore-hero-cap::before {
  content: '';
  flex: none;
  width: 6px;
  height: 6px;
  margin-right: 9px;
  border-radius: 50%;
  background: var(--encore-accent, #B00000);
}

.encore-hero-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.hdot {
  width: 30px;
  height: 44px;
  border: 0;
  background: none;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.hdot i {
  display: block;
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: var(--encore-border, #e2e8f0);
  transition: background 0.2s ease;
}

.hdot:hover i {
  background: var(--encore-muted, #64748b);
}

.hdot[aria-current="true"] i {
  background: var(--encore-accent, #B00000);
}

.hdot:focus-visible {
  outline: 2px solid var(--encore-accent, #B00000);
  outline-offset: 2px;
  border-radius: 6px;
}

.encore-hero-ctrl {
  display: flex;
  align-items: center;
  gap: 10px;
}

.encore-hero-count {
  font-family: var(--encore-font-mono, ui-monospace, monospace);
  font-size: 12.5px;
  color: var(--encore-muted, #64748b);
  letter-spacing: 0.06em;
}

.encore-hero-count b {
  color: var(--encore-fg, #0f172a);
  font-size: 15px;
}

.harrow {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--encore-border, #e2e8f0);
  border-radius: 999px;
  background: var(--encore-surface, #fff);
  color: var(--encore-fg, #0f172a);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.harrow:hover {
  border-color: var(--encore-fg, #0f172a);
}

.harrow:focus-visible {
  outline: 2px solid var(--encore-accent, #B00000);
  outline-offset: 2px;
}

.harrow .ic {
  width: 19px;
  height: 19px;
}

.harrow.prev .ic {
  transform: rotate(180deg);
}

.hplay .ic-play {
  display: none;
}

.hplay[aria-pressed="true"] .ic-pause {
  display: none;
}

.hplay[aria-pressed="true"] .ic-play {
  display: inline-block;
}

.hplay[aria-pressed="true"] {
  color: var(--encore-accent, #B00000);
  border-color: color-mix(in oklch, var(--encore-accent, #B00000) 45%, var(--encore-border, #e2e8f0));
}

/* ─── 響應式 ─────────────────────────────────────────────── */
@media (max-width: 880px) {
  .encore-hero-slide {
    min-height: var(--encore-hero-h-m, 540px);
  }
  .encore-hero-slide.is-auto {
    min-height: 0;
    aspect-ratio: var(--encore-hero-ar-m, var(--encore-hero-ar));
  }
  .encore-hero-inner {
    align-items: flex-end;
    padding-block: clamp(48px, 12vw, 76px) clamp(34px, 8vw, 52px);
  }
  .encore-hero-copy {
    max-width: none;
  }
  .encore-hero-title {
    max-width: 18ch;
  }
  .encore-hero-photo,
  .encore-hero-video {
    object-position: var(--encore-hero-focus-m, center);
  }
  .encore-hero-bg::after {
    background: linear-gradient(0deg,
      rgba(255, 255, 255, calc(var(--encore-hero-overlay, 0.7) * 0.92)) 0%,
      rgba(255, 255, 255, calc(var(--encore-hero-overlay, 0.7) * 0.5)) 42%,
      transparent 78%);
  }
}

@media (max-width: 620px) {
  .encore-hero-cap {
    display: none;
  }
}

@media (max-width: 520px) {
  .encore-hero-count {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .encore-hero-track {
    transition: none;
  }
  .encore-hero-photo {
    transform: none;
    transition: none;
  }
  .encore-hero-slide .encore-hero-copy > * {
    opacity: 1;
    animation: none;
  }
}

/* === Encore Hero Overlay Controls (integrated into BN) === */
.encore-hero-viewport {
  position: relative;
  overflow: hidden;
}

.encore-hero-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 12;
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #0f172a;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.16);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.encore-hero-arrow.prev {
  left: clamp(12px, 2vw, 28px);
}

.encore-hero-arrow.next {
  right: clamp(12px, 2vw, 28px);
}

.encore-hero-arrow:hover {
  background: #ffffff;
  color: var(--encore-accent, #B00000);
  border-color: #ffffff;
  transform: translateY(-50%) scale(1.06);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.22);
}

.encore-hero-arrow:active {
  transform: translateY(-50%) scale(0.98);
}

.encore-hero-dots-overlay {
  position: absolute;
  left: 50%;
  bottom: clamp(12px, 1.8vw, 22px);
  transform: translateX(-50%);
  z-index: 12;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.encore-hero-dots-overlay .hdot {
  width: 22px;
  height: 16px;
  transition: width 0.22s ease;
}

.encore-hero-dots-overlay .hdot i {
  height: 3.5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.52);
  transition: background 0.22s ease;
}

.encore-hero-dots-overlay .hdot:hover i {
  background: rgba(255, 255, 255, 0.85);
}

.encore-hero-dots-overlay .hdot[aria-current="true"] {
  width: 34px;
}

.encore-hero-dots-overlay .hdot[aria-current="true"] i {
  background: #ffffff;
}

@media (max-width: 640px) {
  .encore-hero-arrow {
    width: 34px;
    height: 34px;
  }
  .encore-hero-arrow .ic {
    width: 16px;
    height: 16px;
  }
  .encore-hero-arrow.prev {
    left: 10px;
  }
  .encore-hero-arrow.next {
    right: 10px;
  }
  .encore-hero-dots-overlay {
    bottom: 10px;
    padding: 5px 10px;
    gap: 6px;
  }
  .encore-hero-dots-overlay .hdot {
    width: 16px;
    height: 14px;
  }
  .encore-hero-dots-overlay .hdot[aria-current="true"] {
    width: 26px;
  }
}
