/* ============================================================
   首頁 Hero 輪播五個動態展示的點綴圖（電塔／檢修／綠能／建築／
   服務示意圖，取代原主題 elements27.png）。素材尺寸皆為 1536x1024
   （比例 3:2），五頁共用同一套設定。

   行動裝置／平板（<1200px）：改用「文字說明下方」的文件流排版，
   不再用 position:absolute + 手動量測像素座標。原因：先前依 16 款
   裝置截圖裡手繪藍色線框逐一量測 px 座標的做法，只要某一頁的內文
   字數比量測當下的頁面長或短，量出來的座標就會跟該頁實際文字高度
   對不上，導致有時被文字蓋到、有時離文字有一大段空白，且每次微調
   都要重新對 16 款裝置逐一核對，難以維護。

   改成 .hero4 設 display:flex; flex-direction:column，並用 order
   讓 .container（文字）排在前面、.elements27（點綴圖）排在後面，
   點綴圖從 position:absolute 改回一般文件流（position:static）。
   如此點綴圖永遠緊接在該頁實際渲染出的文字下方，不論文字幾行都
   自動對齊，不會被文字蓋到，也不會產生過大空白。

   點綴圖水平置中（align-self: center），寬度改為「接近但小於螢幕
   寬度、左右各保留 24px 間距」（width: calc(100% - 48px)），高度
   維持原始 3:2 比例等比放大（height: auto），不裁切、不變形。

   .hero4 的 padding-bottom 加大以避免點綴圖／文字被撐開後貼齊
   左右箭頭按鈕（.testimonial-arrow，本身 bottom:30px、高約
   53px，需要 >83px 的淨空間）。

   桌機版（≥1200px，見下方區塊）維持原本 position:absolute 貼齊
   主視覺右側大圖左邊緣、置於左下角的設計，不受這裡影響。
   ============================================================ */
@media (max-width: 1199.98px) {
  .hero4-arrow-slider-area .hero4-main-slider .hero4 {
    display: flex;
    flex-direction: column;
  }
  .hero4-arrow-slider-area .hero4-main-slider .hero4 .container {
    order: 1;
  }
  .hero4-arrow-slider-area .hero4-main-slider .hero4 .elements27 {
    order: 2;
    position: static;
    flex: none;
    align-self: center;
    margin: 28px 0 0 0;
    width: calc(100% - 48px);
    height: auto;
  }
}
@media (max-width: 991.98px) {
  .hero4-arrow-slider-area .hero4-main-slider .hero4 {
    padding-bottom: 100px;
  }
}

/* ============================================================
   首頁 Hero 輪播桌機版（≥1200px，超出上方 16 款行動裝置測試範圍）：
   五個動態展示的左下點綴圖還原成較大尺寸（460px，維持原設計視覺
   佔比），左邊緣對齊主視覺文字區塊（.col-xl-7）左邊緣、貼齊底部。
   文字區塊左邊緣＝Bootstrap .container 置中公式 (100vw − container
   max-width) / 2，再加上 container 本身的 12px 內距（row 負邊界與
   col 內距互相抵銷後，實際留下的即是 container 自身內距）。
   斷點 max-width 沿用 Bootstrap 5 預設值：1200px→1140px、
   1400px→1320px。
   ============================================================ */
@media (min-width: 1200px) {
  .hero4-arrow-slider-area .hero4-main-slider .hero4 .elements27.elements27-tower1,
  .hero4-arrow-slider-area .hero4-main-slider .hero4 .elements27.elements27-tower2,
  .hero4-arrow-slider-area .hero4-main-slider .hero4 .elements27.elements27-tower3,
  .hero4-arrow-slider-area .hero4-main-slider .hero4 .elements27.elements27-tower4,
  .hero4-arrow-slider-area .hero4-main-slider .hero4 .elements27.elements27-tower5 {
    left: calc((100vw - 1140px) / 2 + 12px);
    right: auto;
    top: auto;
    bottom: 0;
    width: 460px;
    max-width: 60vw;
    height: auto;
  }
}
@media (min-width: 1400px) {
  .hero4-arrow-slider-area .hero4-main-slider .hero4 .elements27.elements27-tower1,
  .hero4-arrow-slider-area .hero4-main-slider .hero4 .elements27.elements27-tower2,
  .hero4-arrow-slider-area .hero4-main-slider .hero4 .elements27.elements27-tower3,
  .hero4-arrow-slider-area .hero4-main-slider .hero4 .elements27.elements27-tower4,
  .hero4-arrow-slider-area .hero4-main-slider .hero4 .elements27.elements27-tower5 {
    left: calc((100vw - 1320px) / 2 + 12px);
  }
}

/* ============================================================
   首頁三段整版背景圖區塊（整廠 / 機電水電 / 太陽能）
   對應 design_handoff_home_sections：.hp-plant / .hp-mep / .hp-solar
   純靜態展示：滿版圖 + 疊放中文標題，無連結、無動畫、無 hover
   ============================================================ */

/* 敘述文字色（專案未定義 --muted，於此三段內補一個近似灰） */
.hp-plant, .hp-mep, .hp-solar {
    --muted: #5A5C60;
}

/* 覆寫 Voltz 全域 img 的 max-height:100% 限制，避免滿版圖被壓 */
.hp-plant-img, .hp-mep-img, .hp-solar-img {
    max-width: 100%;
    max-height: none;
}

/* ===== 段落 1 — 讓我們協助您完成廠房施作或維運 ===== */
.hp-plant {
    position: relative;
    padding: 72px 0;
    background: #F9F6F1; /* 與圖片邊緣同色，無縫銜接 */
}

.hp-plant-img {
    display: block;
    width: 100%;
    height: auto;
}

/* 內嵌影片小視窗：疊在背景圖上，依 design_handoff_home_video 座標換算（已實機截圖覆核） */
.hp-plant-video {
    position: absolute;
    left: 31.4%;
    top: 16.2%;
    width: 37.6%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
    box-shadow: 0 14px 40px rgba(0, 0, 0, .18);
}

.hp-plant-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.hp-plant-title {
    position: absolute;
    top: 7%;
    left: 50%;
    transform: translateX(-50%);
    width: min(46%, 620px);
    text-align: center;
    margin: 0;
    font-family: 'Noto Sans TC', sans-serif;
    font-weight: 800;
    font-size: clamp(18px, 1.8vw, 26px);
    line-height: 1.4;
    letter-spacing: -.01em;
    color: var(--ink);
}

.hp-plant-desc {
    position: absolute;
    bottom: 3.5%;
    left: 50%;
    transform: translateX(-50%);
    width: min(46%, 620px);
    text-align: center;
    margin: 0;
    font-family: 'Noto Sans TC', sans-serif;
    font-size: clamp(13px, 1.05vw, 15.5px);
    line-height: 1.85;
    color: var(--muted);
}

/* ===== 段落 2 — 您的用電就是我們的用心 ===== */
.hp-mep {
    position: relative;
    padding: 72px 0 32px; /* 下方刻意壓縮 */
    background: #DAE4F0;
}

.hp-mep-img {
    display: block;
    width: 100%;
    height: auto;
}

.hp-mep-title {
    position: absolute;
    top: 7%;
    left: 50%;
    transform: translateX(-50%);
    width: min(52%, 680px);
    text-align: center;
    margin: 0;
    font-family: 'Noto Sans TC', sans-serif;
    font-weight: 800;
    font-size: clamp(18px, 1.8vw, 26px);
    line-height: 1.4;
    letter-spacing: -.01em;
    color: var(--ink);
}

/* 內嵌影片小視窗：座標對照 design_handoff_home_mep_video 換算，待實機截圖覆核 */
.hp-mep-video {
    position: absolute;
    left: 31.7%;
    top: 13.6%;
    width: 38%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
    box-shadow: 0 14px 40px rgba(0, 0, 0, .18);
}

.hp-mep-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* 桌機版段落文案：一般文件流，排在背景圖之後，負上邊界使上緣切齊指定位置 */
.hp-mep-desc {
    width: min(57%, 780px);
    margin: -42px auto 0;
    font-family: 'Noto Sans TC', sans-serif;
    font-size: clamp(13px, 1.05vw, 15.5px);
    line-height: 1.85;
    color: var(--muted);
    text-align: left;
    text-wrap: pretty;
}

/* ===== 段落 3 — 我們提供您最佳的綠能發電及儲能的長期收益方案 ===== */
.hp-solar {
    position: relative;
    padding: 72px 0 0; /* 下方 padding 移除，段落底部貼齊背景圖下緣 */
    background: #E4F2F0; /* 貼合新圖上緣邊緣色 */
}

.hp-solar-img {
    display: block;
    width: 100%;
    height: auto;
}

/* 內嵌影片小視窗：座標對照 design_handoff_home_vimeo 換算 */
.hp-solar-video {
    position: absolute;
    left: 32%;
    top: 14.7%;
    width: 36.3%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
    box-shadow: 0 14px 40px rgba(0, 0, 0, .18);
}

.hp-solar-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.hp-solar-title {
    position: absolute;
    top: 7%;
    left: 50%;
    transform: translateX(-50%);
    width: min(52%, 720px);
    text-align: center;
    margin: 0;
    font-family: 'Noto Sans TC', sans-serif;
    font-weight: 800;
    font-size: clamp(18px, 1.8vw, 26px);
    line-height: 1.4;
    letter-spacing: -.01em;
    color: var(--ink);
}

/* ============================================================
   手機／平板（≤1199.98px，對齊本站 Header 抽屜斷點）：
   三段背景圖沿垂直中線拆左右兩半、改上下堆疊，內容放大約兩倍高。
   純 CSS、不切新圖——同一張 webp 當 background-image，靠 background-size +
   background-position 分別露出左半、右半。桌機（>1199.98px）維持原本 <img>。
   ============================================================ */
.hp-split { display: none; }

@media (max-width: 1199.98px) {
    /* 桌機用的 <img> 與其標題/敘述在此斷點隱藏，改走 .hp-split */
    .hp-plant-img, .hp-mep-img, .hp-solar-img { display: none; }
    .hp-plant-video, .hp-mep-video, .hp-solar-video { display: none; }
    .hp-plant, .hp-mep { padding: 0 0 40px; }
    /* 太陽能段不留底部留白：背景圖下緣直接接續 CTA 段，避免露出一條淺綠色空白帶 */
    .hp-solar { padding: 0; }

    .hp-split { display: block; }
    .hp-split-half {
        width: 100%;
        background-repeat: no-repeat;
        background-size: 200% 100%; /* 圖等比放大到容器兩倍寬，只露一半→不失真 */
    }

    /* 各段半圖比例＝原圖的一半寬（plant 1994/2、mep 1656/2），確保上下等高 */
    .hp-plant .hp-split-half { aspect-ratio: 997 / 789; }
    .hp-mep .hp-split-half { aspect-ratio: 828 / 831; }

    .hp-plant-half-l { background-image: url('/img/home/plant-bg.webp'); background-position: 0% center; }
    .hp-plant-half-r { background-image: url('/img/home/plant-bg.webp'); background-position: 100% center; }
    .hp-mep-half-l { background-image: url('/img/home/mep-bg.webp'); background-position: 0% center; }
    .hp-mep-half-r { background-image: url('/img/home/mep-bg.webp'); background-position: 100% center; }

    /* 太陽能：示意圖偏中央，切點改約 60/40。
       上半露左 60%（含完整示意圖，background-size 166.667%=1/0.6）；
       下半露右 40%，與上半等高（同 aspect-ratio），高度以 auto 溢出後由容器裁切。 */
    .hp-solar-half-l {
        background-image: url('/img/home/solar-bg.webp');
        aspect-ratio: 1197 / 788;
        background-size: 166.667% 100%;
        background-position: 0% center;
    }
    .hp-solar-half-r {
        background-image: url('/img/home/solar-bg.webp');
        aspect-ratio: 1197 / 788;
        background-size: 250% auto;
        background-position: 100% center;
    }

    /* 桌機標題／敘述在此斷點隱藏（改用 .hp-msplit-title） */
    .hp-plant-title, .hp-mep-title, .hp-solar-title { display: none; }
    .hp-plant-desc, .hp-mep-desc { display: none; }

    /* 半圖容器設 relative，讓標題與按鈕可絕對定位其上 */
    .hp-plant-half-l, .hp-plant-half-r,
    .hp-mep-half-l, .hp-mep-half-r,
    .hp-solar-half-l, .hp-solar-half-r { position: relative; }

    .hp-msplit-title {
        position: absolute;
        top: 8%;
        right: 5%;
        width: 48%;
        margin: 0;
        text-align: left;
        font-family: 'Noto Sans TC', sans-serif;
        font-weight: 800;
        font-size: clamp(20px, 4vw, 30px);
        line-height: 1.4;
        color: var(--ink);
    }
    .hp-solar .hp-msplit-title { width: 44%; font-size: clamp(17px, 3.4vw, 26px); line-height: 1.35; }

    /* 綠能段：觀看影片按鈕左緣切齊標題左緣 */
    .hp-solar .hp-video-btn { left: 51%; right: auto; }

    /* 下半張左上：整廠施作段落文案（手機版，黑字直接疊在背景圖上） */
    .hp-msplit-desc {
        position: absolute;
        left: 5%;
        top: 7%;
        width: 46%;
        margin: 0;
        text-align: left;
        text-wrap: pretty;
        font-family: 'Noto Sans TC', sans-serif;
        font-weight: 500;
        font-size: 14px;
        line-height: 1.75;
        color: var(--ink);
    }

    /* 下半張左側：機電水電段落文案（手機版，黑字直接疊在背景圖上） */
    .hp-mep-mdesc {
        position: absolute;
        left: 2.5%;
        top: 4%;
        width: 36%;
        margin: 0;
        text-align: left;
        text-wrap: pretty;
        font-family: 'Noto Sans TC', sans-serif;
        font-weight: 500;
        font-size: 11px;
        line-height: 1.7;
        color: #111;
    }

    /* 下半張左上：綠能與儲能段落文案（手機版，黑字直接疊在背景圖上；右緣不可壓到背景圖的樹木與風車，故鎖行不換行） */
    .hp-solar-mdesc {
        display: block;
        position: absolute;
        left: 4%;
        top: 13%;
        width: 44%;
        white-space: nowrap;
        margin: 0;
        text-align: left;
        text-wrap: pretty;
        font-family: 'Noto Sans TC', sans-serif;
        font-weight: 500;
        font-size: 11px;
        line-height: 1.7;
        color: #111;
    }

    /* 上半張：標題右下方的播放按鈕 */
    .hp-video-btn {
        position: absolute;
        top: 44%;
        right: 5%;
        display: inline-flex;
        align-items: center;
        gap: 10px;
        padding: 8px 16px 8px 8px;
        border: 0;
        border-radius: 999px;
        background: rgba(255, 255, 255, .92);
        box-shadow: 0 4px 14px rgba(0, 0, 0, .14);
        cursor: pointer;
        font-family: 'Noto Sans TC', sans-serif;
        font-weight: 700;
        font-size: clamp(15px, 2.4vw, 18px);
        color: var(--ink);
    }
    .hp-video-btn:active { transform: translateY(1px); }

    .hp-video-ico {
        width: 34px;
        height: 34px;
        border-radius: 50%;
        background: var(--red);
        display: grid;
        place-items: center;
        flex: none;
    }
}

/* ===== 影片 Modal（全裝置共用） ===== */
.hp-video-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.hp-video-modal[hidden] { display: none; }
.hp-video-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .62); }
.hp-video-dialog {
    position: relative;
    width: min(880px, 100%);
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.hp-video-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}
.hp-video-bar-title { font-family: 'Noto Sans TC', sans-serif; font-weight: 800; font-size: 16px; color: var(--ink); }
.hp-video-close { border: 0; background: transparent; font-size: 26px; line-height: 1; cursor: pointer; color: #666; padding: 0 4px; }
.hp-video-close:hover { color: #111; }
.hp-video-frame { position: relative; aspect-ratio: 16 / 9; background: #0d0d0d; }
.hp-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.hp-video-ph {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    text-align: center;
    color: #9aa3ad;
    font-family: 'Noto Sans TC', sans-serif;
    font-size: 15px;
    line-height: 1.7;
}
