/* 台拓 — 工業整廠 ｜ 建築資訊模型（BIM）頁專用樣式
   沿用設計稿 styles.css 的設計 token；本檔負責：首段寓意、整合專業技術（變形多邊形動畫）、
   施工前階段（圖文卡）、建置案例（卡片 + 燈箱）。
   注意：頁面同時載入 about-history.css 以取得 inner-header / breadcrumb / .ah-container / .ah-eyebrow 等共用 chrome。
*/

/* ============ 設計 token（對應設計稿 styles.css :root；main.css 未使用裸 token，安全不衝突）============ */
:root {
  --red: #E0121A;
  --red-dark: #B30E14;
  --red-soft: #FEE2E4;
  --ink: #0E0F11;
  --ink-2: #1A1B1F;
  --paper: #F1F1F4;
  --paper-2: #FAFAFB;
  --white: #FFFFFF;
  --muted: #6B7280;
  --muted-2: #9CA3AF;
  --border: #E5E7EB;
  --coral: #F4B0A8;
  --coral-2: #FAD2CC;
  --yellow: #FACC15;
  --radius: 14px;
  --radius-lg: 22px;
  --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);
}

/* ============ 區段通用 ============ */
.bim-section { padding: 76px 0; }
.bim-section.alt { background: var(--paper-2); border-block: 1px solid var(--border); }

.bim-head { max-width: 760px; margin-bottom: 40px; }
.bim-head .ah-eyebrow { margin-bottom: 14px; }
.bim-head h2 {
  font-family: 'Noto Sans TC', sans-serif;
  font-weight: 800;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.18;
  letter-spacing: -.01em;
  margin: 0;
  color: var(--ink);
}
.bim-head h2 .accent { color: var(--red); }
.bim-head p {
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 15.5px;
  line-height: 1.8;
  color: var(--muted);
  margin: 14px 0 0;
}

/* ============ 首段：寓意 + 寓意圖 ============ */
.bim-intro {
  background:
    radial-gradient(ellipse 760px 480px at 14% 26%, #F4EFEC 0%, transparent 62%),
    linear-gradient(180deg, #F7F5F2 0%, #FBFAF8 100%);
  border-bottom: 1px solid var(--border);
  padding: 64px 0 70px;
}
.bim-intro-grid {
  display: grid;
  grid-template-columns: 1.02fr .98fr;
  gap: 60px;
  align-items: stretch;
}
.bim-intro-text { display: flex; flex-direction: column; justify-content: center; }
.bim-intro-text .ah-eyebrow { margin-bottom: 18px; }
.bim-intro-text 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 22px;
  color: var(--ink);
}
.bim-intro-text h1 .accent { color: var(--red); }
.bim-intro-text .bim-lead {
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 17.5px;
  line-height: 1.95;
  color: #2A2C31;
  margin: 0;
  text-wrap: pretty;
}
.bim-intro-text .bim-lead strong { color: var(--red); font-weight: 700; }
.bim-hero-img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 320px;
  max-height: none;            /* 覆寫 Voltz main.css 對所有 img 的 max-height:100% 限制 */
  object-fit: cover;
  border-radius: 18px;
  box-shadow: var(--shadow-card);
}

/* ============ BIM 變形多邊形動畫 ============ */
.morph-stage {
  position: relative;
  margin: 14px auto 0;
  max-width: 1000px;
  height: 560px;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 60% at 50% 42%, #14203c 0%, #0b1326 55%, #070d1c 100%);
  border: 1px solid rgba(120,150,210,.18);
  box-shadow: inset 0 0 80px rgba(4,8,18,.7), 0 20px 50px rgba(6,10,22,.35);
}
/* 藍圖網格（opacity 由 JS 控制，廠房圖階段會漸出） */
.morph-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: var(--grid-op, 1);
  transition: none;
  background-image:
    linear-gradient(rgba(120,160,225,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120,160,225,.06) 1px, transparent 1px);
  background-size: 40px 40px;
  mask: radial-gradient(ellipse 80% 75% at 50% 50%, #000 35%, transparent 88%);
  -webkit-mask: radial-gradient(ellipse 80% 75% at 50% 50%, #000 35%, transparent 88%);
  pointer-events: none;
}
.morph-stage canvas { position: absolute; inset: 0; display: block; max-height: none; }
.morph-labels { position: absolute; inset: 0; pointer-events: none; }
.morph-label {
  position: absolute;
  top: 0; left: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px 5px 7px;
  border-radius: 999px;
  background: rgba(12,20,38,.74);
  border: 1px solid rgba(125,160,215,.3);
  backdrop-filter: blur(5px);
  color: #e9f0fc;
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
  will-change: transform, opacity;
  box-shadow: 0 4px 14px rgba(4,8,18,.4);
}
.morph-label .mi {
  width: 15px; height: 15px;
  color: #6fb0ff;
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.morph-label .mi svg { width: 15px; height: 15px; }
.morph-label.core {
  border-color: rgba(255,90,100,.6);
  background: rgba(40,12,16,.82);
  color: #fff;
  font-weight: 700;
}
.morph-label.core .mi { color: #ff5660; }
.morph-caption {
  position: absolute;
  left: 50%; bottom: 18px;
  transform: translateX(-50%);
  z-index: 200;
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 16.5px;
  letter-spacing: .16em;
  color: var(--yellow, #FACC15);
  text-transform: uppercase;
}
.morph-caption.flash { animation: cap-in .5s ease; }
@keyframes cap-in {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.morph-legend {
  position: absolute;
  top: 16px; left: 18px;
  font-family: 'Manrope', 'Noto Sans TC', sans-serif;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--yellow);
  text-transform: uppercase;
}
.morph-step {
  position: absolute;
  top: 14px; right: 18px;
  z-index: 200;
  width: 64px; height: 64px;
  display: grid; place-items: center;
  border-radius: 16px;
  border: 3px solid rgba(255,90,100,.55);
  background: rgba(40,12,16,.55);
  color: var(--yellow);
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 40px;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(4,8,18,.4);
  transition: opacity .35s ease;
}
@media (max-width: 760px) {
  .morph-stage { height: 460px; border-radius: 16px; }
  .morph-label { font-size: 11px; padding: 4px 9px 4px 6px; }
}

/* ============ 施工前階段（圖文卡） ============ */
.pre-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
}
.pre-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform .25s ease, box-shadow .25s ease;
}
.pre-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card-hover); }
.pre-media {
  position: relative;
  width: 100%;
  display: block;
}
/* 占位圖（待換上實際照片） */
.pre-media .bim-shot {
  display: block;
  width: 100%;
  height: 168px;
  background:
    repeating-linear-gradient(135deg, #eef1f5 0 14px, #e7ebf1 14px 28px);
  display: grid;
  place-items: center;
  color: var(--muted-2);
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 12.5px;
  letter-spacing: .02em;
}
/* 施工前 / 軟體應用：固定實體圖，滿版等比裁切（handoff 變更 2：object-fit cover） */
.pre-media .pre-img {
  display: block;
  width: 100%;
  height: 168px;
  object-fit: cover;
  max-height: none; /* 覆寫 Voltz main.css 全域 img max-height */
}
/* 編號徽章：依交辦 #7 全數隱藏（保留 HTML 上的 <span>，樣式改名 --hidden 以便日後還原） */
.pre-num { display: none; }
.pre-num--hidden {
  position: absolute;
  top: 12px; left: 12px;
  z-index: 2;
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  display: grid; place-items: center;
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(224,18,26,.3);
}
.pre-label {
  padding: 16px 18px 18px;
  font-family: 'Noto Sans TC', sans-serif;
  font-weight: 700;
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--ink);
  letter-spacing: -.005em;
}

/* ============ 施工品質（左右交錯圖文，交辦 #5） ============ */
.quality-list {
  display: grid;
  gap: 44px;
}
.quality-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}
/* 偶數列圖片靠右（交錯 zig-zag） */
.quality-row:nth-child(even) .quality-media { order: 2; }
/* 施工品質襯底（handoff 變更 3）：Footer 同款深灰黑底 + 淺灰小圓點 */
.quality-media {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  background-color: #0E0F11;
  background-image: radial-gradient(rgba(255,255,255,.16) 1.4px, transparent 1.5px);
  background-size: 16px 16px;
}
/* 施工品質：固定實體圖，等比完整顯示不裁切（handoff 變更 2：object-fit contain） */
.quality-media .quality-img {
  display: block;
  width: 100%;
  height: 320px;
  object-fit: contain;
  max-height: none; /* 覆寫 Voltz main.css 全域 img max-height */
}
.quality-media .bim-shot {
  display: grid;
  place-items: center;
  width: 100%;
  height: 300px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: repeating-linear-gradient(135deg, #eef1f5 0 14px, #e7ebf1 14px 28px);
  color: var(--muted-2);
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 13px;
  letter-spacing: .02em;
}
/* 編號徽章：依交辦 #7 全數隱藏（保留 <span>，樣式改名 --hidden 以便日後還原） */
.quality-index { display: none; }
.quality-index--hidden {
  position: absolute;
  top: 12px; left: 12px;
  z-index: 2;
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  display: grid; place-items: center;
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(224,18,26,.3);
}
.quality-body h3 {
  font-family: 'Noto Sans TC', sans-serif;
  font-weight: 800;
  font-size: clamp(20px, 2.2vw, 26px);
  line-height: 1.3;
  letter-spacing: -.01em;
  color: var(--ink);
  margin-bottom: 14px;
}
.quality-body p {
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 15.5px;
  line-height: 1.85;
  color: var(--muted);
}

/* ============ 建置案例（卡片 + 燈箱） ============ */
.case-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 26px;
}
.case-card {
  display: flex;
  flex-direction: column;
}
.case-media {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 16px;
  overflow: hidden;
  cursor: zoom-in;
  box-shadow: var(--shadow-card);
  transition: transform .25s ease, box-shadow .25s ease;
}
.case-media:hover { transform: translateY(-4px); box-shadow: var(--shadow-card-hover); }
/* 封面占位（待換上實際封面） */
.case-media .bim-cover {
  display: grid;
  place-items: center;
  width: 100%;
  height: 230px;
  background:
    repeating-linear-gradient(135deg, #e9edf3 0 16px, #e1e6ee 16px 32px);
  color: var(--muted-2);
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 13px;
  letter-spacing: .02em;
}
.case-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 52%, rgba(14,15,17,.34) 100%);
  pointer-events: none;
}
.case-zoom {
  position: absolute;
  right: 12px; bottom: 12px;
  z-index: 2;
  display: inline-flex; align-items: center; gap: 7px;
  white-space: nowrap;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(14,15,17,.62);
  backdrop-filter: blur(6px);
  color: #fff;
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
}
.case-zoom svg { width: 14px; height: 14px; }
.case-tag {
  position: absolute;
  top: 12px; left: 12px;
  z-index: 2;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 12.5px;
  letter-spacing: .04em;
  box-shadow: 0 4px 12px rgba(224,18,26,.3);
}
.case-cap {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink);
}
.case-cap .cap-title { font-weight: 700; display: block; }
.case-cap .cap-sub { color: var(--muted); font-size: 13px; }

/* ---- 燈箱 ---- */
.lb {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.lb[data-open] { display: flex; }
.lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10,11,13,.86);
  backdrop-filter: blur(4px);
}
.lb-dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
}
.lb-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-gallery { display: none; }
.lb-gallery[data-active] { display: block; }
/* 燈箱內的圖片占位（待換上實際照片） */
.lb-gallery .lb-slide {
  display: none;
  place-items: center;
  width: min(86vw, 1060px);
  height: min(72vh, 660px);
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
  background:
    repeating-linear-gradient(135deg, #eef0f3 0 18px, #e6e9ee 18px 36px);
  color: var(--muted);
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 15px;
  letter-spacing: .02em;
}
.lb-gallery .lb-slide[data-show] { display: grid; }
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px; height: 52px;
  border-radius: 50%;
  background: rgba(12,13,15,.58);
  border: 1.5px solid rgba(255,255,255,.42);
  color: #fff;
  display: grid; place-items: center;
  cursor: pointer;
  transition: background .15s, transform .15s, border-color .15s;
  z-index: 3;
  backdrop-filter: blur(4px);
}
.lb-nav:hover { background: var(--red); border-color: var(--red); }
.lb-nav:active { transform: translateY(-50%) scale(.94); }
.lb-nav svg { width: 24px; height: 24px; }
.lb-prev { left: -8px; }
.lb-next { right: -8px; }
.lb-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  color: #fff;
}
.lb-counter {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .06em;
  white-space: nowrap;
}
.lb-counter .cur { color: #fff; }
.lb-counter .sl { color: rgba(255,255,255,.4); margin: 0 2px; }
.lb-counter .tot { color: rgba(255,255,255,.5); }
.lb-title {
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 14.5px;
  color: rgba(255,255,255,.82);
}
.lb-close {
  position: absolute;
  top: -54px; right: 8px;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.1);
  color: #fff;
  display: grid; place-items: center;
  cursor: pointer;
  transition: background .15s;
  z-index: 3;
}
.lb-close:hover { background: rgba(255,255,255,.22); }
.lb-close svg { width: 20px; height: 20px; }
.lb-dots {
  display: flex;
  gap: 7px;
}
.lb-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,.32);
  border: 0; padding: 0;
  cursor: pointer;
  transition: background .15s, transform .15s;
}
.lb-dot[data-on] { background: var(--red); transform: scale(1.25); }

/* ============ 響應式 ============ */
@media (max-width: 1080px) {
  .bim-intro-grid { grid-template-columns: 1fr; gap: 34px; }
  .bim-hero-img { min-height: 280px; }
  .pre-grid { grid-template-columns: repeat(2, 1fr); }
  .case-grid { grid-template-columns: repeat(2, 1fr); }
  /* 施工品質交錯列在斷點以下改單欄堆疊，並讓圖片一律在上 */
  .quality-row { grid-template-columns: 1fr; gap: 24px; }
  .quality-row:nth-child(even) .quality-media { order: 0; }
  .quality-media .quality-img { height: 240px; }
}
@media (max-width: 620px) {
  .pre-grid { grid-template-columns: 1fr; }
  .case-grid { grid-template-columns: 1fr; }
  .lb-prev { left: 0; }
  .lb-next { right: 0; }
}
