/* ==========================================================================
   Hero 輪播元件 —— fade 過場、左右箭頭（無背景、白色 icon）
   由子主題 functions.php 條件載入：首頁一定有；其他頁／文章有 [ug_slider] 短碼就載入。
   版本號用 filemtime。2026-10 由 assets/css/home.css 搬入本檔，CSS 規則原封不動。

   HTML 由 inc/slider-render.php 輸出（[ug_slider] 短碼，首頁都一樣，放喺頁面內容最頂）。
   放喺內文（entry-content）→ 靠 alignfull ＋ 下面嘅 width:auto 補償成真正全寬。
   ⚠️ 本檔只負責 .ug-hero* 呢個元件。
   ========================================================================== */
/* ==========================================================================
   首頁 Hero 輪播（3 張 Slide）—— fade 過場、左右箭頭（無背景、白色 icon）
   備註：
   1. HTML 由 inc/slider-render.php 輸出（[ug_slider] 短碼；首頁都一樣）。
   2. 高度固定 600px（桌面同手機一樣，之後可再調）。
   3. 文字全部置中；遮罩用中等強度深色，同時兼顧深色同淺色相片。
   4. 刻意對齊網站現有設計：按鈕 #65c5c3 系、字體同標題字級跟主題。
   ========================================================================== */
.ug-hero{
  position:relative;
  display:block;
  width:100%;
  height:600px;
  overflow:hidden;
  background:var(--wp--preset--color--accent-3, #143a6b);
  isolation:isolate;
}
/* 放喺內文（短碼 [ug_slider]）時 WordPress 會為 .ug-hero 加上 alignfull。
   但 .ug-hero 上面寫死 width:100%，alignfull 嘅負 margin 只會令佢「移位」而唔會撐開
   → 實測寬度只有 1165px（父層內容寬）而唔係全寬。覆蓋成 width:auto 之後：
   desktop 1265/1265、mobile 390/390，兩者都冇橫向溢出。
   2026-10 起首頁都改用短碼，所以全站都行呢條路。 */
.ug-hero.alignfull{
  width:auto;
}
/* 舊首頁注入版先啱用：消除 main.is-layout-flow 喺 hero 同內容區之間加嘅空隙。
   2026-10 起 hero 搬入內文，呢條規則已無作用（保留只為還原方便）。 */
.ug-hero + .wp-block-post-content{margin-block-start:0;}

.ug-hero__track{position:absolute;inset:0;}

.ug-hero__slide{
  position:absolute;
  inset:0;
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transition:opacity .8s ease, visibility 0s linear .8s;
}
.ug-hero__slide.is-active{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  transition:opacity .8s ease, visibility 0s linear 0s;
}

.ug-hero__img{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  max-width:none;
  object-fit:cover;
  object-position:center;
  z-index:0;
}
.ug-hero__overlay{
  position:absolute;
  inset:0;
  z-index:1;
  background:linear-gradient(180deg, rgba(0,0,0,.30) 0%, rgba(0,0,0,.55) 100%);
}

.ug-hero__content{
  position:absolute;
  inset:0;
  z-index:2;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:48px 24px;
  color:#fff;
}
.ug-hero__title{
  margin:0 0 18px;
  max-width:1000px;
  font-family:inherit;
  font-size:clamp(28px, 4.2vw, 48px);
  line-height:1.2;
  font-weight:600;
  color:#fff;
  text-shadow:0 2px 14px rgba(0,0,0,.45);
}
.ug-hero__tagline{
  margin:0 0 30px;
  max-width:760px;
  font-size:clamp(16px, 1.5vw, 20px);
  line-height:1.65;
  font-weight:400;
  color:rgba(255,255,255,.94);
  text-shadow:0 1px 10px rgba(0,0,0,.4);
}
.ug-hero__button{
  position:relative;
  display:inline-block;
  overflow:hidden;
  padding:14px 36px;
  border:1px solid #fff;
  border-radius:8px;
  background:transparent;
  color:#fff;
  font-size:var(--wp--preset--font-size--medium, 17.88px);
  font-weight:500;
  line-height:1.75;
  text-decoration:none;
  transition:color .35s ease, border-color .35s ease;
}
/* Swipe Right：白色填充由左邊掃出。
   刻意用 transform:scaleX() 而唔係 width —— scaleX 只喺合成層做，
   唔會每格重新計算 layout（width 版本會），手機上差別最明顯。 */
.ug-hero__button::after{
  content:"";
  position:absolute;
  inset:0;
  z-index:0;
  background:#fff;
  transform:scaleX(0);
  transform-origin:left center;
  transition:transform .35s ease;
}
/* 文字要壓喺填充之上 */
.ug-hero__button-text{position:relative;z-index:1;}
.ug-hero__button:hover,
.ug-hero__button:focus-visible{
  border-color:#fff;
  color:#323639;
  text-decoration:none;
}
.ug-hero__button:hover::after,
.ug-hero__button:focus-visible::after{transform:scaleX(1);}
.ug-hero__button:focus-visible{outline:3px solid #fff;outline-offset:3px;}

/* 箭頭：無背景、只有白色 icon */
.ug-hero__arrow{
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  z-index:3;
  display:flex;
  align-items:center;
  justify-content:center;
  width:56px;
  height:56px;
  margin:0;
  padding:0;
  border:0;
  background:none;
  background-color:transparent;
  color:#fff;
  cursor:pointer;
  opacity:.85;
  transition:opacity .25s ease, transform .25s ease;
  filter:drop-shadow(0 1px 6px rgba(0,0,0,.65));
}
.ug-hero__arrow:hover,
.ug-hero__arrow:focus-visible{opacity:1;transform:translateY(-50%) scale(1.12);}
.ug-hero__arrow:focus-visible{outline:3px solid #fff;outline-offset:2px;border-radius:6px;}
.ug-hero__arrow--prev{left:12px;}
.ug-hero__arrow--next{right:12px;}
.ug-hero__icon{display:block;width:34px;height:34px;}

/* 手機：收窄箭頭並加大內容左右內距，避免文字同箭頭重疊 */
@media (max-width:782px){
  .ug-hero__content{padding:40px 64px;}
  .ug-hero__arrow{width:48px;height:48px;}
  .ug-hero__icon{width:28px;height:28px;}
  .ug-hero__arrow--prev{left:6px;}
  .ug-hero__arrow--next{right:6px;}
}

@media (prefers-reduced-motion:reduce){
  .ug-hero__slide,
  .ug-hero__slide.is-active{transition:none;}
  .ug-hero__arrow:hover,
  .ug-hero__arrow:focus-visible{transform:translateY(-50%);}
  .ug-hero__button,
  .ug-hero__button::after{transition:none;}
}
