/* 山海匯聚 — 中臺灣百頁共創計畫 互動網站 */

:root {
  --paper: #f3f2ee;
  --ink: #3b3a36;
  --ink-soft: #6f6d66;
  --line: #dcd9d0;
  --card: #ffffff;
  --tc: #3fb6cd;   /* 台中 */
  --ch: #ef9b84;   /* 彰化 */
  --nt: #84bf41;   /* 南投 */
  --yl: #eecb2f;   /* 雲林 */
  --county-idle: #e6e3da;
  --county-hover: #cfcabc;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", sans-serif;
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
  position: relative;
}

/* ── 年輪背景紋理 ───────────────────────── */
.ring-deco {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  opacity: .5;
}
.ring-deco.r1 {
  width: 46vw; height: 46vw; left: -14vw; top: -16vw;
  background: repeating-radial-gradient(circle at 50% 50%,
    rgba(63,182,205,.16) 0 2px, transparent 2px 11px, rgba(63,182,205,.09) 11px 13px, transparent 13px 26px);
}
.ring-deco.r2 {
  width: 40vw; height: 40vw; right: -12vw; bottom: -14vw;
  background: repeating-radial-gradient(circle at 50% 50%,
    rgba(239,155,132,.18) 0 2px, transparent 2px 10px, rgba(239,155,132,.1) 10px 12px, transparent 12px 24px);
}
.ring-deco.r3 {
  width: 26vw; height: 26vw; left: 30vw; bottom: -16vw;
  background: repeating-radial-gradient(circle at 50% 50%,
    rgba(238,203,47,.2) 0 2px, transparent 2px 9px);
}
.ring-deco.r4 {
  width: 20vw; height: 20vw; right: 26vw; top: -10vw;
  background: repeating-radial-gradient(circle at 50% 50%,
    rgba(132,191,65,.18) 0 2px, transparent 2px 9px);
}

/* ── 版面 ───────────────────────── */
.app {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 28px 14px;
  gap: 10px;
}

header.site {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 18px; }
.brand h1 {
  font-size: clamp(30px, 3.4vw, 46px);
  font-weight: 900;
  letter-spacing: .12em;
  line-height: 1;
}
.brand .sub {
  border-left: 3px solid var(--ink);
  padding-left: 14px;
}
.brand .sub .en { font-size: 12px; letter-spacing: .18em; color: var(--ink-soft); }
.brand .sub .zh { font-size: clamp(14px, 1.3vw, 18px); font-weight: 700; letter-spacing: .1em; }
.brand .sub .tag { font-size: 12px; color: var(--ink-soft); margin-top: 2px; letter-spacing: .06em; }

nav.top { display: flex; gap: 10px; align-items: center; }
nav.top a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .1em;
  padding: 9px 20px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
  transition: all .2s;
}
nav.top a:hover, nav.top a.active { background: var(--ink); color: var(--paper); }

/* ── 主區 ───────────────────────── */
main.stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 46%) minmax(0, 54%);
  gap: 20px;
}

/* 地圖區 */
.map-wrap {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.map-wrap .legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 4px 2px 8px;
  font-size: 13px;
  letter-spacing: .08em;
  color: var(--ink-soft);
}
.legend .key { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--ink); }
.legend .key i {
  width: 14px; height: 14px; border-radius: 4px; display: inline-block;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08) inset;
}
#taiwan-map { flex: 1; min-height: 0; }
#taiwan-map svg { width: 100%; height: 100%; display: block; }

#taiwan-map path.land {
  fill: var(--county-idle);
  stroke: var(--paper);
  stroke-width: 1.2;
  cursor: pointer;
  transition: fill .18s, filter .18s;
}
#taiwan-map path.land:hover { fill: var(--county-hover); }

/* 四大主軸縣市:平時就以專色發亮 */
#taiwan-map path.focus { animation: breathe 2.6s ease-in-out infinite; }
#taiwan-map path.focus:hover, #taiwan-map path.land.selected { animation: none; }

#taiwan-map path.land.selected {
  fill: var(--county-hover);
  stroke: var(--ink);
  stroke-width: 2;
  filter: drop-shadow(0 0 10px rgba(59,58,54,.35));
}
#taiwan-map path.land.focus.selected {
  filter: drop-shadow(0 0 12px var(--glow));
}

@keyframes breathe {
  0%, 100% { filter: drop-shadow(0 0 3px var(--glow)) saturate(1); }
  50%      { filter: drop-shadow(0 0 14px var(--glow)) saturate(1.15); }
}

.island-label {
  font-size: 13px;
  letter-spacing: .2em;
  fill: var(--ink-soft);
  pointer-events: none;
}
.island-box {
  fill: none;
  stroke: var(--line);
  stroke-dasharray: 5 5;
  stroke-width: 1.2;
  rx: 10;
}

/* 游標提示 */
#tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  background: var(--ink);
  color: var(--paper);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 14px;
  letter-spacing: .06em;
  line-height: 1.5;
  opacity: 0;
  transform: translate(-50%, calc(-100% - 14px));
  transition: opacity .12s;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
#tooltip.on { opacity: 1; }
#tooltip .n { font-weight: 900; font-size: 15px; }
#tooltip .c { opacity: .8; font-size: 12px; }

/* ── 右側面板 ───────────────────────── */
aside.panel {
  min-height: 0;
  background: var(--card);
  border-radius: 22px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 34px rgba(59,58,54,.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel-head {
  padding: 20px 26px 16px;
  border-bottom: 1px solid var(--line);
  position: relative;
  transition: background .25s;
}
.panel-head .kicker {
  font-size: 12px; letter-spacing: .28em; color: var(--ink-soft); margin-bottom: 4px;
}
.panel-head h2 {
  font-size: clamp(22px, 2.2vw, 30px);
  font-weight: 900;
  letter-spacing: .1em;
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
}
.panel-head h2 .count { font-size: 15px; font-weight: 700; color: var(--ink-soft); letter-spacing: .05em; }
.panel-head .close {
  position: absolute; right: 18px; top: 18px;
  border: none; background: var(--paper); color: var(--ink);
  width: 34px; height: 34px; border-radius: 50%;
  font-size: 16px; cursor: pointer; display: none;
}
.panel-head.locked .close { display: block; }

.panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 26px 26px;
  scrollbar-width: thin;
}

/* 總覽 */
.overview .lead { font-size: 15px; line-height: 1.9; color: var(--ink-soft); letter-spacing: .04em; margin-bottom: 18px; }
.stats { display: flex; gap: 14px; margin-bottom: 20px; }
.stat {
  flex: 1; background: var(--paper); border-radius: 16px; padding: 14px 18px;
  border: 1px solid var(--line);
}
.stat b { font-size: 30px; font-weight: 900; display: block; line-height: 1.15; }
.stat span { font-size: 13px; color: var(--ink-soft); letter-spacing: .1em; }

.focus-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 22px; }
.focus-chip {
  border: none; cursor: pointer; text-align: left;
  border-radius: 14px; padding: 12px 16px;
  font-family: inherit; font-size: 16px; font-weight: 900; letter-spacing: .12em;
  color: var(--ink);
  display: flex; align-items: center; justify-content: space-between;
  transition: transform .15s, box-shadow .15s;
}
.focus-chip:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(0,0,0,.12); }
.focus-chip small { font-weight: 700; font-size: 12px; letter-spacing: .08em; opacity: .75; }

.section-title {
  font-size: 14px; font-weight: 900; letter-spacing: .22em;
  margin: 6px 0 12px; color: var(--ink);
  display: flex; align-items: center; gap: 10px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* 交流會介紹(地方議事桌) */
.meetup-intro {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 12px;
  font-size: 13.5px;
  line-height: 1.95;
  letter-spacing: .04em;
}
.meetup-intro p { color: var(--ink-soft); margin-bottom: 12px; }
.meetup-intro ol {
  list-style: none;
  counter-reset: mi;
  display: grid;
  gap: 9px;
}
.meetup-intro li {
  counter-increment: mi;
  position: relative;
  padding-left: 30px;
  color: var(--ink-soft);
}
.meetup-intro li::before {
  content: counter(mi);
  position: absolute;
  left: 0;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  display: grid;
  place-items: center;
}
.meetup-intro li b { color: var(--ink); margin-right: 8px; }

.more-link {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1.5px solid var(--ink);
  padding-bottom: 2px;
  margin: 2px 0 10px;
}
.more-link:hover { opacity: .7; }

/* 工作坊卡片 */
.ws-card {
  border-radius: 16px;
  padding: 14px 18px;
  margin-bottom: 10px;
  background: var(--paper);
  border-left: 6px solid var(--ink);
  position: relative;
}
.ws-card .row1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.ws-card .badge {
  font-size: 12px; font-weight: 900; letter-spacing: .1em;
  color: #fff; background: var(--ink);
  padding: 3px 10px; border-radius: 999px;
}
.ws-card .date { font-weight: 900; font-size: 17px; letter-spacing: .04em; }
.ws-card .tag { font-size: 12px; color: var(--ink-soft); letter-spacing: .08em; }
.ws-card h4 { font-size: 15px; font-weight: 700; letter-spacing: .04em; line-height: 1.6; }
.ws-card .venue { font-size: 13px; color: var(--ink-soft); margin-top: 4px; letter-spacing: .05em; }

/* 基地卡片 */
.base-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  margin-bottom: 10px;
  background: var(--card);
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.base-card.open { box-shadow: 0 8px 22px rgba(59,58,54,.1); }
.base-card > button.head {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 16px;
  box-sizing: border-box;
}
.base-card .icon {
  flex: 0 0 auto;
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 17px; color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
}
.base-card .txt { flex: 1; min-width: 0; }
.base-card .txt .nm { font-size: 15px; font-weight: 700; letter-spacing: .03em; line-height: 1.45; }
.base-card .txt .meta { font-size: 12px; color: var(--ink-soft); letter-spacing: .05em; margin-top: 2px; }
.base-card .arrow { flex: 0 0 auto; color: var(--ink-soft); transition: transform .2s; font-size: 13px; }
.base-card.open .arrow { transform: rotate(180deg); }

.base-detail { display: none; padding: 0 16px 16px; }
.base-card.open .base-detail { display: block; }
.base-detail .org { font-size: 13px; color: var(--ink-soft); letter-spacing: .04em; margin-bottom: 10px; }
.base-detail iframe {
  width: 100%; height: 240px; border: 0; border-radius: 12px; background: var(--paper);
}
.base-detail .link-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.base-detail .gmap-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700; letter-spacing: .06em;
  color: var(--ink); text-decoration: none;
  border: 1.5px solid var(--ink); border-radius: 999px;
  padding: 6px 14px;
}
.base-detail .gmap-link:hover { background: var(--ink); color: #fff; }
.base-detail .gmap-link.official { border-color: var(--nt); color: var(--nt); }
.base-detail .gmap-link.official:hover { background: var(--nt); color: #fff; }

/* 頁尾 */
footer.site {
  font-size: 11.5px;
  color: var(--ink-soft);
  letter-spacing: .08em;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
}
footer.site b { color: var(--ink); font-weight: 700; }

/* 直式或窄螢幕 */
@media (max-aspect-ratio: 1/1) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100vh; }
  main.stage { grid-template-columns: 1fr; }
  #taiwan-map { min-height: 70vh; }
  aside.panel { min-height: 60vh; }
}
