/* ==========================================================================
   富利發企業社 — 單頁形象網站
   手寫 CSS，無建置步驟。設計系統：Flat Design + Trust & Authority
   配色全數通過 WCAG AA（詳見 README.md 對比度表）
   ========================================================================== */

/* --- Design tokens ------------------------------------------------------ */
:root {
  /* 品牌色：teal-700 為主，白字對比 5.47:1 */
  --brand: #0F766E;
  --brand-dark: #115E59;
  --brand-bright: #14B8A6;   /* 僅用於裝飾與大字，勿承載小字白字 */
  --brand-tint: #F0FDFA;
  --brand-line: #99F6E4;

  --deep: #083344;           /* 深色區塊底：白字對比 13.4:1 */
  --deep-soft: #0B4457;

  --accent: #F59E0B;         /* 撥號 CTA：深字對比 8.31:1 */
  --accent-dark: #D97706;

  --ink: #0F172A;
  --ink-soft: #475569;
  --ink-muted: #64748B;

  --bg: #FFFFFF;
  --bg-soft: #F6FAFB;
  --line: #E2E8F0;

  --radius: 14px;
  --radius-lg: 22px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 2px 8px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .07), 0 12px 28px rgba(15, 23, 42, .06);
  --shadow-cta: 0 6px 18px rgba(217, 119, 6, .32);

  /* density 4/10 — marketing 頁面偏寬鬆 */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 40px;
  --space-5: 64px;
  --space-6: 96px;

  --header-h: 68px;

  /* 中文走系統字體（避免載入 5MB+ 的 Noto Sans TC），英數用 Figtree */
  --font: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI",
          "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Heiti TC",
          system-ui, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Roboto Mono", Menlo, monospace;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 { line-height: 1.3; letter-spacing: -.02em; margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { max-width: 100%; }
a { color: var(--brand-dark); }

.mono { font-family: var(--font-mono); letter-spacing: .02em; }

/* 電話號碼不准在行末被拆成兩行。
   ponytail: 用 CSS 而不是 &#8209; ——後者會讓使用者複製到 U+2011，
   貼進撥號程式可能失效。顯示問題就用顯示層解決。 */
a[href^="tel:"], .mono { white-space: nowrap; }

/* 可見的鍵盤焦點框 —— 不要拿掉 */
:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
  border-radius: 6px;
}

/* 深色區塊上必須換色：teal-700 對 #083344 只有 2.45:1，
   低於 WCAG 對非文字元素要求的 3:1，焦點框會幾乎看不見。 */
.section-dark :focus-visible,
.site-footer :focus-visible { outline-color: #5EEAD4; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 12px 20px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { left: 12px; top: 12px; }

.container {
  width: min(1140px, calc(100% - 2 * var(--space-3)));
  margin-inline: auto;
}

.ico { width: 20px; height: 20px; flex: none; }

/* --- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;            /* > 44px 觸控目標 */
  padding: 12px 22px;
  border: 2px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease,
              color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.btn:active { transform: translateY(1px); }

.btn-call {
  background: var(--accent);
  color: var(--ink);
  box-shadow: var(--shadow-cta);
}
.btn-call:hover { background: var(--accent-dark); }

.btn-ghost {
  background: transparent;
  color: var(--brand-dark);
  border-color: var(--brand-line);
}
.btn-ghost:hover { background: var(--brand-tint); border-color: var(--brand); }

.btn-lg { min-height: 56px; padding: 14px 30px; font-size: 1.0625rem; }
.btn-xl { min-height: 62px; padding: 16px 36px; font-size: 1.25rem; }

/* --- Header ------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, box-shadow .25s ease;
}
.site-header.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;              /* 觸控目標 */
  margin-right: auto;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--brand-bright), var(--brand));
  color: #fff;
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 1.0625rem; letter-spacing: .01em; }
.brand-text small { font-size: .7rem; color: var(--ink-muted); letter-spacing: .06em; }

.site-nav { display: flex; gap: var(--space-3); }
.site-nav a {
  position: relative;
  padding: 6px 2px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: .9375rem;
  text-decoration: none;
  transition: color .2s ease;
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .22s ease;
}
.site-nav a:hover { color: var(--brand-dark); }
.site-nav a:hover::after,
.site-nav a.is-active::after { transform: scaleX(1); }
.site-nav a.is-active { color: var(--brand-dark); }

.header-call { padding: 10px 18px; min-height: 44px; font-size: .9375rem; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}
.nav-toggle-bar {
  display: block;
  width: 20px;
  height: 2px;
  margin-inline: auto;
  border-radius: 2px;
  background: var(--ink);
  transition: transform .22s ease, opacity .18s ease;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* --- Hero --------------------------------------------------------------- */
.hero {
  position: relative;
  padding: clamp(56px, 9vw, 104px) 0 clamp(48px, 8vw, 88px);
  overflow: hidden;
  isolation: isolate;
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(760px 460px at 88% -8%, rgba(20, 184, 166, .18), transparent 62%),
    radial-gradient(620px 400px at 4% 0%, rgba(8, 145, 178, .13), transparent 60%),
    linear-gradient(180deg, var(--brand-tint) 0%, #ffffff 62%);
}
.hero-bg::after {
  /* 細緻網點：不用圖檔，避免額外請求 */
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(15, 118, 110, .10) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 72%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 72%);
}

.hero-inner { max-width: 820px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--space-3);
  padding: 8px 16px;
  border: 1px solid var(--brand-line);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-dark);
  font-size: .875rem;
  font-weight: 600;
}

.hero-title {
  font-size: clamp(2.125rem, 6.2vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -.03em;
  margin-bottom: var(--space-3);
}
.hero-title .accent {
  /* 兩端色距刻意收窄：手機上文字寬度變短，色差太大會讓開頭幾個字看起來像另一個顏色 */
  background: linear-gradient(95deg, var(--brand) 0%, #0E7490 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  max-width: 62ch;
  margin-bottom: var(--space-4);
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.6vw, 1.1875rem);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.hero-badges {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}
.hero-badges li { display: flex; flex-direction: column; }
.hero-badges strong {
  color: var(--brand-dark);
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 800;
  line-height: 1.2;
}
.hero-badges span { color: var(--ink-muted); font-size: .875rem; }

/* --- Section shell ------------------------------------------------------ */
.section { padding: clamp(56px, 8vw, var(--space-6)) 0; }
.section-dark { background: var(--deep); color: #fff; }
.section-contact { background: var(--bg-soft); }

.section-head { max-width: 700px; margin-bottom: var(--space-5); }
.section-tag {
  margin-bottom: 10px;
  color: var(--brand);
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .16em;
}
.section-head h2 {
  margin-bottom: var(--space-2);
  font-size: clamp(1.625rem, 4vw, 2.5rem);
  font-weight: 800;
}
.section-lede { color: var(--ink-soft); font-size: 1.0625rem; }

.section-dark .section-tag { color: #5EEAD4; }
.section-dark .section-lede { color: #CBD5E1; }

/* --- Service cards ------------------------------------------------------ */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-3);
}

.card {
  display: flex;
  flex-direction: column;
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--brand-line);
  box-shadow: var(--shadow-md);
}

.card-ico {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: var(--space-2);
  border-radius: 14px;
  background: var(--brand-tint);
  color: var(--brand);
}
.card-ico svg { width: 28px; height: 28px; }

.card h3 { margin-bottom: 8px; font-size: 1.25rem; font-weight: 700; }
.card > p { margin-bottom: var(--space-2); color: var(--ink-soft); font-size: .9375rem; }

.card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: var(--space-2);
  border-top: 1px dashed var(--line);
}
.card-list li {
  position: relative;
  padding-left: 24px;
  color: var(--ink-soft);
  font-size: .9375rem;
}
.card-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: .72em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-bright);
}

.services-note {
  margin-top: var(--space-4);
  padding: var(--space-2) var(--space-3);
  border-left: 4px solid var(--brand-bright);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--brand-tint);
  color: var(--brand-dark);
  font-weight: 600;
}

/* --- Service area ------------------------------------------------------- */
.section-area { background: var(--bg-soft); }

.area-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-2);
}
.area-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border: 1px solid var(--brand-line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--brand-dark);
  font-weight: 700;
}
.area-list li::before {
  content: "";
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--brand-bright);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, .18);
}

.area-note {
  margin-top: var(--space-3);
  color: var(--ink-muted);
  font-size: .9375rem;
}

/* --- Why us ------------------------------------------------------------- */
.why-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-3);
}
.why-item {
  padding: var(--space-3);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, .04);
  transition: background-color .25s ease, border-color .25s ease;
}
.why-item:hover {
  background: rgba(255, 255, 255, .07);
  border-color: rgba(94, 234, 212, .45);
}
.why-ico {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: var(--space-2);
  border-radius: 12px;
  background: rgba(94, 234, 212, .14);
  color: #5EEAD4;
}
.why-ico svg { width: 26px; height: 26px; }
.why-item h3 { margin-bottom: 8px; font-size: 1.125rem; font-weight: 700; }
.why-item p { color: #CBD5E1; font-size: .9375rem; }
.why-item strong { color: #fff; font-family: var(--font-mono); }

/* --- Process ------------------------------------------------------------ */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--space-3);
}
.step {
  position: relative;
  padding: var(--space-3) var(--space-2) var(--space-3) 0;
  border-top: 3px solid var(--line);
  transition: border-color .25s ease;
}
.step:hover { border-top-color: var(--brand); }
.step-num {
  display: block;
  margin-bottom: 10px;
  color: var(--brand-line);
  font-family: var(--font-mono);
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1;
}
.step h3 { margin-bottom: 8px; font-size: 1.125rem; font-weight: 700; }
.step p { color: var(--ink-soft); font-size: .9375rem; }

/* --- Contact ------------------------------------------------------------ */
.contact-inner {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: var(--space-5);
  align-items: center;
}
.contact-copy .section-lede { margin-bottom: var(--space-4); }

.contact-card {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-md);
}
.contact-card > div {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: var(--space-2);
  align-items: baseline;
  padding-bottom: var(--space-2);
  border-bottom: 1px dashed var(--line);
}
.contact-card > div:last-child { padding-bottom: 0; border-bottom: 0; }
.contact-card dt { color: var(--ink-muted); font-size: .875rem; }
.contact-card dd { margin: 0; font-weight: 700; }
.contact-card dd a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;              /* 觸控目標 */
  color: var(--brand-dark);
  text-decoration: none;
}
.contact-card dd a:hover { text-decoration: underline; }

/* --- Footer ------------------------------------------------------------- */
.site-footer {
  padding: var(--space-4) 0 calc(var(--space-4) + env(safe-area-inset-bottom));
  background: var(--deep);
  color: #CBD5E1;
}
.footer-inner { display: grid; gap: var(--space-2); }
.footer-brand { display: flex; flex-direction: column; }
.footer-brand strong { color: #fff; font-size: 1.125rem; }
.footer-brand span { font-size: .875rem; color: #94A3B8; }
.footer-nav { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); }
.footer-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;              /* 觸控目標 */
  color: #CBD5E1;
  font-size: .9375rem;
  text-decoration: none;
  transition: color .2s ease;
}
.footer-nav a:hover { color: #5EEAD4; }
.footer-meta { font-size: .9375rem; }
.footer-meta a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;              /* 觸控目標 */
  color: #5EEAD4;
  text-decoration: none;
}
.footer-copy {
  padding-top: var(--space-2);
  border-top: 1px solid rgba(255, 255, 255, .1);
  color: #94A3B8;
  font-size: .8125rem;
}

/* --- Sticky mobile call bar --------------------------------------------- */
.call-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 14px 20px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .25);
}
.call-bar:active { transform: translateY(1px); }

/* 主要撥號 CTA 還在畫面上時讓開（由 main.js 切換）。
   小螢幕上固定列會蓋住主視覺 CTA 七成以上，擋住的正是要轉換的那顆按鈕。 */
.call-bar.is-hidden {
  transform: translateY(150%);
  opacity: 0;
  pointer-events: none;
}
.call-bar { transition: transform .28s ease, opacity .2s ease; }

/* --- Scroll reveal ------------------------------------------------------ */
/* 內容預設就是看得見的。只有在 main.js 成功跑起來、確認 IntersectionObserver
   可用之後才會在 <html> 掛上 .js-anim，那時進場動畫才生效。
   反過來寫（預設 opacity:0，靠 JS 顯示）的話，main.js 一旦 404、被擋、或
   在舊瀏覽器丟例外，整頁內容就永遠不見 —— 而 <noscript> 只處理「JS 被關掉」，
   救不了「JS 載入失敗」。 */
.js-anim .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .45s ease, transform .45s ease;
}
.js-anim .reveal.is-visible { opacity: 1; transform: none; }

/* --- Responsive --------------------------------------------------------- */
@media (max-width: 900px) {
  .contact-inner { grid-template-columns: 1fr; gap: var(--space-4); }
}

/* 900 而不是 780：實測 781–892px 之間導覽與品牌文字會擠成多行 */
@media (max-width: 900px) {
  .nav-toggle { display: flex; }
  .header-call { display: none; }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: var(--space-1) var(--space-3) var(--space-3);
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    display: none;
    /* 橫向手機（如 568×320）選單會超出 viewport，必須能捲 */
    max-height: calc(100dvh - var(--header-h) - 12px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .site-nav.is-open { display: flex; }
  .site-nav a {
    padding: 14px 4px;            /* 觸控目標 > 44px */
    border-bottom: 1px solid var(--line);
    font-size: 1rem;
  }
  .site-nav a::after { display: none; }

  .hero-badges { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
  .hero-cta .btn { width: 100%; }

  .call-bar { display: flex; }
  body { padding-bottom: 84px; }    /* 讓固定撥號列不遮住頁尾 */
}

@media (max-width: 420px) {
  .brand-text small { display: none; }
  .contact-card { padding: var(--space-3); }
  .contact-card > div { grid-template-columns: 1fr; gap: 2px; }
}

/* --- Motion / print preferences ----------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

@media print {
  .site-header, .call-bar, .hero-bg, .nav-toggle { display: none !important; }
  body { padding-bottom: 0; }
  .section-dark, .site-footer { background: #fff !important; color: #000 !important; }
  .why-item p, .footer-brand span, .footer-copy { color: #333 !important; }
}
