/* 思源黑體（Noto Sans TC）。網站只用到 400 與 700 兩個字重。
   這裡載入的是「子集化」版本：只保留 index.html 與 main.js 實際會用到的字，
   再轉成 WOFF2，兩個字重合計約 174KB（原始 TTF 是 13.56MB）。
   ★ 之後若新增中文文字，必須重新產生子集，否則新字會變成空白方框。
     指令見 README「字型子集化」一節。 */
@font-face {
  font-family: "Noto Sans TC";
  src: url("../fonts/NotoSansTC-Regular-subset.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans TC";
  src: url("../fonts/NotoSansTC-Bold-subset.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --gold: #85661f;
  --gold-light: #b28d47;
  --ink: #232323;
  --muted: #66615b;
  --paper: #ffffff;
  --soft-gray: #d9d9d7;
  --card-gray: #c9c9c6;
  --footer: #dfd0bb;
  --black: #0d0d0d;
  --container: 1080px;
  --header-height: 78px;
  --ease: cubic-bezier(.2,.7,.2,1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", Arial, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.menu-open,
body.modal-open { overflow: hidden; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
section, footer { scroll-margin-top: calc(var(--header-height) + 12px); }

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 9999;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--gold);
  transform: translateY(-160%);
  transition: transform .2s ease;
}
.skip-link:focus { transform: translateY(0); }

.container {
  width: min(calc(100% - 48px), var(--container));
  margin-inline: auto;
}
.section { padding: 72px 0; }
.section-kicker {
  margin: 0 0 9px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .22em;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  background: rgba(255,255,255,.98);
  border-bottom: 1px solid transparent;
  transition: height .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.site-header.is-scrolled {
  border-bottom-color: rgba(0,0,0,.06);
  box-shadow: 0 10px 28px rgba(0,0,0,.08);
}
.header-inner {
  /* 與 .container 同一個寬度公式，讓左右兩個 LOGO 對齊各 section 的內容邊界 */
  width: min(calc(100% - 48px), var(--container));
  height: 100%;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}
.brand { flex: 0 0 auto; }
.brand img { width: 208px; height: auto; }
.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(24px, 3vw, 46px);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .08em;
}
/* span 是還沒有對應頁面的項目（最新消息），排版與連結一致但沒有底線與點擊 */
.site-nav > a:not(.nav-home),
.site-nav > span {
  position: relative;
  padding: 27px 0 23px;
}
.site-nav > span { cursor: default; }
.site-nav > a:not(.nav-home)::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 17px;
  left: 0;
  height: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .25s var(--ease);
}
.site-nav > a:hover::after,
.site-nav > a:focus-visible::after { transform: scaleX(1); transform-origin: left; }
.nav-home img { width: 46px; height: 46px; }
.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 9px;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.menu-toggle span {
  display: block;
  height: 2px;
  margin: 6px 0;
  background: var(--ink);
  transition: transform .25s ease, opacity .25s ease;
}
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

.hero {
  position: relative;
  /* 2.322 是 hero 這個框的長寬比，決定它的高度（寬 ÷ 2.322）。
     搭配下方 object-position: 60%，目前影片 1920x1066 會上切 143px、下切 96px。 */
  aspect-ratio: 1168 / 503;
  overflow: hidden;
  background: var(--black);
}
.hero-media,
.hero-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/* 影片 1920x1066，此框比例下垂直溢出 239px。40pct = 上切 96px、下切 143px：
   拱頂（native y=170）上方保留約 74px 天空，下方草皮切掉。 */
.hero-media { display: block; object-fit: cover; object-position: center 40%; }
.hero-shade {
  background:
    linear-gradient(90deg, rgba(0,0,0,.02) 0%, rgba(0,0,0,0) 35%, rgba(0,0,0,.06) 100%),
    linear-gradient(180deg, rgba(255,255,255,.02) 0%, rgba(0,0,0,.18) 100%);
}

.story-slider {
  position: relative;
  /* 與 hero 之間留白色間隔，參考圖實測為 16px */
  margin-top: 16px;
  height: 380px;
  overflow: hidden;
  background: #24211f;
}
.story-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(1.025);
  transition: opacity .65s ease, transform 1.2s var(--ease);
  pointer-events: none;
}
.story-slide.is-active { opacity: 1; transform: scale(1); pointer-events: auto; }
.story-slide img,
.story-slide video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #24211f;
}
.story-play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 11px 12px 11px 18px;
  border: 0;
  border-radius: 12px;
  background: rgba(255,255,255,.5);
  box-shadow: 0 12px 32px rgba(0,0,0,.22);
  color: #55514c;
  cursor: pointer;
  transition: transform .25s ease, box-shadow .25s ease;
}
.story-play:hover { transform: translate(-50%, -50%) scale(1.03); box-shadow: 0 16px 38px rgba(0,0,0,.3); }
.play-icon {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: #eee;
  position: relative;
}
.play-icon::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 6px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 11px solid #d50930;
}
.slider-dots {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: flex;
  gap: 22px;
}
.slider-dot {
  width: 12px;
  height: 12px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #b36f32;
  opacity: .75;
  cursor: pointer;
  transition: transform .2s ease, background .2s ease, opacity .2s ease;
}
.slider-dot:nth-child(1) { background: #fff; }
.slider-dot:nth-child(2) { background: #d2a060; }
.slider-dot:nth-child(3) { background: #2e7c56; }
.slider-dot.is-active { transform: scale(1.35); opacity: 1; box-shadow: 0 0 0 3px rgba(255,255,255,.18); }

.intro { background: #fff; }
.intro-inner { padding-left: 28px; }
.intro h2 {
  margin: 0 0 10px;
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 400;
  letter-spacing: .04em;
}
.intro p:last-child {
  max-width: 980px;
  margin: 0;
  font-size: 17px;
  letter-spacing: .025em;
}

.capabilities { background: var(--soft-gray); padding-top: 20px; }
/* 寬螢幕時內容區跟著螢幕加寬，最低占 70%，三個區塊一起以保持左右對齊。
   max() 保證永不比原本的 1080px 窄，所以 1543px 以下（70vw < 1080px）維持原樣。
   hero 的 .container 不在此列 —— 那是標題與按鈕的位置，不隨之變動。 */
@media (min-width: 1440px) {
  .header-inner,
  #capabilities .container,
  .intro .container,
  .site-footer .container {
    width: min(calc(100% - 48px), max(var(--container), 70vw));
  }
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
/* 整張卡可點：卡片內放一個絕對定位、撐滿卡片的 <a>。
   絕對定位不佔文件流，所以完全不影響既有的 grid 版面。
   三種卡片都需要 position: relative 當定位基準。 */
.stat-card,
.service-card,
.project-card { position: relative; }
.card-link {
  position: absolute;
  inset: 0;
  z-index: 2;
}
/* inset:0 是對齊 padding box，會漏掉 stat-card 那 1.5px 邊框；往外撐讓整張卡含邊框都可點 */
.stat-card > .card-link { inset: -1.5px; }
.card-link:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.stat-card {
  min-height: 150px;
  padding: 16px 20px 15px;
  border: 1.5px solid rgba(133,102,31,.72);
  border-radius: 0 24px 0 0;
  background: rgba(255,255,255,.06);
}
.stat-card strong,
.stat-card span { display: block; }
.stat-card strong { color: var(--gold); font-size: 30px; line-height: 1; letter-spacing: -.02em; }
.stat-card span { padding-bottom: 6px; border-bottom: 1px solid rgba(133,102,31,.42); font-size: 15px; font-weight: 700; line-height: 1.25; }
.stat-card h3 { margin: 8px 0 3px; font-size: 18px; line-height: 1.35; }
.stat-card p { margin: 0; font-size: 13.5px; line-height: 1.6; }

.service-grid,
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.service-grid { margin-bottom: 22px; }
.service-card {
  min-height: 165px;
  display: grid;
  grid-template-columns: 45% 55%;
  overflow: hidden;
  border-radius: 0 14px 14px 0;
  background: #c4c4c2;
}
.service-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* 標題是唯一內容，靠 flex 置中即為上下垂直居中 */
  justify-content: center;
  /* 左右內距縮小，換取放大字級後「美式木結構建築」仍能單行不換行 */
  padding: 22px 12px;
  text-align: center;
}
.service-copy h3 { margin: 0; font-size: 29px; font-weight: 700; letter-spacing: .03em; }
.service-card img { width: 100%; height: 100%; object-fit: cover; }

.project-card {
  min-height: 164px;
  display: grid;
  grid-template-columns: 52% 48%;
  overflow: hidden;
  border-radius: 0 14px 14px 0;
  background: #080808;
}
.project-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px 24px 18px 48px;
  color: #fff;
}
/* 字級依參考圖量測換算（參考圖內容寬 980px，本站容器 1080px，比例 ×1.102） */
.project-copy p { margin: 0 0 5px; color: #efb871; font-size: 26px; font-weight: 700; letter-spacing: .12em; }
.project-copy span { color: #fff; font-size: 13.5px; }
.project-copy h3 { margin: 5px 0 0; color: #d7a16e; font-size: 18px; font-weight: 400; letter-spacing: .09em; }
.project-card img { width: 100%; height: 100%; object-fit: cover; }

.site-footer {
  padding: 50px 0 18px;
  background: var(--footer);
}
.footer-grid {
  display: grid;
  /* 欄寬比例取自參考圖實測（各欄起始 x：165 / 495 / 685 / 895，結束 1146），
     聯絡資訊欄需要較寬才能讓地址維持單行 */
  grid-template-columns: 1.93fr 1fr 1.13fr 1.67fr;
  gap: 44px;
}
/* 品牌區所有區塊（logo、兩行標誌文字、甲等登記、說明段落）共用同一個寬度。
   參考圖（1920px 寬、頁尾內容 1437px）中這些區塊都是約 140px，佔內容寬 9.74%。
   105px 對應我們 1080px 容器；6.83vw 讓寬螢幕跟著參考圖比例放大（2048 → 140px）。 */
.footer-brand { --brand-w: max(105px, 6.83vw); }
.footer-logo {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: var(--brand-w);
}
.footer-logo img { width: 100%; height: auto; }
/* 這兩行的字級綁定區塊寬度，區塊放大時才會一起放大並維持與 logo 齊寬 */
.footer-logo-sub {
  margin: 0;
  font-size: calc(var(--brand-w) * .0857);
  letter-spacing: 0;
  white-space: nowrap;
  line-height: 1.2;
}
.footer-logo-name {
  margin: 0;
  font-size: calc(var(--brand-w) * .2476);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.15;
}
/* :not() 是必要的 —— .footer-brand p 的權重高於 .footer-cert，否則會蓋掉下面的設定。
   用 > 限定直接子層，才不會連 .footer-logo 裡的兩行文字一起套用。 */
.footer-brand .footer-cert {
  width: var(--brand-w);
  margin: 14px 0 0;
  /* 字級也綁定寬度，否則 9 個字在窄螢幕的 105px 內會換行 */
  font-size: calc(var(--brand-w) * .10);
  font-weight: 700;
  letter-spacing: .04em;
}
.footer-brand > p:not(.footer-cert) {
  width: var(--brand-w);
  max-width: none;
  margin: 14px 0 0;
  font-size: max(12px, calc(var(--brand-w) * .10));
  line-height: 1.6;
}
.footer-column { display: flex; flex-direction: column; align-items: flex-start; }
.footer-column h2 { margin: 4px 0 17px; font-size: 20px; font-weight: 400; letter-spacing: .12em; }
.footer-column a,
.footer-column span,
.footer-column address { font-size: 16px; line-height: 1.7; font-style: normal; }
.footer-column a:hover { color: var(--gold); }
.footer-contact address { letter-spacing: .05em; }
.footer-bottom {
  margin-top: 34px;
  padding-top: 14px;
  border-top: 1px solid rgba(0,0,0,.08);
  font-size: 13px;
  letter-spacing: .06em;
}

.video-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.video-modal.is-open { display: flex; }
.video-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.78); backdrop-filter: blur(6px); }
/* 滿版：面板撐滿整個視窗，不留邊也不限制比例 */
.video-modal-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  background: #000;
}
.video-modal-close {
  position: absolute;
  /* 滿版後面板貼齊視窗邊緣，關閉鈕必須改到框內，否則會跑出畫面外 */
  right: 18px;
  top: 18px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}
.video-modal-player {
  display: block;
  width: 100%;
  height: 100%;
  /* contain = 完整畫面不裁切；視窗比例非 16:9 時上下（或左右）會是黑底。
     若要真正邊到邊填滿、可接受裁掉畫面邊緣，改成 cover。 */
  object-fit: contain;
  background: #000;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .7s ease, transform .7s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }
.no-js .reveal { opacity: 1; transform: none; }

/* 821–1127px 之間卡片仍兩欄並排，左欄寬度隨視窗縮放（約 146px→215px 可用）。
   固定字級在這一段一定會撞牆，所以改成隨視窗連續縮放，確保「美式木結構建築」始終單行。 */
@media (min-width: 821px) and (max-width: 1127px) {
  .service-copy h3 { font-size: clamp(19px, calc(3vw - 6px), 29px); }
}

@media (max-width: 1024px) {
  :root { --header-height: 72px; }
  .brand img { width: 190px; }
  .site-nav { gap: 22px; font-size: 13px; }
  .nav-home img { width: 40px; height: 40px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { gap: 34px; }
}

@media (max-width: 820px) {
  .container,
  .header-inner { width: min(calc(100% - 32px), var(--container)); }
  .menu-toggle { display: block; position: relative; z-index: 2; }
  .site-nav {
    position: fixed;
    top: var(--header-height);
    right: 0;
    left: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 14px 20px 24px;
    background: rgba(255,255,255,.99);
    box-shadow: 0 20px 40px rgba(0,0,0,.12);
    transform: translateY(-120%);
    opacity: 0;
    visibility: hidden;
    transition: transform .28s var(--ease), opacity .2s ease, visibility .28s;
  }
  .site-nav.is-open { transform: translateY(0); opacity: 1; visibility: visible; }
  .site-nav > a:not(.nav-home),
  .site-nav > span { padding: 13px 8px; border-bottom: 1px solid rgba(0,0,0,.06); }
  .site-nav > a:not(.nav-home)::after { display: none; }
  .nav-home { display: none; }

  /* 窄螢幕依比例會太矮（375px 寬只有 175px 高），改用高度下限撐出可看的視覺區。
     這裡必須解除 aspect-ratio：它會把 min-height 反向換算成最小寬度，把 hero 撐到比視窗還寬。 */
  .hero {
    aspect-ratio: auto;
    min-height: 560px;
  }
  .hero-shade {
    background: linear-gradient(180deg, rgba(255,255,255,.03) 0%, rgba(0,0,0,.18) 52%, rgba(0,0,0,.55) 100%);
  }

  .story-slider { height: 430px; }
  .story-slide img,
  .story-slide video { object-position: center; }
  .story-play { white-space: nowrap; }

  .intro-inner { padding-left: 0; }
  .service-grid,
  .project-grid { grid-template-columns: 1fr; }
  .service-card,
  .project-card { min-height: 210px; }
  .footer-grid { grid-template-columns: 1.2fr 1fr; }
}

@media (max-width: 560px) {
  :root { --header-height: 66px; }
  .section { padding: 52px 0; }
  .brand img { width: 170px; }
  .hero { min-height: 520px; }

  .story-slider { height: 470px; }
  .story-slide img,
  .story-slide video { object-position: 44% center; }
  .story-play { top: 52%; font-size: 13px; }
  .slider-dots { bottom: 20px; }

  .intro h2 { font-size: 28px; }
  .intro p:last-child { font-size: 15px; }
  .stat-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: auto; padding: 18px 20px; }

  .service-card { grid-template-columns: 1fr; border-radius: 0 0 14px 14px; }
  .service-copy { order: 2; padding: 24px; }
  .service-card img { order: 1; height: 210px; }
  .service-copy h3 { font-size: 28px; }

  .project-card { grid-template-columns: 1fr; border-radius: 0 0 14px 14px; }
  .project-card img { height: 210px; order: 1; }
  .project-copy { order: 2; padding: 26px 28px; }

  .footer-grid { grid-template-columns: 1fr; gap: 26px; }
  .footer-brand p { max-width: 100%; }
  .footer-column h2 { margin-bottom: 8px; }
  .footer-bottom { margin-top: 24px; }

  .video-modal-close { right: 12px; top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
