/* =========================================================================
   果秝國際 Design System — Design Tokens
   =========================================================================
   核心規則（解決舊版最大問題）：
   品牌黃 #EAD041 對白色只有 1.54:1 對比，遠低於 WCAG AA 要求的 4.5:1。
   因此本系統中：

     黃色 = 「填色 / 強調塊」，永遠不當文字色用在白底上
     黃底上的文字 = 墨黑 (--c-ink)，對比 10.93:1
     需要黃色系文字時 = 深琥珀 (--c-accent-ink)，對白底 6.38:1

   每個色票後方註記的是實測 WCAG 對比值。
   ========================================================================= */

:root {
  /* ---------------------------------------------------------------------
     1. 品牌色 — 只作為填色與裝飾
     --------------------------------------------------------------------- */
  --c-brand: #ead041;          /* 品牌主黃：按鈕底、色塊、標記 */
  --c-brand-bright: #f5de5c;   /* 亮一階：hover 狀態 */
  --c-brand-deep: #d9bb28;     /* 暗一階：按下狀態、邊框 */
  --c-brand-tint: #fdf7dc;     /* 極淡黃：區塊底色 */
  --c-brand-tint-2: #fbf1c4;   /* 淡黃：卡片底、標籤底 */

  /* 需要「黃色感的文字」時用這個深琥珀，不要用 --c-brand */
  --c-accent-ink: #7a5a00;     /* 對白底 6.38:1 — AA 通過 */

  /* ---------------------------------------------------------------------
     2. 文字色階 — 全部通過 AA
     --------------------------------------------------------------------- */
  --c-ink: #1b1d21;            /* 標題／黃底上的文字   對白 16.88:1 */
  --c-body: #4b5056;           /* 內文                 對白  8.14:1 */
  --c-muted: #6b7076;          /* 次要說明             對白  4.99:1 */
  --c-inverse: #ffffff;        /* 深底上的文字 */

  /* ---------------------------------------------------------------------
     3. 表面色
     --------------------------------------------------------------------- */
  --c-surface: #ffffff;
  --c-surface-alt: #f7f7f5;    /* 交錯區塊底色 */
  --c-surface-sunken: #f0f0ed;
  --c-surface-dark: #24262a;   /* 深色區塊：黃字於其上 9.81:1 */

  /* ---------------------------------------------------------------------
     4. 線條
     --------------------------------------------------------------------- */
  --c-border: #e3e3df;
  --c-border-strong: #cfcfc9;
  --c-border-brand: var(--c-brand);

  /* ---------------------------------------------------------------------
     5. 功能色
     --------------------------------------------------------------------- */
  --c-line: #06c755;           /* LINE 官方綠：填色，配 --c-ink 文字 7.48:1 */
  --c-line-deep: #05a548;
  --c-danger: #c02626;         /* 對白 6.0:1 */
  --c-focus: #0b63c4;          /* 鍵盤焦點環，對白 5.84:1 */

  /* ---------------------------------------------------------------------
     6. 字體
     --------------------------------------------------------------------- */
  --font-sans: 'Noto Sans TC', -apple-system, BlinkMacSystemFont,
               'Segoe UI', 'PingFang TC', 'Microsoft JhengHei', sans-serif;

  /* 流體字級：clamp(手機最小, 隨視窗縮放, 桌機最大) — 不需要斷點就能順暢縮放 */
  --fs-xs:   0.8125rem;                             /* 13px */
  --fs-sm:   0.875rem;                              /* 14px */
  --fs-base: 1rem;                                  /* 16px — 內文最小值 */
  --fs-md:   clamp(1.0625rem, 0.4vw + 1rem, 1.125rem);
  --fs-lg:   clamp(1.125rem, 0.6vw + 1rem, 1.375rem);
  --fs-xl:   clamp(1.375rem, 1.2vw + 1rem, 1.75rem);
  --fs-2xl:  clamp(1.625rem, 2vw + 1rem, 2.25rem);
  --fs-3xl:  clamp(1.875rem, 3vw + 1rem, 3rem);
  --fs-4xl:  clamp(2.25rem, 4.5vw + 1rem, 3.75rem);

  --lh-tight: 1.25;
  --lh-snug: 1.45;
  --lh-normal: 1.75;   /* 中文內文建議 1.7~1.8，比英文寬 */

  --fw-regular: 400;
  --fw-bold: 700;
  --fw-black: 900;

  --ls-tight: -0.01em;
  --ls-wide: 0.05em;

  /* ---------------------------------------------------------------------
     7. 間距階梯（4px 基準）
     --------------------------------------------------------------------- */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 2.5rem;
  --sp-8: 3rem;
  --sp-9: 4rem;
  --sp-10: 5rem;

  /* 區塊上下留白：手機窄、桌機寬 */
  --sp-section: clamp(3rem, 6vw, 5.5rem);
  --sp-gutter: clamp(1rem, 4vw, 2.5rem);

  /* ---------------------------------------------------------------------
     8. 版面
     --------------------------------------------------------------------- */
  --w-content: 1180px;   /* 一般區塊最大寬 */
  --w-prose: 46rem;      /* 純文字閱讀最大寬（約 40 字/行，中文閱讀舒適區） */

  /* ---------------------------------------------------------------------
     9. 圓角
     --------------------------------------------------------------------- */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* ---------------------------------------------------------------------
     10. 陰影
     --------------------------------------------------------------------- */
  --sh-sm: 0 1px 2px rgba(27, 29, 33, 0.06), 0 1px 3px rgba(27, 29, 33, 0.08);
  --sh-md: 0 4px 12px rgba(27, 29, 33, 0.08);
  --sh-lg: 0 12px 28px rgba(27, 29, 33, 0.12);
  --sh-brand: 0 6px 18px rgba(217, 187, 40, 0.35);

  /* ---------------------------------------------------------------------
     11. 動態
     --------------------------------------------------------------------- */
  --ease: cubic-bezier(0.2, 0, 0.2, 1);
  --dur-fast: 120ms;
  --dur: 220ms;

  /* ---------------------------------------------------------------------
     12. 觸控目標最小尺寸
     Apple HIG 44px / Material 48dp — 取 48px 作為所有可點元素的下限
     --------------------------------------------------------------------- */
  --tap-min: 48px;

  --z-header: 100;
  --z-drawer: 200;
  --z-mobilebar: 150;
}

/* =========================================================================
   Reset / Base
   ========================================================================= */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* 錨點捲動時避開固定頁首 */
  scroll-padding-top: 5.5rem;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--c-body);
  background-color: var(--c-surface);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img,
picture,
svg,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

h1, h2, h3, h4 {
  color: var(--c-ink);
  line-height: var(--lh-tight);
  font-weight: var(--fw-black);
  letter-spacing: var(--ls-tight);
  text-wrap: balance;
}

p { text-wrap: pretty; }

a {
  color: var(--c-accent-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* 鍵盤操作可見的焦點環 — 滑鼠點擊不會出現 */
:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* 尊重使用者的「減少動態效果」系統設定 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 螢幕閱讀器專用文字 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 跳到主內容 — 鍵盤使用者按 Tab 第一個看到的連結 */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--sp-4);
  z-index: 999;
  padding: var(--sp-3) var(--sp-5);
  background: var(--c-ink);
  color: var(--c-inverse);
  border-radius: 0 0 var(--r-md) var(--r-md);
  font-weight: var(--fw-bold);
  text-decoration: none;
}
.skip-link:focus { top: 0; }
