/* 視覺方向：地政測量圖紙 × 糖廠告示牌。米白圖紙底、深墨綠字、朱紅戳章，四種標案各有一色。 */
:root {
  --paper: #f5f0e3;
  --paper-deep: #ebe3cf;
  --surface: #fffcf4;
  --ink: #1d2a26;
  --ink-soft: #55625c;
  --rule: #cfc5ab;
  --cane: #23483c;
  --stamp: #b23b2a;
  --amber: #c07f1e;
  --kind: var(--cane);

  --serif: 'Noto Serif TC', 'Songti TC', serif;
  --sans: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;

  --text-sm: 0.8125rem;
  --text-base: 1rem;
  --text-lg: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  --text-hero: clamp(2.25rem, 1.2rem + 4.6vw, 4.5rem);

  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2.5rem);
  --space-section: clamp(2.5rem, 2rem + 3vw, 5rem);
  --radius: 3px;
  --shadow: 0 1px 0 var(--rule), 0 10px 24px -18px rgb(29 42 38 / 0.55);
  --fast: 150ms;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-kind='land-rent'] { --kind: #3c7a4b; }
[data-kind='sale'] { --kind: #b23b2a; }
[data-kind='house-rent'] { --kind: #c07f1e; }
[data-kind='superficies'] { --kind: #2c5a86; }

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--ink);
  background-color: var(--paper);
  /* 測量方格紙 */
  background-image:
    linear-gradient(rgb(35 72 60 / 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgb(35 72 60 / 0.045) 1px, transparent 1px);
  background-size: 28px 28px;
  font-variant-numeric: tabular-nums;
}

a { color: var(--cane); text-underline-offset: 0.2em; }
a:hover { color: var(--stamp); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.25; margin: 0; }
small { font-size: var(--text-sm); }
.wrap { width: min(100% - 2 * var(--gutter), 84rem); margin-inline: auto; }
.fine { font-size: var(--text-sm); color: var(--ink-soft); margin: 0.5rem 0 0; }

/* 刊頭 */
.masthead { background: var(--cane); color: var(--paper); border-bottom: 4px double var(--paper-deep); }
.masthead-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 0.75rem; }
.brand { display: flex; align-items: center; gap: 0.75rem; color: inherit; text-decoration: none; }
.brand:hover { color: #fff; }
.brand-mark {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; flex: none;
  font-family: var(--serif); font-weight: 900; font-size: 1.375rem;
  color: var(--paper); background: var(--stamp); border-radius: 50%; box-shadow: inset 0 0 0 2px var(--stamp), inset 0 0 0 3px var(--paper);
}
.brand-text strong { display: block; font-family: var(--serif); font-size: 1.125rem; letter-spacing: 0.06em; }
.brand-text small { display: block; opacity: 0.75; line-height: 1.3; }
.masthead-nav { display: flex; gap: 1.25rem; font-size: 0.9375rem; }
.masthead-nav a { color: var(--paper); text-decoration: none; border-bottom: 1px solid transparent; }
.masthead-nav a:hover { border-bottom-color: var(--amber); color: #fff; }

/* 首屏 */
.hero { border-bottom: 1px solid var(--rule); background: linear-gradient(180deg, rgb(255 252 244 / 0.7), transparent); }
.hero-row { display: grid; gap: 2rem; padding-block: var(--space-section) calc(var(--space-section) * 0.7); align-items: end; }
.eyebrow { margin: 0 0 1rem; font-size: var(--text-sm); letter-spacing: 0.24em; color: var(--stamp); font-weight: 700; }
.hero h1 { font-size: var(--text-hero); font-weight: 900; letter-spacing: 0.02em; }
.hero h1 em { font-style: normal; color: var(--stamp); box-shadow: inset 0 -0.18em 0 rgb(192 127 30 / 0.35); }
.hero-lede { max-width: 38rem; margin: 1.5rem 0 0; font-size: var(--text-lg); color: var(--ink-soft); }
.hero-stats { display: grid; grid-template-columns: repeat(3, auto); gap: 0; margin: 0; border: 1px solid var(--ink); background: var(--surface); box-shadow: 6px 6px 0 var(--cane); }
.hero-stats div { padding: 1rem 1.25rem; border-left: 1px dashed var(--rule); }
.hero-stats div:first-child { border-left: 0; }
.hero-stats dt { font-size: var(--text-sm); color: var(--ink-soft); letter-spacing: 0.1em; }
.hero-stats dd { margin: 0; font-family: var(--serif); font-weight: 900; font-size: 2.25rem; line-height: 1.15; }
.hero-stats div:first-child dd { color: var(--stamp); }
.hero-stats dd.small { font-family: var(--sans); font-weight: 500; font-size: 0.9375rem; line-height: 2.6; }

/* 類型分頁 */
.finder { padding-block: 2rem var(--space-section); }
.tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tab {
  display: inline-flex; align-items: baseline; gap: 0.5rem; padding: 0.5rem 0.875rem 0.5rem 1rem;
  font: inherit; font-weight: 500; color: var(--ink); cursor: pointer;
  background: var(--surface); border: 1px solid var(--rule); border-left: 5px solid var(--kind); border-radius: var(--radius);
  transition: transform var(--fast) var(--ease), background-color var(--fast);
}
.tab b { font-size: var(--text-sm); color: var(--ink-soft); font-weight: 700; }
.tab:hover { transform: translateY(-2px); background: #fff; }
.tab[aria-pressed='true'] { background: var(--ink); color: var(--paper); border-color: var(--ink); border-left-color: var(--kind); }
.tab[aria-pressed='true'] b { color: var(--paper-deep); }

/* 篩選列 */
.filters {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 0.75rem 1rem; align-items: end;
  margin-top: 1rem; padding: 1rem 1.25rem 1.25rem; background: var(--surface); border: 1px solid var(--rule); border-top: 3px solid var(--ink);
}
.field { display: grid; gap: 0.25rem; }
.field-wide { grid-column: span 2; }
.field span { font-size: var(--text-sm); font-weight: 700; letter-spacing: 0.08em; color: var(--ink-soft); }
.field input, .field select {
  width: 100%; min-height: 2.75rem; padding: 0.375rem 0.625rem; font: inherit; color: var(--ink);
  background: #fff; border: 1px solid var(--rule); border-bottom: 2px solid var(--ink-soft); border-radius: var(--radius);
}
.field input:hover, .field select:hover { border-bottom-color: var(--stamp); }
.field select:disabled { opacity: 0.55; }
.reset { min-height: 2.75rem; font: inherit; color: var(--ink-soft); background: none; border: 1px dashed var(--rule); border-radius: var(--radius); cursor: pointer; }
.reset:hover { color: var(--stamp); border-color: var(--stamp); }

/* 列表與地圖 */
.view-switch { display: none; margin-top: 1rem; }
.view-switch button { flex: 1; min-height: 2.75rem; font: inherit; font-weight: 700; background: var(--surface); border: 1px solid var(--ink); cursor: pointer; }
.view-switch button[aria-pressed='true'] { background: var(--ink); color: var(--paper); }
.results { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr); gap: 1.5rem; margin-top: 1.5rem; align-items: start; }
.results-map { position: sticky; top: 1rem; }
.map { height: min(78vh, 46rem); border: 1px solid var(--ink); box-shadow: 6px 6px 0 var(--paper-deep); background: var(--paper-deep); z-index: 0; }
.results-count { margin: 0 0 0.75rem; font-weight: 700; letter-spacing: 0.04em; }
.cards { display: grid; gap: 0.875rem; margin: 0; padding: 0; list-style: none; }

.card { background: var(--surface); border: 1px solid var(--rule); border-left: 6px solid var(--kind); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform var(--fast) var(--ease), box-shadow var(--fast); }
.card:hover, .card:focus-within { transform: translateX(4px); box-shadow: 0 1px 0 var(--rule), 0 16px 28px -18px rgb(29 42 38 / 0.7); }
.card-link { display: block; padding: 1rem 1.25rem; color: inherit; text-decoration: none; }
.card-link:hover { color: inherit; }
.card-top { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0 0 0.5rem; }
.card-title { font-size: 1.125rem; font-weight: 600; overflow-wrap: anywhere; }
.card:hover .card-title { color: var(--kind); }
.card-place { margin: 0.25rem 0 0; font-size: 0.9375rem; color: var(--ink-soft); }
.card-place span { margin-left: 0.75rem; padding-left: 0.75rem; border-left: 1px solid var(--rule); }
.card-figures { display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; margin: 0.875rem 0 0; padding-top: 0.75rem; border-top: 1px dashed var(--rule); }
.card-figures dt { font-size: 0.75rem; letter-spacing: 0.1em; color: var(--ink-soft); }
.card-figures dd { margin: 0; font-weight: 700; font-size: 1.0625rem; }
.card-price dd { font-family: var(--serif); font-size: 1.5rem; font-weight: 900; line-height: 1.2; color: var(--kind); }
.card-foot { margin: 0.75rem 0 0; font-size: var(--text-sm); color: var(--ink-soft); }
.empty { padding: 2rem 1.5rem; background: var(--surface); border: 1px dashed var(--rule); }
.empty p { margin: 0 0 0.5rem; }
.more { width: 100%; min-height: 3rem; margin-top: 1rem; font: inherit; font-weight: 700; color: var(--paper); background: var(--cane); border: 0; border-radius: var(--radius); cursor: pointer; }
.more:hover { background: var(--ink); }

.kind-chip { padding: 0.0625rem 0.5rem; font-size: var(--text-sm); font-weight: 700; color: #fff; background: var(--kind); border-radius: 2px; letter-spacing: 0.08em; }
.tag { padding: 0.0625rem 0.5rem; font-size: var(--text-sm); color: var(--ink-soft); border: 1px solid var(--rule); border-radius: 2px; background: var(--paper); }
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
/* 戳章 */
.stamp { padding: 0 0.5rem; font-size: var(--text-sm); font-weight: 700; letter-spacing: 0.06em; border: 1.5px solid currentColor; border-radius: 2px; transform: rotate(-1.5deg); }
.stamp-open { color: var(--stamp); }
.stamp-upcoming { color: var(--amber); }
.stamp-closed, .stamp-suspended { color: var(--ink-soft); border-style: dashed; transform: none; font-weight: 500; }

.popup strong { color: var(--cane); }
.popup p { margin: 0.25rem 0; }
.leaflet-container { font-family: var(--sans); }

/* 關於 */
.about { padding-block: var(--space-section); border-top: 4px double var(--rule); }
.about h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.25rem); margin-bottom: 1.5rem; }
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 2rem; }
.about h3 { font-size: 1.125rem; padding-bottom: 0.5rem; margin-bottom: 0.75rem; border-bottom: 2px solid var(--ink); }
.about p { margin: 0; color: var(--ink-soft); }
.about strong { color: var(--ink); }

/* 詳情頁 */
.detail { padding-block: 1.5rem var(--space-section); }
.crumbs { display: flex; gap: 0.5rem; font-size: var(--text-sm); color: var(--ink-soft); }
.detail-head { margin-top: 1.25rem; padding-bottom: 1.5rem; border-bottom: 3px solid var(--ink); }
.detail-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 0.625rem; margin: 0 0 0.75rem; }
.detail-head h1 { font-size: clamp(1.625rem, 1.1rem + 2.4vw, 2.875rem); font-weight: 900; overflow-wrap: anywhere; }
.detail-place { margin: 0.75rem 0 0; color: var(--ink-soft); }
.detail-main { min-width: 0; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 2.5rem; margin-top: 2rem; align-items: start; }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0; margin: 0; background: var(--surface); border: 1px solid var(--ink); box-shadow: 6px 6px 0 var(--kind); }
.figure { padding: 1rem 1.25rem; border-right: 1px dashed var(--rule); border-bottom: 1px dashed var(--rule); }
.figure dt { font-size: var(--text-sm); letter-spacing: 0.1em; color: var(--ink-soft); }
.figure dd { margin: 0; font-family: var(--serif); font-weight: 900; font-size: 1.625rem; line-height: 1.3; }
.figure:first-child dd { color: var(--kind); font-size: 2rem; }
.figure dd small { display: block; font-family: var(--sans); font-weight: 400; color: var(--ink-soft); line-height: 1.5; }
.block { margin-top: 2.5rem; }
.block h2 { font-size: 1.375rem; padding-left: 0.75rem; margin-bottom: 1rem; border-left: 6px solid var(--kind); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1.75rem 0; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; padding: 1.25rem 1rem 0 0; border-top: 2px solid var(--ink); counter-increment: step; }
.steps li::before { content: counter(step); position: absolute; top: -0.875rem; left: 0; display: grid; place-items: center; width: 1.625rem; height: 1.625rem; font-size: var(--text-sm); font-weight: 700; color: var(--paper); background: var(--ink); border-radius: 50%; }
.step-label { display: block; font-size: var(--text-sm); letter-spacing: 0.1em; color: var(--ink-soft); }
.step-value { display: block; font-weight: 700; }
.step-extra { display: block; font-size: var(--text-sm); color: var(--ink-soft); }
.detail-map { height: 22rem; border: 1px solid var(--ink); z-index: 0; }
.table-scroll { overflow-x: auto; border: 1px solid var(--rule); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; white-space: nowrap; }
.data-table th, .data-table td { padding: 0.625rem 0.875rem; text-align: left; border-bottom: 1px solid var(--rule); }
.data-table th { font-size: var(--text-sm); letter-spacing: 0.06em; color: var(--ink-soft); background: var(--paper-deep); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; }
.note { margin: 0; padding: 1.25rem 1.5rem; white-space: pre-line; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--rule); border-left: 3px solid var(--rule); }
.photos { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; }
.photo img { display: block; width: 20rem; max-width: 100%; height: 13.75rem; object-fit: cover; border: 1px solid var(--ink); transition: transform var(--fast) var(--ease); }
.photo:hover img { transform: scale(1.02); }
.file-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.file-list a { display: block; padding: 0.625rem 0.875rem; background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--stamp); text-decoration: none; overflow-wrap: anywhere; }
.file-list a:hover { background: #fff; border-color: var(--stamp); }
.contact-card { position: sticky; top: 1rem; padding: 1.5rem; background: var(--ink); color: var(--paper); box-shadow: 6px 6px 0 var(--kind); }
.contact-card h2 { font-size: var(--text-sm); font-family: var(--sans); letter-spacing: 0.24em; opacity: 0.7; }
.contact-card p { margin: 0.5rem 0 0; }
.contact-unit { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; }
.contact-phone a { color: #fff; font-size: 1.25rem; font-weight: 700; }
.contact-card .fine { color: var(--paper-deep); margin-top: 1rem; }
.cta { display: block; margin-top: 1.25rem; padding: 0.75rem 1rem; text-align: center; font-weight: 700; color: #fff; background: var(--stamp); text-decoration: none; border-radius: var(--radius); transition: transform var(--fast) var(--ease); }
.cta:hover { color: #fff; transform: translateY(-2px); }
.detail > .cta { display: inline-block; }

.site-foot { padding-block: 2rem; font-size: var(--text-sm); color: var(--paper-deep); background: var(--ink); }
.site-foot a { color: var(--paper); }
.site-foot p { margin: 0 0 0.5rem; max-width: 60rem; }

@media (max-width: 60rem) {
  .hero-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .contact-card { position: static; }
  .view-switch { display: flex; }
  .results { grid-template-columns: minmax(0, 1fr); }
  .results[data-view='list'] .results-map { display: none; }
  .results[data-view='map'] .results-list { display: none; }
  .results-map { position: static; }
  .map { height: 70vh; }
}
@media (min-width: 60.0625rem) {
  .hero-row { grid-template-columns: minmax(0, 1fr) auto; }
}
@media (max-width: 36rem) {
  .masthead-nav a:last-child, .brand-text small { display: none; }
  .hero-stats { grid-template-columns: 1fr 1fr; box-shadow: 4px 4px 0 var(--cane); }
  .hero-stats div:last-child { grid-column: span 2; border-left: 0; border-top: 1px dashed var(--rule); }
  .hero-stats dd.small { line-height: 1.6; }
  .field-wide { grid-column: 1 / -1; }
  .filters { grid-template-columns: 1fr 1fr; padding: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
