/* ── Reset & base ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-page: #FAF8F4;
  --bg-section: #F4EFE6;
  --bg-card: #FFFFFF;
  --bg-muted: #F7F4EE;

  --text-primary: #1A1A1A;
  --text-body: #3A3A3A;
  --text-secondary: #6B6B6B;
  --text-muted: #9A9A9A;

  --border: #E8E2D5;
  --border-strong: #D4CCB9;
  --border-focus: #B8924A;

  --accent: #B8924A;        /* warm gold */
  --accent-hover: #9A7A3A;
  --accent-soft: #EDE2C7;
  --accent-bg: #FBF5E8;

  --info: #2E6FB0;
  --success: #4A8A5A;
  --warning: #C97B25;
  --danger: #B43A3A;

  --shadow-sm: 0 1px 2px rgba(60, 40, 20, 0.05), 0 1px 3px rgba(60, 40, 20, 0.05);
  --shadow-md: 0 4px 12px rgba(60, 40, 20, 0.06), 0 2px 4px rgba(60, 40, 20, 0.04);
  --shadow-lg: 0 16px 40px rgba(60, 40, 20, 0.10), 0 6px 12px rgba(60, 40, 20, 0.06);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;

  --font-sans: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-serif: 'Noto Serif TC', Georgia, 'Times New Roman', serif;
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-body);
  background: var(--bg-page);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; border: none; background: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }

.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* ── Header ──────────────────────────────────────────────────────── */
.site-header {
  background: rgba(250, 248, 244, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px; height: 38px;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  font-family: var(--font-serif);
  font-weight: 700; font-size: 22px;
  box-shadow: 0 2px 6px rgba(184, 146, 74, 0.30);
}
.brand-name {
  font-family: var(--font-serif);
  font-weight: 700; font-size: 22px;
  color: var(--text-primary); line-height: 1;
}
.brand-tagline {
  font-size: 11px; color: var(--text-muted);
  letter-spacing: 0.08em; margin-top: 2px;
}
.header-actions { display: flex; align-items: center; gap: 24px; }
.header-link {
  font-size: 14px; color: var(--text-secondary);
  font-weight: 500; transition: color .15s;
}
.header-link:hover { color: var(--accent); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  transition: all .15s ease; white-space: nowrap;
}
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 2px 6px rgba(184, 146, 74, 0.30);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(184, 146, 74, 0.35); }
.btn-secondary {
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-text {
  color: var(--text-secondary); padding: 10px 12px;
}
.btn-text:hover { color: var(--accent); background: var(--accent-bg); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }

.link-btn {
  font-size: 13px; color: var(--accent);
  font-weight: 500; padding: 4px 14px;
  border: 1px solid var(--accent); border-radius: 14px;
  background: transparent;
  transition: all .15s ease;
}
.link-btn:hover { background: var(--accent); color: #fff; }
.dot { color: var(--text-muted); margin: 0 2px; }

/* ── Hero ────────────────────────────────────────────────────────── */
.hero {
  padding: 72px 0 48px;
  background: linear-gradient(180deg, var(--bg-page) 0%, var(--bg-section) 100%);
  border-bottom: 1px solid var(--border);
}
.hero-inner { text-align: center; max-width: 880px; margin: 0 auto; }
.hero-eyebrow {
  font-size: 12px; letter-spacing: 0.20em; font-weight: 500;
  color: var(--accent); margin-bottom: 18px;
}
.hero-title {
  font-family: var(--font-serif); font-weight: 700;
  font-size: clamp(34px, 5vw, 56px); line-height: 1.18;
  color: var(--text-primary); margin-bottom: 22px;
}
.hero-accent { color: var(--accent); }
.hero-sub {
  font-size: 17px; color: var(--text-secondary);
  max-width: 620px; margin: 0 auto 40px; line-height: 1.7;
}
.hero-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
  margin-top: 40px;
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 16px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-num {
  font-family: var(--font-serif); font-weight: 700;
  font-size: 32px; color: var(--accent); line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 12px; color: var(--text-secondary);
  margin-top: 8px; letter-spacing: 0.04em;
}

/* ── Main ────────────────────────────────────────────────────────── */
main { padding: 48px 0 72px; }

/* ── Filter card ─────────────────────────────────────────────────── */
.filter-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
  box-shadow: var(--shadow-md); margin-bottom: 36px;
}
.filter-row {
  display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 18px;
  margin-bottom: 22px;
}
.filter-group { display: flex; flex-direction: column; gap: 6px; }
.filter-group label {
  font-size: 12px; font-weight: 500; color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.filter-group input[type="text"],
.filter-group input[type="date"],
.filter-group select {
  padding: 11px 14px; background: var(--bg-muted);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-primary);
  transition: border-color .15s, background .15s;
}
.filter-group input:focus,
.filter-group select:focus {
  outline: none; border-color: var(--accent); background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(184, 146, 74, 0.12);
}
.filter-group input::placeholder { color: var(--text-muted); }

.input-wrap { position: relative; }
.input-wrap .input-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none; font-size: 13px;
}
.input-wrap input { padding-left: 34px !important; width: 100%; }

.filter-toggle { justify-content: flex-end; padding-bottom: 10px; }
.checkbox-line {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 14px; color: var(--text-body); user-select: none;
}
.checkbox-line input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--accent);
  cursor: pointer;
}

.filter-venues {
  border-top: 1px dashed var(--border);
  padding-top: 20px; margin-bottom: 20px;
}
.filter-venues-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.filter-label {
  font-size: 12px; font-weight: 500; color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.filter-venue-actions { display: flex; align-items: center; gap: 4px; }

.venues-container { display: flex; flex-direction: column; gap: 14px; }
.venue-category {
  display: flex; flex-direction: column; gap: 8px;
}
.venue-category-name {
  font-size: 12px; color: var(--text-muted);
  font-weight: 500; letter-spacing: 0.04em;
}
.venue-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.venue-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; background: var(--bg-muted);
  border: 1px solid var(--border); border-radius: 20px;
  font-size: 13px; color: var(--text-body);
  cursor: pointer; transition: all .12s;
  user-select: none;
}
.venue-chip:hover { border-color: var(--accent); color: var(--accent); }
.venue-chip.active {
  background: var(--accent-bg); border-color: var(--accent);
  color: var(--accent-hover); font-weight: 500;
}
.venue-chip .count {
  font-size: 11px; color: var(--text-muted);
  background: var(--bg-card); padding: 1px 6px; border-radius: 10px;
}
.venue-chip.active .count { color: var(--accent); background: rgba(255,255,255,0.7); }

.loading-text { font-size: 13px; color: var(--text-muted); padding: 8px 0; }

.filter-actions {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 16px; border-top: 1px solid var(--border);
}
.filter-actions-right { display: flex; align-items: center; gap: 8px; }
.result-count {
  font-size: 13px; color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.result-count strong { color: var(--accent); font-weight: 700; display: inline-block; }
.result-count.flash strong { animation: countFlash 0.7s ease; }
@keyframes countFlash {
  0%   { transform: scale(1.6); color: var(--accent-hover); }
  60%  { transform: scale(1); }
  100% { transform: scale(1); color: var(--accent); }
}

/* ── Section head ────────────────────────────────────────────────── */
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 22px;
}
.section-title {
  font-family: var(--font-serif); font-weight: 700;
  font-size: 26px; color: var(--text-primary);
}
.section-meta {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text-secondary);
}
.section-meta select {
  padding: 8px 12px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px;
}
.section-meta select:focus { outline: none; border-color: var(--accent); }

.view-toggle {
  display: inline-flex; padding: 3px;
  background: var(--bg-muted); border: 1px solid var(--border);
  border-radius: 999px;
}
.view-btn {
  padding: 6px 14px; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); border-radius: 999px;
  transition: all .15s ease;
}
.view-btn:hover { color: var(--accent); }
.view-btn.active {
  background: var(--bg-card); color: var(--accent);
  box-shadow: 0 1px 3px rgba(60,40,20,0.10);
}

/* ── Table view ──────────────────────────────────────────── */
.result-table-wrap {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.exh-table {
  width: 100%; border-collapse: collapse;
  font-size: 14px;
}
.exh-table thead th {
  background: var(--bg-section); color: var(--text-primary);
  font-weight: 700; font-size: 13px; text-align: left;
  padding: 14px 16px; border-bottom: 2px solid var(--border-strong);
  white-space: nowrap;
}
.exh-table tbody td {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  color: var(--text-body); vertical-align: top;
}
.exh-table tbody tr:last-child td { border-bottom: none; }
.exh-table tbody tr.has-link { cursor: pointer; transition: background .12s; }
.exh-table tbody tr.has-link:hover { background: var(--accent-bg); }

.exh-table .col-date  { width: 14%; min-width: 140px; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-primary); font-weight: 500; }
.exh-table .col-venue { width: 16%; min-width: 130px; }
.exh-table .col-name  { width: 24%; min-width: 200px; font-weight: 500; color: var(--text-primary); }
.exh-table .col-info  { width: 30%; min-width: 200px; color: var(--text-secondary); font-size: 13px; line-height: 1.55; }
.exh-table .col-org   { width: 16%; min-width: 130px; color: var(--text-secondary); font-size: 13px; }

.exh-table .row-status {
  display: inline-block; margin-left: 6px;
  font-size: 11px; padding: 1px 7px; border-radius: 4px;
  vertical-align: middle;
}
.exh-table .row-status.ongoing { background: #E8F2EA; color: var(--success); }
.exh-table .row-status.upcoming { background: #E5EFF8; color: var(--info); }
.exh-table .row-status.ended { background: #F1ECE0; color: var(--text-muted); }
.exh-table .row-status.unknown { background: #F1ECE0; color: var(--text-muted); }

.exh-table .venue-pill {
  display: inline-block;
  background: var(--accent-bg); color: var(--accent-hover);
  padding: 2px 8px; border-radius: 4px; font-size: 12px;
  margin: 1px 2px 1px 0;
}
.exh-table .row-name {
  color: var(--text-primary); font-weight: 600;
}
.exh-table tbody tr.has-link:hover .row-name { color: var(--accent-hover); }
.exh-table .row-link-icon {
  display: inline-block; margin-left: 6px; opacity: 0;
  font-weight: 700; color: var(--accent);
  transition: opacity .15s;
}
.exh-table tbody tr.has-link:hover .row-link-icon { opacity: 1; }

.exh-table .info-clip {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 960px) {
  .exh-table .col-info { display: none; }
  .exh-table .col-org { display: none; }
}
@media (max-width: 640px) {
  .exh-table .col-venue { display: none; }
  .exh-table { font-size: 13px; }
  .exh-table thead th, .exh-table tbody td { padding: 10px 12px; }
}

/* ── Result grid ─────────────────────────────────────────────────── */
.result-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
}
.exh-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  position: relative;
  color: inherit; text-decoration: none;   /* 讓 <a class="exh-card"> 不出現底線 */
}
.exh-card.has-link { cursor: pointer; }
.exh-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}
.exh-card.has-link:hover { border-color: var(--accent); }
.exh-external {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.92); color: var(--accent);
  display: grid; place-items: center;
  font-size: 16px; font-weight: 700;
  box-shadow: 0 2px 6px rgba(0,0,0,0.10);
  opacity: 0; transform: translateY(-4px);
  transition: opacity .18s, transform .18s;
  z-index: 2;
}
.exh-card.has-link:hover .exh-external { opacity: 1; transform: translateY(0); }
.exh-image {
  width: 100%; aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--bg-section), var(--accent-soft));
  background-size: cover; background-position: center;
  position: relative;
}
.exh-image-placeholder {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  font-family: var(--font-serif);
  font-size: 38px; color: var(--accent);
  opacity: 0.6;
}
.exh-body {
  padding: 18px 20px 20px; display: flex; flex-direction: column;
  gap: 10px; flex: 1;
}
.exh-meta-row {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 12px;
}
.exh-venue-tag {
  background: var(--accent-bg); color: var(--accent-hover);
  padding: 3px 10px; border-radius: 4px;
  font-weight: 500; letter-spacing: 0.02em;
}
.exh-status {
  padding: 3px 10px; border-radius: 4px;
  font-weight: 500; letter-spacing: 0.02em;
}
.exh-status.ongoing { background: #E8F2EA; color: var(--success); }
.exh-status.upcoming { background: #E5EFF8; color: var(--info); }
.exh-status.ended { background: #F1ECE0; color: var(--text-muted); }
.exh-status.unknown { background: #F1ECE0; color: var(--text-muted); }

.exh-name {
  font-family: var(--font-serif); font-weight: 700;
  font-size: 18px; line-height: 1.4; color: var(--text-primary);
}
.exh-dates {
  font-size: 13px; color: var(--text-body);
  font-variant-numeric: tabular-nums; font-weight: 500;
}
.exh-dates .sep { color: var(--text-muted); margin: 0 6px; }
.exh-dates .countdown { color: var(--accent); font-weight: 600; margin-left: 8px; }

.exh-info {
  font-size: 13px; color: var(--text-secondary); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
/* .exh-actions / .exh-link / .exh-source 已移除：整張卡片即連結 */

/* ── Empty state ─────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 80px 24px;
  background: var(--bg-card); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg); margin-top: 8px;
}
.empty-icon { font-size: 56px; margin-bottom: 18px; opacity: 0.7; }
.empty-title {
  font-family: var(--font-serif); font-weight: 700;
  font-size: 22px; color: var(--text-primary); margin-bottom: 10px;
}
.empty-text { color: var(--text-secondary); font-size: 14px; }

/* ── Footer ──────────────────────────────────────────────────────── */
.site-footer {
  background: var(--bg-section); border-top: 1px solid var(--border);
  padding: 32px 0; margin-top: 48px;
}
.footer-content {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
}
.footer-brand {
  font-family: var(--font-serif); font-weight: 700;
  font-size: 18px; color: var(--text-primary); margin-bottom: 4px;
}
.footer-meta { font-size: 13px; color: var(--text-secondary); }

.footer-bottom {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-secondary);
}
.footer-bottom a { color: var(--text-secondary); text-decoration: none; border-bottom: 1px dotted var(--text-secondary); }
.footer-bottom a:hover { color: var(--text-primary); border-bottom-color: var(--text-primary); }

@media (max-width: 600px) {
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

/* ── Toast & overlay ─────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text-primary); color: #fff;
  padding: 12px 20px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: all .25s ease;
  z-index: 1000; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

.overlay {
  position: fixed; inset: 0;
  background: rgba(20, 16, 10, 0.55); backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: 999; padding: 20px;
}
.overlay-card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  padding: 36px 32px; box-shadow: var(--shadow-lg);
  max-width: 520px; width: 100%;
  text-align: center;
}
.overlay-spinner {
  width: 48px; height: 48px; border-radius: 50%;
  border: 3px solid var(--accent-soft); border-top-color: var(--accent);
  margin: 0 auto 20px; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.overlay-title {
  font-family: var(--font-serif); font-weight: 700;
  font-size: 20px; color: var(--text-primary); margin-bottom: 8px;
}
.overlay-text {
  font-size: 14px; color: var(--text-secondary); margin-bottom: 16px;
}
.overlay-log {
  font-family: 'SF Mono', Consolas, 'Courier New', monospace;
  font-size: 12px; color: var(--text-secondary);
  background: var(--bg-muted); border-radius: var(--radius-sm);
  padding: 14px; max-height: 220px; overflow-y: auto;
  text-align: left; white-space: pre-wrap; word-break: break-word;
  margin-bottom: 14px;
}

/* ── Exhibitions section ─────────────────────────────────────────── */
.exhibitions-section { scroll-margin-top: 80px; }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .filter-row { grid-template-columns: 1fr 1fr; }
  .filter-search { grid-column: 1 / -1; }
  .filter-toggle { grid-column: 1 / -1; justify-content: flex-start; padding: 0; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .header-link { display: none; }
  .header-inner { height: 60px; }
  .brand-tagline { display: none; }
  .hero { padding: 48px 0 32px; }
  .hero-stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-num { font-size: 24px; }
  .filter-card { padding: 20px; }
  .filter-row { grid-template-columns: 1fr; gap: 14px; }
  .result-grid { grid-template-columns: 1fr; gap: 16px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .footer-content { flex-direction: column; align-items: flex-start; }
}
