/**
 * 造形語言
 *
 * 對照 chenya-vision.com：藍色有機曲線色塊、伴隨的平行細線、
 * 偏移描邊（offset outline）、膠囊按鈕、外框式數據卡、細線技術圖騰。
 *
 * 這些是讓版面脫離「白底方塊堆疊」的關鍵，不是裝飾。
 */

/* ===== 波浪造形（取自 vision 的 about-mask：單弧、單色、無細線）=====
 *
 * 波浪是「深色區塊的邊緣」：它就是那個深色區塊往外多長出來的一段，
 * 用同一個顏色、乾淨切進相鄰的白色區。所以：
 *   - 不用負邊距（margin: 0）——貼齊深色區塊、同色無縫接續。
 *   - 一種填色、沒有平行細線——vision「切得恰到好處」正是因為乾淨。
 *   - 填色必須＝它所延伸的深色區塊的底色，否則接縫會露出來。
 */
.wave {
  position: relative;
  z-index: 0;
  display: block;
  line-height: 0;
  margin: 0;
  pointer-events: none;
}

.wave svg { display: block; width: 100%; height: clamp(40px, 5vw, 80px); }
.wave--flip svg { transform: scaleY(-1); }

/* 填色對齊深色區塊：brand＝數據帶（--color-primary #20458b）；dark＝CTA／頁尾（--color-second #16305f）。 */
.wave path { fill: var(--color-primary); }
.wave--dark path { fill: var(--color-second); }
.wave--tint path { fill: var(--color-second-bg); }

/* 波浪透明區的底色＝相鄰淺色區塊的背景，否則會露出 body 的白色形成一條白帶 */
.wave--on-tint  { background: var(--color-second-bg); }
.wave--on-brand { background: var(--color-primary-bg); }
/* hero 的深藍。波浪緊接在內頁主視覺下方時要用它，否則透明區露出 body 的白，
   在深藍 hero 與波浪之間夾出一條白線。 */
.wave--on-hero  { background: var(--color-second); }

/* ===== 斜切邊界（淺色區塊之間）=====
 *
 * 造形語言分工，兩者不可混用在同一條邊界上：
 *   淺↔深（真正的色彩轉場）→ 波浪，戲劇性留給少數幾處
 *   淺↔淺（同為淺色）      → 低角度斜切，打破直線又不搶戲
 *
 * 作法：把背景移到 ::before 再用 clip-path 斜切，不動區塊本身的排版，
 * 內容也不會被裁到（padding 已補足斜切吃掉的高度）。
 */
/*
 * 區塊自身的背景＝「被斜切掉那塊三角形」會露出的顏色，必須等於相鄰區塊的底色。
 * 預設 transparent（露出 body 的白），相鄰是白色區塊時正確；
 * 但若上方是淺灰／淺藍區塊，就要用 .on-tint／.on-brand 指定，
 * 否則會夾出一條白帶（與波浪的 wave--on-* 是同一個道理）。
 */
.section-wrap--diag,
.section-wrap--diag-top {
  position: relative;
  z-index: 0;
  background: var(--diag-behind, transparent);
}

.section-wrap--diag.on-tint,
.section-wrap--diag-top.on-tint  { --diag-behind: var(--color-second-bg); }
.section-wrap--diag.on-brand,
.section-wrap--diag-top.on-brand { --diag-behind: var(--color-primary-bg); }

.section-wrap--diag::before,
.section-wrap--diag-top::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--diag-bg, var(--color-second-bg));
}

/* 上緣斜切：左低右高 */
.section-wrap--diag-top::before {
  clip-path: polygon(0 var(--diag-cut), 100% 0, 100% 100%, 0 100%);
}

/* 上下都斜切，兩邊反向，避免變成平行四邊形那種呆板 */
.section-wrap--diag::before {
  clip-path: polygon(0 var(--diag-cut), 100% 0, 100% calc(100% - var(--diag-cut)), 0 100%);
}

:root { --diag-cut: clamp(18px, 2.4vw, 44px); }

/* 斜切會吃掉邊角的高度，補回內距，內容才不會貼到斜線 */
.section-wrap--diag,
.section-wrap--diag-top { padding-top: calc(var(--space-6) + var(--diag-cut)); }
.section-wrap--diag { padding-bottom: calc(var(--space-7) + var(--diag-cut)); }

/* 淺藍底的斜切區塊改用淺藍 */
.section-wrap--diag.is-brand,
.section-wrap--diag-top.is-brand { --diag-bg: var(--color-primary-bg); }

/* ===== 實拍襯底 =====
 *
 * 照片鋪滿整片文字後方是最典型的業餘作法：中文字壓在紋理上會糊掉。
 * 這裡改成「角落淡出」——
 *   1. background-blend-mode: color 把照片染成單色品牌藍（去彩度）
 *   2. 透明度壓到 0.09，只當質感不當內容
 *   3. mask 往文字方向淡出到全透明，文字區永遠是乾淨底色
 */
.has-photobg { position: relative; overflow: hidden; }
.has-photobg > .container { position: relative; z-index: 1; }

.photobg {
  position: absolute;
  /*
   * 上下都貼齊區塊（不用固定 aspect-ratio），照片才會填滿整個區塊高度。
   * 先前固定 16:10 又只錨在底部，區塊比照片高時上緣就出現一條硬邊界。
   */
  top: 0;
  bottom: 0;
  z-index: 0;
  width: min(72%, 1000px);
  pointer-events: none;
  background-image: linear-gradient(var(--color-primary), var(--color-primary)), var(--photobg);
  background-blend-mode: color;
  background-size: cover;
  background-position: center;
  opacity: 0.16;
  /*
   * 兩層遮罩相交：橫向往文字方向淡出，縱向上下也各淡出一段，
   * 四邊都沒有硬邊界，照片像是「從版面裡透出來」而不是貼上去的一塊。
   */
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

.photobg--right {
  right: 0;
  -webkit-mask-image:
    linear-gradient(to left, #000 18%, transparent 90%),
    linear-gradient(to bottom, transparent 0%, #000 16%, #000 84%, transparent 100%);
  mask-image:
    linear-gradient(to left, #000 18%, transparent 90%),
    linear-gradient(to bottom, transparent 0%, #000 16%, #000 84%, transparent 100%);
}

.photobg--left {
  left: 0;
  -webkit-mask-image:
    linear-gradient(to right, #000 18%, transparent 90%),
    linear-gradient(to bottom, transparent 0%, #000 16%, #000 84%, transparent 100%);
  mask-image:
    linear-gradient(to right, #000 18%, transparent 90%),
    linear-gradient(to bottom, transparent 0%, #000 16%, #000 84%, transparent 100%);
}

/* 手機：襯底改為更淡、更小，避免和卡片搶注意力 */
@media (max-width: 800px) {
  .photobg { width: 92%; opacity: 0.12; }
}

/* ===== 線稿圖示 ===== */
.icon { width: 100%; height: 100%; display: block; }

/*
 * 服務卡圖示接手原本編號徽章的位置（跨在圖片與內文交界）。
 * 三項服務是並列的，不是流程——標 01/02/03 會誤導成有先後順序，
 * 所以改用圖示當識別，位置與尺寸沿用徽章，版面重心不變。
 */
.servicecard__icon {
  position: absolute;
  right: var(--space-3);
  top: calc(56.25% - 1.6rem);
  z-index: 2;
  display: grid;
  place-items: center;
  width: 3.2rem;
  height: 3.2rem;
  padding: 0.72rem;
  color: var(--color-primary);
  background: var(--color-solar);
  border-radius: 50%;
  box-shadow: 0 6px 18px rgba(2, 27, 72, 0.28);
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
}

.servicecard:hover .servicecard__icon {
  transform: translateY(-5px);
  box-shadow: 0 12px 26px rgba(2, 27, 72, 0.34);
}

/* 競爭力圖示接手原編號的左側圓徽章位置（同樣是並列項目，不編號） */
.benefit__icon {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  padding: 0.62rem;
  color: var(--color-primary);
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid rgba(32, 69, 139, 0.28);
  border-radius: 50%;
  transition: background-color 0.3s var(--ease-out), border-color 0.3s var(--ease-out),
    transform 0.3s var(--ease-out);
}

.benefit:hover .benefit__icon {
  background: var(--color-solar);
  border-color: var(--color-solar);
  transform: translateY(-3px);
}

/* ===== 招牌①：服務卡的技術細線＋講究 hover ===== */
.servicecard__body::before {
  content: "";
  display: block;
  width: 2.2rem;
  height: 3px;
  margin-bottom: 0.9rem;
  background: var(--color-solar);
  transition: width 0.45s var(--ease-out);
}
.servicecard:hover .servicecard__body::before { width: 4.5rem; }
.servicecard:hover 
/* ===== 招牌③：數據帶——數值下方的重點橫線，進場時由左展開 ===== */
.stat__value { position: relative; }
.stat__value::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.55rem;
  width: 2.4rem;
  height: 3px;
  background: var(--color-solar);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.7s var(--ease-out) 0.35s;
}
.stat.is-revealed .stat__value::before { transform: scaleX(1); }

/* ===== 招牌②：標語帶＋太陽能地景線稿 ===== */
.statement {
  position: relative;
  overflow: hidden;
  background: var(--color-surface);
  text-align: center;
  /* 下方留白必須跟著線稿高度（寬度的 14.6%）等比縮放，否則寬螢幕會壓到文字 */
  padding-bottom: calc(var(--space-4) + 15vw);
}
/* max-width 用 min(100%, 48rem)：.container 本身帶 max-width:100%（視窗上限），
   若直接寫 48rem 會蓋掉那條上限，手機上就固定 768px 撐爆版面。 */
.statement__inner { position: relative; z-index: 1; max-width: min(100%, 48rem); margin-inline: auto; }
.statement__title {
  font-size: var(--fs-display-2);
  color: var(--color-primary);
  letter-spacing: var(--ls-heading);
}
.statement__lead {
  margin-top: var(--space-3);
  color: var(--color-text-sub);
  font-size: var(--fs-md);
  line-height: 1.95;
}

/*
 * 用 aspect-ratio 讓容器比例＝viewBox 比例（1440:210），SVG 就永遠「剛好放得下」，
 * 任何螢幕寬度都不會裁切。
 *
 * 先前用固定 210px 高＋slice：螢幕越寬，SVG 被放大越多、上下裁掉越多——
 * 1791px 寬時上下各裁約 20 單位，雲頂與太陽上方光芒剛好被切掉。
 * 這是幾何上必然的結果，不是調參數能解決的，所以改成等比例容器。
 */
.ecoline {
  position: absolute;
  inset: auto 0 0 0;
  aspect-ratio: 1440 / 210;
  height: auto;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
  color: var(--color-solar);
  opacity: 0.55;
}
.ecoline svg { display: block; width: 100%; height: 100%; }
.ecoline line,
.ecoline path,
.ecoline circle { stroke: currentColor; stroke-width: 1.5; fill: none; }

/*
 * 手機：整幅 1440 寬硬縮到 375 只剩 55px 高，細節全糊成一條線。
 * 改成容器變高、SVG 用 slice 左右裁切，只露出中段（水面案場→屋頂→風機→電塔），
 * 看得到東西才有意義。
 */
@media (max-width: 800px) {
  .ecoline { aspect-ratio: 660 / 210; }
}

/* ===== 地景動態 =====
 * 進場先把線稿「畫出來」，之後只留低幅度的常駐動態。
 * 這是背景，文字壓在上面，動得太大會搶走注意力。
 */

/* 每個元素都標了 pathLength="1"，長度正規化成 1，不必個別算路徑長度 */
.ecoline [data-draw] { stroke-dasharray: 1; stroke-dashoffset: 1; }

.ecoline.is-revealed [data-draw] {
  animation: eco-draw 1.1s var(--ease-out) forwards;
  animation-delay: var(--d, 0s);
}

@keyframes eco-draw { to { stroke-dashoffset: 0; } }

/* 常駐動態只在畫完之後才開始，避免線還沒出現就在動 */
/* 旋轉中心必須等於 ecoline.php 裡的座標，改動時兩邊要一起改 */
.ecoline.is-revealed .ecoline__rays   { transform-box: view-box; transform-origin: 752px 143px; animation: eco-spin 48s linear infinite 1s; }
.ecoline.is-revealed .ecoline__blades { transform-box: view-box; transform-origin: 628px 150px; animation: eco-spin 7s linear infinite 1s; }
.ecoline.is-revealed .ecoline__cloud--1 { animation: eco-drift 34s ease-in-out infinite alternate 1s; }
.ecoline.is-revealed .ecoline__cloud--2 { animation: eco-drift 44s ease-in-out infinite alternate-reverse 1s; }
.ecoline.is-revealed .ecoline__ripples--a { animation: eco-ripple 9s ease-in-out infinite alternate 1.2s; }
.ecoline.is-revealed .ecoline__ripples--b { animation: eco-ripple 12s ease-in-out infinite alternate-reverse 1.2s; }

/* 飛鳥：整群緩慢橫越，是畫面裡唯一真正在移動的東西 */
.ecoline.is-revealed .ecoline__birds { animation: eco-fly 42s linear infinite 1.4s; }
.ecoline.is-revealed .ecoline__bird--2 { animation: eco-flap 2.6s ease-in-out infinite 1.4s; }
.ecoline.is-revealed .ecoline__bird--3 { animation: eco-flap 3.2s ease-in-out infinite 1.8s; }

/* 電流：沿輸電線由電廠流向廠區，說明「電是流動的」 */
.ecoline__spark { fill: currentColor; stroke: none; opacity: 0; }
.ecoline.is-revealed .ecoline__spark { animation: eco-spark-in 0.6s ease forwards 1.6s; }

@keyframes eco-draw   { to { stroke-dashoffset: 0; } }
@keyframes eco-spin   { to { transform: rotate(360deg); } }
@keyframes eco-drift  { from { transform: translateX(-14px); } to { transform: translateX(24px); } }
@keyframes eco-ripple { from { transform: translateX(-8px); } to { transform: translateX(10px); } }
@keyframes eco-fly    { from { transform: translateX(-60px); } to { transform: translateX(1180px); } }
@keyframes eco-flap   { 50% { transform: translateY(-3px); } }
@keyframes eco-spark-in { to { opacity: 0.9; } }

/*
 * 減少動態：線稿直接是畫好的狀態，電流點不顯示。
 * .motion-off 是站上的動態開關，一併處理。
 */
@media (prefers-reduced-motion: reduce) {
  .ecoline [data-draw] { stroke-dasharray: none; stroke-dashoffset: 0; animation: none !important; }
  .ecoline__rays,
  .ecoline__blades,
  .ecoline__cloud--1,
  .ecoline__cloud--2,
  .ecoline__ripples,
  .ecoline__birds,
  .ecoline__bird--2,
  .ecoline__bird--3 { animation: none !important; }
  .ecoline__spark { display: none; }
}

.motion-off .ecoline [data-draw] { stroke-dasharray: none; stroke-dashoffset: 0; animation: none !important; }
.motion-off .ecoline__spark { display: none; }

/* ===== 主視覺的曲線色塊 =====
   vision 站在照片上疊了大面積藍色圓弧，是最搶眼的造形。 */
.hero__shape {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  border-radius: 50%;
  background: var(--color-primary);
}

/*
 * 尺寸要克制：曲線是「疊在照片上的造形」，照片仍然是主體。
 * 第一版做成 78% + 0.88 不透明，結果整片深藍把照片蓋光，反而更平。
 */
.hero__shape--left {
  left: -26%;
  bottom: -72%;
  width: 62%;
  aspect-ratio: 1.35;
  opacity: 0.82;
}

.hero__shape--right {
  right: -16%;
  bottom: -78%;
  width: 42%;
  aspect-ratio: 1.2;
  background: var(--color-second);
  opacity: 0.72;
}

/* 曲線旁的伴隨細線 */
.hero__shape--left::after {
  content: "";
  position: absolute;
  inset: 3%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

/* ===== 膠囊按鈕 =====
   vision 站的按鈕是全圓角膠囊，帶一個圓形箭頭圖示。 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.6rem 1.1rem 0.6rem 1.4rem;
  border-radius: 999px;
  font-weight: var(--fw-medium);
}

.btn::after {
  content: "→";
  display: grid;
  place-items: center;
  width: 1.6em;
  height: 1.6em;
  font-size: 0.85em;
  line-height: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  transition: transform 0.25s var(--ease-out), background-color 0.25s;
}

.btn:hover::after { transform: translateX(3px); }
.btn-primary::after { background: var(--color-primary-bg); }
.btn-outerline::after { background: rgba(34, 37, 38, 0.08); }

/*
 * v2 移除偏移描邊。
 *
 * v1 在按鈕與卡片外都加了一圈淡藍偏移線，本意是製造層次，
 * 但全站到處都有之後反而變成雜訊——專業站靠留白與字級分層，不是靠描邊。
 */


/* ===== 外框式數據卡 =====
   深藍底、半透明白框、標籤突出在卡片外、燈泡圖示掛在左上角。 */
.section-wrap--stats {
  position: relative;
  background: var(--color-primary);
  color: #fff;
  overflow: hidden;
}

/* 細線技術圖騰 */
.section-wrap--stats::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(115deg, transparent 48%, rgba(255, 255, 255, 0.09) 49%, transparent 50%),
    linear-gradient(65deg, transparent 62%, rgba(255, 255, 255, 0.07) 63%, transparent 64%),
    linear-gradient(150deg, transparent 30%, rgba(255, 255, 255, 0.05) 31%, transparent 32%);
  background-size: 340px 340px, 480px 480px, 260px 260px;
  pointer-events: none;
}

.section-wrap--stats .container { position: relative; z-index: 1; }
.section-wrap--stats .section-title { color: #fff; }
.section-wrap--stats .section-lead { color: rgba(255, 255, 255, 0.82); }
.section-wrap--stats .section-title::after { background: linear-gradient(90deg, var(--color-solar), rgba(255, 255, 255, 0.6)); }

.stats { margin-top: var(--space-5); }

.stat {
  position: relative;
  padding: var(--space-4) var(--space-3) var(--space-3);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}

/* 標籤突出在卡片左上角外側 */
.stat__label {
  position: absolute;
  top: -0.85rem;
  left: 1.6rem;
  padding: 0.15rem 0.7rem;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: #fff;
  background: var(--color-primary);
  border: 1px solid rgba(255, 255, 255, 0.55);
  white-space: nowrap;
}

/* 燈泡圖示掛在左上角 */
.stat::after {
  content: "";
  position: absolute;
  top: -1.1rem;
  left: -0.9rem;
  width: 1.9rem;
  height: 1.9rem;
  background: var(--color-solar);
  border-radius: 50% 50% 45% 45%;
  box-shadow: 0 0 0 4px rgba(2, 27, 72, 0.9);
  opacity: 0.95;
}

.stat__value {
  display: flex;
  align-items: baseline;
  gap: 0.15em;
  font-size: var(--fs-display-1);
  font-weight: var(--fw-regular);
  color: #fff;
  font-family: var(--font-num);
}

.stat__unit { font-size: var(--fs-base); color: rgba(255, 255, 255, 0.85); }
.stat__prefix { font-size: var(--fs-sm); color: rgba(255, 255, 255, 0.7); margin-right: 0.35em; }

/*
 * 兩群用顏色分：自有電廠白色系、綠電銷售與轉供成果金橘系。
 * 沿用發展里程碑的對應（藍＝電廠、橘＝綠電），不另外發明顏色。
 * 寫在基礎樣式之後，順序與權重都不會被上面那幾條蓋掉。
 */
.stat--plant::after { background: #fff; }

.stat--green .stat__value { color: var(--color-solar); }
/*
 * 金橘對深藍是 4.62:1，剛好過 AA（小字 4.5）——所以不能再降透明度，
 * 降到 0.75 只剩 3.18:1。標籤文字用深藍（既有 token）對金橘是 6.52:1。
 */
.stat--green .stat__unit,
.stat--green .stat__prefix { color: var(--color-solar); }
.stat--green .stat__label { color: var(--color-primary-dk); background: var(--color-solar); border-color: rgba(255, 255, 255, 0.55); }
.stat--green { border-color: rgba(238, 172, 41, 0.38); }
.stat--green:hover { border-color: var(--color-solar); }

/* ===== 數據卡的「電流」繞框 =====
 * 一道亮點沿著外框跑一圈。做法是在卡片外緣鋪一層 conic-gradient，
 * 再用 mask 把中間挖掉，只留 1px 的環——所以不必為了動畫多加任何 DOM。
 *
 * 轉動的是自訂屬性 --chenya-flow。沒有 @property 的瀏覽器不會把角度當動畫值，
 * 亮點就靜止在起點，看起來只是外框上有一小段亮邊，不會破版。
 *
 * 只在卡片進場之後才跑（.is-revealed）：這個動畫每格都要重繪那圈 1px，
 * 沒必要在使用者還沒捲到的時候就一直燒。
 */
@property --chenya-flow {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

.stat::before {
  content: "";
  position: absolute;
  /* motion.css 把這個 ::before 當成卡片左側的 3px 色條，寬度、位移、縮放都要蓋掉，
     不然電流會變成左邊一條被壓扁的線——原本那條 display:none 就是為了關掉它 */
  inset: -1px;
  width: auto;
  transform: none;
  padding: 1px;
  display: block;
  border-radius: inherit;
  /*
   * 亮點必須明顯亮於卡片本身的外框，否則兩者顏色太接近，看起來只是整圈都在發光。
   * 第一版就是這樣——外框金橘 0.55、亮點也是金橘，實測四個角度都分不出亮點在哪。
   * 現在外框調暗、亮點給白芯，另外用 drop-shadow 做暈開。
   */
  background: conic-gradient(
    from var(--chenya-flow),
    transparent 0deg,
    transparent 288deg,
    rgba(255, 255, 255, 0.5) 326deg,
    #fff 346deg,
    #fff 352deg,
    rgba(255, 255, 255, 0.5) 356deg,
    transparent 360deg
  );
  filter: drop-shadow(0 0 7px rgba(255, 255, 255, 0.85));
  /* 兩層遮罩相減＝只留邊框那一圈；Safari 走 -webkit- 的 xor */
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
  pointer-events: none;
  z-index: 0;
}

.stat.is-revealed::before {
  transform: none;
  opacity: 1;
  animation: chenya-flow 4.5s linear infinite;
  /* 每張卡錯開，六張才不會像同一條燈管在閃 */
  animation-delay: calc(var(--reveal-delay, 0ms) * 2);
}

/* 綠電那四則的電流跟著金橘走 */
.stat--green::before {
  background: conic-gradient(
    from var(--chenya-flow),
    transparent 0deg,
    transparent 288deg,
    rgba(238, 172, 41, 0.55) 326deg,
    #fff3d0 346deg,
    #fff3d0 352deg,
    rgba(238, 172, 41, 0.55) 356deg,
    transparent 360deg
  );
  filter: drop-shadow(0 0 7px rgba(238, 172, 41, 0.9));
}

@keyframes chenya-flow {
  to { --chenya-flow: 360deg; }
}

@media (prefers-reduced-motion: reduce) {
  .stat.is-revealed::before { animation: none; }
}
.stat:hover { transform: none; box-shadow: none; border-color: var(--color-solar); }

/* ===== 導覽列的膠囊 CTA ===== */
.header-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  margin-left: var(--space-2);
  padding: 0.45rem 0.7rem 0.45rem 1.1rem;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: #fff;
  background: var(--color-accent);
  border-radius: 999px;
  white-space: nowrap;
  transition: background-color 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.header-cta::after {
  content: "→";
  display: grid;
  place-items: center;
  width: 1.5em;
  height: 1.5em;
  font-size: 0.8em;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  transition: transform 0.25s var(--ease-out);
}

.header-cta:hover { transform: translateY(-2px); opacity: 1; }
.header-cta:hover::after { transform: translateX(2px); }

@media (max-width: 800px) {
  .header-cta { display: none; }

  /*
   * 語言鈕的手機調整原本寫在這裡，但本體定義在本檔後面、權重相同，
   * 後者勝——這三行其實從來沒生效過。已移到本體之後（搜尋「語言鈕：手機」）。
   */
  .hero__shape--left { width: 130%; left: -30%; bottom: -60%; }
  .hero__shape--right { display: none; }
  .stat__label { left: 1rem; }
}

/* ===== 減少動態 ===== */
@media (prefers-reduced-motion: reduce) {
  .btn::after,
  .btn-second::before,
  .btn-accent::before,
  .card::before,
  .header-cta,
  .header-cta::after { transition: none; }
}

/* ===== 語言切換器 ===== */
/*
 * 不可被壓縮：手機上 logo 很寬，flex 會把空間從右側按鈕擠出來，
 * 「ZH」只剩 16px 寬就折成兩行。空間不夠時應該讓 logo 縮，不是語言鈕。
 */
.langswitch { position: relative; margin-left: 0.6rem; flex-shrink: 0; }

/*
 * 第一版做成細灰框 + 只有「ZH」，緊貼在金色 CTA 右邊——使用者找不到。
 * 改成實心淺藍底、地球圖示放大、加上下拉箭頭，才讀得出「這是可以點的語言選單」。
 */
.langswitch__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.45rem 0.75rem;
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  letter-spacing: 0.04em;
  color: var(--color-primary);
  background: var(--color-primary-bg);
  border: 1px solid rgba(32, 69, 139, 0.22);
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.25s var(--ease-out), border-color 0.25s, color 0.25s;
}

.langswitch__toggle svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  flex-shrink: 0;
}

.langswitch__caret { font-size: 0.7em; opacity: 0.7; transition: transform 0.25s var(--ease-out); }
.langswitch.is-open .langswitch__caret { transform: rotate(180deg); }

.langswitch__toggle:hover {
  color: #fff;
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.langswitch__list {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 8.5rem;
  padding: 0.35rem;
  background: #fff;
  border: 1px solid var(--color-line);
  /*
   * 用卡片圓角，不是按鈕的膠囊圓角（999px）——
   * 膠囊圓角套在這種矮寬面板上會變成兩端全圓的藥丸形，右半邊鼓出一塊空白，
   * 看起來像溢出、也不像可點的清單。
   */
  border-radius: var(--radius-card);
  box-shadow: 0 12px 28px rgba(2, 27, 72, 0.14);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.4rem);
  transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out), visibility 0.25s;
  z-index: 20;
}

.langswitch.is-open .langswitch__list { opacity: 1; visibility: visible; transform: none; }

.langswitch__item {
  display: block;
  padding: 0.4rem 0.6rem;
  font-size: var(--fs-sm);
  color: var(--color-text-sub);
  border-radius: var(--radius-sm);
}

.langswitch__item:hover { background: var(--color-second-bg); color: var(--color-primary); opacity: 1; }
.langswitch__item.is-active { color: var(--color-primary); font-weight: var(--fw-medium); background: var(--color-primary-bg); }

/* 語言鈕：手機。必須放在本體之後，否則同權重會被本體蓋掉（前面吃過這個虧） */
@media (max-width: 800px) {
  .langswitch__toggle { padding: 0.7rem 0.6rem; }  /* 命中高度補到 44 */
}

/* ===== 形象影片 ===== */
.videoblock { margin: 0; position: relative; }

.videoblock__trigger,
.videoblock__placeholder {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--color-second);
  cursor: pointer;
  aspect-ratio: 16 / 9;
}

.videoblock__placeholder { cursor: default; }

.videoblock__poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out), filter 0.4s var(--ease-out);
}

.videoblock__trigger:hover .videoblock__poster { transform: scale(1.04); filter: brightness(0.85); }

.videoblock__play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4.5rem;
  height: 4.5rem;
  margin: -2.25rem 0 0 -2.25rem;
  display: grid;
  place-items: center;
  background: var(--color-accent);
  border-radius: 50%;
  box-shadow: 0 10px 30px rgba(2, 27, 72, 0.35);
  transition: transform 0.3s var(--ease-out);
}

.videoblock__play svg { width: 1.9rem; height: 1.9rem; fill: #fff; margin-left: 0.15rem; }
.videoblock__trigger:hover .videoblock__play { transform: scale(1.1); }

/* 播放鈕外的擴散環 */
.videoblock__play::before {
  content: "";
  position: absolute;
  inset: -0.6rem;
  border: 2px solid var(--color-accent);
  border-radius: 50%;
  opacity: 0.5;
  animation: play-pulse 2.4s ease-out infinite;
}

@keyframes play-pulse {
  0%   { transform: scale(0.9); opacity: 0.6; }
  70%  { transform: scale(1.25); opacity: 0; }
  100% { transform: scale(1.25); opacity: 0; }
}

.videoblock__label {
  position: absolute;
  left: var(--space-3);
  bottom: var(--space-3);
  padding: 0.3rem 0.9rem;
  font-size: var(--fs-sm);
  color: #fff;
  background: rgba(2, 27, 72, 0.72);
  border-radius: 999px;
  backdrop-filter: blur(6px);
}

.videoblock__note {
  position: absolute;
  inset: auto 0 var(--space-3) 0;
  text-align: center;
  font-size: var(--fs-sm);
  color: rgba(255, 255, 255, 0.85);
}

.videoblock iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius-card); display: block; }

@media (prefers-reduced-motion: reduce) {
  .videoblock__play::before { animation: none; }
  .videoblock__poster { transition: none; }
}

/* ===== 影片 + 數據並列 ===== */
.statsplit {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
  margin-top: var(--space-5);
}

/*
 * 影片旁邊只放「自有電廠」那兩則，直排並拉伸到跟影片一樣高——
 * 六則全擠在這裡會排成三列，右欄比影片高出一大截。
 */
.statsplit { align-items: stretch; }
.statsplit .stats--stack {
  margin-top: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: minmax(0, 1fr);
  gap: var(--space-3);
}

/* 拉伸後卡片比內容高，數字要置中，不然會黏在上緣、下半截空著 */
.statsplit .stats--stack .stat { display: flex; flex-direction: column; justify-content: center; }

/* 綠電成果那四則橫跨整個寬度排在影片下方 */
.stats--row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4) var(--space-3);
  margin-top: var(--space-4);
}

@media (max-width: 1024px) {
  .statsplit { grid-template-columns: 1fr; gap: var(--space-4); }
  .statsplit .stats--stack { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: auto; }
  .stats--row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
  .statsplit .stats--stack { grid-template-columns: 1fr; }
  .stats--row { grid-template-columns: 1fr; }
}

/* ===== 服務卡片 =====
   原本只有編號圓圈 + 文字，太平。改成帶照片的卡片，
   編號壓在圖片右下角、卡片有偏移描邊。 */
.servicegrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}

.servicecard {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
}

.servicecard:hover { transform: translateY(-6px); box-shadow: 0 18px 40px rgba(2, 27, 72, 0.16); }

.servicecard__media { position: relative; aspect-ratio: 16 / 11; overflow: hidden; background: var(--color-second-bg); }
.servicecard__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.7s var(--ease-out); }
.servicecard:hover .servicecard__media img { transform: scale(1.07); }


.servicecard__body { padding: var(--space-3); display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.servicecard__title { font-size: var(--fs-lg); color: var(--color-primary); line-height: var(--lh-heading); }
.servicecard__text { margin: 0; font-size: var(--fs-base); color: var(--color-text-sub); }

/* ===== 優勢區 =====
   淺藍底上的四格，左側有粗編號與細線，不用圖片也有層次。 */
.benefitgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4) var(--space-5);
}

.benefit {
  position: relative;
  padding-left: 4.2rem;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid rgba(32, 69, 139, 0.18);
}


/* 這組原本誤寫成 .benefit:hover .benefit__title（選擇器斷行被併成後代選擇器），
   平常沒有字級與行高，游標滑過才套用，標題會跳一下。拆成常態樣式。 */
.benefit__title {
  font-size: var(--fs-lg);
  color: var(--color-primary);
  margin-bottom: 0.4rem;
  line-height: var(--lh-heading);
}

.benefit__text { margin: 0; font-size: var(--fs-base); color: var(--color-text-sub); }

.section-more { margin-top: var(--space-4); }
.cta .section-more { margin-top: var(--space-3); }

/* 買賣雙向兩顆按鈕並排。
 * 用 flex 而不是 inline-block：.cta 是 text-align:center，兩顆按鈕中間會多出
 * 一個空白字元的縫，窄螢幕換行時左右也對不齊。flex 的 gap 兩種情況都一致。 */
.section-more--pair {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
}

@media (max-width: 1024px) {
  .servicegrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
  .servicegrid, .benefitgrid { grid-template-columns: 1fr; }
  .benefit { padding-left: 3.7rem; }
}
