/* 買賣攻略 /guides、/guides/{slug}：暖和紙編輯風。
   只用主題 CSS 變數（neon_theme.css／site.css）：紙底 --bg／--field、墨 --ink、砂色邊 --line／--border-strong、
   鼠尾草綠 --accent／--accent-soft、暖金 --gold-soft。不寫任何色碼；無 inline style／script（CSP）。
   390px 手機：容器全部 min-width:0 + 長字斷行，比較表只在 .gd-table-wrap 內橫捲，頁面本身不橫捲。 */

.gd-page {
  --gd-gap: clamp(16px, 4vw, 28px);
  max-width: 880px;
  margin: 0 auto;
  padding: 4px 0 56px;
  color: var(--ink);
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}
.gd-page *, .gd-page *::before, .gd-page *::after { box-sizing: border-box; }
.gd-page a:focus-visible,
.gd-page summary:focus-visible,
.gd-table-wrap:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ── 麵包屑 ─────────────────────────────── */
.gd-crumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 2px;
  margin: 0;
  padding: 12px 0 4px;
  list-style: none;
  font-size: 13px;
  color: var(--muted);
}
.gd-crumbs li { display: inline-flex; align-items: center; min-width: 0; }
.gd-crumbs li + li::before { content: "/"; margin: 0 6px; color: var(--border-strong); }
.gd-crumbs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 6px;
  margin: 0 -6px;
  color: var(--ink-2);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: color .18s ease;
}
.gd-crumbs a:hover { color: var(--accent); }
.gd-crumbs [aria-current="page"] { color: var(--ink); font-weight: 600; }

.gd-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: transform .18s ease, color .18s ease;
}
.gd-back:hover { color: var(--accent-deep, var(--accent)); transform: translateX(-2px); }

/* ── 共用：標籤、日期 ─────────────────────── */
.gd-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 4px 11px;
  border: 1px solid var(--accent-border, var(--line));
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep, var(--accent));
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  line-height: 1.4;
}
.gd-date { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.gd-eyebrow,
.gd-alt-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .14em;
}
.gd-hint { margin: -4px 0 12px; color: var(--muted); font-size: 13px; line-height: 1.6; }

/* ── 索引頁：標頭 ─────────────────────────── */
.gd-hero {
  padding: 22px 0 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.gd-hero-title {
  margin: 0 0 10px;
  font-family: var(--serif, var(--font));
  font-size: clamp(28px, 6vw, 38px);
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.25;
  color: var(--ink);
}
.gd-hero-lede { margin: 0; max-width: 40em; color: var(--ink-2); font-size: 15.5px; line-height: 1.8; }

/* 分段主題篩選（純連結） */
.gd-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 22px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
}
.gd-filter-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.gd-filter-pill:hover { color: var(--ink); background: var(--field, var(--bg)); }
.gd-filter-pill.is-on {
  background: var(--field, var(--bg));
  color: var(--accent-deep, var(--accent));
  font-weight: 600;
  box-shadow: var(--elev);
}

/* ── 卡片格（索引＋延伸閱讀） ──────────────── */
.gd-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.gd-grid-item { display: flex; min-width: 0; }
.gd-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 20px 20px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field, var(--bg));
  box-shadow: var(--elev);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.gd-card:hover,
.gd-card:focus-within {
  transform: translateY(-2px);
  border-color: var(--accent-border, var(--border-strong));
  box-shadow: var(--elev-hover);
}
.gd-card-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.gd-card-title {
  margin: 2px 0 0;
  font-family: var(--serif, var(--font));
  font-size: 19px;
  font-weight: 700;
  line-height: 1.45;
}
.gd-card-link { color: var(--ink); text-decoration: none; }
.gd-card-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.gd-card-link:focus-visible { outline: none; }
.gd-card-link:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 2px; }
.gd-card:hover .gd-card-link { color: var(--accent-deep, var(--accent)); }
.gd-card-sub { margin: 0; color: var(--ink-2); font-size: 14.5px; line-height: 1.7; }
/* Box chrome (padding/background) lives on the outer container; the clamp lives
   on the inner text with zero padding, so a 4th line can never peek into the
   container's bottom padding below the ellipsis. */
.gd-card-answer {
  margin: 2px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent-border, var(--accent));
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.7;
}
.gd-card-answer-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  margin: 0;
  padding: 0;
}
.gd-card-answer-label { margin-right: 6px; color: var(--accent); font-weight: 600; }
.gd-card-more {
  margin-top: auto;
  padding-top: 4px;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 600;
  transition: transform .22s ease;
}
.gd-card:hover .gd-card-more { transform: translateX(3px); }
.gd-card-compact { padding: 16px 18px; }
.gd-card-compact .gd-card-title { font-size: 16.5px; }
.gd-card-compact .gd-card-sub { font-size: 13.5px; }

.gd-empty {
  padding: 28px 20px;
  border: 1px dashed var(--border-strong, var(--line));
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink-2);
  text-align: center;
  line-height: 1.8;
}
.gd-empty a { color: var(--accent); font-weight: 600; }

/* ── 內文頁 ───────────────────────────────── */
.gd-article { min-width: 0; }
.gd-article-head { padding: 14px 0 20px; }
.gd-article-title {
  margin: 12px 0 10px;
  font-family: var(--serif, var(--font));
  font-size: clamp(25px, 5.6vw, 36px);
  font-weight: 700;
  line-height: 1.32;
  letter-spacing: .01em;
  color: var(--ink);
}
.gd-article-sub { margin: 0 0 12px; color: var(--ink-2); font-size: 16px; line-height: 1.8; }
.gd-byline { margin: 0; color: var(--muted); font-size: 13px; }

.gd-section { margin: 0 0 var(--gd-gap); min-width: 0; }
.gd-section + .gd-section,
.gd-alt + .gd-section { padding-top: 6px; }
.gd-h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-family: var(--serif, var(--font));
  font-size: 21px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink);
}
.gd-h2::before {
  content: "";
  flex: 0 0 auto;
  width: 4px;
  height: 1.05em;
  border-radius: 2px;
  background: var(--accent);
}

/* 重點結論（TL;DR） */
.gd-tldr {
  margin: 0 0 var(--gd-gap);
  padding: clamp(18px, 4vw, 26px);
  border: 1px solid var(--gold-border, var(--line));
  border-radius: var(--radius);
  background: var(--gold-soft, var(--surface-2));
  box-shadow: var(--elev);
}
.gd-tldr-title {
  margin: 0 0 10px;
  color: var(--accent-deep, var(--accent));
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .1em;
}
.gd-tldr-answer { margin: 0 0 14px; color: var(--ink); font-size: 16.5px; font-weight: 500; line-height: 1.85; }
.gd-tldr-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 14px 0 0;
  border-top: 1px dashed var(--gold-border, var(--line));
  list-style: none;
}
.gd-tldr-list li { position: relative; padding-left: 22px; color: var(--ink-2); font-size: 14.5px; line-height: 1.75; }
.gd-tldr-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-weight: 700;
}

/* 比較表：只在容器內橫捲 */
.gd-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field, var(--bg));
  box-shadow: var(--elev);
}
.gd-table {
  width: 100%;
  min-width: 620px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  line-height: 1.65;
}
.gd-table th,
.gd-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: normal;
  word-break: normal;
}
.gd-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  white-space: nowrap;
}
.gd-table tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 108px;
  background: var(--field, var(--bg));
  color: var(--ink);
  font-weight: 600;
  box-shadow: 1px 0 0 var(--line);
}
.gd-table thead th:first-child { left: 0; z-index: 2; box-shadow: 1px 0 0 var(--line); }
.gd-table td { color: var(--ink-2); min-width: 150px; }
.gd-table tbody tr:last-child th,
.gd-table tbody tr:last-child td { border-bottom: 0; }
.gd-table tbody tr { transition: background-color .18s ease; }
.gd-table tbody tr:hover td { background: var(--accent-soft); }

/* 優點／取捨 */
.gd-proscons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.gd-pc {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field, var(--bg));
}
.gd-pc-pro { border-top: 3px solid var(--accent); }
.gd-pc-con { border-top: 3px solid var(--border-strong, var(--line)); }
.gd-pc-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 16px; font-weight: 700; }
.gd-pc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 14px;
}
.gd-pc-pro .gd-pc-icon { background: var(--accent-soft); color: var(--accent); }
.gd-pc-con .gd-pc-icon { background: var(--surface-2); color: var(--warn, var(--ink-2)); }
.gd-pc-list { display: grid; gap: 8px; margin: 0; padding-left: 1.2em; color: var(--ink-2); font-size: 14.5px; line-height: 1.75; }
.gd-pc-list li::marker { color: var(--muted); }

/* 實作步驟：時間軸 */
.gd-steps { position: relative; margin: 0; padding: 0; list-style: none; }
.gd-step { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 14px; padding-bottom: 18px; }
.gd-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 38px;
  bottom: 4px;
  width: 2px;
  border-radius: 1px;
  background: var(--line);
}
.gd-step:last-child { padding-bottom: 0; }
.gd-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--accent-border, var(--line));
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-deep, var(--accent));
  font-size: 15px;
  font-weight: 700;
}
.gd-step-body { margin: 0; padding-top: 6px; color: var(--ink-2); font-size: 15px; line-height: 1.8; }

/* 替代方案參考：安靜、不推銷 */
.gd-alt {
  margin: 0 0 var(--gd-gap);
  padding: clamp(18px, 4vw, 24px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.gd-alt-title { margin: 0 0 8px; font-size: 18px; font-weight: 700; line-height: 1.5; color: var(--ink); }
.gd-alt-body { margin: 0 0 14px; color: var(--ink-2); font-size: 14.5px; line-height: 1.8; }
.gd-actions { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.gd-action { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-width: 0; }
.gd-action-pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--accent-border, var(--accent));
  border-radius: 999px;
  background: var(--field, var(--bg));
  color: var(--accent-deep, var(--accent));
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.gd-action-pill:hover { background: var(--accent-soft); transform: translateY(-1px); box-shadow: var(--elev); }
.gd-action-note { flex: 1 1 14em; min-width: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

/* FAQ 手風琴 */
.gd-faq { display: grid; gap: 10px; }
.gd-faq-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field, var(--bg));
  transition: border-color .2s ease, box-shadow .2s ease;
}
.gd-faq-item[open] { border-color: var(--accent-border, var(--border-strong)); box-shadow: var(--elev); }
.gd-faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  border-radius: var(--radius);
}
.gd-faq-q::-webkit-details-marker { display: none; }
.gd-faq-q::after {
  content: "+";
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  transition: transform .22s ease;
}
.gd-faq-item[open] > .gd-faq-q::after { transform: rotate(45deg); }
.gd-faq-q:hover .gd-faq-q-text { color: var(--accent-deep, var(--accent)); }
.gd-faq-q-text { margin: 0; min-width: 0; font-size: 15.5px; font-weight: 600; line-height: 1.6; color: var(--ink); transition: color .18s ease; }
.gd-faq-a { margin: 0; padding: 0 16px 16px; color: var(--ink-2); font-size: 14.5px; line-height: 1.85; }

/* 站內相關現貨參考 */
.gd-listings {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.gd-listings > li { min-width: 0; display: flex; }
.gd-listing {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field, var(--bg));
  color: var(--ink);
  text-decoration: none;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.gd-listing:hover { transform: translateY(-2px); box-shadow: var(--elev-hover); border-color: var(--accent-border, var(--border-strong)); }
.gd-listing-media {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  background: var(--surface-2);
  overflow: hidden;
}
.gd-listing-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gd-listing-noimg { color: var(--muted); font-size: 12px; }
.gd-listing-text { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 12px; min-width: 0; }
.gd-listing-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-size: 13.5px;
  line-height: 1.5;
}
.gd-listing-price { color: var(--price, var(--accent)); font-size: 14px; font-weight: 700; }

/* 資料來源 */
.gd-sources-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 4px 16px 4px 2.2em;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field, var(--bg));
  color: var(--muted);
  font-size: 14px;
}
.gd-sources-list li { min-width: 0; }
.gd-sources-list li::marker { color: var(--muted); font-size: 12.5px; }
.gd-sources-list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 0;
  color: var(--accent);
  line-height: 1.6;
  text-decoration: underline;
  text-decoration-color: var(--accent-border, var(--line));
  text-underline-offset: 3px;
  transition: text-decoration-color .18s ease;
}
.gd-sources-list a:hover { text-decoration-color: currentColor; }

.gd-related { margin-top: 8px; padding-top: 22px; border-top: 1px solid var(--line); }

/* ── 響應式 ───────────────────────────────── */
@media (max-width: 760px) {
  .gd-listings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .gd-grid,
  .gd-proscons { grid-template-columns: minmax(0, 1fr); }
  .gd-filter { width: 100%; border-radius: var(--radius); }
  .gd-filter-pill { flex: 1 1 auto; padding: 0 12px; }
  .gd-card { padding: 18px 16px 16px; }
  .gd-hero { padding-top: 14px; }
  .gd-hero-lede, .gd-article-sub { font-size: 15px; }
  .gd-tldr-answer { font-size: 16px; }
  .gd-table { min-width: 560px; font-size: 13.5px; }
  .gd-table th, .gd-table td { padding: 10px 12px; }
  .gd-table tbody th { min-width: 92px; }
  .gd-table td { min-width: 140px; }
}

@media (prefers-reduced-motion: reduce) {
  .gd-page *, .gd-page *::before, .gd-page *::after { transition: none !important; }
  .gd-card:hover, .gd-card:focus-within, .gd-listing:hover, .gd-action-pill:hover, .gd-back:hover { transform: none; }
}
