/* 知凡科技 xdr.tw — 企業信賴 × 精準藍圖
   設計 token 與規則見 docs/DESIGN.md */

:root {
  --ink: #0B1324;
  --cobalt: #1D4ED8;
  --cobalt-strong: #1E3A8A;
  --cobalt-light: #93B4FF;
  --tint: #E8EEFC;
  --bg: #F3F5F8;
  --white: #FFFFFF;
  --text-2: #2D3748;
  --muted: #4A5568;
  --on-dark: #C7D0DD;
  --line: #DCE1E8;
  --line-2: #C9D1DC;
  --field: #6B7A90;
  --error: #B42318;
  /* 輔助色：只用在固定位置，不另作他用 */
  --cobalt-active: #172E6E;
  --cobalt-soft: #C4D2F5;
  --sum-bg: #F8FAFC;
  --nav-line: #EDF0F4;
  --bp-grid: #E4E8EE;
  --hero-bg: #111A2E;
  --hero-grid: #1C2740;
  --on-dark-strong: #E2E8F0;
  --dark-line: #243049;
  --font-sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --r-ctl: 6px;
  --r-card: 8px;
}

html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body { margin: 0; background: var(--bg); }
a { color: var(--cobalt); }
a:hover { color: var(--cobalt-strong); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.z { font-family: var(--font-sans); color: var(--ink); background: var(--bg); font-size: 16px; line-height: 1.8; -webkit-font-smoothing: antialiased; }
.z *, .z *::before, .z *::after { box-sizing: border-box; }
.z :focus-visible { outline: 3px solid var(--cobalt); outline-offset: 3px; }
.dk :focus-visible { outline-color: var(--cobalt-light); }

.mono, .en { font-family: var(--font-mono); }
.en { font-weight: 500; letter-spacing: .1em; text-transform: uppercase; font-size: 12px; color: var(--cobalt); margin: 0; }
.en-dk { color: var(--cobalt-light); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 40px; }

.skip { position: absolute; left: 16px; top: -90px; z-index: 50; background: var(--white); color: var(--ink); padding: 12px 16px; border: 2px solid var(--cobalt); }
.skip:focus { top: 12px; }

/* 頂部聯絡列：目前頁面未使用，聯絡電話與信箱確定後恢復（見 docs/TODO.md） */
.util { background: var(--ink); color: var(--on-dark); font-size: 13px; }
.util .wrap { display: flex; justify-content: flex-end; gap: 24px; padding-top: 6px; padding-bottom: 6px; }

/* 頁首 */
.hdr { position: sticky; top: 0; z-index: 20; background: var(--white); border-bottom: 1px solid var(--line); }
.hdr-in { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 80px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; min-height: 44px; }
.brand:hover { color: var(--ink); }
.brand-txt { display: flex; flex-direction: column; line-height: 1.2; }
.brand-zh { font-size: 21px; font-weight: 900; letter-spacing: .1em; }
.brand-en { font-size: 12px; letter-spacing: .14em; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 32px; font-size: 16px; font-weight: 500; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); text-decoration: none; }
.nav a:hover { color: var(--cobalt); }
.nav a.btn, .nav a.btn:hover { color: var(--white); }
.menu-btn { display: none; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; background: var(--white); border: 1px solid var(--field); border-radius: var(--r-ctl); color: var(--ink); font: inherit; font-size: 15px; cursor: pointer; }

/* 按鈕 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 14px; min-height: 50px; padding: 0 26px; border: 1px solid var(--cobalt); border-radius: var(--r-ctl); background: var(--cobalt); color: var(--white); font: inherit; font-size: 16px; font-weight: 700; text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s, color .15s; }
.btn:hover { background: var(--cobalt-strong); border-color: var(--cobalt-strong); color: var(--white); }
.btn:active { background: var(--cobalt-active); }
.btn-ghost { background: transparent; border-color: rgba(255, 255, 255, .7); color: var(--white); }
.btn-ghost:hover { background: rgba(255, 255, 255, .1); border-color: var(--white); color: var(--white); }
.btn-line { background: var(--white); color: var(--ink); border-color: var(--field); }
.btn-line:hover { background: var(--tint); border-color: var(--cobalt); color: var(--ink); }
.btn-sm { min-height: 44px; padding: 0 18px; font-size: 15px; }

/* 區塊共用 */
.sec { padding: 96px 0; }
.sec-white { background: var(--white); border-top: 1px solid var(--line); }
.sec-line { border-top: 1px solid var(--line); }
.h2 { font-size: 36px; font-weight: 900; line-height: 1.4; letter-spacing: .02em; margin: 10px 0 0; }
/* 標題以片語為單位換行：放不下時只在逗號後斷行，避免單字落到下一行 */
.h2 .ph { display: inline-block; max-width: 100%; }
.lead { font-size: 17px; color: var(--muted); margin: 0; max-width: 34em; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 48px; margin-bottom: 44px; }

/* 主視覺 */
.hero { background: var(--ink); color: var(--white); overflow: hidden; }
/* 超寬螢幕時照片變寬，高度隨之增加，避免格點上緣被裁掉 */
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: max(600px, 31vw); }
.hero-txt { padding: 96px 56px 112px 0; align-self: center; }
.h1 { font-size: clamp(34px, 4vw, 54px); font-weight: 900; line-height: 1.38; letter-spacing: .02em; margin: 20px 0 24px; }
.h1 em { font-style: normal; color: var(--cobalt-light); }
.hero-lead { font-size: 17px; color: var(--on-dark); margin: 0; max-width: 30em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; }
/* 主視覺圖片：深色底＋藍圖網格作為載入前底色；左緣漸層與左側文字區銜接
   桌面版延伸到視窗右緣（超出捲軸的部分由 .hero 裁掉） */
.hero-photo { position: relative; overflow: hidden; margin-right: calc(-1 * max(40px, (100vw - 1200px) / 2 + 40px)); background-color: var(--hero-bg); background-image: linear-gradient(var(--hero-grid) 1px, transparent 1px), linear-gradient(90deg, var(--hero-grid) 1px, transparent 1px); background-size: 48px 48px; }
.hero-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 55% 40%; display: block; }
.hero-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--ink) 0, rgba(11, 19, 36, 0) 22%); pointer-events: none; }

/* 服務入口列 */
.entry { position: relative; margin-top: -56px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--white); border-radius: var(--r-card); border-top: 3px solid var(--cobalt); box-shadow: 0 6px 24px rgba(11, 19, 36, .1); overflow: hidden; }
.entry a { display: block; padding: 22px 26px; color: var(--ink); text-decoration: none; border-right: 1px solid var(--line); }
.entry a:last-child { border-right: 0; }
.entry a:hover { background: var(--tint); }
.entry a:focus-visible { outline-offset: -3px; }
.entry b { display: block; font-size: 17px; margin-top: 2px; }

/* 常見困擾 */
.qgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.qcard { background: var(--white); border-top: 3px solid var(--ink); padding: 22px 24px 18px; display: flex; flex-direction: column; }
.qcard:hover { border-top-color: var(--cobalt); }
.qnum { font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: .1em; color: var(--cobalt); margin-bottom: 14px; }
.ic { width: 44px; height: 44px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.qcard h3 { font-size: 18px; font-weight: 700; line-height: 1.55; margin: 18px 0 8px; }
.qcard p { margin: 0; font-size: 15px; color: var(--muted); flex: 1; }
.qcard a { display: inline-flex; align-items: center; min-height: 44px; margin-top: 10px; font-size: 15px; font-weight: 500; text-decoration: none; }
.qcard a:hover { text-decoration: underline; }

/* 服務分頁 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-top: 8px; }
.tab { min-height: 56px; padding: 0 22px; font: inherit; font-size: 16px; font-weight: 500; color: var(--muted); background: transparent; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); font-weight: 700; border-bottom-color: var(--cobalt); }
.tab .mono { font-size: 12px; color: var(--cobalt); margin-right: 8px; }
[role="tabpanel"]:focus-visible { outline-offset: 8px; }
.panel-head { display: flex; align-items: baseline; gap: 16px; margin: 32px 0 20px; }
.panel-head h3 { font-size: 24px; font-weight: 900; margin: 0; }
.panel-head p { color: var(--muted); font-size: 16px; margin: 0; }
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.col { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-card); padding: 26px; }
.col h4 { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; margin: 0 0 12px; }
.col h4 span { width: 26px; height: 26px; background: var(--ink); color: var(--white); font-family: var(--font-mono); font-size: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
.col ul { margin: 0; padding-left: 1.2em; font-size: 15px; color: var(--text-2); line-height: 1.9; }
.col.del { background: var(--bg); border-color: var(--cobalt-soft); }
.col.del h4 span { background: var(--cobalt); }

/* 顧問方法（藍圖網格） */
.bp { background-color: var(--bg); background-image: linear-gradient(var(--bp-grid) 1px, transparent 1px), linear-gradient(90deg, var(--bp-grid) 1px, transparent 1px); background-size: 120px 120px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.appr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; align-items: start; }
.appr-lead { margin: 16px 0 28px; }
.pr { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 16px; padding: 22px 0; border-top: 1px solid var(--line-2); }
.pr-last { border-bottom: 1px solid var(--line-2); }
.pr .mono { font-size: 14px; color: var(--cobalt); padding-top: 3px; }
.pr h3 { font-size: 19px; font-weight: 700; margin: 0 0 6px; }
.pr p { margin: 0; font-size: 15px; color: var(--muted); }
.pr .how { margin-top: 10px; padding: 10px 14px; background: var(--white); border-left: 3px solid var(--cobalt); color: var(--text-2); font-size: 14px; }
.how b { color: var(--cobalt); font-weight: 700; margin-right: 8px; }
.mx-card { margin: 0; background: var(--white); border: 1px solid var(--ink); padding: 28px; }
.mx-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.mx-note { font-size: 13px; color: var(--muted); }
.mx { display: grid; grid-template-columns: 88px repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--ink); border-left: 1px solid var(--line); }
.mx > div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); height: 56px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.mx .h { height: 42px; font-size: 13px; color: var(--muted); background: var(--bg); }
.mx .r { justify-content: flex-start; padding-left: 14px; font-weight: 700; background: var(--bg); }
.f, .p, .e { display: inline-block; width: 16px; height: 16px; }
.f { background: var(--cobalt); }
.p { background: linear-gradient(90deg, var(--cobalt) 50%, var(--white) 50%); border: 1px solid var(--cobalt); }
.e { border: 1px solid var(--field); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 16px; font-size: 13px; color: var(--muted); }
.legend span { display: flex; gap: 6px; align-items: center; }
.legend i { width: 12px; height: 12px; }
.mx-card figcaption { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; color: var(--text-2); }

/* 合作流程 */
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); list-style: none; margin: 0; padding: 0; }
.step { position: relative; border-top: 2px solid var(--ink); padding: 30px 28px 0 0; }
.step::before { content: ""; position: absolute; top: -7px; left: 0; width: 12px; height: 12px; background: var(--cobalt); }
.step .mono { font-size: 12px; letter-spacing: .1em; color: var(--cobalt); font-weight: 500; }
.step h3 { font-size: 20px; font-weight: 700; margin: 6px 0 8px; }
.step p { margin: 0; font-size: 15px; color: var(--muted); }
.step .get { margin-top: 18px; padding-top: 12px; border-top: 1px dashed var(--line-2); color: var(--ink); }
.get span { display: block; font-size: 13px; font-weight: 700; color: var(--cobalt); }
.scope { display: flex; justify-content: space-between; align-items: center; gap: 32px; margin-top: 48px; padding: 22px 28px; background: var(--bg); border-radius: var(--r-card); font-size: 15px; color: var(--muted); }
.scope p { margin: 0; }
.scope b { display: block; color: var(--ink); }
.scope a { white-space: nowrap; font-weight: 700; min-height: 44px; display: inline-flex; align-items: center; }

/* 關於知凡 */
.about { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 72px; margin-top: 96px; padding-top: 56px; border-top: 1px solid var(--line); }
.about p { color: var(--text-2); margin: 0 0 16px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.tags span { border: 1px solid var(--cobalt-soft); background: var(--tint); border-radius: 4px; padding: 3px 12px; font-size: 14px; color: var(--cobalt-strong); }

/* 需求洽詢 */
.ct { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 64px; align-items: start; }
.ct-lead { margin-top: 16px; }
.prep-title { margin: 28px 0 0; font-weight: 700; }
.prep { margin: 8px 0 0; padding-left: 1.2em; color: var(--text-2); font-size: 15px; }
.howto { list-style: none; margin: 28px 0 0; padding: 0; }
.howto li { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 14px 0; border-top: 1px solid var(--line-2); font-size: 15px; }
.howto .mono { color: var(--cobalt); font-weight: 500; }
.form { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-card); padding: 36px; }
.form h3 { font-size: 20px; font-weight: 700; margin: 0; }
.note { font-size: 14px; color: var(--text-2); margin: 10px 0 28px; padding: 12px 14px; background: var(--tint); border-left: 3px solid var(--cobalt); }
.fld { margin-bottom: 22px; }
.lbl { display: block; font-size: 15px; font-weight: 700; margin-bottom: 8px; padding: 0; }
.opt { font-weight: 400; color: var(--muted); font-size: 14px; }
.inp { width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid var(--field); border-radius: var(--r-ctl); background: var(--white); color: var(--ink); font: inherit; font-size: 16px; line-height: 1.6; }
.inp:hover { border-color: var(--ink); }
.inp::placeholder { color: var(--muted); opacity: 1; }
textarea.inp { min-height: 140px; resize: vertical; }
.inp[aria-invalid="true"] { border: 2px solid var(--error); }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.err { font-size: 14px; color: var(--error); margin: 6px 0 0; font-weight: 700; }
.fs { border: 0; margin: 0 0 22px; padding: 0; min-width: 0; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tile { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: var(--r-ctl); background: var(--white); font-size: 15px; cursor: pointer; line-height: 1.5; }
.tile:hover { border-color: var(--ink); }
.tile.on { border-color: var(--cobalt); background: var(--tint); box-shadow: inset 0 0 0 1px var(--cobalt); }
.tile input { accent-color: var(--cobalt); width: 18px; height: 18px; margin: 0; flex: none; }
.tile:focus-within { outline: 3px solid var(--cobalt); outline-offset: 3px; }
/* 支援 :has() 時，只在鍵盤聚焦時於卡片畫一層焦點框，避免與 radio 本身的框重疊 */
@supports selector(:has(a)) {
  .tile:focus-within { outline: none; }
  .tile:has(input:focus-visible) { outline: 3px solid var(--cobalt); outline-offset: 3px; }
  .tile input:focus-visible { outline: none; }
}
.result { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.result h4 { font-size: 16px; font-weight: 700; margin: 0 0 4px; }
.result .hint { margin: 0 0 10px; }
.sum { min-height: 220px; font-size: 15px; background: var(--sum-bg); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.status { margin: 14px 0 0; font-size: 14px; color: var(--cobalt-strong); min-height: 1.6em; font-weight: 500; }

/* 頁尾 */
.ft { background: var(--ink); color: var(--on-dark); font-size: 14px; padding: 48px 0 32px; }
.ft-top { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.ft-brand { display: flex; align-items: center; gap: 12px; }
.ft-brand b { color: var(--white); font-size: 18px; font-weight: 900; letter-spacing: .1em; }
.ft-links { display: flex; gap: 24px; flex-wrap: wrap; }
.ft-links a { color: var(--on-dark-strong); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.ft-links a:hover { color: var(--white); text-decoration: underline; }
.ft-bot { display: flex; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--dark-line); font-size: 13px; }

/* 響應式 */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .hero-txt { padding: 56px 0 40px; }
  /* 單欄時照片寬高比固定，確保 3×3 格點、塗滿的那一格與手都在畫面內 */
  .hero-photo { margin: 0 -40px; aspect-ratio: 2 / 1; }
  .hero-photo img { object-position: 55% 32%; }
  .hero-photo::after { background: linear-gradient(180deg, var(--ink) 0, rgba(11, 19, 36, 0) 16%); }
  .entry { margin-top: 0; border-radius: 0 0 var(--r-card) var(--r-card); grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entry a:nth-child(2) { border-right: 0; }
  .entry a:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .qgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols, .appr, .about, .ct { grid-template-columns: minmax(0, 1fr); }
  .appr, .about, .ct { gap: 40px; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 44px; }
  .head { flex-direction: column; align-items: flex-start; gap: 14px; }
}
@media (max-width: 860px) {
  .menu-btn { display: inline-flex; }
  .nav { display: none; position: absolute; top: 80px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; background: var(--white); border-bottom: 1px solid var(--line); padding: 8px 40px 20px; box-shadow: 0 12px 24px rgba(11, 19, 36, .08); }
  .nav.open { display: flex; }
  .nav a { padding: 12px 4px; border-bottom: 1px solid var(--nav-line); min-height: 52px; display: flex; align-items: center; }
  .nav a.btn { margin-top: 16px; padding: 0 18px; justify-content: space-between; border-bottom: 1px solid var(--cobalt); }
}
@media (max-width: 640px) {
  .wrap { padding: 0 20px; }
  .util { display: none; }
  .hdr-in { height: 68px; }
  html { scroll-padding-top: 84px; }
  .nav { top: 68px; padding: 8px 20px 20px; }
  .sec { padding: 64px 0; }
  .h2 { font-size: 28px; }
  .lead, .hero-lead { font-size: 16px; }
  .hero-photo { margin: 0 -20px; aspect-ratio: 3 / 2; }
  .entry b { font-size: 15px; }
  .entry a { padding: 16px; }
  .qgrid { grid-template-columns: minmax(0, 1fr); }
  .tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; border-bottom: 0; }
  .tab { border: 1px solid var(--line-2); border-radius: var(--r-ctl); margin: 0; font-size: 15px; padding: 0 12px; text-align: left; }
  .tab.on { border-color: var(--cobalt); background: var(--tint); box-shadow: inset 0 0 0 1px var(--cobalt); }
  .panel-head { flex-direction: column; gap: 2px; }
  .col { padding: 20px; }
  .mx { grid-template-columns: 64px repeat(4, minmax(0, 1fr)); }
  .mx .h { font-size: 13px; }
  .mx-card { padding: 18px; }
  .steps { grid-template-columns: minmax(0, 1fr); row-gap: 0; }
  .step { border-top: 0; border-left: 2px solid var(--ink); padding: 0 0 34px 26px; }
  .step::before { top: 4px; left: -7px; }
  .scope { flex-direction: column; align-items: flex-start; padding: 20px; }
  .about { margin-top: 64px; }
  .form { padding: 22px; }
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .hero-actions .btn { width: 100%; justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .z * { transition: none !important; }
}
