/* ============================================================
   有心制作 文章站 — 共用樣式（侘寂米色系）
   每篇文章共用這支 CSS 與 toc.js；新文章只要照 article 模板寫 h2/h3，
   目錄(錨點)會自動生成。
   ============================================================ */
:root {
  --paper: #F4F0E9;
  --paper-2: #EFE9DF;
  --card: #FBF9F5;
  --ink: #3A352F;
  --ink-soft: #5C554C;
  --muted: #8C8377;
  --line: #E4DCCE;
  --terra: #B07B57;
  --terra-soft: #C49A7C;
  --sage: #7E8A72;
  --sand: #EDE4D5;
  --shadow: 0 1px 2px rgba(58,53,47,.04), 0 8px 24px rgba(58,53,47,.05);
  --header-h: 56px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Sans TC", system-ui, -apple-system, "PingFang TC", sans-serif;
  font-weight: 400;
  line-height: 1.9;
  letter-spacing: .01em;
  font-size: 16.5px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--terra); text-decoration: none; }

/* ---------- 頂部固定列 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: rgba(244,240,233,.86);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center;
}
.site-header .inner {
  max-width: 1080px; margin: 0 auto; width: 100%;
  padding: 0 20px; display: flex; align-items: center; justify-content: space-between;
}
.site-header .brand {
  font-family: "Noto Serif TC", serif; font-size: 15px;
  letter-spacing: .3em; color: var(--ink); font-weight: 600;
}
.site-header .brand small { letter-spacing: .12em; color: var(--muted); font-weight: 400; font-size: 11px; margin-left: 8px; }
.site-header .back { font-size: 13px; color: var(--muted); }

/* ---------- 版面：內容 + 側邊目錄 ---------- */
.layout {
  max-width: 1080px; margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}
@media (min-width: 960px) {
  .layout { grid-template-columns: minmax(0,1fr) 248px; gap: 56px; align-items: start; }
}

/* ---------- 文章本體 ---------- */
.article { max-width: 720px; padding: 40px 0 64px; min-width: 0; }
.article .eyebrow {
  font-family: "Noto Serif TC", serif; font-size: 12px;
  letter-spacing: .22em; color: var(--terra); font-weight: 600; margin: 0 0 14px;
}
.article h1 {
  font-family: "Noto Serif TC", serif; font-weight: 600;
  font-size: clamp(26px, 5.6vw, 38px); line-height: 1.4;
  margin: 0 0 16px; letter-spacing: .02em;
}
.article .meta {
  display: flex; flex-wrap: wrap; gap: 10px 16px;
  color: var(--muted); font-size: 13px; margin-bottom: 26px;
}
.article .meta .dot { color: var(--terra-soft); }
.article .lead {
  font-size: 17.5px; color: var(--ink-soft); font-weight: 300;
  border-left: 3px solid var(--terra-soft); padding-left: 16px; margin: 0 0 36px;
}
.article .hero-img { width: 100%; border-radius: 16px; margin: 0 0 40px; box-shadow: var(--shadow); }

.article h2 {
  font-family: "Noto Serif TC", serif; font-weight: 600;
  font-size: 23px; letter-spacing: .03em;
  margin: 48px 0 16px; padding-top: 6px;
  scroll-margin-top: calc(var(--header-h) + 18px);
}
.article h2::before {
  content: ""; display: block; width: 30px; height: 2px;
  background: var(--terra-soft); margin-bottom: 14px;
}
.article h3 {
  font-family: "Noto Serif TC", serif; font-weight: 600;
  font-size: 17.5px; margin: 30px 0 10px; color: var(--ink);
  scroll-margin-top: calc(var(--header-h) + 18px);
}
.article p { margin: 0 0 18px; color: var(--ink-soft); }
.article strong { color: var(--ink); font-weight: 500; }
.article ul, .article ol { margin: 0 0 20px; padding-left: 1.2em; color: var(--ink-soft); }
.article li { margin-bottom: 9px; }
.article ul li::marker { color: var(--terra-soft); }
.article ol li::marker { color: var(--terra); font-family: "Noto Serif TC", serif; }

/* anchor hover 連結符號 */
.article h2, .article h3 { position: relative; }
.anchor-link {
  position: absolute; left: -1.1em; top: 50%; transform: translateY(-50%);
  opacity: 0; color: var(--terra-soft); font-weight: 400; transition: opacity .15s;
}
.article h2:hover .anchor-link, .article h3:hover .anchor-link { opacity: 1; }

/* callout / 提醒框 */
.callout {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 20px; margin: 0 0 24px; box-shadow: var(--shadow);
}
.callout.tip { border-left: 4px solid var(--sage); }
.callout.note { border-left: 4px solid var(--terra); background: rgba(176,123,87,.06); }
.callout p:last-child { margin-bottom: 0; }
.callout .ct { font-weight: 600; color: var(--ink); display:block; margin-bottom: 6px; }

/* 表格 */
.tbl-wrap { overflow-x: auto; margin: 0 0 26px; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 460px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: var(--sand); color: var(--ink); font-weight: 600; font-family: "Noto Serif TC", serif; }
tr:last-child td { border-bottom: none; }

/* 步驟時間軸 */
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0 0 26px; }
.steps li {
  counter-increment: s; position: relative; padding: 0 0 20px 50px;
}
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: -2px;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--sand); border: 1px solid var(--line); color: var(--terra);
  font-family: "Noto Serif TC", serif; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.steps li strong { display: block; color: var(--ink); margin-bottom: 2px; }

/* 文章配圖（放圖前用佔位框，之後把 .ph 換成 <img> 即可） */
figure.fig { margin: 0 0 34px; }
figure.fig img { width: 100%; border-radius: 14px; box-shadow: var(--shadow); display: block; }
figure.fig .ph {
  aspect-ratio: 16 / 9; border: 1px dashed var(--terra-soft); border-radius: 14px;
  background: var(--paper-2); display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px; letter-spacing: .05em; text-align: center; padding: 16px;
}
figure.fig.r43 .ph { aspect-ratio: 4 / 3; }
figure.fig figcaption { font-size: 13px; color: var(--muted); text-align: center; margin-top: 10px; font-style: italic; }

/* ---------- 互動測驗（裝修適性小測驗） ---------- */
.quiz {
  background: #F7F1E8; border: 1px solid var(--terra-soft); border-radius: 24px;
  padding: 30px 24px; margin: 52px 0 0; box-shadow: var(--shadow);
}
.quiz .q-eyebrow { font-family: "Noto Serif TC", serif; font-size: 12px; letter-spacing: .2em; color: var(--terra); font-weight: 600; margin: 0 0 6px; }
.quiz h2 { font-family: "Noto Serif TC", serif; font-weight: 600; font-size: 21px; margin: 0 0 10px; letter-spacing: .03em; }
.quiz h2::before { display: none; }
.quiz .q-intro { color: var(--ink-soft); font-size: 14.5px; font-weight: 300; margin: 0 0 22px; }
.quiz .progress { font-size: 12px; color: var(--muted); letter-spacing: .08em; margin: 0 0 18px; }
.quiz .q { margin: 0 0 22px; }
.quiz .q .qn { font-weight: 500; color: var(--ink); margin: 0 0 10px; font-size: 15.5px; }
.quiz .q .qn b { color: var(--terra); font-family: "Noto Serif TC", serif; margin-right: 6px; }
.quiz .opts { display: flex; flex-direction: column; gap: 8px; }
.quiz .opt {
  display: flex; align-items: flex-start; gap: 11px; cursor: pointer;
  background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 13px 15px;
  transition: border-color .15s, background .15s, box-shadow .15s; font-size: 14.5px; color: var(--ink-soft); line-height: 1.65;
}
.quiz .opt:hover { border-color: var(--terra-soft); background: #FCFAF6; }
.quiz .opt .dot {
  flex: 0 0 18px; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%;
  border: 1.5px solid var(--terra-soft); position: relative; transition: border-color .15s;
}
.quiz .opt.sel { border-color: var(--terra); background: #FBF4EB; color: var(--ink); box-shadow: 0 0 0 1px var(--terra) inset; }
.quiz .opt.sel .dot { border-color: var(--terra); }
.quiz .opt.sel .dot::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--terra); }
.quiz .opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.quiz-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 24px; }
.quiz-btn {
  display: inline-flex; align-items: center; gap: 8px; border: none; cursor: pointer;
  background: var(--terra); color: #fff; padding: 13px 30px; border-radius: 999px;
  font-size: 15px; font-weight: 500; letter-spacing: .06em; font-family: inherit;
  box-shadow: 0 6px 18px rgba(176,123,87,.26); transition: transform .15s, background .2s, opacity .2s;
}
.quiz-btn:hover { transform: translateY(-1px); }
.quiz-btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; transform: none; }
.quiz-btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--terra-soft); box-shadow: none; padding: 12px 24px; }
.quiz-btn.ghost:hover { background: var(--sand); }
.quiz .hint { font-size: 13px; color: var(--terra); }

/* 結果區 */
.quiz-result { display: none; margin-top: 26px; padding-top: 26px; border-top: 1px dashed var(--terra-soft); }
.quiz-result.show { display: block; animation: qfade .5s ease; }
@keyframes qfade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.quiz-result .r-tag { font-family: "Noto Serif TC", serif; font-size: 12px; letter-spacing: .18em; color: var(--terra); font-weight: 600; }
.quiz-result h3 { font-family: "Noto Serif TC", serif; font-size: 22px; font-weight: 600; margin: 6px 0 6px; color: var(--ink); }
.quiz-result .score { font-size: 13px; color: var(--muted); letter-spacing: .05em; margin: 0 0 16px; }
.quiz-result .r-body { color: var(--ink-soft); font-size: 15px; }
.quiz-result .r-next { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin: 16px 0 4px; }
.quiz-result .r-next .nt { font-weight: 600; color: var(--ink); display: block; margin-bottom: 8px; font-size: 14px; }
.quiz-result .r-next ul { margin: 0; padding-left: 1.1em; }
.quiz-result .r-next li { margin-bottom: 6px; font-size: 14px; }

/* CTA */
.cta-box { text-align: center; background: var(--paper-2); border-radius: 16px; padding: 34px 22px; margin: 48px 0 0; }
.cta-box p { font-family: "Noto Serif TC", serif; font-size: 16px; color: var(--ink); margin: 0 0 18px; }
.cta {
  display: inline-block; background: var(--terra); color: #fff;
  padding: 13px 30px; border-radius: 999px; font-size: 15px; font-weight: 500;
  letter-spacing: .06em; box-shadow: 0 6px 18px rgba(176,123,87,.28);
}

/* ---------- 側邊目錄（錨點） ---------- */
.toc-wrap { display: none; }
@media (min-width: 960px) {
  .toc-wrap { display: block; position: sticky; top: calc(var(--header-h) + 28px); padding: 28px 0; }
}
.toc-title {
  font-family: "Noto Serif TC", serif; font-size: 12px; letter-spacing: .2em;
  color: var(--muted); font-weight: 600; margin: 0 0 14px; padding-left: 14px;
}
#toc { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
#toc li a {
  display: block; padding: 7px 14px; font-size: 13.5px; line-height: 1.5;
  color: var(--muted); border-left: 2px solid transparent; margin-left: -1px;
  transition: color .15s, border-color .15s;
}
#toc li.sub a { padding-left: 26px; font-size: 13px; }
#toc li a:hover { color: var(--ink); }
#toc li a.active { color: var(--terra); border-left-color: var(--terra); font-weight: 500; }

/* ---------- 手機版目錄（可收合） ---------- */
.toc-mobile { display: block; margin: 0 0 32px; }
@media (min-width: 960px) { .toc-mobile { display: none; } }
.toc-mobile details {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.toc-mobile summary {
  list-style: none; cursor: pointer; padding: 14px 18px;
  font-family: "Noto Serif TC", serif; font-weight: 600; color: var(--ink);
  display: flex; align-items: center; justify-content: space-between;
}
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary .chev { transition: transform .2s; color: var(--terra); }
.toc-mobile details[open] summary .chev { transform: rotate(180deg); }
.toc-mobile #toc-m { list-style: none; margin: 0; padding: 4px 8px 12px; }
.toc-mobile #toc-m li a { display: block; padding: 8px 12px; font-size: 14.5px; color: var(--ink-soft); border-radius: 8px; }
.toc-mobile #toc-m li.sub a { padding-left: 28px; font-size: 13.5px; color: var(--muted); }
.toc-mobile #toc-m li a:active { background: var(--sand); }

/* 回頂部 */
.to-top {
  position: fixed; right: 18px; bottom: 18px; z-index: 40;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--terra); color: #fff; border: none; cursor: pointer;
  box-shadow: 0 6px 18px rgba(176,123,87,.3);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.to-top.show { opacity: 1; pointer-events: auto; }

/* footer */
.site-footer { text-align: center; padding: 32px 20px 48px; color: var(--muted); font-size: 12px; letter-spacing: .08em; border-top: 1px solid var(--line); }
.site-footer .fb { font-family: "Noto Serif TC", serif; letter-spacing: .3em; color: var(--ink-soft); margin-bottom: 6px; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .to-top { transition: none; } }
