:root {
  --coffee-dark: #3F2A1A;
  --coffee: #5C3A21;
  --coffee-soft: #8A6A4F;
  --cream: #F7EFE3;
  --cream-deep: #EFE4CE;
  --beige: #E8D9BD;
  --sage: #6E8E84;
  --sage-soft: #B7CFC7;
  --moss: #5A7A6F;
  --line: #D8C9AE;
  --shadow: 0 6px 22px rgba(63, 42, 26, .08);
  --radius: 14px;
  --max-w: 1080px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--coffee-dark);
  background: linear-gradient(180deg, #FAF3E7 0%, #F2E7D2 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
a { color: var(--coffee); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }

/* 防原生拖曳：僅針對非內容元素 */
img, .brand-mark, .read-btn, .btn-secondary, .secondary-btn, .nav-toggle {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  user-drag: none;
  -webkit-touch-callout: none;
}

/* 可及性焦點環：鍵盤聚焦明顯，滑鼠不顯 */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--sage);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--coffee-dark); color: #fff;
  padding: 8px 14px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; z-index: 99; }

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

/* Header — 單列精簡 */
.site-header {
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.header-inner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  flex-wrap: nowrap;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  color: var(--coffee-dark);
  flex: 0 0 auto;
  min-width: 0;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--coffee); color: #fff; font-weight: 700; letter-spacing: 1px;
  font-size: .95rem;
}
.brand-name {
  font-weight: 700; font-size: 1rem; line-height: 1.2;
}
.search-inline {
  flex: 1 1 200px; min-width: 0;
}
.search-inline input {
  width: 100%; padding: 8px 12px; font: inherit;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  color: var(--coffee-dark);
  font-size: .92rem;
}

/* 分類收合面板 */
.nav-panel {
  position: relative;
  flex-shrink: 0;
}
.nav-toggle {
  list-style: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--cream-deep); color: var(--coffee-dark);
  border: 1px solid var(--line);
  font-size: .9rem; font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.nav-toggle::-webkit-details-marker { display: none; }
.nav-toggle:hover { background: var(--beige); }
.nav-toggle:active { transform: translateY(1px); }
.nav-toggle-caret {
  display: inline-block;
  transition: transform .15s ease;
  font-size: .8em;
}
.nav-panel[open] .nav-toggle-caret { transform: rotate(180deg); }
.nav-panel[open] .nav-toggle {
  background: var(--coffee); color: #fff; border-color: var(--coffee);
}

.primary-nav {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  min-width: 220px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(63,42,26,.12);
  display: flex; flex-direction: column;
  gap: 2px;
}
.primary-nav a {
  padding: 9px 12px; border-radius: 8px;
  color: var(--coffee-dark);
  font-size: .92rem;
  display: block;
}
.primary-nav a:hover, .primary-nav a:focus-visible {
  background: var(--cream-deep);
  text-decoration: none;
}
.primary-nav a[aria-current="page"] {
  background: var(--coffee); color: #fff;
  font-weight: 600;
}

/* Hero */
.main-content { padding: 28px 20px 60px; }
.hero {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.kicker {
  margin: 0 0 6px; font-size: .78rem; letter-spacing: 1.4px;
  color: var(--moss); text-transform: uppercase; font-weight: 700;
}
.hero h1 { margin: 0 0 8px; font-size: 1.4rem; line-height: 1.25; }
.lede { margin: 0 0 10px; color: #4B3525; font-size: .95rem; line-height: 1.5; }
.meta-line { margin: 0 0 8px; font-size: .88rem; color: var(--coffee-soft); }
.disclaimer {
  margin-top: 10px; padding: 9px 12px; border-radius: 10px;
  background: #FFFAEC; border: 1px dashed #C9A55F;
  color: #6A4A1A; font-size: .88rem; line-height: 1.45;
}

/* Filters */
.filters {
  display: grid; grid-template-columns: 1fr; gap: 12px;
  margin: 28px 0 18px;
  padding: 16px;
  background: rgba(255,255,255,.65); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.filter-row { display: flex; flex-direction: column; gap: 6px; }
.filter-label { font-size: .82rem; font-weight: 700; color: var(--moss); }
.filters select {
  width: 100%; padding: 10px 12px; font: inherit;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  color: var(--coffee-dark);
}
.filters select:focus-visible { outline-offset: 1px; }
.btn-secondary {
  justify-self: start;
  padding: 9px 18px; border-radius: 999px;
  background: transparent; border: 1px solid var(--coffee-soft);
  color: var(--coffee-dark);
}
.btn-secondary:hover { background: var(--cream-deep); }
.btn-secondary:active { background: var(--beige); transform: translateY(1px); }

/* News grid */
.section-heading {
  margin: 26px 0 14px; font-size: 1.25rem;
  border-left: 4px solid var(--coffee); padding-left: 12px;
}
.section-counter {
  margin-left: 10px; font-size: .92rem; font-weight: 400;
  color: var(--coffee-soft);
}
.news-grid {
  display: grid; gap: 16px;
  grid-template-columns: 1fr;
}
.news-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
}
.news-card h3 { margin: 0; font-size: 1.05rem; line-height: 1.4; }
.news-card .meta {
  display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center;
  font-size: .82rem; color: var(--coffee-soft);
}
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: var(--cream-deep); color: var(--coffee-dark);
  font-size: .76rem; font-weight: 600;
}
.tag-status-官方確認 { background: #DBE9DC; color: #2F5B3A; }
.tag-status-已公告   { background: #DEE7F2; color: #2C4F77; }
.tag-status-規劃中   { background: #F2EAD0; color: #6E5A1B; }
.tag-status-媒體報導 { background: #ECE4F5; color: #5A3F8A; }
.tag-status-市場觀察 { background: #F6E2D9; color: #8B4327; }
.tag-status-建案資訊 { background: #E9E2D3; color: #6F5A2F; }
.tag-cat {
  background: var(--sage-soft); color: var(--coffee-dark);
}
.summary { margin: 0; color: #3B2D1F; font-size: .94rem; }
.news-card .source {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  font-size: .85rem;
}
.source a { color: var(--moss); }
.news-card footer { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.read-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--coffee); color: #fff; font-weight: 600;
}
.read-btn:hover { background: var(--coffee-dark); text-decoration: none; }
.read-btn:active { transform: translateY(1px); }

.empty-msg { padding: 24px; text-align: center; color: var(--coffee-soft); }

/* About */
.about-card {
  background: rgba(255,255,255,.65);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px;
}
.about-card p { margin: 0 0 12px; }
.about-card ul { margin: 0 0 12px 1.2em; padding: 0; }
.about-card li { margin-bottom: 6px; }
.about-cta-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  background: var(--cream-deep);
  border: 1px dashed var(--coffee-soft);
  border-radius: 10px;
  font-size: .88rem;
  color: var(--coffee-dark);
}
.about-cta-note .contact-pending::before {
  content: "⏳ ";
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line); background: var(--cream);
  margin-top: 40px;
}
.footer-inner {
  padding: 18px 20px;
  font-size: .85rem;
  color: var(--coffee-soft);
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  align-items: center;
}
.footer-inner p { margin: 0; }
.footer-contact {
  color: var(--coffee);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Mobile-first, ≥640px 平板 */
@media (max-width: 639px) {
  /* 手機單列精簡：search 吃剩餘寬度、nav-toggle 縮為圖示鈕 */
  .search-inline { flex: 1 1 auto; min-width: 0; }
  .search-inline input { padding: 7px 10px; font-size: .88rem; }
  .nav-toggle { padding: 7px 10px; font-size: .85rem; }
  .nav-toggle-label { display: none; } /* 只留 ▾ 符號，節省水平空間 */
  .brand-name { font-size: .92rem; }
  .brand-mark { width: 32px; height: 32px; font-size: .88rem; }
  .header-inner { padding: 8px 12px; gap: 8px; }
}
@media (min-width: 640px) {
  .nav-toggle-label { display: inline; }
  .filters { grid-template-columns: 1fr 1fr auto; align-items: end; }
  .news-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero h1 { font-size: 1.7rem; }
  .header-inner { padding: 12px 20px; }
}
@media (min-width: 960px) {
  .news-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Visually hidden helper */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Tag cat with category color accents */
.tag-cat[data-cat="yangmei"]         { background: #F7DBC2; color: #7A4318; }
.tag-cat[data-cat="longtan-science"] { background: #CDE3D9; color: #29554A; }
.tag-cat[data-cat="new-projects"]    { background: #E9DCC2; color: #6F5320; }
.tag-cat[data-cat="infrastructure"]  { background: #D8DCE7; color: #2D3E66; }
.tag-cat[data-cat="market-data"]     { background: #E5D5E9; color: #5B2E73; }
.tag-cat[data-cat="policy-mortgage"] { background: #F5D2C5; color: #8A3320; }