/* =========================================================
   嘉盈機電工程 — final polish layer
   載入順序：style.css → no-webfonts.css → overrides.css
   ========================================================= */

/* 1) 容器不超出畫面（中文標題與長段落都唔會撐爆版面） */
html,body{width:100%;max-width:100%;overflow-x:hidden}
.hero,.phero,.section,.marquee,.hdr,.ftr,.cta,.licence,.panel{max-width:100%}
.hero__in,.wrap,.hdr__in,.sec-head,.split,.svc-grid,.cards,.steps,.stats,.phones,.licence__row,.row-2{min-width:0}
.lead,h1,h2,h3,p,.chip,.svc__list li,.specs span{overflow-wrap:break-word}
.marquee{overflow:hidden}
.hero__bg,.hero__grid,.hero__glow{overflow:hidden}

/* 2) 手機：hero 用固定內邊距，唔用 vw 計算，避免某些 viewport 下被推爆 */
@media(max-width:900px){
  .hero__in{width:100%;max-width:100%;box-sizing:border-box;
    padding-left:clamp(18px,5.5vw,34px);padding-right:clamp(18px,5.5vw,34px)}
  .hero{gap:0}
  .hero h1{font-size:clamp(2rem,8.6vw,2.9rem);letter-spacing:-.01em}
  .hero .lead{font-size:15px;line-height:1.8}
  .hero__cards{gap:10px}
  .btn-row .btn{flex:1 1 100%}
  .chip{font-size:10.5px;letter-spacing:.08em;padding:7px 12px}
}

/* 3) 窄螢幕細節 */
@media(max-width:600px){
  .stats{grid-template-columns:1fr 1fr}
  .marquee__item{font-size:10.5px;padding:14px 16px;gap:16px}
  .ftr__grid{gap:26px}
  .licence__stamp{margin-left:0}
  .phero{padding-top:clamp(104px,26vw,140px)}
}

/* 4) 細字可讀性（深色底） */
.muted,.hero .lead,.svc__list li{color:#a9a49a}
.hcard p{color:#9b968c}

/* 5) 鍵盤可達性 */
a:focus-visible,button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{
  outline:2px solid var(--c-copper-lt);outline-offset:3px;border-radius:6px;
}

/* 6) 手機安全網：任何一層都唔可超出 viewport */
@media(max-width:900px){
  .wrap,.hdr__in{width:100%;max-width:100%;box-sizing:border-box}
  .hero__in>*{max-width:100%}
  .hero h1,.hero .lead,.phero h1,.phero .lead{max-width:100%}
}

@media(max-width:900px){
  .hdr__in{padding-left:18px;padding-right:18px}
  }

/* 7) 最終：手機 hero 高度改用內容決定，避免大面積空白 */
@media(max-width:900px){
  .hero{min-height:0;padding-top:112px;padding-bottom:56px;align-items:flex-start}
  .hero__scroll{display:none}
  .hero__cards{margin-top:8px}
}


/* 8) 白底區塊內的表格：文字夠黑、行間有分格（原本深色字太淡） */
.section--paper .tbl-wrap{background:#fff;border-color:rgba(20,32,28,.14);box-shadow:0 18px 40px -34px rgba(20,32,28,.45)}
.section--paper table.tbl th{
  color:#6b4a15;background:#f1ead8;border-bottom:1px solid rgba(20,32,28,.16);
  font-weight:600;
}
.section--paper table.tbl td{color:#26332e;border-bottom:1px solid rgba(20,32,28,.10)}
.section--paper table.tbl td:first-child{color:#0f1a16;font-weight:600}
.section--paper table.tbl tr:nth-child(even) td{background:#faf7ef}
.section--paper table.tbl tr:hover td{background:#f3ecdd;color:#0f1a16}
.section--paper .tbl-wrap caption{color:#6b4a15!important}


/* 9) 單頁版：Hero 導覽 + 章節節奏 */
.hero__in{grid-template-columns:1fr}
.hero__main{max-width:52rem}
.hero__nav{margin-top:clamp(28px,4vw,44px);display:grid;grid-template-columns:repeat(4,1fr);
  border-top:1px solid var(--c-line);border-bottom:1px solid var(--c-line)}
.hero__nav a{display:flex;gap:14px;align-items:flex-start;padding:18px 16px 18px 0;position:relative;
  border-right:1px solid var(--c-line);transition:background .35s var(--ease)}
.hero__nav a:last-child{border-right:0}
.hero__nav a:hover{background:rgba(201,138,60,.07)}
.hero__nav .idx{font-family:var(--f-mono);font-size:10.5px;letter-spacing:.18em;color:var(--c-copper);padding-top:.35em}
.hero__nav .t{display:flex;flex-direction:column;font-size:15px;line-height:1.35;color:var(--t-1)}
.hero__nav .t em{font-style:normal;font-family:var(--f-mono);font-size:10.5px;letter-spacing:.06em;color:var(--t-3);margin-top:6px}
.hero__nav a:hover .t{color:var(--c-copper-lt)}
.h3-lg{font-size:clamp(1.25rem,2vw,1.6rem)}
.section{padding-block:clamp(64px,8vw,110px)}
.section--paper .svc__list li{color:#455049}
.section--paper .muted{color:#6d756e}
.section--paper .principles li{border-color:rgba(20,32,28,.12)}
@media(max-width:900px){
  .hero__nav{grid-template-columns:1fr 1fr}
  .hero__nav a:nth-child(2n){border-right:0}
  .hero__nav a:nth-child(-n+2){border-bottom:1px solid var(--c-line)}
  .hero__nav .t{font-size:14px}
}
@media(max-width:560px){
  .hero__nav{grid-template-columns:1fr}
  .hero__nav a{border-right:0;border-bottom:1px solid var(--c-line);padding:14px 0}
  .hero__nav a:last-child{border-bottom:0}
}


/* 10) 「關於我們」四條工作原則：加深，白底上要一眼讀得出 */
.principles li{padding:clamp(22px,2.6vw,32px) 0}
.principles .num{color:#8a5411;font-weight:600;letter-spacing:.14em}
.principles h3{color:#0d1613;font-size:clamp(1.2rem,1.8vw,1.42rem);font-weight:500;margin-bottom:8px}
.principles p{color:#2b3733;font-size:15px;line-height:1.78;max-width:56ch}
.section--paper .principles li{border-bottom-color:rgba(20,32,28,.18)}
.section--paper .principles h3{color:#0d1613}
.section--paper .principles p{color:#2b3733}
.section--paper .principles .num{color:#8a5411}

/* 11) 「工作原則」最終配色：深底淺字，標題清楚、正文不灰 */
.principles li{padding:clamp(22px,2.6vw,32px) 0;border-bottom:1px solid var(--c-line)}
.principles .num{color:var(--c-copper-lt);font-weight:500;opacity:1}
.principles h3,.section--paper .principles h3{color:#ffffff;font-size:clamp(1.22rem,1.9vw,1.45rem);font-weight:500;margin-bottom:8px}
.principles p,.section--paper .principles p{color:#e8e3d8;font-size:15.5px;line-height:1.78;max-width:56ch}


/* 12) 保險層：即使動畫未觸發，內容都一定睇得到 */
[data-reveal], .step, .principles, .principles li, .specs, .svc__list, .cards .card {
  opacity: 1 !important;
  transform: none !important;
}
/* 只保留極輕微的位移淡入，由 .in-view 控制，錯過都不影響可見度 */
@media (prefers-reduced-motion: no-preference) {
  [data-reveal]:not(.in-view) { opacity: .001; }
}


/* 13) 頁首在淺色區塊上要換色（否則白字壓米白底睇唔到） */
body{ --hdr-fg:#f5f1e8; }
.hdr.is-light .brand__cn, .hdr.is-light .nav a, .hdr.is-light .burger{color:#14201c}
.hdr.is-light .brand__en{color:#8a5411}
.hdr.is-light .nav a:hover{color:#a06a24;background:rgba(20,32,28,.06)}
.hdr.is-light .nav a[aria-current="page"]{color:#8a5411}
.hdr.is-light .burger{border-color:rgba(20,32,28,.28)}
.hdr.is-light .brand__mark{background:#fff;border-color:rgba(20,32,28,.16)}
.hdr.is-light .brand__mark svg{color:#a06a24!important}
.hdr.is-light .hdr__cta .btn{color:#1a1206}


/* 14) 品牌全稱：頁首/頁尾字級要收細，避免撐爆 */
.brand__cn{font-size:15px!important;letter-spacing:.02em;white-space:nowrap}
.ftr .brand__cn{font-size:16px!important}
@media(max-width:1024px){
  .brand__cn{font-size:14px!important}
  .brand__en{font-size:8.5px;letter-spacing:.16em}
}
@media(max-width:420px){
  .brand__cn{font-size:13px!important}
  .brand__mark{width:36px;height:36px}
}


/* 15) 英文副標題改全稱後，字距要收窄，避免過長 */
.brand__en{font-size:9px!important;letter-spacing:.13em;white-space:nowrap}
.ftr .brand__en{letter-spacing:.14em}
@media(max-width:1024px){ .brand__en{font-size:8px!important;letter-spacing:.1em} }
@media(max-width:420px){ .brand__en{font-size:7.5px!important;letter-spacing:.09em} }


/* 16) 後台連結（只放喺頁尾，低調） */
.ftr__admin{font-family:var(--f-mono);font-size:10.5px;letter-spacing:.12em;color:#5c5a52;transition:color .3s}
.ftr__admin:hover{color:var(--c-copper)}
