/* ==========================================================
   PCCoder Lab — 網站樣式
   視覺概念：電路板。整頁防焊綠底、銅（接點/強調）、
   訊號黃（只用在 AI 偵測框，代表「AI 看到的東西」）。
   ========================================================== */

:root {
  /* 色彩：整頁同一個防焊綠底，區塊之間只用細線分隔，不換底色 */
  --bg: #0E2A22;          /* 防焊綠：整頁底色 */
  --bg-2: #14362C;        /* 浮起來的一層：卡片、表格 */
  --bg-3: #0B231C;        /* 凹下去的一層：輸入框、表頭 */
  --line: #2A5446;        /* 分隔線 */
  --text: #E8EEE9;        /* 主要文字 */
  --text-soft: #A9BDB3;   /* 次要文字 */
  --copper: #C98B3A;      /* 銅：強調、連結 */
  --copper-hi: #DDA052;   /* 銅：滑過 */
  --signal: #F2D23C;      /* 訊號黃：只給偵測框與焦點 */

  /* 字體 */
  --font-zh: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --font-latin: "Archivo", "Noto Sans TC", system-ui, sans-serif;

  /* 字級（基準 17px，約 1.25 倍率） */
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3125rem;
  --step-2: 1.625rem;
  --step-3: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);
  --step-4: clamp(2.4rem, 1.6rem + 4vw, 4.75rem);

  /* 間距：元件內部一律用這組刻度，不再寫零散的數字 */
  --space-2xs: 4px;
  --space-xs: 8px;
  --space-s: 12px;
  --space-m: 16px;
  --space-l: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  --gutter: clamp(16px, 4vw, 48px);
  --section-y: clamp(72px, 10vw, 136px);
  --maxw: 1200px;
  --measure: 36em;  /* 中文一行約 36 字 */

  --radius-s: 4px;
  --radius-m: 10px;
}

/* ---------- 基本 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-zh);
  font-size: var(--step-0);
  line-height: 1.8;
  line-break: strict;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.3;
  font-weight: 700;
  text-wrap: balance;
}
p { margin: 0; text-wrap: pretty; }

a { color: var(--copper); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--signal);
  outline-offset: 3px;
  border-radius: 2px;
}

.wrap {
  width: 100%;
  max-width: calc(var(--maxw) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 16px; top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--signal);
  color: var(--bg);
  font-weight: 700;
  border-radius: var(--radius-s);
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- 按鈕 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 22px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-s);
  font: inherit;
  font-weight: 700;
  font-size: var(--step-0);
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn-primary {
  background: var(--copper);
  color: #1B1206;
}
.btn-primary:hover { background: var(--copper-hi); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: color-mix(in srgb, var(--text) 45%, transparent);
}
.btn-ghost:hover { border-color: var(--text); }
.btn-small { min-height: 40px; padding: 8px 16px; font-size: var(--step--1); }

/* ---------- 頁首 ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  color: var(--text);
  transition: background-color .25s, box-shadow .25s;
}
.site-header.is-solid {
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-family: var(--font-latin);
  font-weight: 700;
  font-stretch: 112%;
  font-size: 1.125rem;
  letter-spacing: 0.01em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.site-nav a {
  padding: 8px 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: var(--radius-s);
}
.site-nav a:hover { background: color-mix(in srgb, var(--text) 10%, transparent); }
.site-nav .nav-cta {
  margin-left: 8px;
  border: 1.5px solid var(--copper);
  color: var(--copper);
  font-weight: 700;
}
.site-nav .nav-cta:hover { background: var(--copper); color: #1B1206; }

.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block;
  width: 22px; height: 2px;
  margin-inline: auto;
  background: currentColor;
  transition: transform .2s, opacity .2s;
}
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before,
.nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -7px; }
.nav-toggle-bars::after { top: 7px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: min(100vh, 980px);
  min-height: min(100svh, 980px);
  display: flex;
  align-items: center;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  isolation: isolate;
}
.hero-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
}
.hero-shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(10, 30, 24, .88) 0%, rgba(10, 30, 24, .62) 34%, rgba(10, 30, 24, 0) 62%),
    linear-gradient(0deg, var(--bg) 0%, rgba(14, 42, 34, 0) 30%);
}
.hero-content {
  padding-top: 120px;
  padding-bottom: 96px;
}
.hero-title {
  max-width: 11em;
  font-size: var(--step-4);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -0.01em;
}
.hero-lead {
  max-width: 27em;
  margin-top: 28px;
  color: var(--text);
  font-size: var(--step-1);
  line-height: 1.7;
  opacity: .92;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 40px;
}

/* 偵測框：全站唯一的動畫，頁面載入時依序「鎖定」 */
.det-box {
  fill: none;
  stroke: var(--signal);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 2400;
  stroke-dashoffset: 2400;
  animation: det-draw 0.9s cubic-bezier(.6, 0, .2, 1) forwards;
  animation-delay: calc(0.5s + var(--d) * 0.45s);
}
.det-tag {
  opacity: 0;
  animation: det-tag 0.25s ease-out forwards;
  animation-delay: calc(1.25s + var(--d) * 0.45s);
}
.det-tag rect { fill: var(--signal); }
.det-tag text {
  fill: var(--bg);
  font-family: var(--font-latin);
  font-size: 21px;
  font-weight: 700;
  font-stretch: 100%;
}
@keyframes det-draw { to { stroke-dashoffset: 0; } }
@keyframes det-tag { to { opacity: 1; } }

/* ---------- 區塊共用 ---------- */
.section { padding-block: var(--section-y); }
.section + .section,
.section + .contact { border-top: 1px solid var(--line); }
.section-head {
  max-width: var(--measure);
  margin-bottom: clamp(40px, 6vw, 72px);
}
.section-head h2 {
  font-size: var(--step-3);
  font-weight: 900;
  letter-spacing: -0.005em;
}
.section-head p {
  margin-top: var(--space-m);
  color: var(--text-soft);
  font-size: var(--step-1);
  line-height: 1.6;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin: 0;
  padding: 0;
  list-style: none;
}
.chips li {
  padding: var(--space-2xs) var(--space-s);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-latin);
  font-size: var(--step--1);
  line-height: 1.5;
  color: var(--text-soft);
}

/* ---------- 服務 ---------- */
.service {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(24px, 5vw, 72px);
  align-items: center;
  padding-block: clamp(40px, 6vw, 80px);
  border-top: 1px solid var(--line);
}
.service:last-child { border-bottom: 1px solid var(--line); }
/* 偶數列圖片換到右邊：欄寬也一起對調，讓文字永遠在寬的那一欄，不會被擠窄 */
.service:nth-of-type(even) { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.service:nth-of-type(even) .service-media { order: 2; }

.service-media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-m);
  background: var(--bg);
}
.service-body h3 {
  font-size: var(--step-2);
  font-weight: 900;
}
.service-body > p {
  max-width: var(--measure);
  margin-top: var(--space-m);
  color: var(--text);
}
/* 段落 → 條列 → 規格，三段之間留出明顯的間隔，不要黏成一團 */
.service-body .ticks { max-width: var(--measure); margin-top: var(--space-l); }
.service-facts {
  display: grid;
  max-width: var(--measure);
  margin: var(--space-xl) 0 0;
}
.service-facts div {
  display: grid;
  grid-template-columns: 5.5em 1fr;
  gap: var(--space-m);
  padding-block: var(--space-s);
  border-top: 1px dashed var(--line);
}
.service-facts dt {
  color: var(--copper);
  font-weight: 700;
  font-size: 0.9375rem;
}
.service-facts dd {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9375rem;
  line-height: 1.7;
  text-wrap: pretty;
}

/* ---------- 案例 ---------- */
.case-hero img {
  width: 100%;
  aspect-ratio: 21 / 9;
  object-fit: cover;
  border-radius: var(--radius-m);
}
.case-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: clamp(32px, 6vw, 88px);
  margin-top: clamp(40px, 6vw, 64px);
}
.case-story { max-width: var(--measure); }
.case-story h3 {
  margin-top: var(--space-2xl);
  font-size: var(--step-1);
  color: var(--copper);
}
.case-story h3:first-child { margin-top: 0; }
.case-story p { margin-top: var(--space-s); }

/* 條列：銅色圓點 + 項目之間一條細線（只畫在兩項之間，頭尾不畫，避免和下面的線疊成兩條） */
.ticks {
  margin: var(--space-xs) 0 0;
  padding: 0;
  list-style: none;
}
.ticks li {
  position: relative;
  padding: var(--space-s) 0 var(--space-s) 30px;
  line-height: 1.7;
  text-wrap: pretty;  /* 避免最後一行只剩一兩個字 */
}
.ticks li + li { border-top: 1px solid var(--line); }
.ticks li::before {
  content: "";
  position: absolute;
  /* 對齊第一行文字的中線：上內距 + 半個行高 − 半個圓 */
  left: 2px; top: calc(var(--space-s) + 0.85em - 6px);
  width: 12px; height: 12px;
  border: 2px solid var(--copper);
  border-radius: 50%;
}

.case-facts {
  align-self: start;
  padding: var(--space-xl);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}
.case-facts dl { margin: 0; }
.case-facts dl div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-m);
  padding: var(--space-s) 0;
  border-bottom: 1px solid var(--line);
}
.case-facts dl div:first-child { padding-top: 0; }
.case-facts dt { color: var(--text-soft); font-size: 0.9375rem; }
.case-facts dd {
  margin: 0;
  font-family: var(--font-latin);
  font-weight: 700;
  font-size: var(--step-1);
  color: var(--text);
  white-space: nowrap;
}
.case-facts h4 {
  margin: var(--space-xl) 0 var(--space-s);
  font-size: 0.9375rem;
  color: var(--copper);
}
.case-facts p { color: var(--text-soft); font-size: 0.9375rem; }
.case-facts .chips li {
  border-color: var(--line);
  color: var(--text);
}

/* 後端的第二個案子：小卡片，不放圖 */
.mini-case {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: clamp(20px, 5vw, 64px);
  align-items: center;
  margin-top: clamp(56px, 8vw, 96px);
  padding: clamp(24px, 3.5vw, 40px);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}
.mini-case h3 { font-size: var(--step-1); }
.mini-case p { max-width: var(--measure); margin-top: var(--space-s); color: var(--text-soft); }

/* ---------- 實驗室 ---------- */
.lab-feature {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
}
.lab-feature + .lab-feature {
  margin-top: clamp(56px, 8vw, 104px);
}
.lab-feature-flip { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.lab-feature-flip .lab-feature-media { order: 2; }
.lab-feature-media img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: var(--radius-m);
}
.lab-feature-body h3 {
  font-size: var(--step-2);
  font-weight: 900;
}
.lab-feature-body > p { margin-top: var(--space-m); }
.lab-feature-body .chips { margin-top: var(--space-l); }

.lab-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(32px, 5vw, 72px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.lab-list li {
  padding: var(--space-l) 0 var(--space-xl);
  border-top: 1px solid var(--line);
}
.lab-list h3 { font-size: var(--step-1); }
.lab-list p { margin-top: var(--space-xs); color: var(--text-soft); }
.lab-list .lab-tech {
  margin-top: var(--space-s);
  font-family: var(--font-latin);
  font-size: var(--step--1);
  color: var(--copper);
}

/* ---------- 板子比較表（放在邊緣作品裡） ---------- */
.boards { margin-top: clamp(72px, 10vw, 128px); }
.boards-title {
  font-size: var(--step-2);
  font-weight: 900;
}
.boards-lead {
  max-width: var(--measure);
  margin: var(--space-s) 0 var(--space-xl);
  color: var(--text-soft);
}
.board-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  overflow: hidden;
  background: var(--bg-2);
}
.board-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.65;
}
.board-table th,
.board-table td {
  padding: var(--space-l) var(--space-m);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
/* 表格左右兩端多留一點，不要貼著外框（只在真正是表格的寬度才需要） */
@media (min-width: 961px) {
  .board-table tr > :first-child { padding-left: var(--space-l); }
  .board-table tr > :last-child { padding-right: var(--space-l); }
}
.board-table tbody tr:last-child > * { border-bottom: 0; }
.board-table thead th {
  padding-block: var(--space-m);
  background: var(--bg-3);
  color: var(--text-soft);
  font-weight: 700;
  font-size: 0.875rem;
  white-space: nowrap;
}
/* 欄寬：字最多的「AI 怎麼加速」給最寬，短欄位（價格、耗電）收窄，
   各列高度才會平均，不會有一格擠成四行、旁邊一格只有一行 */
.board-table thead th:nth-child(1) { width: 14%; }
.board-table thead th:nth-child(2) { width: 32%; }
.board-table thead th:nth-child(3) { width: 21%; }
.board-table thead th:nth-child(4) { width: 14%; }
.board-table thead th:nth-child(5) { width: 7%; }
.board-table thead th:nth-child(6) { width: 12%; }
.board-table tbody th {
  white-space: nowrap;
  font-size: var(--step-1);
  font-weight: 900;
  line-height: 1.3;
  color: var(--text);
}
.board-sub {
  display: inline-block;
  margin-top: var(--space-2xs);
  font-family: var(--font-latin);
  font-size: var(--step--1);
  font-weight: 500;
  color: var(--copper);
}
.board-table td { color: var(--text-soft); text-wrap: pretty; }
.board-table td:nth-child(3) { color: var(--text); }
.board-table td:nth-child(4) { font-family: var(--font-latin); }
.board-table td:nth-child(5) { white-space: nowrap; }
.board-table td:nth-child(6) { text-wrap: balance; }
.boards-note {
  max-width: var(--measure);
  margin-top: var(--space-l);
  color: var(--text-soft);
}

/* ---------- 其他作品 ---------- */
.others { padding-top: var(--section-y); }

/* ---------- 流程（真的是順序，所以有編號） ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps li {
  position: relative;
  padding: 56px var(--space-xl) 0 0;
  counter-increment: step;
}
/* 像電路走線：一條銅線串起四個接點 */
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--copper);
  color: var(--copper);
  font-family: var(--font-latin);
  font-weight: 700;
  font-size: 0.9375rem;
  z-index: 1;
}
.steps li::after {
  content: "";
  position: absolute;
  left: 36px; right: 0; top: 17px;
  height: 2px;
  background: var(--copper);
  opacity: .5;
}
.steps li:last-child::after { display: none; }
.steps h3 { font-size: var(--step-1); }
.steps p { margin-top: var(--space-s); color: var(--text-soft); }

/* ---------- 關於 + FAQ ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 6fr);
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
}
.about-text h2 {
  font-size: var(--step-3);
  font-weight: 900;
}
.about-text p { max-width: var(--measure); margin-top: 18px; }
.about-media img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: var(--radius-m);
}

.faq {
  margin-top: clamp(72px, 10vw, 120px);
}
.faq h2 {
  margin-bottom: var(--space-l);
  font-size: var(--step-2);
  font-weight: 900;
}
.faq details {
  max-width: 52em;
  border-top: 1px solid var(--line);
}
.faq details:last-of-type { border-bottom: 1px solid var(--line); }
.faq summary {
  position: relative;
  padding: 20px 48px 20px 0;
  font-weight: 700;
  font-size: var(--step-1);
  line-height: 1.5;
  text-wrap: balance;  /* 問題換行時兩行等長，不會剩「嗎？」掛在第二行 */
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  position: absolute;
  right: 6px; top: 50%;
  width: 12px; height: 12px;
  border-right: 2px solid var(--copper);
  border-bottom: 2px solid var(--copper);
  transform: translateY(-70%) rotate(45deg);
  transition: transform .2s;
}
.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq details p {
  max-width: var(--measure);
  padding-bottom: 24px;
  color: var(--text-soft);
}

/* ---------- 聯絡 ---------- */
.contact { padding-block: var(--section-y); }
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(40px, 7vw, 96px);
  align-items: start;
}
.contact-intro h2 {
  font-size: var(--step-3);
  font-weight: 900;
}
.contact-intro > p { margin-top: 16px; color: var(--text-soft); }
.contact-intro .contact-email {
  margin-top: 32px;
  margin-bottom: 16px;
  font-family: var(--font-latin);
  font-size: clamp(1.25rem, 0.9rem + 1.6vw, 1.875rem);
  font-weight: 700;
  word-break: break-all;
}
.contact-email a { color: var(--copper); }
.copy-status {
  display: inline-block;
  margin-left: 12px;
  color: var(--signal);
  font-size: var(--step--1);
}

.contact-form {
  display: grid;
  gap: var(--space-l);
  padding: clamp(24px, 4vw, 40px);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}
.field { display: grid; gap: var(--space-xs); }
.field label { font-weight: 700; font-size: 0.9375rem; }
.optional { font-weight: 400; color: var(--text-soft); }
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--bg-3);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  line-height: 1.6;
}
.field textarea { resize: vertical; min-height: 140px; }
.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--copper) 50%),
                    linear-gradient(135deg, var(--copper) 50%, transparent 50%);
  background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 40px;
}
.field input::placeholder,
.field textarea::placeholder { color: #7C948A; }
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--copper); }
.field [aria-invalid="true"] { border-color: var(--signal); }

.form-error {
  padding: 10px 14px;
  border-left: 3px solid var(--signal);
  background: color-mix(in srgb, var(--signal) 10%, transparent);
  color: var(--text);
  font-size: 0.9375rem;
}
.contact-form .btn { justify-self: start; }
.form-note { color: var(--text-soft); font-size: var(--step--1); }

/* ---------- 頁尾 ---------- */
.site-footer {
  padding-block: 28px;
  border-top: 1px solid var(--line);
  color: var(--text-soft);
  font-size: var(--step--1);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-footer .brand { color: var(--text); font-size: 1rem; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--text-soft); }
.footer-links a:hover { color: var(--copper); }

/* ---------- 平板 ---------- */
@media (max-width: 960px) {
  .case-grid,
  .about-grid,
  .contact-grid { grid-template-columns: 1fr; }
  .lab-feature,
  .lab-feature-flip { grid-template-columns: 1fr; }
  .lab-feature-flip .lab-feature-media { order: 0; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--space-2xl); }
  .steps li:nth-child(2)::after { display: none; }
  .case-facts { max-width: 560px; }
  .mini-case { grid-template-columns: 1fr; }

  /* 主要業務：平板寬度改成兩欄等寬、靠上對齊；規格的標題放到內容上面，文字欄才夠寬 */
  .service,
  .service:nth-of-type(even) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
  .service-facts div { grid-template-columns: 1fr; gap: var(--space-2xs); }

  /* 比較表：六欄在平板寬度會擠成一格十幾行，所以從平板就改成一塊一塊 */
  .board-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .board-table,
  .board-table tbody,
  .board-table tr,
  .board-table th,
  .board-table td { display: block; width: auto; }
  .board-table tbody tr { border-bottom: 1px solid var(--line); }
  .board-table tbody tr:last-child { border-bottom: 0; }
  .board-table tbody th {
    padding: var(--space-m) var(--space-l);
    border-bottom: 1px solid var(--line);
    background: var(--bg-3);
  }
  .board-table tbody th br { display: none; }
  .board-sub { margin-left: var(--space-xs); }
  .board-table td {
    display: grid;
    grid-template-columns: 7em 1fr;
    gap: var(--space-m);
    padding: var(--space-xs) var(--space-l);
    border-bottom: 0;
    white-space: normal !important;
  }
  .board-table th + td { padding-top: var(--space-m); }
  .board-table td:last-child { padding-bottom: var(--space-l); }
  .board-table td::before {
    content: attr(data-label);
    font-family: var(--font-zh);
    font-weight: 700;
    color: var(--copper);
  }
}

/* ---------- 手機 ---------- */
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .site-nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px var(--gutter) 20px;
    background: var(--bg);
    box-shadow: 0 1px 0 var(--line);
  }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: 12px 8px; font-size: 1.0625rem; }
  .site-nav .nav-cta { margin: 8px 0 0; text-align: center; }
  .site-header:has(.site-nav.is-open) { background: var(--bg); }

  /* Hero 改為上下排：先文字、後圖片，偵測框跟著圖一起縮放 */
  .hero {
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
  }
  .hero-scene {
    position: relative;
    order: 2;
    height: auto;
    aspect-ratio: 3 / 2;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14%, #000 80%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 14%, #000 80%, transparent 100%);
  }
  .hero-shade { display: none; }
  /* 手機上圖縮小了，標籤字放大才看得到；樓房的框太小就先藏起來 */
  .det-tag-in { transform: scale(2.2); }
  .det[style*="--d: 2"] .det-tag-in { transform-origin: 226px 0; }
  .det[style*="--d: 1"] { display: none; }
  .hero-content { padding-top: 104px; padding-bottom: 32px; }
  .hero-lead { font-size: 1.125rem; }
  .hero-actions .btn { flex: 1 1 100%; }

  .service,
  .service:nth-of-type(even) { grid-template-columns: 1fr; gap: var(--space-l); }
  .service:nth-of-type(even) .service-media { order: 0; }

  .case-hero img { aspect-ratio: 3 / 2; }
  .lab-list { grid-template-columns: 1fr; }

  /* 比較表的卡片在手機上收窄一點內距，標籤欄也縮小 */
  .board-table tbody th { padding: var(--space-m) 18px; }
  .board-table td {
    grid-template-columns: 6.5em 1fr;
    gap: var(--space-s);
    padding-inline: 18px;
  }

  .steps { grid-template-columns: 1fr; row-gap: 0; }
  .steps li { padding: 0 0 var(--space-xl) 56px; }
  .steps li::after {
    left: 17px; right: auto; top: 36px; bottom: 0;
    width: 2px; height: auto;
  }
  .steps li:nth-child(2)::after { display: block; }
  .steps li:last-child { padding-bottom: 0; }
  .steps li:last-child::after { display: none; }

  .contact-form .btn { justify-self: stretch; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

/* ---------- 減少動態 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .det-box { animation: none; stroke-dashoffset: 0; }
  .det-tag { animation: none; opacity: 1; }
  * { transition: none !important; }
}
