/* 台拓 — 客戶實績頁（共用：工業整廠 / 機電・水電 / 綠能與儲能）
   案件網格 + 客戶實績卡片（圖片框 + 多邊形白色文字塊 + 紅底六邊形箭頭）+ 分頁。
   沿用設計稿 styles.css 設計 token；頁面同時載入 about-history.css 取得 inner-header / breadcrumb / .ah-container / .ah-eyebrow。
*/

/* ============ 設計 token（main.css 未使用裸 token，安全不衝突）============ */
:root {
  --red: #E0121A;
  --red-dark: #B30E14;
  --red-soft: #FEE2E4;
  --ink: #0E0F11;
  --paper: #F1F1F4;
  --paper-2: #FAFAFB;
  --white: #FFFFFF;
  --muted: #6B7280;
  --muted-2: #9CA3AF;
  --border: #E5E7EB;
  --coral: #F4B0A8;
  --coral-2: #FAD2CC;
  --yellow: #FACC15;
  --shadow-card: 0 1px 2px rgba(15,17,21,.04), 0 12px 28px rgba(15,17,21,.06);
  --shadow-card-hover: 0 6px 12px rgba(15,17,21,.06), 0 24px 48px rgba(15,17,21,.10);
}

/* ============ 區段抬頭（簡短，僅頁面定位用）============ */
.works-hero {
  background:
    radial-gradient(ellipse 700px 460px at 12% 30%, #F4EFEC 0%, transparent 62%),
    linear-gradient(180deg, #F7F5F2 0%, #FBFAF8 100%);
  border-bottom: 1px solid var(--border);
  padding: 56px 0 52px;
}
.works-hero .ah-eyebrow { margin-bottom: 16px; }
.works-hero-grid {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 56px;
  align-items: stretch;
}
.works-hero-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.works-hero-img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 300px;
  max-height: none;            /* 覆寫 Voltz main.css 對所有 img 的 max-height:100% 限制 */
  border-radius: 18px;
  box-shadow: var(--shadow-card);
}
/* 主視覺占位（待換上實際照片） */
.works-hero-ph {
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(135deg, #E9EBEF 0 16px, #F1F3F6 16px 32px);
  color: var(--muted-2);
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 13px;
  letter-spacing: .02em;
}
.works-hero h1 {
  font-family: 'Noto Sans TC', sans-serif;
  font-weight: 800;
  font-size: clamp(34px, 4.4vw, 56px);
  line-height: 1.1;
  letter-spacing: -.01em;
  margin: 0 0 16px;
  color: var(--ink);
}
.works-hero h1 .accent { color: var(--red); }
.works-hero p {
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: var(--muted);
  max-width: 600px;
  margin: 0;
}

/* ============ 頁面內容區 ============ */
.works {
  padding: 64px 0 96px;
  background: var(--white);
}
.works .ah-container { position: relative; }

/* 結果列計數 */
.works-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 30px;
  font-family: 'Noto Sans TC', sans-serif;
}
.works-meta .count {
  font-size: 14px;
  color: var(--muted);
}
.works-meta .count strong {
  color: var(--ink);
  font-weight: 700;
}
.works-meta .page-label {
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--muted-2);
  text-transform: uppercase;
}

/* ============ 案件網格 ============ */
.proj-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px 26px;
}

/* ============ 客戶實績卡片 ============ */
.proj-card {
  position: relative;
  display: block;
  border-radius: 18px;
  outline: none;
  text-decoration: none;
}

/* ① 圖片框 */
.proj-photo {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 3.7;
  border-radius: 18px;
  overflow: hidden;
  background:
    repeating-linear-gradient(135deg, #E9EBEF 0 14px, #F1F3F6 14px 28px);
  box-shadow: var(--shadow-card);
  transition: box-shadow .3s ease, transform .3s ease;
}
.proj-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(14,15,17,.28) 100%);
  pointer-events: none;
  z-index: 1;
}
.proj-photo .ph-label {
  position: absolute;
  top: 16px; left: 16px;
  z-index: 2;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: .04em;
  color: #9097A1;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(14,15,17,.06);
  padding: 5px 9px;
  border-radius: 6px;
}
.proj-photo .ph-glyph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #C2C7CF;
}
.proj-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  transition: transform .5s cubic-bezier(.2,.7,.2,1);
}

/* ② 多邊形白色區塊 */
.proj-cap {
  position: absolute;
  left: 0;
  bottom: 18px;
  z-index: 3;
  width: 82%;
  max-width: 290px;
  background: var(--white);
  padding: 18px 46px 18px 22px;
  clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 0 100%);
  box-shadow: 0 10px 28px rgba(14,15,17,.16);
  transition: transform .3s ease;
}
.proj-cap .eyebrow-loc {
  display: block;
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--red);
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.proj-cap .title {
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.32;
  letter-spacing: -.005em;
  color: var(--ink);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ③ 紅底六邊形箭頭 */
.proj-hex {
  position: absolute;
  z-index: 4;
  right: -16px;
  bottom: 30px;
  width: 46px;
  height: 50px;
  background: var(--red);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 8px 18px rgba(224,18,26,.34);
  transition: background .25s ease, transform .3s ease;
}
.proj-hex svg { width: 18px; height: 18px; }

/* hover 動態 */
.proj-card:hover .proj-photo,
.proj-card:focus-visible .proj-photo {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}
.proj-card:hover .proj-photo img { transform: scale(1.05); }
.proj-card:hover .proj-hex { background: var(--red-dark); transform: scale(1.08); }
.proj-card:hover .proj-hex svg { animation: hex-nudge .5s ease; }
.proj-card:focus-visible { outline: 3px solid var(--coral); outline-offset: 4px; border-radius: 18px; }
@keyframes hex-nudge {
  0%,100% { transform: translateX(0); }
  50% { transform: translateX(3px); }
}

/* ============ 造型 C（角標式，正式版預設）============ */
.proj-grid[data-variant="c"] .proj-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform .3s ease, box-shadow .3s ease;
}
.proj-grid[data-variant="c"] .proj-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}
.proj-grid[data-variant="c"] .proj-photo {
  aspect-ratio: 3 / 2.6;
  border-radius: 0;
  box-shadow: none;
  transform: none !important;
}
.proj-grid[data-variant="c"] .proj-photo::after {
  background: linear-gradient(180deg, transparent 60%, rgba(14,15,17,.18) 100%);
}
.proj-grid[data-variant="c"] .proj-cap {
  position: relative;
  left: auto; bottom: auto;
  width: 100%;
  max-width: none;
  background: var(--white);
  clip-path: none;
  box-shadow: none;
  padding: 22px 24px 24px;
  transform: none !important;
}
.proj-grid[data-variant="c"] .proj-cap .title { font-size: 18px; }
.proj-grid[data-variant="c"] .proj-hex {
  right: 16px;
  top: 16px;
  bottom: auto;
}
.proj-grid[data-variant="c"] .proj-card:hover .proj-photo img { transform: scale(1.05); }

/* ============ 分頁切換 ============ */
.pager-wrap {
  display: flex;
  justify-content: center;
  margin-top: 64px;
}
.pager {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1.5px solid #C9D6EA;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15,17,21,.04);
}
.pg-btn {
  min-width: 46px;
  height: 46px;
  padding: 0 6px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--border);
  transition: background .15s, color .15s, border-color .15s, transform .12s;
  user-select: none;
  cursor: pointer;
}
.pg-btn:hover:not(.is-active):not(:disabled) {
  background: var(--red-soft);
  border-color: var(--coral-2);
  color: var(--red);
}
.pg-btn:active:not(:disabled) { transform: translateY(1px); }
.pg-btn.is-active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  box-shadow: 0 6px 14px rgba(224,18,26,.28);
  cursor: default;
}
.pg-btn.is-arrow { color: var(--ink); }
.pg-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}
.pg-ellipsis {
  min-width: 30px;
  text-align: center;
  color: var(--muted-2);
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  user-select: none;
}
.pg-btn svg { width: 18px; height: 18px; }

/* ============ 響應式 ============ */
@media (max-width: 1080px) {
  .proj-grid { grid-template-columns: repeat(2, 1fr); }
  .works-hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .works-hero-img { min-height: 260px; }
}
@media (max-width: 680px) {
  .proj-grid { grid-template-columns: 1fr; gap: 24px; }
  .works { padding: 44px 0 72px; }
  .proj-cap { max-width: 78%; }
  .pager { flex-wrap: wrap; justify-content: center; }
}

/* ===========================================================
   相簿模式：封面真圖 + 放大鏡 + 索引徽章（僅整廠施作等啟用頁面渲染）
   =========================================================== */
.proj-card[data-id] { cursor: pointer; }
.proj-photo .proj-idx {
  position: absolute;
  top: 14px; left: 14px;
  z-index: 3;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: .04em;
  color: #6B7280;
  background: rgba(255,255,255,.86);
  border: 1px solid rgba(14,15,17,.06);
  padding: 4px 8px;
  border-radius: 6px;
  pointer-events: none;
}
.proj-grid[data-variant="c"] .proj-photo .proj-idx { top: 12px; }
.proj-zoom {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 5;
  width: 40px; height: 40px;
  border: 0;
  border-radius: 10px;
  background: rgba(14,15,17,.55);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .2s ease, transform .2s ease, background .15s ease;
  backdrop-filter: blur(6px);
}
.proj-zoom svg { width: 19px; height: 19px; }
.proj-card:hover .proj-zoom,
.proj-card:focus-within .proj-zoom { opacity: 1; transform: translateY(0); }
.proj-zoom:hover { background: var(--red); }

/* ===========================================================
   案件相簿 Modal
   =========================================================== */
.wk-modal { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; padding: 24px; }
.wk-modal.open { display: flex; }
.wk-modal-backdrop { position: absolute; inset: 0; background: rgba(8,9,11,.74); }
.wk-modal-card {
  position: relative; z-index: 1; width: min(1000px, 100%); max-height: 88vh;
  background: #fff; border-radius: 18px; overflow: visible;
  display: grid; grid-template-columns: .9fr 1.1fr;
  /* 品牌黃四層外光暈（與「專業與品質」精密儀器 Modal 一致）+ 最底層深色投影 */
  box-shadow:
    0 0 0 1px var(--yellow),
    0 0 24px 2px rgba(250,204,21,.55),
    0 0 60px 12px rgba(250,204,21,.28),
    0 30px 80px rgba(0,0,0,.45);
  animation: wkModalIn .22s ease;
}
@keyframes wkModalIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.wk-modal-info { padding: 38px 36px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; border-radius: 18px 0 0 18px; }
.wk-modal-ix {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px;
  font-weight: 500; letter-spacing: .1em; color: var(--red);
}
.wk-modal-ix .bolt { width: 12px; height: 12px; background: var(--red); clip-path: polygon(40% 0, 100% 0, 60% 45%, 100% 45%, 0 100%, 40% 55%, 0 55%); }
.wk-modal-loc { font-family: 'Noto Sans TC', sans-serif; font-size: 13px; font-weight: 700; color: var(--red); letter-spacing: .01em; }
.wk-modal-info h3 { font-family: 'Noto Sans TC', sans-serif; font-weight: 800; font-size: clamp(22px, 2.4vw, 28px); line-height: 1.3; color: var(--ink); margin: 0; }
.wk-note-view { font-family: 'Noto Sans TC', sans-serif; font-size: 15.5px; line-height: 1.95; color: #2A2C31; margin: 6px 0 0; text-wrap: pretty; white-space: pre-wrap; }
.wk-modal-figure { position: relative; background: #0E0F11; display: flex; flex-direction: column; padding: 20px; min-height: 380px; gap: 14px; border-radius: 0 18px 18px 0; }
.wk-gal-viewer { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; }
.wk-gal-viewer #wkModalImg { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; object-fit: contain; display: none; border-radius: 8px; }
.wk-modal-figure.has-img #wkModalImg { display: block; }
.wk-modal-empty { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12.5px; line-height: 1.7; color: #8C9098; text-align: center; max-width: 82%; }
.wk-modal-figure.has-img .wk-modal-empty { display: none; }
.wk-modal-empty small { color: #6B7280; font-size: 11.5px; }
/* 切換鈕預設即為品牌紅實心，Modal 一開啟就清楚可見（不再是半透明） */
.wk-gal-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--red); color: #fff; display: none; place-items: center; cursor: pointer; z-index: 3; transition: background .15s, transform .15s; }
.wk-gal-viewer.multi .wk-gal-nav { display: grid; }
.wk-gal-nav.prev { left: 4px; } .wk-gal-nav.next { right: 4px; }
/* hover 須保留 translateY(-50%)，否則按鈕會掉出垂直置中 */
.wk-gal-nav:hover { background: var(--red-dark, var(--red)); transform: translateY(-50%) scale(1.06); }
.wk-gal-nav svg { width: 20px; height: 20px; }
.wk-gal-count { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); z-index: 4; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11px; letter-spacing: .06em; color: #fff; background: rgba(0,0,0,.5); padding: 3px 9px; border-radius: 999px; }
.wk-gal-viewer:not(.multi) .wk-gal-count { display: none; }
.wk-gal-rail { display: flex; gap: 8px; justify-content: center; flex: none; flex-wrap: wrap; }
.wk-gal-rail .wk-gal-thumb { width: 84px; height: 60px; max-height: none; display: block; object-fit: cover; cursor: pointer; outline: 2px solid transparent; outline-offset: 2px; border-radius: 8px; transition: outline-color .15s; }
.wk-gal-rail .wk-gal-thumb.wk-gal-active { outline-color: var(--red); }
.wk-modal-close {
  position: absolute; top: -18px; right: -18px; z-index: 6;
  width: 40px; height: 40px; border-radius: 50%;
  background: #17181B; color: #fff; border: 2px solid #fff;
  display: grid; place-items: center; cursor: pointer; transition: background .15s, transform .15s;
}
.wk-modal-close:hover { background: var(--red); transform: scale(1.06); }
.wk-modal-close svg { width: 18px; height: 18px; }

@media (max-width: 760px) {
  .wk-modal { padding: 14px; }
  .wk-modal-card { grid-template-columns: 1fr; max-height: 90vh; overflow-y: auto; }
  .wk-modal-info { border-radius: 0 0 18px 18px; padding: 26px 22px; }
  .wk-modal-figure { min-height: 240px; order: -1; border-radius: 18px 18px 0 0; }
  /* 手機卡片改為可捲動，外露關閉鈕會被裁切→移回卡內右上角 */
  .wk-modal-close { top: 10px; right: 10px; }
}

/* 直立窄屏手機：縮圖列必定換行擠壓主照片，改為完全不顯示
   （本區塊須排在 760px 之後，否則 min-height 會被上方的 240px 覆蓋） */
@media (max-width: 600px) {
  .wk-gal-rail { display: none; }
  .wk-modal-figure { min-height: 260px; }
  /* 放大至 44px 最小點擊目標；仍受 .multi 控制，單張圖不顯示 */
  .wk-gal-viewer.multi .wk-gal-nav { display: grid; width: 44px; height: 44px; }
  .wk-gal-nav.prev { left: 8px; } .wk-gal-nav.next { right: 8px; }
  .wk-modal-close { top: 8px; right: 8px; }
}
