/*
 * 對外頁面共用的外框：首頁、法律與政策、註冊、登入、404 都載這一份（src/site.js 的 siteHeader／siteFooter）。
 * 品牌的色彩、圓角、字體、卡片樣式在這裡定義一次；首頁（home.css）、法律頁（legal.css）、註冊登入（/static/site.css）都用這組。
 * 收斂：字標單色、不用漸層、光暈、彩色陰影；主按鈕實心；層次靠留白、字級字重、對齊與細分隔線。
 * 這份會跟 /static/site.css（服務頁的元素樣式）一起載入，所以外框自己的元素把邊距、字級都寫死，不吃那邊的 h2、p 規則。
 */

:root {
  --bg: #F6F6F7;
  --surface: #FFFFFF;
  --surface2: #F2F3F5;
  --line: #ECECEF;
  --ink: #0A0C10;
  --ink2: #33363D;
  --ink3: #53575F;
  --acc: #2481CC;
  --acc-ink: #1A66A3;
  --acc-tint: rgba(36, 129, 204, .10);
  --btn: #1D6BB2;
  --btn-hover: #175994;
  --r-tag: 6px;
  --r-btn: 14px;
  --r-card: 24px;
  --r-panel: 32px;
  /* 卡片只有兩種高度：
     --sh-card：放在畫布上的白卡（步驟、情境、功能、FAQ、法律頁的目錄與表格、註冊登入）。一圈極淡的中性細線定出邊緣，加一層很淡的陰影；
     --sh3：浮在其他內容上面的東西（首頁示意畫面的對話面板與推播、手機選單）。
     --sh1 只給卡片裡面的小元件（訊息泡泡、金鑰列）。 */
  --edge: rgba(10, 12, 16, .06);
  --sh-card: 0 0 0 1px var(--edge), 0 1px 2px rgba(10, 12, 16, .04), 0 4px 14px rgba(10, 12, 16, .035);
  --sh1: 0 1px 2px rgba(0, 0, 0, .04), 0 2px 8px rgba(0, 0, 0, .04);
  --sh3: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .07), 0 28px 56px -16px rgba(0, 0, 0, .12);
  --font: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gutter: 24px;
  --header-h: 68px;
  color-scheme: light;
}

html {
  -webkit-text-size-adjust: 100%;
  /* 錨點（首頁區塊、法律頁章節）不要被黏住的頁首蓋住 */
  scroll-padding-top: calc(var(--header-h) + 20px);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

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

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

.skip {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  padding: 12px 16px;
  border-radius: var(--r-btn);
  background: var(--surface);
  box-shadow: var(--sh3);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- 頁首 ---------- */

.hd {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(246, 246, 247, .84);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(10, 12, 16, .06);
  font-family: var(--font);
}

.hd-in {
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--header-h);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ink);
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.logo img { display: block; width: 34px; height: 34px; }

.hd-nav {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 2px;
}

.hd-nav a,
.hd-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin: 0;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--ink2);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.hd-nav a:hover,
.hd-link:hover { color: var(--ink); background: rgba(10, 12, 16, .05); }
.hd .ic { display: block; flex: none; }

.hd-act {
  display: flex;
  align-items: center;
  gap: 2px;
}
.hd-form { display: flex; margin: 0; }

/* 頁首的主按鈕：實心、沒有外發光 */
.hd-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-left: 8px;
  padding: 0 18px;
  border-radius: var(--r-btn);
  background: var(--btn);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s ease;
}
.hd-cta:hover { background: var(--btn-hover); }

.hd-menu { display: none; }

.hd-menu > summary {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-left: 8px;
  border-radius: var(--r-btn);
  background: var(--surface);
  box-shadow: var(--sh-card);
  color: var(--ink);
  list-style: none;
  cursor: pointer;
}
.hd-menu > summary::-webkit-details-marker { display: none; }
.hd-menu[open] .i-open,
.hd-menu:not([open]) .i-close { display: none; }

.hd-sheet {
  position: absolute;
  top: calc(100% + 8px);
  left: var(--gutter);
  right: var(--gutter);
  z-index: 45;
  display: grid;
  padding: 8px;
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--sh3);
}
.hd-sheet a,
.hd-sheet .sheet-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r-btn);
  background: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.hd-sheet .sheet-link:last-child { color: var(--ink2); }
.hd-sheet a:hover,
.hd-sheet .sheet-link:hover { background: var(--surface2); }
.hd-sheet .hd-form { display: grid; }
.hd-sheet hr {
  height: 1px;
  margin: 6px 12px;
  border: 0;
  background: var(--line);
}

@media (max-width: 960px) {
  /* 手機選單是 <details>，點錨點不會自己收起來；頁首不跟著捲，選單就會跟著頁首一起捲走 */
  .hd { position: relative; }
  html { scroll-padding-top: 16px; }
  .hd-nav,
  .hd-act .hd-link,
  .hd-act > .hd-form { display: none; }
  .hd-act { margin-left: auto; }
  .hd-menu { display: block; }
}

/* ---------- 頁尾 ---------- */

.ft {
  padding: 56px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--ink3);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
}
.ft p { margin: 0; }

.ft-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, .8fr) minmax(0, 1.2fr);
  gap: 32px;
}

.ft-brand > p { margin-top: 8px; text-wrap: pretty; }
.ft-lang {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-top: 8px;
  color: var(--ink2);
  text-decoration: none;
}
.ft-lang:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.ft .ic { display: block; flex: none; }

.ft-h {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0;
}

.ft-addr { font-style: normal; line-height: 1.6; }
.ft-addr p + p { margin-top: 6px; }
.ft-strong { color: var(--ink2); font-weight: 600; }
.ft-k { display: block; color: var(--ink3); font-size: 13px; }
.ft-addr a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: -12px 0 -10px;
  color: var(--ink2);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.ft ul { margin: 0; padding: 0; list-style: none; }
.ft li a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--ink2);
  text-decoration: none;
}
.ft-addr a:hover,
.ft li a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

.ft .ft-bottom {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

/* 桌機用滑鼠點，連結列 32px 就夠（仍大於 24px 的最小點擊範圍）；四欄並排時頁尾不必被最長的那欄拉高。平板與手機維持 40px。 */
@media (min-width: 1081px) {
  .ft li a { min-height: 32px; }
}

@media (max-width: 1080px) {
  .ft-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  :root { --gutter: 20px; --header-h: 64px; }
  .logo { font-size: 20px; }
  .logo img { width: 32px; height: 32px; }
  .ft-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 16px; }
  .ft-brand,
  .ft-grid > div { grid-column: 1 / -1; }
}

@media (max-width: 380px) {
  .hd-cta { padding: 0 14px; }
}

@media print {
  .skip, .hd-nav, .hd-act, .ft-grid > nav, .ft-lang { display: none !important; }
  .hd { position: static; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .ft { padding: 24px 0 0; }
  .ft-grid { grid-template-columns: 1fr 1fr; }
}
