/*
 * 首頁已確認視覺定稿。
 * 獨立放在共用互動樣式之後，避免歷次前台微調的舊規則蓋掉首頁定稿。
 */

/* 01：保留可辨識的低彩工程照片，並以淺色遮罩確保文字可讀。 */
/* 2026-10-17 使用者指示：原本是美術館照片（與輪播第 4、5 張同一座），改為臺中中央公園（清翠園）空拍——
   工程 10219 原圖裁成與舊圖相同的 1920×532。
   同日起照片可在後台「首頁區塊 → 01 關於德昌 → 背景照片」更換：照片網址與長寬比由首頁輸出成 --intro-photo、--intro-photo-ratio
   （Services/HomeBackgrounds），高度＝max(區塊高度＋40px, 畫面寬度÷長寬比)，任何比例的照片寬度都蓋滿、上下都留得出位移空間。 */
/* 2026-10-21：照片焦點（後台「01 關於德昌 → 背景照片焦點」）由首頁輸出成 --intro-focal-x／--intro-focal-y，沒設定時置中。 */
/* 2026-10-17：滑鼠移動時照片會上下位移最多 18px。照片是 1920×532 的長條圖，原本用 cover 時高度剛好等於區塊高度，
   一位移下緣就露出、接著重複出現照片最上面那一條。改成高度固定比區塊多 40px（上下各留 20px）、
   且至少是畫面寬度÷3.55（照片長寬比約 3.6，寬度一定蓋滿）；不重複，萬一露邊也不會出現第二張。 */
.forge-intro {
    background:
        linear-gradient(102deg, rgba(228, 242, 250, .78), rgba(247, 251, 253, .64)),
        var(--intro-photo, url('/media/hero/hero-about.jpg')) var(--intro-focal-x, 50%) calc(var(--intro-focal-y, 50%) + var(--intro-pointer-y, 0px)) / auto max(calc(100% + 40px), calc(100vw / var(--intro-photo-ratio, 3.55))) no-repeat !important;
    transition: background-position .14s ease-out;
}

.forge-intro .section-atmosphere::before { display: none !important; }
.forge-intro .forge-section-head div > p {
    color: #143f63;
    font-weight: 650;
}

/* 保留標題卡的凸出圓角，只隱藏負上邊距露出的格線邊框。 */
.forge-capability-title {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border-color: transparent !important;
}
.forge-capability-title > * { position: relative; z-index: 1; }
.forge-capability-title::after {
    content: "";
    position: absolute;
    right: -3.75rem;
    bottom: -4.75rem;
    width: 13rem;
    height: 13rem;
    border: 1px solid rgba(183, 220, 245, .52);
    background: repeating-linear-gradient(90deg, transparent 0 1.7rem, rgba(183, 220, 245, .2) 1.7rem 1.76rem), repeating-linear-gradient(0deg, transparent 0 1.7rem, rgba(183, 220, 245, .2) 1.7rem 1.76rem);
    transform: rotate(30deg);
    pointer-events: none;
}

/* 未選取的輪播項目仍保持可讀，不讓文字被深藍底吃掉。 */
.forge-capability-grid[data-values-carousel] article { opacity: .86 !important; }
.forge-capability-grid[data-values-carousel] article h3 { color: #f5fbff; }
.forge-capability-grid[data-values-carousel] article p { color: #d4e8f6; font-weight: 500; }
.forge-capability-grid[data-values-carousel] article.is-active p { color: #f2f9ff; }

/* 03：新標題字數較長，並收斂右側四張工程卡的標題，保留照片可視面積。 */
.forge-projects .forge-heading-row h2 {
    max-width: 46rem;
    font-size: clamp(2.2rem, 3.5vw, 3.6rem);
}
.forge-project:not(.featured) h3 {
    font-size: clamp(1.08rem, 1.45vw, 1.48rem);
    line-height: 1.24;
}

/* 02：新聞維持輕量幾何圖案，避免全版照片造成閱讀與捲動負擔。 */
.forge-news { background: linear-gradient(118deg, #e9f4fa, #f8fbfd) !important; }

.forge-news .section-atmosphere::before {
    inset: -12% !important;
    display: block !important;
    width: auto !important;
    height: auto !important;
    right: -10% !important;
    top: -12% !important;
    bottom: auto !important;
    opacity: 1 !important;
    background: repeating-linear-gradient(115deg, transparent 0 100px, rgba(31, 90, 158, .06) 101px 102px) !important;
    clip-path: polygon(32% 0, 100% 0, 68% 100%, 0 100%) !important;
}

/* 06：沿用參考圖的蜂巢線稿，縮為右下角的低彩度理念印記。 */
.forge-responsibility-hexes {
    display: block !important;
    top: auto !important;
    right: clamp(1rem, 3vw, 2.5rem) !important;
    bottom: clamp(1rem, 3vw, 2.5rem) !important;
    width: clamp(190px, 17vw, 255px) !important;
    height: clamp(168px, 15vw, 225px) !important;
    padding: 0 !important;
    background: url('/media/brand/esg-hex-honeycomb.svg') center / contain no-repeat !important;
    clip-path: none !important;
    opacity: .74 !important;
    transform: none !important;
    box-shadow: none !important;
}

.forge-responsibility-hexes span {
    position: absolute;
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: 0 !important;
    width: 20%;
    height: 18%;
    padding: 0 !important;
    background: transparent !important;
    clip-path: none !important;
    box-shadow: none !important;
    color: #e8f6ff;
    font-size: clamp(.62rem, .8vw, .78rem) !important;
    font-weight: 800;
    text-shadow: 0 1px 3px rgba(7, 25, 53, .85);
}

.forge-responsibility-hexes .hex-core {
    top: 40%; left: 40%; width: 20%; height: 20%;
    background: transparent !important;
    clip-path: none !important;
    color: #fff;
    font-size: clamp(.68rem, .95vw, .9rem) !important;
    line-height: 1.2;
    flex-direction: column;
    white-space: nowrap;
}

.forge-responsibility-hexes .hex-core strong { font: inherit; }
.forge-responsibility-hexes .hex-core small { display: block; margin-top: .14rem; font-size: .72em; line-height: 1; color: #b9dff5; }
.hex-sincerity, .hex-confidence, .hex-focus, .hex-technology, .hex-skill, .hex-craft {
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
}
.hex-sincerity { top: 7.7%; left: 40%; }
.hex-confidence { top: 24.3%; left: 68.75%; }
.hex-focus { top: 57.7%; left: 68.75%; }
.hex-technology { top: 74.3%; left: 40%; }
.hex-skill { top: 24.3%; left: 11.25%; }
.hex-craft { top: 57.7%; left: 11.25%; }

.forge-responsibility-copy .esg-discovery {
    display: inline-flex;
    width: fit-content;
    min-width: 0 !important;
    gap: 1.1rem !important;
    margin-top: 1.25rem;
    padding: .58rem 1.2rem .58rem 1rem !important;
    font-size: .78rem !important;
    letter-spacing: .06em;
}
.forge-responsibility-copy .esg-discovery::after { display: none; }

/* 頁尾採黑白識別，移除與底色不協調的淺色底板。 */
.footer-logo-lockup {
    animation: none !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    clip-path: none !important;
    backdrop-filter: none;
}
.footer-logo-lockup .footer-logo-original { filter: grayscale(1) brightness(0) invert(1) !important; }

.site-footer .footer-certification {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #fff !important;
    text-decoration-color: #8fc1ea !important;
}
.site-footer .footer-certification a {
    color: #fff !important;
    text-decoration-color: #8fc1ea !important;
}
.site-footer .footer-certification a:hover,
.site-footer .footer-certification a:focus-visible {
    color: #ccecff !important;
}
.site-footer .footer-certification:hover,
.site-footer .footer-certification:focus-within {
    padding: 0 !important;
    border: 0 !important;
    outline: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}
.site-footer .footer-brand-panel + .mt-3 {
    width: min(100%, 334px);
    text-align: center;
}

/* 桌面版首頁標題：保留層級感，避免字級壓縮內容與照片。 */
@media (min-width: 992px) {
    .forge-intro .forge-section-head h2 {
        font-size: clamp(2rem, 2.75vw, 2.85rem);
        letter-spacing: -.07em;
        white-space: nowrap;
    }

    .forge-capability-title h2 {
        font-size: clamp(1.8rem, 2.65vw, 2.75rem);
    }

    .forge-news .forge-heading-row h2 {
        font-size: clamp(2.15rem, 3.35vw, 3.35rem);
    }

    .forge-projects .forge-heading-row h2 {
        max-width: none;
        font-size: clamp(1.95rem, 2.45vw, 2.7rem);
        letter-spacing: -.07em;
        white-space: nowrap;
    }
}

@media (max-width: 575.98px) {
    .forge-intro { background-position: center !important; }
    .forge-news .section-atmosphere::before { width: 90% !important; height: 140% !important; right: -12% !important; top: -20% !important; }
    .forge-responsibility-hexes { top: auto !important; right: .75rem !important; bottom: .75rem !important; width: 180px !important; height: 158px !important; }
    .forge-responsibility-hexes span { font-size: .55rem !important; }
    .forge-responsibility-hexes .hex-core { font-size: .64rem !important; }
    .forge-responsibility-copy h2 { padding-top: 0 !important; }
}

@media (pointer: coarse), (prefers-reduced-motion: reduce) {
    .forge-intro { background-position: center !important; transition: none; }
}

/* 頁尾聯絡資訊：以一致的線條圖示協助快速掃讀。 */
.footer-contact-list,
.footer-service-links {
    display: grid;
    gap: .48rem;
    margin: 0;
}

.footer-contact-item {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    width: fit-content;
    min-height: 1.5rem;
}

.footer-contact-icon {
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    color: #ffd166;
    opacity: 1;
}

.footer-facebook-icon {
    fill: currentColor;
    stroke: none;
}

.footer-service-links { margin-top: 1rem; }

/* 聯絡資訊每一行前面的「地址：」「電話：」「傳真：」「服務信箱：」 */
.footer-contact-label { opacity: .78; }

/* 公司位置地圖是獨立的一欄（見 _Layout.cshtml）。
   電腦版（1200px 以上）在網站資訊右邊，高度跟著同一列最高的欄位（通常是聯絡資訊）填滿，頁尾維持沒有地圖時的高度。 */
.footer-map-col { display: flex; }
.footer-map { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.footer-map .footer-heading { flex: 0 0 auto; }
.footer-map iframe {
    display: block;
    width: 100%;
    flex: 1 1 0;
    height: auto;
    min-height: 160px;
    border: 0;
    border-radius: 8px;
    background: #1d3d5c;
}
/* 平板與手機（1200px 以下，選單變成漢堡按鈕）：地圖排在三欄下面，自己佔一整列（2026-10-14 使用者指示） */
@media (max-width: 1199.98px) {
    .footer-map iframe { flex: none; height: 260px; }
}
@media (max-width: 575.98px) {
    .footer-map iframe { height: 220px; }
}
/* 手機（576px 以下，聯絡資訊、網站資訊、公司位置上下排列）：標題靠左，內容往右縮排一層，看得出每一行屬於哪個類別（2026-10-15 使用者指示） */
@media (max-width: 575.98px) {
    .footer-contact-col, .footer-info-col, .footer-map-col { padding-left: calc(var(--bs-gutter-x) * .5 + 1.25rem); }
    .footer-contact-col > .footer-heading, .footer-info-col > .footer-heading, .footer-map-col .footer-heading { margin-left: -1.25rem; }
}
/* 以下兩段只在開啟地圖時（.footer-row-map，4／3／5 欄）調整；沒開地圖時照原本的 5／3／4 欄（2026-10-15）。
   992～1199px：照 4／3／5 欄分，品牌區只剩 312px（ISO 證書被擠到商標下面），聯絡資訊也會折行；改成 37%／33%／30% */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .footer-row-map .footer-brand-col { flex: 0 0 auto; width: 37%; }
    .footer-row-map .footer-contact-col { flex: 0 0 auto; width: 33%; }
    .footer-row-map .footer-info-col { flex: 0 0 auto; width: 30%; }
}
/* 1200～1399px：聯絡資訊欄只有 285px，地址與服務信箱會折成兩行；從網站資訊與地圖借一點寬度 */
@media (min-width: 1200px) and (max-width: 1399.98px) {
    .footer-row-map .footer-contact-col { flex: 0 0 auto; width: 29%; }
    .footer-row-map .footer-info-col { flex: 0 0 auto; width: 15%; }
    .footer-row-map .footer-map-col { flex: 0 0 auto; width: 22.6667%; }
}
/* 沒開地圖（5／4／3 欄）在 992～1199px：品牌區、聯絡資訊、網站資訊之間的空白平均分配（2026-10-15）；
   品牌區不能再窄，否則 ISO 證書會被擠到商標下面。1200px 以上直接用 5／4／3 欄 */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .row:not(.footer-row-map) > .footer-brand-col { flex: 0 0 auto; width: 40.4%; }
    .row:not(.footer-row-map) > .footer-contact-col { flex: 0 0 auto; width: 36.4%; }
    .row:not(.footer-row-map) > .footer-info-col { flex: 0 0 auto; width: 23.2%; }
}

.site-footer .footer-contact-item[href],
.site-footer .footer-certification a {
    transition: color .18s ease, text-decoration-color .18s ease;
}

.site-footer .footer-contact-item[href]:hover,
.site-footer .footer-contact-item[href]:focus-visible,
.site-footer .footer-certification a:hover,
.site-footer .footer-certification a:focus-visible {
    color: #ffe08a !important;
    text-decoration-color: #ffe08a !important;
}

.site-footer .footer-brand-panel + .mt-3 {
    margin-left: .7rem !important;
}

@media (max-width: 575.98px) {
    .site-footer .footer-brand-panel + .mt-3 { margin-left: .35rem !important; }
}

/* 2026-10-05：頁尾的認證證書可以有好幾張（後台「ISO 證書管理」）。
   證書排成一列、放不下就整列換到標誌下方再往下折；三張以上縮小一點；只有 PDF 沒有圖片的證書顯示成外框連結。 */
.site-footer .footer-certifications {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .75rem 1rem;
}
.site-footer .has-many-certificates .footer-certification img { width: 124px; }
/* 連結名稱與「(EN)」英文版連結排在同一行，放不下才折行 */
.site-footer .footer-certification-links {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: baseline;
    gap: .1rem .6rem;
}
.site-footer .footer-certification.is-text-only .footer-certification-links {
    align-items: center;
    min-height: 2.5rem;
    padding: .35rem .75rem;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 4px;
}
.site-footer .footer-certification.is-text-only .footer-certification-links:focus-within { border-color: #ffe08a; }
@media (max-width: 575.98px) {
    .site-footer .footer-certifications { gap: .6rem .8rem; }
    .site-footer .has-many-certificates .footer-certification img { width: 112px; }
}
