/* ============================================================
   團購小幫草 行銷網站 — 設計系統
   原則：行動優先（團購店家是純手機族）、零外部資源（CWV）、
   系統字型（不載 webfont）、無 JS 依賴（INP 趨近 0）
   ============================================================ */

:root {
  /* 告訴瀏覽器兩種配色都支援（捲軸、表單元件跟著走，也避免深色下先閃一下白底） */
  color-scheme: light dark;

  /* 品牌色：幸運草綠 */
  --green-900: #1c4a2a;
  --green-700: #2f7d43;
  --green-600: #3a9152;
  --green-100: #e6f3ea;
  --green-50:  #f3faf5;
  /* 中性色：溫暖米白基底 */
  --ink:       #24292d;
  --ink-soft:  #4d565c;
  --ink-faint: #626c74;
  --paper:     #fdfcf9;
  --card:      #ffffff;
  --line:      #e3e0d8;
  /* 強調（棄單/警示情境用，節制使用） */
  --amber-700: #8a5f0e;
  --amber-50:  #fdf6e8;
  /* 衍生色：原本寫死在規則裡，08-05 收成變數才有辦法做深色 */
  --paper-warm:      #faf7f0;  /* before 對照框底 */
  --bubble:          #f1efe9;  /* LINE 對話泡泡（對方） */
  --green-line:      #cbe5d2;  /* 淺綠框線 */
  --green-line-soft: #d9ecdf;  /* 更淺的綠框線 */
  --amber-line:      #ecd9b0;  /* 琥珀框線 */
  --cta-band-soft:   #d3e6d9;  /* CTA 帶內文 */

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(28, 74, 42, .06), 0 8px 24px rgba(28, 74, 42, .07);
  --maxw: 1080px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; height: auto; }

a { color: var(--green-700); text-underline-offset: 3px; }
a:hover { color: var(--green-900); }

h1, h2, h3 { line-height: 1.35; letter-spacing: .01em; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.5rem); margin: 0 0 .6em; }
h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); margin: 0 0 .8em; }
h3 { font-size: 1.1rem; margin: 0 0 .5em; }

p { margin: 0 0 1em; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.site-header .container {
  display: flex; align-items: center; gap: 16px;
  min-height: 60px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 1.1rem; color: var(--ink);
  text-decoration: none; white-space: nowrap;
}
.brand svg { width: 26px; height: 26px; flex: none; }
.brand img { width: 28px; height: 28px; flex: none; }
.site-nav { display: flex; gap: 4px 18px; flex-wrap: wrap; margin-left: auto; }
.site-nav a {
  text-decoration: none; color: var(--ink-soft);
  font-size: .95rem; padding: 4px 2px;
}
.site-nav a:hover { color: var(--green-700); }
.site-nav a[aria-current="page"] { color: var(--green-700); font-weight: 600; }

/* ---------- CTA 按鈕 ---------- */
.btn {
  display: inline-block; text-decoration: none; font-weight: 700;
  padding: 12px 26px; border-radius: 999px; font-size: 1rem;
  background: var(--green-700); color: #fff;
  border: 2px solid var(--green-700);
}
.btn:hover { background: var(--green-900); border-color: var(--green-900); color: #fff; }
.btn.ghost { background: transparent; color: var(--green-700); }
.btn.ghost:hover { background: var(--green-100); color: var(--green-900); }
.btn.small { padding: 8px 18px; font-size: .92rem; }

/* ---------- Hero ---------- */
.hero { padding: 56px 0 40px; background: linear-gradient(180deg, var(--green-50), var(--paper)); }
.hero .lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 34em; }
.hero .cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0 10px; }
.hero .trust-line { font-size: .92rem; color: var(--ink-faint); }
.hero-grid { display: grid; gap: 36px; align-items: center; }
@media (min-width: 860px) { .hero-grid { grid-template-columns: 1.15fr .85fr; } }

/* ---------- Section 基本 ---------- */
.section { padding: 52px 0; }
.section.tint { background: var(--green-50); }
.section-head { max-width: 42em; margin-bottom: 32px; }
.section-head .kicker {
  color: var(--green-700); font-weight: 700; font-size: .9rem;
  letter-spacing: .08em; margin-bottom: .4em;
}
.section-head p { color: var(--ink-soft); }

/* 答案前置段（AI 檢索取用；視覺上是自然的導言） */
.answer-lead {
  font-size: 1.08rem; max-width: 38em;
  border-left: 4px solid var(--green-600);
  padding-left: 16px; margin: 0 0 1.6em;
}

/* ---------- 卡片 ---------- */
.cards { display: grid; gap: 20px; }
@media (min-width: 640px) { .cards.cols-2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 860px) { .cards.cols-3 { grid-template-columns: repeat(3, 1fr); } }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}
.card h3 { display: flex; align-items: center; gap: 8px; }
.card .icon { width: 22px; height: 22px; flex: none; color: var(--green-700); }
.card p { color: var(--ink-soft); font-size: .97rem; margin-bottom: 0; }
.card .more { display: inline-block; margin-top: 10px; font-size: .93rem; font-weight: 600; }

/* ---------- before / after 對照 ---------- */
.contrast { display: grid; gap: 20px; }
@media (min-width: 780px) { .contrast { grid-template-columns: 1fr 1fr; } }
.contrast .pane {
  border-radius: var(--radius); padding: 24px 24px 16px;
  border: 1px solid var(--line); background: var(--card);
}
.contrast .pane.before { background: var(--paper-warm); }
.contrast .pane.after { background: var(--green-100); border-color: var(--green-line); }
.contrast .pane h3 { font-size: 1rem; color: var(--ink-soft); }
.contrast .pane.after h3 { color: var(--green-900); }
.contrast ul { padding-left: 1.2em; margin: 0 0 1em; }
.contrast li { margin-bottom: .5em; color: var(--ink-soft); font-size: .97rem; }
.contrast .pane.after li { color: var(--green-900); }

/* ---------- 步驟流程 ---------- */
.steps { counter-reset: step; display: grid; gap: 18px; padding: 0; margin: 0; list-style: none; }
@media (min-width: 860px) { .steps.cols-4 { grid-template-columns: repeat(4, 1fr); } .steps.cols-3 { grid-template-columns: repeat(3, 1fr); } }
.steps li {
  counter-increment: step; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
}
.steps li::before {
  content: counter(step);
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--green-700); color: #fff; font-weight: 700; font-size: .9rem;
  margin-bottom: 10px;
}
.steps h3 { font-size: 1rem; }
.steps p { font-size: .93rem; color: var(--ink-soft); margin: 0; }

/* ---------- 手機模擬框（LINE 對話 / 訂單列表示意） ---------- */
.phone-mock {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 22px; box-shadow: var(--shadow);
  padding: 18px 16px; max-width: 340px; margin: 0 auto;
}
.phone-mock .bar {
  font-size: .8rem; color: var(--ink-faint); text-align: center;
  border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 12px;
}
.chat { display: flex; flex-direction: column; gap: 8px; font-size: .88rem; }
.chat .msg {
  background: var(--bubble); border-radius: 12px; padding: 8px 12px;
  align-self: flex-start; max-width: 85%;
}
.chat .msg.me { background: var(--green-100); align-self: flex-end; }
.chat .msg .who { font-size: .75rem; color: var(--ink-faint); display: block; }
.order-list { display: flex; flex-direction: column; gap: 8px; font-size: .88rem; }
.order-list .row {
  display: flex; justify-content: space-between; gap: 8px;
  background: var(--green-50); border: 1px solid var(--green-line-soft);
  border-radius: var(--radius-sm); padding: 8px 12px;
}
.order-list .row .qty { font-weight: 700; color: var(--green-900); white-space: nowrap; }
.order-list .row .state { font-size: .78rem; color: var(--green-700); text-align: right; }

/* ---------- FAQ ---------- */
.faq-list { max-width: 46em; }
.faq-list details {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); margin-bottom: 12px; padding: 0 18px;
}
.faq-list summary {
  cursor: pointer; font-weight: 600; padding: 14px 0;
  list-style: none; position: relative; padding-right: 28px;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: "＋"; position: absolute; right: 2px; top: 12px; color: var(--green-700);
}
.faq-list details[open] summary::after { content: "－"; }
.faq-list .a { padding: 0 0 16px; color: var(--ink-soft); }
.faq-list .a p:last-child { margin-bottom: 0; }

/* ---------- 誠實框（非目標/邊界聲明） ---------- */
.honest {
  background: var(--amber-50); border: 1px solid var(--amber-line);
  border-radius: var(--radius); padding: 20px 24px; max-width: 46em;
}
.honest h3 { color: var(--amber-700); font-size: 1rem; }
.honest p, .honest li { color: var(--ink-soft); font-size: .95rem; }
.honest ul { padding-left: 1.2em; margin-bottom: 0; }

/* ---------- 信任區 ---------- */
.trust-strip { display: grid; gap: 20px; }
@media (min-width: 780px) { .trust-strip { grid-template-columns: repeat(3, 1fr); } }
.trust-strip .item { border-left: 3px solid var(--green-600); padding-left: 16px; }
.trust-strip h3 { font-size: 1rem; }
.trust-strip p { font-size: .93rem; color: var(--ink-soft); margin: 0; }

/* ---------- 頁尾 CTA 帶 ---------- */
.cta-band { background: var(--green-900); color: #fff; padding: 52px 0; }
.cta-band h2 { color: #fff; }
.cta-band p { color: var(--cta-band-soft); max-width: 36em; }
.cta-band .btn { background: #fff; color: var(--green-900); border-color: #fff; }
.cta-band .btn:hover { background: var(--green-100); border-color: var(--green-100); color: var(--green-900); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line); padding: 36px 0 48px;
  font-size: .9rem; color: var(--ink-faint);
}
.site-footer .cols { display: grid; gap: 24px; margin-bottom: 24px; }
@media (min-width: 640px) { .site-footer .cols { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer h3 { font-size: .95rem; color: var(--ink-soft); }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: var(--ink-faint); text-decoration: none; }
.site-footer a:hover { color: var(--green-700); text-decoration: underline; }

/* ---------- 文章（guide） ---------- */
.article { max-width: 44em; }
.article h2 { margin-top: 2em; }
.article h3 { margin-top: 1.6em; }
.article .meta { color: var(--ink-faint); font-size: .9rem; margin-bottom: 2em; }
.article table { border-collapse: collapse; width: 100%; font-size: .93rem; }
.article th, .article td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.article th { background: var(--green-50); }
.table-wrap { overflow-x: auto; }

/* ---------- 麵包屑 ---------- */
.breadcrumb { font-size: .85rem; color: var(--ink-faint); padding: 16px 0 0; }
.breadcrumb a { color: var(--ink-faint); }
.breadcrumb span { margin: 0 6px; }

/* ---------- 工具 ---------- */
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}

/* ---------- 首頁 Hero 副標（H1 第二行） ---------- */
.hero h1 { margin-bottom: .5em; }
.hero h1 .sub {
  display: block; margin-top: .12em;
  font-size: .66em; font-weight: 700; color: var(--ink-soft);
}

/* ---------- 卡片徽章（核心／AI） ---------- */
.badge {
  display: inline-block; margin-bottom: 10px;
  font-size: .75rem; font-weight: 700; line-height: 1.6;
  padding: 1px 10px; border-radius: 999px; white-space: nowrap;
  background: var(--green-100); color: var(--green-900); border: 1px solid var(--green-line);
}
.badge.plan { background: var(--amber-50); color: var(--amber-700); border-color: var(--amber-line); }

/* 功能格：4 / 5 欄（行動優先，逐段展開） */
@media (min-width: 620px) {
  .cards.cols-4, .cards.cols-5 { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 980px) {
  .cards.cols-4 { grid-template-columns: repeat(4, 1fr); }
  .cards.cols-5 { grid-template-columns: repeat(5, 1fr); }
  .cards.cols-4 .card, .cards.cols-5 .card { padding: 20px; }
}

/* 狀態小字（目前全站未使用——「規劃中」標記已於 08-03 全數移除） */
.status-note { font-size: .92rem; color: var(--ink-faint); }

/* ---------- Hero 推薦卡（AI 週推薦示意） ---------- */
.rec {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 16px 14px; max-width: 360px; margin: 0 auto;
}
.rec .rec-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: .92rem; font-weight: 700; margin: 0 0 12px;
  border-bottom: 1px solid var(--line); padding-bottom: 10px;
}
/* 行內小標記（目前全站未使用——「規劃中」標記已於 08-03 全數移除） */
.tag {
  display: inline-block; font-size: .72rem; font-weight: 600; white-space: nowrap;
  line-height: 1.6; vertical-align: middle;
  background: var(--amber-50); color: var(--amber-700);
  border: 1px solid var(--amber-line); border-radius: 999px; padding: 0 8px;
}
.rec ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.rec li {
  display: flex; justify-content: space-between; gap: 8px; font-size: .88rem;
  background: var(--green-50); border: 1px solid var(--green-line-soft);
  border-radius: var(--radius-sm); padding: 8px 12px;
}
.rec li .pick { font-weight: 700; color: var(--green-900); white-space: nowrap; }
.rec .note { font-size: .78rem; color: var(--ink-faint); margin: 12px 0 0; }

/* ---------- Skip link（鍵盤導覽） ---------- */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--green-900); color: #fff;
  padding: 10px 18px; border-radius: 0 0 var(--radius-sm) 0;
  z-index: 100; text-decoration: none;
}
.skip-link:focus { left: 0; }

/* 版面微調工具類（08-04：原本是內嵌 style 屬性，改成 class 以便 CSP 不必開 unsafe-inline） */
.mt-20{margin-top:20px}
.mt-24{margin-top:24px}
.mb-05{margin-bottom:.5em}
.mb-8{margin-bottom:8px}
.mb-0{margin-bottom:0}

/* ============================================================
   深色模式（防刺眼）— Peter 2026-08-05 定
   跟隨手機／系統的深色設定，⛔ 沒有切換鈕：CSP 是 script-src 'none'，
   純 CSS 記不住跨頁狀態，做了鈕換一頁就跳回去，反而像壞掉。
   改色只要動下面這組變數；⛔ 不要在規則裡寫死顏色，寫死就不會跟著深色走。
   ============================================================ */
@media (prefers-color-scheme: dark) {
  :root {
    /* 綠色在深色模式「換角色」：green-900 由深綠底變成亮綠字 */
    --green-900: #a3ddb5;
    --green-700: #6fc98a;
    --green-600: #5cbb7a;
    --green-100: #1e3327;
    --green-50:  #172219;
    /* 中性色反轉（不用純黑，純黑在 OLED 上邊緣會糊） */
    --ink:       #e8eaec;
    --ink-soft:  #b6bec4;
    --ink-faint: #8f989e;
    --paper:     #14181b;
    --card:      #1c2126;
    --line:      #2f363c;
    --amber-700: #e3b968;
    --amber-50:  #2b2214;
    /* 衍生色 */
    --paper-warm:      #1f2328;
    --bubble:          #272d33;
    --green-line:      #325a41;
    --green-line-soft: #2b4d38;
    --amber-line:      #4d3d1e;
    --cta-band-soft:   #bfdccb;
    /* 深底上綠色陰影看不見，改用純黑 */
    --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 8px 24px rgba(0, 0, 0, .38);
  }

  /* 以下都是「綠色當底、白字疊上去」的地方——底色不能跟著提亮，
     否則白字會糊在亮綠上。維持深綠底，白字對比才夠。 */
  .btn { background: #2f7d43; border-color: #2f7d43; }
  .btn:hover { background: #246034; border-color: #246034; }
  .btn.ghost { background: transparent; border-color: var(--green-700); }
  .steps li::before { background: #2f7d43; }
  .skip-link { background: #2f7d43; }
  /* CTA 帶在淺色版是搶眼的深綠塊。深色版若直接沿用 green-900，會跟頁面底色只差 1.26:1，
     整條帶等於消失——所以這裡刻意提亮，讓它在深底上仍然是一塊「帶」。 */
  .cta-band { background: #1e5533; }
  /* 白底按鈕上的字要用深綠，⛔ 不能吃 var(--green-900)（深色模式下它是亮綠，會看不到） */
  .cta-band .btn { color: #1e5533; }
}
