/* ==========================================================================
   首頁（front-page.php）
   - < 1280px ：手機 / 平板版（地圖 + 選區說明 + 手風琴議員名單）
   - >= 1280px：桌機版（以 2000 x 800 的設計稿座標，用 % 定位，整體隨寬度縮放）
   顏色 / 選單 / LOGO / 頁首 / 頁尾由 Astra 後台設定；這裡只有選區專用色。
   ========================================================================== */

/* ---- 讓 Astra 內容區滿版、首頁最小高度 = 一個螢幕 ---- */
body.tcc-home-page #page {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: calc(100dvh - var(--wp-admin--admin-bar--height, 0px));
}
body.tcc-home-page #content {
	flex: 1 0 auto;
	display: flex;
	flex-direction: column;
}
body.tcc-home-page #content > .ast-container {
	flex: 1 0 auto;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
}

/* ---- 變數 ---- */
.tcc-home {
	--tcc-gold: var(--ast-global-color-0, #b8892b);
	--tcc-ink: #222;
	--tcc-muted: #6b6b6b;
	--tcc-bg: #f4f4f4;
	--tcc-paper: #fff;
	--tcc-serif: "Noto Serif TC", "Source Han Serif TC", "Songti TC", "PMingLiU", serif;

	/* 選區色（c = 主色, bg = 卡片標題底色） */
	--c1: #9B6307; --bg1: #fdf0dc;
	--c2: #1D7895; --bg2: #d9f0f8;
	--c3: #fcd54a; --bg3: #fbf1c4;
	--c4: #d0155f; --bg4: #e9b3c0;
	--c5: #D61970; --bg5: #f8cfe0;
	--c6: #537A2D; --bg6: #d7ebbb;
	--c7: #4f3a9a; --bg7: #e3daf5;
	--c8: #8a5a3c; --bg8: #e7d0bd;

	flex: 1 0 auto;
	width: 100%;
	container-type: inline-size;
	box-sizing: border-box;
	background: var(--tcc-bg);
	color: var(--tcc-ink);
	line-height: 1.5;
}
.tcc-home *,
.tcc-home *::before,
.tcc-home *::after {
	box-sizing: border-box;
}
:where(.tcc-home) :is(ul, ol) {
	margin: 0;
	padding: 0;
	list-style: none;
}
:where(.tcc-home) li {
	margin: 0;
}
:where(.tcc-home) :is(h1, h2, h3, p) {
	margin: 0;
	padding: 0;
	color: inherit;
}

.tcc-c1, .tcc-district--1 { --c: var(--c1); --bg: var(--bg1); }
.tcc-c2, .tcc-district--2 { --c: var(--c2); --bg: var(--bg2); }
.tcc-c3, .tcc-district--3 { --c: var(--c3); --bg: var(--bg3); }
.tcc-c4, .tcc-district--4 { --c: var(--c4); --bg: var(--bg4); }
.tcc-c5, .tcc-district--5 { --c: var(--c5); --bg: var(--bg5); }
.tcc-c6, .tcc-district--6 { --c: var(--c6); --bg: var(--bg6); }
.tcc-c7, .tcc-district--7 { --c: var(--c7); --bg: var(--bg7); }
.tcc-c8, .tcc-district--8 { --c: var(--c8); --bg: var(--bg8); }

/* 桌機 / 手機專屬元素 */
.tcc-d { display: none; }

/* 數字圓點 */
.tcc-badge,
.tcc-district__num {
	flex: none;
	display: inline-grid;
	place-items: center;
	width: 1.7em;
	height: 1.7em;
	border-radius: 50%;
	background: var(--c);
	color: #fff;
	font-size: 1em;
	font-weight: 700;
	line-height: 1;
}
.tcc-badge--light {
	background: #fff;
	color: var(--tcc-ink);
	box-shadow: 0 0.1em 0.5em rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   手機 / 平板（預設）
   ========================================================================== */
.tcc-stage {
	display: grid;
	gap: 1.25rem 1rem;
	grid-template-columns: minmax(0, 1fr);
	grid-template-areas: "intro" "map" "legend" "list";
	width: 100%;
	max-width: 64rem;
	margin: 0 auto;
	padding: 1.75rem 1rem 2.25rem;
	font-size: 1rem;
    background-image: url('../images/index_bg.png');
    background-repeat: no-repeat;
    background-position: 0 50%;
    background-color: #f3f1ef;
}

/* 標題區 */
.tcc-intro { grid-area: intro; }
.tcc-intro__title {
	font-family: var(--tcc-serif);
	font-size: clamp(1.9rem, 7vw, 2.4rem);
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: 0.04em;
}
.tcc-intro__bar {
	display: block;
	width: 3.2rem;
	height: 0.28rem;
	margin: 0.9rem 0 1rem;
	background: var(--tcc-gold);
}
.tcc-intro__desc {
	font-size: 1rem;
	line-height: 1.8;
	color: #444;
}

/* 選區說明 */
.tcc-legend {
	grid-area: legend;
	align-self: start;
	padding: 1rem 1.1rem;
	background: var(--tcc-paper);
	border-radius: 0.75rem;
	box-shadow: 0 0.15rem 0.75rem rgba(0, 0, 0, 0.08);
}
.tcc-legend__title {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
.tcc-legend__list li {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.28rem 0;
	font-size: 0.95rem;
	white-space: nowrap;
}

/* 地圖 */
.tcc-map {
	grid-area: map;
	position: relative;
	justify-self: center;
	width: min(100%, 24rem);
}
.tcc-map__img {
	display: block;
	width: 100%;
	height: auto;
	filter: drop-shadow(0 0.4rem 0.7rem rgba(0, 0, 0, 0.18));
}
.tcc-map__extra {
	position: absolute;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.95rem;
	font-weight: 700;
	white-space: nowrap;
}
.tcc-map__extra--7 { left: -2%; top: 79%; }
.tcc-map__extra--8 { left: 6%; top: 90%; }

/* 議員名單（手風琴） */
.tcc-districts {
	grid-area: list;
	padding: 1rem;
	background: rgba(0, 0, 0, 0.04);
	border-radius: 1rem;
}
.tcc-districts__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.25rem 0.75rem;
	margin-bottom: 0.9rem;
}
.tcc-districts__title {
	font-family: var(--tcc-serif);
	font-size: 1.35rem;
	font-weight: 700;
}
.tcc-districts__hint {
	font-size: 0.85rem;
	color: var(--tcc-muted);
}

.tcc-district {
	margin-bottom: 0.6rem;
	background: var(--tcc-paper);
	border-radius: 0.75rem;
	box-shadow: 0 0.1rem 0.5rem rgba(0, 0, 0, 0.06);
	overflow: hidden;
}
.tcc-district:last-child { margin-bottom: 0; }
.tcc-district__heading {
	font-size: inherit;
	line-height: inherit;
}
.tcc-district__toggle {
	all: unset;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	width: 100%;
	padding: 0.8rem 1rem;
	font-size: clamp(0.9rem, 4vw, 1.05rem);
	line-height: 1.4;
	color: var(--tcc-ink);
	cursor: pointer;
}
.tcc-district__toggle:focus-visible {
	outline: 2px solid var(--tcc-gold);
	outline-offset: -2px;
}
.tcc-district__title { flex: 1; min-width: 0; }
.tcc-district__areas { white-space: nowrap; }
.tcc-district__areas::before { content: "（"; }
.tcc-district__areas::after { content: "）"; }
.tcc-district__chev {
	flex: none;
	margin-left: auto;
	transition: transform 0.2s;
}
.tcc-district.is-open .tcc-district__chev { transform: rotate(180deg); }

.tcc-district__body {
	display: none;
	margin: 0 1rem;
	padding: 0.9rem 0 1.1rem;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.tcc-district.is-open .tcc-district__body { display: block; }
.tcc-district__empty {
	font-size: 0.9rem;
	color: var(--tcc-muted);
}

/* 議員（政黨 icon + 姓名） */
.tcc-members {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 0.6rem 0.5rem;
}
.tcc-member {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	max-width: 100%;
	color: inherit;
	text-decoration: none;
	white-space: nowrap;
	line-height: 1.5;
}
a.tcc-member:hover .tcc-member__name,
a.tcc-member:focus-visible .tcc-member__name {
	color: var(--tcc-gold);
	text-decoration: underline;
	text-underline-offset: 0.2em;
}
.tcc-member__icon {
	flex: none;
	width: 1.15em;
	height: 1.15em;
	min-width: 12px;
	min-height: 12px;
	margin: 0;
}

/* 個人公告：手機版設計稿沒有 */
.tcc-news { display: none; }

@media (min-width: 640px) {
	.tcc-stage {
		grid-template-columns: minmax(0, 1fr) minmax(0, 45%);
		grid-template-rows: auto 1fr auto;
		grid-template-areas: "intro map" "legend map" "list list";
		gap: 1.5rem 1.5rem;
		padding: 2.25rem 2rem 2.75rem;
	}
	.tcc-members {
		grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
	}
}

/* ==========================================================================
   桌機（>= 1280px）
   1em = 設計稿 14px（設計稿寬 2000）；cqw = 容器寬 1%
   ========================================================================== */
@media (min-width: 1280px) {
	.tcc-home {
		display: flex;
		align-items: center;
	}
	.tcc-stage {
		display: block;
		position: relative;
		width: 100%;
		max-width: none;
		margin: 0;
		padding: 0;
		aspect-ratio: 2000 / 800;
		font-size: max(10px, 0.7cqw);
	}
	.tcc-d { display: revert; }
	.tcc-m { display: none; }

	/* 左上：標題 */
	.tcc-intro {
		position: absolute;
		left: 3.15%;
		top: 3.1%;
		width: 21%;
	}
	.tcc-intro__title {
		font-size: 3.86em;
		letter-spacing: 0.02em;
		white-space: nowrap;
	}
	.tcc-intro__bar {
		width: 2.9em;
		height: 0.22em;
		margin: 0.9em 0 1.3em;
	}
	.tcc-intro__subtitle {
		margin-bottom: 1.5em;
		font-family: var(--tcc-serif);
		font-size: 1.8em;
		font-weight: 700;
		line-height: 1.4;
		color: var(--tcc-gold);
	}
	.tcc-intro__desc {
		font-size: 1.28em;
		line-height: 2;
	}
	.tcc-intro__desc span { display: block; white-space: nowrap; }

	/* 左下：選區說明 */
	.tcc-legend {
		position: absolute;
		left: 2.4%;
		top: 57.75%;
		width: 15.85%;
		padding: 0.9em 1.3em 1em;
		border-radius: 0.9em;
		background: rgba(255, 255, 255, 0.92);
		box-shadow: 0 0.3em 1.1em rgba(0, 0, 0, 0.1);
	}
	.tcc-legend__title {
		position: static;
		width: auto;
		height: auto;
		margin: 0 0 0.5em;
		padding: 0.25em 0;
		overflow: visible;
		clip: auto;
		border-radius: 2em;
		background: #eee;
		font-size: 1.15em;
		font-weight: 700;
		text-align: center;
	}
	.tcc-legend__list li {
		gap: 0.8em;
		padding: 0;
		height: 1.91em;
		font-size: 1.15em;
	}
	.tcc-legend .tcc-badge {
		width: 1.45em;
		height: 1.45em;
		font-size: 0.85em;
	}

	/* 中間：地圖 */
	.tcc-map {
		position: absolute;
		left: 35%;
		top: 1.25%;
		width: 28.1%;
	}
	.tcc-map__extra { display: none; }

	/* 右側：個人公告 */
	.tcc-news {
		position: absolute;
		left: 72.45%;
		top: 2.6%;
		width: 24.65%;
		height: 88.7%;
		display: flex;
		flex-direction: column;
		background: var(--tcc-paper);
		border-radius: 0.9em;
		box-shadow: 0 0.3em 1.1em rgba(0, 0, 0, 0.1);
		overflow: hidden;
	}
	.tcc-news__title {
		padding: 1em 1.4em 0.9em;
		border-bottom: 1px solid rgba(0, 0, 0, 0.08);
		font-family: var(--tcc-serif);
		font-size: 1.85em;
		font-weight: 700;
		line-height: 1.3;
	}
	.tcc-news__list {
		flex: 1;
		display: flex;
		flex-direction: column;
		padding: 0 1.4em;
		overflow: auto;
	}
	.tcc-news__list > li {
		flex: 1 1 0;
		display: flex;
		min-height: 5.5em;
		border-bottom: 1px solid rgba(0, 0, 0, 0.08);
	}
	.tcc-news__list > li:last-child { border-bottom: 0; }
	.tcc-news__link {
		display: flex;
		align-items: center;
		gap: 1.2em;
		width: 100%;
		color: inherit;
		text-decoration: none;
	}
	.tcc-news__icon {
		flex: none;
		width: 2.4em;
		height: 2.4em;
		color: #9a9a9a;
	}
	.tcc-news__body { flex: 1; min-width: 0; }
	.tcc-news__text {
		display: block;
		overflow: hidden;
		font-family: var(--tcc-serif);
		font-size: 1.36em;
		font-weight: 600;
		line-height: 1.4;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
	.tcc-news__meta {
		display: flex;
		justify-content: space-between;
		gap: 1em;
		margin-top: 0.3em;
		font-size: 1.1em;
		color: var(--tcc-muted);
	}
	.tcc-news__meta time {
		font-family: var(--tcc-serif);
		font-size: 0.95em;
		color: #444;
	}
	.tcc-news__link:hover .tcc-news__text,
	.tcc-news__link:focus-visible .tcc-news__text { color: var(--tcc-gold); }

	/* 選區卡片（直接定位在 stage 上） */
	.tcc-districts {
		display: contents;
	}
	.tcc-districts__head {
		position: absolute;
		width: 1px;
		height: 1px;
		margin: 0;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}
	.tcc-district {
		position: absolute;
		width: 13.75%;
		margin: 0;
		border-radius: 0.9em;
		box-shadow: 0 0.3em 1.1em rgba(0, 0, 0, 0.12);
	}
	.tcc-district--1 { left: 55.3%;  top: 4.6%; }
	.tcc-district--2 { left: 57.95%; top: 34.1%; }
	.tcc-district--3 { left: 57.25%; top: 75.1%; }
	.tcc-district--4 { left: 20.6%;  top: 12.1%; }
	.tcc-district--5 { left: 20.35%; top: 35.25%; }
	.tcc-district--6 { left: 23.05%; top: 57.5%; }
	.tcc-district--7 { left: 19.1%;  top: 82.1%; }
	.tcc-district--8 { left: 33.4%;  top: 85.1%; }

	.tcc-district__heading { background: var(--bg); }
	.tcc-district__toggle {
		padding: 0.85em 1em;
		gap: 0.6em;
		font-size: 1em;
		cursor: default;
		pointer-events: none;
	}
	.tcc-district__num {
		width: 1.6em;
		height: 1.6em;
		font-size: 1em;
	}
	.tcc-district__title {
		display: flex;
		align-items: baseline;
		gap: 0.5em;
		white-space: nowrap;
	}
	.tcc-district__name {
		font-family: var(--tcc-serif);
		font-size: 1.4em;
		font-weight: 600;
	}
	.tcc-district__suffix { display: none; }
	.tcc-district__areas {
		font-size: 0.93em;
		color: #555;
	}
	.tcc-district__areas::before { content: "/ "; }
	.tcc-district__areas::after { content: none; }
	.tcc-district__chev { display: none; }

	.tcc-district__body {
		display: block;
		margin: 0;
		padding: 1em 1.2em 1.1em;
		border-top: 0;
	}
	.tcc-members {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 0.25em 0.4em;
	}
	.tcc-member {
		font-size: 1.07em;
		gap: 0.3em;
	}
	.tcc-district__empty { font-size: 0.93em; }
}