/* =====================================================================
   QnoCare 官網 —— 設計系統
   風格：溫暖親情感（米白 / 暖橘 / 柔綠），大字體、高對比、無障礙友善
   五色語彙對應 App 呼吸燈：白(待機) 綠(阿嬤) 藍(看護) 金(AI助理) 紅(緊急)
   ===================================================================== */

/* ---------- 設計 tokens ---------- */
:root {
  --bg: #FBF7F0;
  --bg-card: #FFFFFF;
  --bg-sink: #F3EBDD;
  --ink: #2B2622;
  --ink-soft: #5B534B;
  --ink-faint: #8A8078;
  --line: #E7DDCB;

  --brand: #E0894A;         /* 暖橘主色 */
  --brand-dark: #C46F35;
  --brand-tint: #FBEEE1;

  --grandma: #7FB98E;       /* 阿嬤 / 台語 */
  --carer: #6BA8D6;         /* 看護 / 印尼語 */
  --assist: #E9B44C;        /* AI 專業助理 */
  --alert: #D9534F;         /* 緊急救援 */

  --grandma-tint: #E8F3EA;
  --carer-tint: #E5F0F8;
  --assist-tint: #FBF1DA;
  --alert-tint: #FBE7E6;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 28px;
  --shadow: 0 10px 30px rgba(80, 60, 40, .10);
  --shadow-sm: 0 4px 14px rgba(80, 60, 40, .08);

  --wrap: 1120px;
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --fs-base: 18px;
  --lh: 1.75;
}

/* 「放大字級」切換：由 partials.js 在 <html> 加上 .fs-large */
html.fs-large { --fs-base: 21px; }

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .5em; font-weight: 800; letter-spacing: .01em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.6rem, 3.6vw, 2.3rem); }
h3 { font-size: clamp(1.2rem, 2.4vw, 1.5rem); }
p { margin: 0 0 1em; }

a { color: var(--brand-dark); text-underline-offset: 3px; }
a:hover { color: var(--brand); }

img { max-width: 100%; height: auto; display: block; }

:focus-visible {
  outline: 3px solid var(--carer);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: .6rem 1rem;
  z-index: 200;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; color: #fff; }

/* ---------- 版面 ---------- */
.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.section { padding: clamp(3rem, 8vw, 6rem) 0; }
.section--sink { background: var(--bg-sink); }
.section--brand { background: var(--brand-tint); }
.center { text-align: center; }
.lead { font-size: 1.15em; color: var(--ink-soft); max-width: 62ch; }
.center .lead { margin-inline: auto; }
.eyebrow {
  display: inline-block;
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--brand-dark);
  background: var(--brand-tint);
  padding: .35rem .8rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}
.grid { display: grid; gap: 1.5rem; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) {
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
}

/* ---------- 按鈕 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font: inherit;
  font-weight: 700;
  padding: .85rem 1.6rem;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--brand-dark); color: #fff; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: #fff; }
.btn--block { width: 100%; justify-content: center; }
.btn--lg { padding: 1rem 2rem; font-size: 1.05rem; }
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- 頁首 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(251, 247, 240, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: .7rem 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
}
.brand__dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-tint);
  animation: breathe 4s ease-in-out infinite;
}
.site-nav { margin-left: auto; }
.site-nav ul { list-style: none; display: flex; gap: .3rem; margin: 0; padding: 0; }
.site-nav a {
  display: block;
  padding: .5rem .8rem;
  border-radius: 999px;
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
  font-size: .98rem;
}
.site-nav a:hover { background: var(--brand-tint); color: var(--brand-dark); }
.site-nav a[aria-current="page"] { color: var(--brand-dark); background: var(--brand-tint); }
.header-actions { display: flex; align-items: center; gap: .6rem; }
.cart-link { position: relative; text-decoration: none; font-weight: 700; color: var(--ink); padding: .5rem .7rem; }
.cart-link__count {
  position: absolute;
  top: -2px; right: -6px;
  background: var(--alert);
  color: #fff;
  font-size: .72rem;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0 4px;
}
.cart-link__count[hidden] { display: none; }
.nav-toggle { display: none; background: none; border: 2px solid var(--line); border-radius: 10px; padding: .4rem .6rem; font-size: 1.1rem; cursor: pointer; }
.fs-toggle {
  background: none; border: 2px solid var(--line); border-radius: 999px;
  padding: .35rem .7rem; font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; color: var(--ink-soft);
}
.fs-toggle:hover { border-color: var(--brand); color: var(--brand-dark); }

@media (max-width: 940px) {
  .nav-toggle { display: block; order: 3; margin-left: auto; }
  .site-nav {
    order: 4;
    flex-basis: 100%;
    margin-left: 0;
    display: none;
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; gap: .1rem; padding: .5rem 0 .8rem; }
  .site-nav a { padding: .7rem .8rem; }
  .header-actions { order: 2; margin-left: auto; }
}

/* ---------- Hero ---------- */
.hero {
  padding: clamp(3rem, 9vw, 6.5rem) 0;
  background:
    radial-gradient(1200px 500px at 80% -10%, var(--assist-tint), transparent 60%),
    radial-gradient(900px 500px at 0% 20%, var(--grandma-tint), transparent 55%);
}
.hero__grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 3rem; align-items: center; }
.hero__slogan { font-size: .95rem; letter-spacing: .22em; text-transform: uppercase; color: var(--brand-dark); font-weight: 700; margin-bottom: .8rem; }
.hero h1 { margin-bottom: .6rem; }
.hero__sub { font-size: 1.2em; color: var(--ink-soft); margin-bottom: 1.6rem; }
.hero__cta { display: flex; gap: .9rem; flex-wrap: wrap; }
.hero__note { margin-top: 1rem; font-size: .95rem; color: var(--ink-faint); }
@media (max-width: 860px) {
  .hero__grid { grid-template-columns: 1fr; gap: 2rem; }
}

/* 呼吸燈視覺 */
.lamp {
  position: relative;
  aspect-ratio: 1;
  max-width: 380px;
  margin-inline: auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg-card);
  box-shadow: var(--shadow);
}
.lamp__orb {
  width: 46%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #fff, var(--brand) 70%);
  box-shadow: 0 0 0 18px var(--brand-tint), 0 0 60px rgba(224, 137, 74, .5);
  animation: breathe 4.5s ease-in-out infinite;
}
.lamp__ring {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 2px dashed var(--line);
}
.lamp__tag {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .3rem .7rem;
  font-size: .82rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.lamp__tag::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .4rem; vertical-align: middle; }
.lamp__tag--g { top: 12%; left: -6%; }
.lamp__tag--g::before { background: var(--grandma); }
.lamp__tag--b { bottom: 16%; right: -8%; }
.lamp__tag--b::before { background: var(--carer); }
.lamp__tag--a { bottom: -4%; left: 22%; }
.lamp__tag--a::before { background: var(--assist); }

@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: .92; }
  50% { transform: scale(1.06); opacity: 1; }
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.6rem;
  box-shadow: var(--shadow-sm);
}
.card h3 { margin-bottom: .4rem; }
.card__icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  background: var(--brand-tint);
}
.card__icon--g { background: var(--grandma-tint); }
.card__icon--b { background: var(--carer-tint); }
.card__icon--a { background: var(--assist-tint); }
.card__icon--r { background: var(--alert-tint); }

/* 痛點條 */
.painrow { display: grid; grid-template-columns: 220px 1fr; gap: 1.2rem; padding: 1.4rem 0; border-top: 1px solid var(--line); }
.painrow:last-child { border-bottom: 1px solid var(--line); }
.painrow h3 { margin: 0; }
.painrow .flaw { color: var(--ink-soft); }
@media (max-width: 720px) { .painrow { grid-template-columns: 1fr; gap: .4rem; } }

/* 步驟時間軸 */
.steps { counter-reset: step; display: grid; gap: 1.2rem; }
.step { display: grid; grid-template-columns: 48px 1fr; gap: 1rem; align-items: start; }
.step__num {
  counter-increment: step;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.step__num::before { content: counter(step); }

/* 情境對話例句 */
.dialogue { background: var(--bg-sink); border-radius: var(--radius); padding: 1.2rem 1.4rem; margin: 1rem 0; }
.dialogue p { margin: .35rem 0; }
.dialogue .who { font-weight: 800; }
.dialogue .who--g { color: #4f8f62; }
.dialogue .who--b { color: #3f7fb0; }

/* 功能明細 */
.feature-block { border-top: 1px solid var(--line); padding: 1.8rem 0; }
.feature-block:first-of-type { border-top: none; }
.feature-block .tag-pain { color: var(--alert); font-weight: 700; }
.chips { list-style: none; padding: 0; margin: .6rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.chips li { background: var(--bg-sink); border-radius: 999px; padding: .3rem .8rem; font-size: .9rem; }

/* ---------- 定價 ---------- */
.billing-toggle {
  display: inline-flex;
  background: var(--bg-sink);
  border-radius: 999px;
  padding: .3rem;
  gap: .2rem;
  margin: 1rem auto 2.4rem;
}
.billing-toggle button {
  font: inherit;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  padding: .55rem 1.3rem;
  border-radius: 999px;
  cursor: pointer;
}
.billing-toggle button[aria-pressed="true"] { background: var(--bg-card); color: var(--ink); box-shadow: var(--shadow-sm); }
.billing-toggle .save-hint { color: var(--grandma); font-weight: 800; }

.plan-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 860px) { .plan-cards { grid-template-columns: 1fr; } }
.plan {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2rem;
  position: relative;
}
.plan--featured { border-color: var(--brand); box-shadow: 0 12px 40px rgba(224, 137, 74, .18); }
.plan__badge {
  position: absolute;
  top: -14px; left: 2rem;
  background: var(--brand);
  color: #fff;
  font-size: .82rem;
  font-weight: 800;
  padding: .3rem .9rem;
  border-radius: 999px;
}
.plan__name { font-size: 1.35rem; margin-bottom: .2rem; }
.plan__tagline { color: var(--ink-faint); font-size: .95rem; margin-bottom: 1rem; }
.plan__price { font-size: 2.6rem; font-weight: 800; line-height: 1.1; }
.plan__price small { font-size: .95rem; font-weight: 600; color: var(--ink-faint); }
.plan__price-sub { font-size: .92rem; color: var(--ink-soft); min-height: 1.4em; margin-bottom: 1.2rem; }
.plan__list { list-style: none; padding: 0; margin: 1.2rem 0; display: grid; gap: .6rem; }
.plan__list li { padding-left: 1.7rem; position: relative; }
.plan__list li::before { content: "✓"; position: absolute; left: 0; color: var(--grandma); font-weight: 800; }
.plan__list li.no::before { content: "–"; color: var(--ink-faint); }
.plan__list li.no { color: var(--ink-faint); }

/* 比較表 */
.compare { width: 100%; border-collapse: collapse; margin-top: 1.5rem; }
.compare caption { text-align: left; font-weight: 800; font-size: 1.2rem; margin-bottom: .8rem; }
.compare th, .compare td { padding: .85rem 1rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.compare thead th { background: var(--bg-sink); }
.compare td.mark { text-align: center; font-weight: 800; color: var(--grandma); }
.compare td.nomark { text-align: center; color: var(--ink-faint); }
.table-scroll { overflow-x: auto; }

/* ---------- FAQ accordion ---------- */
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item button {
  width: 100%;
  text-align: left;
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  background: none;
  border: none;
  padding: 1.1rem 2.4rem 1.1rem 0;
  cursor: pointer;
  position: relative;
  color: var(--ink);
}
.faq-item button::after {
  content: "+";
  position: absolute;
  right: .4rem; top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  color: var(--brand-dark);
}
.faq-item button[aria-expanded="true"]::after { content: "–"; }
.faq-item .faq-answer { padding: 0 0 1.2rem; color: var(--ink-soft); max-width: 68ch; }
.faq-item .faq-answer[hidden] { display: none; }

/* ---------- 表單 ---------- */
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 700; margin-bottom: .35rem; }
.field .hint { font-weight: 400; color: var(--ink-faint); font-size: .88rem; }
.field input, .field select, .field textarea {
  width: 100%;
  font: inherit;
  padding: .7rem .9rem;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--carer); outline: none; }
.field .error-text { color: var(--alert); font-size: .88rem; margin-top: .3rem; }
.consent {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .7rem;
  align-items: start;
  padding: .9rem 0;
  border-top: 1px solid var(--line);
}
.consent input { width: 22px; height: 22px; margin-top: .2rem; }
.consent label { font-weight: 500; }

/* ---------- 購物車 ---------- */
.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th, .cart-table td { padding: 1rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.cart-table .num { text-align: right; white-space: nowrap; }
.qty { display: inline-flex; align-items: center; border: 2px solid var(--line); border-radius: 999px; overflow: hidden; }
.qty button { border: none; background: var(--bg-sink); width: 36px; height: 36px; font-size: 1.2rem; cursor: pointer; }
.qty span { min-width: 40px; text-align: center; font-weight: 700; }
.link-danger { color: var(--alert); background: none; border: none; font: inherit; cursor: pointer; text-decoration: underline; }
.summary-box { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow-sm); }
.summary-box dl { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; margin: 0 0 1rem; }
.summary-box dt { color: var(--ink-soft); }
.summary-box dd { margin: 0; text-align: right; font-weight: 700; }
.summary-box .total dt, .summary-box .total dd { font-size: 1.25rem; font-weight: 800; border-top: 2px solid var(--line); padding-top: .7rem; }
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--ink-faint); }

.checkout-grid { display: grid; grid-template-columns: 1.4fr .9fr; gap: 2.5rem; align-items: start; }
@media (max-width: 900px) { .checkout-grid { grid-template-columns: 1fr; } }

/* mock 藍新頁 */
.paybox { max-width: 460px; margin: 3rem auto; background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.paybox__head { background: #1f2c39; color: #fff; padding: 1.2rem 1.5rem; font-weight: 800; }
.paybox__body { padding: 1.5rem; }
.notice {
  background: var(--assist-tint);
  border: 1px solid var(--assist);
  border-radius: var(--radius-sm);
  padding: .9rem 1.1rem;
  font-size: .95rem;
}
.notice--info { background: var(--carer-tint); border-color: var(--carer); }
.notice--danger { background: var(--alert-tint); border-color: var(--alert); }

/* 狀態頁 */
.result { text-align: center; max-width: 560px; margin: 4rem auto; }
.result__mark { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; font-size: 2.6rem; margin: 0 auto 1.5rem; }
.result__mark--ok { background: var(--grandma-tint); color: #3f8a58; }
.result__mark--fail { background: var(--alert-tint); color: var(--alert); }

/* ---------- 會員中心 ---------- */
.account-grid { display: grid; grid-template-columns: 260px 1fr; gap: 2rem; align-items: start; }
@media (max-width: 860px) { .account-grid { grid-template-columns: 1fr; } }
.account-nav { display: grid; gap: .3rem; }
.account-nav a { padding: .7rem 1rem; border-radius: var(--radius-sm); text-decoration: none; color: var(--ink-soft); font-weight: 600; }
.account-nav a[aria-current="true"] { background: var(--brand-tint); color: var(--brand-dark); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1.5rem; }
.kv dt { color: var(--ink-soft); }
.kv dd { margin: 0; font-weight: 700; }
.badge-pill { display: inline-block; background: var(--grandma-tint); color: #3f8a58; font-weight: 800; font-size: .82rem; padding: .2rem .7rem; border-radius: 999px; }

/* ---------- 法遵長文 ---------- */
.legal { max-width: 78ch; }
.legal h2 { margin-top: 2.4rem; font-size: 1.35rem; }
.legal h3 { margin-top: 1.6rem; font-size: 1.1rem; }
.legal ol, .legal ul { padding-left: 1.4rem; }
.legal li { margin-bottom: .5rem; }
.legal .updated { color: var(--ink-faint); font-size: .92rem; }
.toc { background: var(--bg-sink); border-radius: var(--radius); padding: 1.2rem 1.5rem; margin-bottom: 2rem; }
.toc ol { margin: .5rem 0 0; }

/* ---------- 頁尾 ---------- */
.site-footer { background: var(--ink); color: #d9cfc2; padding: 3.5rem 0 2rem; margin-top: 4rem; }
.site-footer a { color: #f1e7d8; }
.site-footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 2rem; }
@media (max-width: 860px) { .site-footer__grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .site-footer__grid { grid-template-columns: 1fr; } }
.site-footer h4 { color: #fff; font-size: .95rem; letter-spacing: .1em; margin-bottom: .8rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.site-footer .company-meta { font-size: .9rem; line-height: 1.7; color: #b7ab9c; }
.site-footer .company-meta strong { color: #f1e7d8; }
.footer-legal { border-top: 1px solid #40372e; margin-top: 2.5rem; padding-top: 1.5rem; font-size: .85rem; color: #9d9082; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.pay-badge { display: inline-flex; align-items: center; gap: .4rem; background: #2f2822; border: 1px solid #40372e; border-radius: 8px; padding: .3rem .6rem; font-size: .8rem; }

/* ---------- 工具 ---------- */
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.stack > * + * { margin-top: 1rem; }
.muted { color: var(--ink-faint); }
.pill-note { display: inline-block; background: var(--grandma-tint); color: #3f8a58; border-radius: 999px; padding: .25rem .8rem; font-size: .85rem; font-weight: 700; }
.callout { background: var(--brand-tint); border-left: 4px solid var(--brand); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 1.1rem 1.3rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- 減少動態 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
html.reduce-motion .brand__dot,
html.reduce-motion .lamp__orb { animation: none; }
