/*
 * 「關於佛學會」頁（page 8637，/about/）整頁樣式
 * 規格：build-about-page/SPEC_about-v1.md（方向一 stair-ledger）。由 mu-plugin gp-about-page.php 只在 page 8637 載入。
 * 本檔由 build/tools/build_about.py 從 tools/about-page.src.css 產生；兩個切換門檻（懸掛欄、階梯型）由產生器用字級算出後填入，
 * 要改請改原始檔再重跑產生器（課目或字級一改，門檻就跟著重算，規格 5.3）。
 *
 * 權重（規格第 9 節）：站上 <style id="baiyu-single-post"> 排在本檔之後，而且帶 !important（body.page .entry-content p／a／ul／ol／li／h2／h3，
 * 權重 0-2-2）。本頁會衝突的屬性一律用 :not(#_#_) 拉到 id 層級（2-x-x）再加 !important，跟聯絡頁 contact-parking.css 同一個做法。
 *   - 段落／清單／標題外距：body .entry-content .gpa :is(...):not(#_#_)  （2-2-2）
 *   - 連結：.entry-content a:not(#_#_).gpa-link  （2-2-1）
 * 不用 table（站上 table／td 規則帶圓角、陰影、斑馬紋、第一欄紅字），不用 .entry-content 直屬的 figure／p img（站上會加陰影與置中外距）。
 *
 * 版面切換一律看內容寬度（container query），不看視窗寬：
 *   gpa  ＝ .entry-content（內文欄）：懸掛欄／單欄、階梯型／直列型
 *   gpab ＝ .gpa-body（正文欄）：上課資訊、住持照、沿革、據點的排法
 *   gpaw ＝ .gpa-wide（學程圖）：直列型的「年級名｜課目」排法
 * 例外：引言字級照規格 4.1 綁站上 h1 的字級，h1 由站上依視窗寬 921／480 切，所以引言也用同樣的 media query。
 */

/* ---------- 容器 ---------- */
.entry-content:has(> .gpa) {
	container: gpa / inline-size;
}

/* ---------- 變數（只用站上既有 --gp-*，帶 fallback；規格 2.1、3.3） ---------- */
.gpa {
	--gpa-ink: var(--gp-tx, #2C2420);
	--gpa-meta: var(--gp-meta, #736B64);
	--gpa-link: var(--gp-cp, #8B1A1A);
	--gpa-gold-deep: var(--gp-cg-deep, #8B6914);
	--gpa-gold: var(--gp-cg, #C9A060);
	--gpa-line: var(--gp-border, #E4DFDA);
	--gpa-face: var(--gp-wh, #FDFCFA);
	--gpa-tantra: var(--gp-bg-tantra, #F0EBE0);
	--gpa-radius: var(--gp-r-card, 8px);
	--gpa-serif: 'Iansui', 'Noto Serif TC', serif;
	--gpa-ease: cubic-bezier(0.2, 0, 0, 1);
	/* 間距 T1:T2:T3:T4（規格 3.3）；單欄時只縮 T3、T4 */
	--gpa-t1: var(--gp-sp-2, 8px);
	--gpa-t2: var(--gp-sp-4, 16px);
	--gpa-t3: var(--gp-sp-6, 24px);
	--gpa-t4-above: 28px;
	--gpa-t4-below: 20px;
	/* 正文字級（規格 6.1）：單欄 16px，懸掛欄 16.8px（站上現值） */
	--gpa-fs: 16px;
	/* 階梯每階升高量 r（規格 5.2：課目行高的 0.75–1.25 倍；課目 15px × 1.6 = 24px，取 1 倍） */
	--gpa-rise: 24px;
	font-size: var(--gpa-fs);
	line-height: 1.8;
	color: var(--gpa-ink);
}

/* ---------- 擋站上 baiyu-single-post 的外距（規格 9.2） ---------- */
body .entry-content .gpa :is(p, ul, ol, li, dl, dt, dd, figure, h2, h3):not(#_#_) {
	margin: 0 !important;
}
body .entry-content .gpa :is(ul, ol):not(#_#_) {
	padding-left: 0 !important;
	list-style: none;
}
body .entry-content .gpa :is(h2, h3):not(#_#_) {
	padding-top: 0 !important;
	border-top: 0 !important;
}
body .entry-content .gpa p:not(#_#_) {
	line-height: 1.8 !important;
}
.gpa-nb {
	white-space: nowrap;
}
.gpa-num {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* ---------- 連結（規格 6.4，比照聯絡頁 .gp-link） ---------- */
.entry-content a:not(#_#_).gpa-link {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	white-space: nowrap;
	color: var(--gpa-link) !important;
	font-weight: 600;
	text-decoration: underline !important;
	text-decoration-color: currentColor !important;
	text-decoration-thickness: 1px !important;
	text-underline-offset: 0.2em !important;
	transition: text-decoration-thickness 150ms var(--gpa-ease) !important;
}
/* 段落內的行內連結（I 區）：依 WCAG 2.5.8 行內例外不撐高；連結字仍不准在中間斷行（規格 6.4） */
.entry-content a:not(#_#_).gpa-link--inline {
	display: inline;
	min-height: 0;
	white-space: nowrap;
}
.entry-content a:not(#_#_).gpa-link:hover {
	color: var(--gpa-link) !important;
	text-decoration-thickness: 2px !important;
}
.entry-content a:not(#_#_).gpa-link:focus-visible {
	outline: 2px solid var(--gpa-ink);
	outline-offset: 2px;
	border-radius: 0;
}
.entry-content a:not(#_#_).gpa-link:active {
	opacity: 0.7;
}
@media (prefers-reduced-motion: reduce) {
	.entry-content a:not(#_#_).gpa-link {
		transition: none !important;
	}
}
/* 獨立連結並排的列（B／C 的連結列、招生、據點） */
.gpa-links {
	display: flex;
	flex-wrap: wrap;
	column-gap: 1.5em;
}

/* ---------- A 開場組（規格 4） ---------- */
.gpa-intro {
	display: flex;
	flex-direction: column;
	align-items: stretch;
}
body .entry-content .gpa p.gpa-lead:not(#_#_) {
	font-family: var(--gpa-serif);
	font-weight: 400;
	font-size: 44px;
	line-height: 1.4 !important;
	text-align: center;
	color: var(--gpa-ink);
}
.gpa-lead > span {
	white-space: nowrap;
}
.gpa-lead > span:first-child {
	display: block;
}
@media (max-width: 921px) {
	body .entry-content .gpa p.gpa-lead:not(#_#_) {
		font-size: 30px;
	}
}
@media (max-width: 480px) {
	body .entry-content .gpa p.gpa-lead:not(#_#_) {
		font-size: 22px;
	}
}
body .entry-content .gpa p.gpa-intro__text:not(#_#_) {
	margin-top: var(--gpa-t2) !important;
	max-width: 38em;
}
/* 跳轉列（規格 4.2＋fix2 A）
 * 外距：要的是「補充段最後一行字框底 → 連結字框頂」＝ T3。這兩個字框外面本來就有一段距離
 *   （補充段行高的下半段＋連結 44px 可點區裡字的上方），單欄 18.4px、懸掛欄 17.1px（2026-11-18 本機 Chromium 量），
 *   所以外距＝T3 − 這段。p 的外距會被上面「擋 baiyu 外距」那條 margin:0 !important 蓋掉，要同樣的權重才贏得過（QA F1）。
 * 可點範圍：每個連結左右各加 --gpa-jump-pad，最短的兩字連結（約 32.6–34.2px）也 ≥ 44px；
 *   所有連結加一樣的內距，相鄰兩個連結的字距整列一致＝欄距＋2×內距＝1.25em（原本的字距）。
 *   列的左右各退 --gpa-jump-pad，字的左緣仍對齊上面的補充段。換行時上下可點區之間 8px。 */
.gpa {
	--gpa-jump-k: 18.4px;
	--gpa-jump-pad: 6px;
}
body .entry-content .gpa p.gpa-jump:not(#_#_) {
	display: flex;
	flex-wrap: wrap;
	column-gap: calc(1.25em - 2 * var(--gpa-jump-pad));
	row-gap: 8px;
	margin: calc(var(--gpa-t3) - var(--gpa-jump-k)) calc(-1 * var(--gpa-jump-pad)) 0 !important;
}
.entry-content .gpa-jump a:not(#_#_).gpa-link {
	justify-content: center;
	min-width: 44px;
	padding-inline: var(--gpa-jump-pad);
	box-sizing: border-box;
}

/* ---------- 區塊骨架（規格 3） ---------- */
.gpa-sec {
	border-top: 1px solid var(--gpa-line);
	margin-top: var(--gpa-t4-above);
	padding-top: var(--gpa-t4-below);
	display: flex;
	flex-direction: column;
	gap: var(--gpa-t2);
}
.gpa-body {
	container: gpab / inline-size;
	min-width: 0;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--gpa-t2);
}
.gpa-body > p {
	max-width: 38em;
}
.gpa-sec > .gpa-wide,
.gpa-sec > .gpa-wide + .gpa-body {
	margin-top: calc(var(--gpa-t3) - var(--gpa-t2));
}
.gpa-body > .gpa-links {
	margin-top: calc(var(--gpa-t3) - var(--gpa-t2) - 8px);
}

/* ---------- C 住持（規格 6.3） ---------- */
.gpa-abbot {
	display: flex;
	flex-direction: column;
	gap: var(--gpa-t2);
}
.gpa-abbot__text {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--gpa-t2);
}
.gpa-abbot__text > p {
	max-width: 38em;
}
body .entry-content .gpa figure.gpa-abbot__photo:not(#_#_) {
	width: 100%;
}
.gpa-abbot__photo img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 3 / 2;
	border-radius: var(--gpa-radius);
	box-shadow: none;
}
@container gpab (min-width: 560px) {
	.gpa-abbot--photo {
		display: grid;
		grid-template-columns: 44% minmax(0, 1fr);
		column-gap: var(--gpa-t3);
		align-items: start;
	}
	/* 照片頂對齊文字第一行的字頂：段落行高 1.8 的上半行距 */
	body .entry-content .gpa figure.gpa-abbot__photo:not(#_#_) {
		margin-top: 0.48em !important;
	}
}

/* ---------- D 天法班：學程圖（規格 5） ---------- */
.gpa-wide {
	container: gpaw / inline-size;
	min-width: 0;
}
.gpa-steps {
	display: flex;
	flex-direction: column;
	gap: 20px;
}
/* 直列型（預設）：每列上方 2px 金線，第 k 列長度是列寬的 k/6 */
.gpa-step {
	position: relative;
	padding-top: calc(2px + var(--gpa-t1));
	display: flex;
	flex-direction: column;
	gap: var(--gpa-t1);
}
.gpa-step::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	height: 2px;
	width: calc(100% * var(--k) / 6);
	background: var(--gpa-gold);
}
.gpa-step:nth-child(1) { --k: 1; }
.gpa-step:nth-child(2) { --k: 2; }
.gpa-step:nth-child(3) { --k: 3; }
.gpa-step:nth-child(4) { --k: 4; }
.gpa-step:nth-child(5) { --k: 5; }
.gpa-step:nth-child(6) { --k: 6; }
.gpa-step__name {
	font-family: var(--gpa-serif);
	font-weight: 400;
	font-size: 20px;
	line-height: 1.4;
	color: var(--gpa-gold-deep);
	white-space: nowrap;
}
.gpa-step__items > li {
	display: inline;
	white-space: nowrap;
}
.gpa-step__items > li:not(:last-child)::after {
	content: "、";
}
body .entry-content .gpa p.gpa-tantra:not(#_#_) {
	margin-top: var(--gpa-t2) !important;
	padding: 12px 16px;
	background: var(--gpa-tantra);
	color: var(--gpa-ink);
}
/* 窄：「實修」獨佔一行，內容從下一行起，間距 T1（fix1 第 1 條） */
.gpa-tantra__label {
	display: block;
	font-family: var(--gpa-serif);
	font-weight: 400;
	font-size: 20px;
	line-height: 1.2;
	margin-bottom: var(--gpa-t1);
	color: var(--gpa-ink);
}
.gpa-tantra__text {
	display: block;
	min-width: 0;
}
/* 夠寬（標籤＋間距之後還有 ≥8 字寬）：標籤在左、內容在右，續行對齊內容起點，不排到標籤底下 */
@container gpaw (min-width: 225px) {
	body .entry-content .gpa p.gpa-tantra:not(#_#_) {
		display: grid;
		grid-template-columns: auto minmax(0, 1fr);
		column-gap: 15px;
		align-items: baseline;
	}
	.gpa-tantra__label {
		margin-bottom: 0;
	}
}
/* 列寬 ≥ 480：年級名在左欄、課目在右欄，續行留在右欄 */
@container gpaw (min-width: 480px) {
	.gpa-step {
		display: grid;
		grid-template-columns: 6em minmax(0, 1fr);
		align-items: baseline;
		column-gap: 0;
	}
}

/* ---------- 上課資訊（規格 5.5） ---------- */
.gpa-info {
	display: flex;
	flex-direction: column;
	gap: var(--gpa-t1);
	width: 100%;
}
.gpa-info__item {
	display: grid;
	grid-template-columns: 4em minmax(0, 1fr);
	align-items: baseline;
}
.gpa-info dt {
	font-size: 15px;
	line-height: 1.8;
	color: var(--gpa-meta);
	font-weight: 400;
}
.gpa-info dd {
	color: var(--gpa-ink);
}
@container gpab (min-width: 560px) {
	.gpa-info {
		display: grid;
		grid-template-columns: repeat(3, minmax(0, 1fr));
		column-gap: var(--gpa-t3);
	}
	.gpa-info__item {
		display: flex;
		flex-direction: column;
		gap: 0;
	}
}

/* ---------- E 沿革（規格 6.5） ---------- */
.gpa-hist {
	width: 100%;
}
.gpa-hist__row {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding-block: 12px;
}
.gpa-hist__row:first-child {
	padding-top: 0;
}
.gpa-hist__row:last-child {
	padding-bottom: 0;
}
.gpa-hist__row + .gpa-hist__row {
	border-top: 1px solid var(--gpa-line);
}
.gpa-hist dt {
	font-weight: 600;
	color: var(--gpa-gold-deep);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	line-height: 1.5;
}
.gpa-hist dd {
	color: var(--gpa-ink);
}
@container gpab (min-width: 27.4em) {
	.gpa-hist__row {
		display: grid;
		grid-template-columns: 7em minmax(0, 1fr);
		align-items: baseline;
		gap: 0;
	}
	.gpa-hist dt {
		line-height: 1.8;
	}
}

/* ---------- F 中心據點（規格 6.6） ---------- */
.gpa-centers {
	display: flex;
	flex-direction: column;
	gap: var(--gpa-t3);
	width: 100%;
}
.gpa-center {
	border-top: 2px solid var(--gpa-gold);
	padding-top: 12px;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
}
body .entry-content .gpa h3.gpa-h3:not(#_#_) {
	margin-bottom: 4px !important;
}
@container gpab (min-width: 560px) {
	.gpa-centers {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		column-gap: 40px;
		align-items: stretch;
	}
	/* 兩欄時說明行數不同：連結推到欄底，兩個連結在同一條線上，到下面行事曆句的距離兩邊一樣（工程預設，規格沒寫） */
	.gpa-center > .gpa-links {
		margin-top: auto;
	}
}
body .entry-content .gpa p.gpa-cal:not(#_#_) {
	margin-top: calc(var(--gpa-t3) - var(--gpa-t2) - 8px) !important;
}
/* 句子與「打開中心行事曆」之間用一般空格分開：連結換到下一行時空格會消失，不會在行首縮排 */

/* ---------- H 結尾小字（規格 6.8） ---------- */
body .entry-content .gpa p.gpa-fine:not(#_#_) {
	font-size: 15px;
	color: var(--gpa-meta);
	max-width: 38em;
}

/* ---------- 懸掛標題欄（內文欄夠寬：標題欄 ≥240 且正文欄 ≥30 字寬，規格 3.2／3.4） ---------- */
@container gpa (min-width: 825px) {
	.gpa {
		--gpa-fs: 16.8px;
		--gpa-t3: var(--gp-sp-8, 32px);
		--gpa-t4-above: 40px;
		--gpa-t4-below: 24px;
	}
	body .entry-content .gpa p.gpa-intro__text:not(#_#_) {
		margin-top: 24px !important;
		align-self: center;
	}
	.gpa {
		--gpa-jump-k: 17.1px;
	}
	body .entry-content .gpa p.gpa-jump:not(#_#_) {
		justify-content: center;
	}
	.gpa-sec {
		display: grid;
		grid-template-columns: 256px minmax(0, 1fr);
		column-gap: 48px;
		row-gap: var(--gpa-t3);
		align-items: start;
	}
	.gpa-sec > .gpa-h2 {
		grid-column: 1;
	}
	/* 據點區正文欄第一行字是 h3（上面先有 2px 金線＋12px 內距）：h2 往下讓同樣的量，字頂才對齊（規格 3.2） */
	body .entry-content .gpa h2.gpa-h2--ruled:not(#_#_) {
		padding-top: 14px !important;
	}
	.gpa-sec > :not(.gpa-h2) {
		grid-column: 2;
	}
	.gpa-sec > .gpa-wide,
	.gpa-sec > .gpa-wide + .gpa-body {
		margin-top: 0;
	}
}

/* ---------- 階梯型（每一階放得下最長課目才用，規格 5.2／5.3） ---------- */
@container gpa (min-width: 913px) {
	.gpa-sec > .gpa-wide {
		grid-column: 1 / -1;
		margin-inline: -2rem;
	}
	.gpa-steps {
		flex-direction: row;
		align-items: stretch;
		gap: 0;
	}
	.gpa-step {
		display: flex;
		flex-direction: column;
		flex: 1 1 0;
		min-width: 0;
		padding: 12px 12px 16px;
		background: var(--gpa-face);
		border-top: 2px solid var(--gpa-gold);
		border-left: 1px solid var(--gpa-gold);
		gap: var(--gpa-t1);
	}
	/* 每往右一階頂面升高 r：用上外距把左邊的階往下壓，六階同列等高（stretch），底邊自然對齊（li 外距要壓過站上 li 規則） */
	body .entry-content .gpa li.gpa-step:not(#_#_) {
		margin-top: calc((6 - var(--k)) * var(--gpa-rise)) !important;
	}
	.gpa-step::before {
		content: none;
	}
	.gpa-step__items > li {
		display: block;
		font-size: 15px;
		line-height: 1.6;
	}
	.gpa-step__items > li:not(:last-child)::after {
		content: none;
	}
	body .entry-content .gpa p.gpa-tantra:not(#_#_) {
		margin-top: 0 !important;
	}
}
