/* Fund page. Every rule is scoped to .fund-page so nothing leaks into the host website */
/**
Copyright © Buddhist Tzu-Chi Merits Society Malaysia (PPM-004-07-26061995)
Author: Jonah (chiee_yeoh@tzuchi.com.my)
Date: 07/Oct/2026
*/

.fund-page {
	--navy: #07417f;
	--navy-deep: #082a6c;
	--teal: #0a6078;
	--red: #b40001;
	--sky-edge: #9ccde0;
	--sky: #b4d8e5;
	--sky-light: #dcedf3;
	--white: #ffffff;
	/* English: Optima · Chinese: FZWeiBei-S. Local fonts only (no web fonts allowed); one stack serves both */
	--en: Optima, "Optima Nova", Candara, "Segoe UI";
	--zh: "FZWeiBei-S03", "FZWeiBei-S03S", "FZWeiBei-S", "方正魏碑简体", "方正魏碑_GBK", "KaiTi", "楷体", "STKaiti", "华文楷体";
	--brush: var(--en), var(--zh), serif;
	--flare: var(--en), var(--zh), sans-serif;
}

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

.fund-page {
	display: grid;
	grid-template-rows: minmax(0, 85fr) minmax(0, 15fr);
	height: 100vh;
	height: 100dvh;
	margin: 0;
	color: var(--navy);
	font-family: var(--flare);
	text-align: left;
	background: var(--sky) url("images/background.jpg") center / cover no-repeat;
}

.fund-page p { margin: 0; }

/* ---------- Content: 85%, a 1920 × 1080 composition sitting directly on the sky background, scaled to fit ---------- */
.fund-page .screen {
	display: grid;
	place-items: center;
	min-height: 0;
	padding: 0;
	container-type: size;
}

.fund-page .stage {
	/* Width caps written as plain length multipliers (16 / 9 = 1.7778) for older browsers.
	   If a line is dropped, the one before it still applies, so the card can never shrink to 0 */
	width: 92vw;
	width: min(92vw, 133.33vh);
	width: min(100cqw, 177.78cqh);
	aspect-ratio: 16 / 9;
	container-type: inline-size;
}

/* --u is one pixel of the 1920-wide reference artwork */
.fund-page .canvas {
	--u: calc(100cqw / 1920);
	position: relative;
	height: 100%;
}

.fund-page .headline { margin: 0; padding: 0; color: var(--navy); font-size: inherit; font-weight: 400; line-height: normal; }

.fund-page .zh {
	position: absolute;
	left: calc(100 * var(--u));
	top: calc(80 * var(--u));
	width: calc(660 * var(--u));
	height: calc(340 * var(--u));
	font-family: var(--brush);
	line-height: 1;
	white-space: nowrap;
}

.fund-page .zh span { position: absolute; }

.fund-page .zh-1 {
	left: calc(12 * var(--u));
	top: calc(6 * var(--u));
	font-size: calc(92 * var(--u));
	letter-spacing: .08em;
}

.fund-page .zh-2 {
	left: calc(78 * var(--u));
	top: calc(142 * var(--u));
	color: var(--red);
	font-size: calc(182 * var(--u));
	letter-spacing: .04em;
}

.fund-page .zh-3 {
	left: calc(472 * var(--u));
	top: calc(226 * var(--u));
	font-size: calc(88 * var(--u));
	letter-spacing: .04em;
}

.fund-page .en {
	position: absolute;
	left: calc(560 * var(--u));
	top: calc(94 * var(--u));
	color: var(--teal);
	font-size: calc(80 * var(--u));
	line-height: calc(84 * var(--u));
	white-space: nowrap;
}

/* ---------- Posters ---------- */
.fund-page .posters {
	position: absolute;
	left: 0;
	right: 0;
	top: calc(478 * var(--u));
	display: flex;
	justify-content: center;
	gap: calc(256 * var(--u));
}

.fund-page .poster {
	position: relative;
	width: calc(275 * var(--u));
	aspect-ratio: 9 / 16;
	padding: 0;
	border: 0;
	background: var(--navy);
	cursor: pointer;
	transition: transform .35s ease, box-shadow .35s ease;
}

.fund-page .poster img {
	display: block;
	width: 100%;
	max-width: none;
	height: 100%;
	border: 0;
	object-fit: cover;
}

/* Hover values from fund.README */
.fund-page .poster:hover,
.fund-page .poster:focus-visible {
	transform: scale(1.04);
	box-shadow: 0 0 12px rgba(0, 0, 0, .4);
}

.fund-page .poster:focus { outline: none; }
.fund-page .poster:focus-visible { outline: 3px solid var(--red); outline-offset: 4px; }

/* Hover label (fund.README Rule 4). All properties set explicitly because Bootstrap also has a .label class */
.fund-page .poster .label {
	display: none;
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: .5em .25em;
	border-radius: 0;
	background: rgba(8, 42, 108, .85);
	color: var(--white);
	font-family: var(--flare);
	font-size: max(10px, calc(18 * var(--u)));
	font-weight: 400;
	line-height: 1.3;
	text-align: center;
	white-space: normal;
	vertical-align: baseline;
}

.fund-page .poster:hover .label,
.fund-page .poster:focus-visible .label { display: block; }

/* ---------- Invitation line ---------- */
.fund-page .invite {
	position: absolute;
	left: 0;
	right: 0;
	top: calc(1006 * var(--u));
	margin: 0;
	color: var(--navy-deep);
	font-family: var(--brush);
	font-size: calc(50 * var(--u));
	line-height: 1;
	letter-spacing: .1em;
	text-align: center;
	white-space: nowrap;
}

.fund-page .invite i {
	display: inline-block;
	width: calc(3 * var(--u));
	min-width: 1px;
	height: .8em;
	margin: 0 .5em 0 .4em;
	background: var(--red);
	vertical-align: -.06em;
}

/* ---------- Footer: 15% ---------- */
.fund-page .site-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 4px 24px;
	flex-wrap: wrap;
	min-height: 0;
	overflow: auto;
	padding: 8px clamp(16px, 4vw, 56px);
	background: rgba(255, 255, 255, .5);
	border-top: 1px solid rgba(7, 65, 127, .14);
	color: rgba(8, 42, 108, .82);
	font-size: clamp(.68rem, .85vw, .82rem);
	line-height: 1.45;
	letter-spacing: .02em;
}

.fund-page .site-footer p { margin: 0; }

.fund-page .site-footer strong { color: var(--navy-deep); font-weight: 600; }

.fund-page .site-footer a {
	color: var(--navy);
	text-decoration: none;
	border-bottom: 1px solid rgba(7, 65, 127, .3);
	transition: border-color .2s ease;
}

.fund-page .site-footer a:hover,
.fund-page .site-footer a:focus-visible { border-color: var(--navy); outline: none; }

.fund-page .footer-links { display: flex; flex-wrap: wrap; gap: 8px clamp(28px, 4vw, 64px); }

/* ---------- Pop-up (styled like claude-v2's lightbox) ---------- */
.fund-page .popup {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 10000;
	background: rgba(7, 45, 90, .62);
	backdrop-filter: blur(5px);
}

.fund-page .popup.open {
	display: flex;
	align-items: center;
	justify-content: center;
}

.fund-page .popup-box {
	display: grid;
	grid-template-rows: minmax(0, 1fr) auto;
	width: min(92vw, 480px);
	max-height: 94vh;
	border-radius: 14px;
	background: var(--white);
	box-shadow: 0 30px 80px rgba(4, 30, 60, .45);
	overflow: hidden;
}

.fund-page .popup-box img {
	display: block;
	width: 100%;
	max-width: none;
	height: 100%;
	max-height: calc(94vh - 72px);
	object-fit: contain;
	background: var(--navy);
}

.fund-page .lb-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 14px;
}

.fund-page .lb-title {
	color: var(--navy);
	font-family: var(--brush);
	font-size: 1.3rem;
	letter-spacing: .08em;
}

.fund-page .lb-actions { display: flex; gap: 8px; }

.fund-page .fund-btn {
	display: inline-flex;
	align-items: center;
	gap: .3em;
	margin: 0;
	padding: 8px 15px;
	border: 1px solid var(--navy);
	border-radius: 999px;
	font-family: var(--flare);
	font-size: .9rem;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background .2s ease, color .2s ease;
}

.fund-page .fund-btn-primary,
.fund-page .fund-btn-primary:hover,
.fund-page .fund-btn-primary:focus { color: var(--white); text-decoration: none; }
.fund-page .fund-btn-primary { background: var(--navy); }
.fund-page .fund-btn-primary:hover { background: var(--navy-deep); }
.fund-page .fund-btn-ghost { background: none; color: var(--navy); }
.fund-page .fund-btn-ghost:hover { background: var(--sky-light); }

/* ---------- Portrait screens: same artwork, stacked ---------- */
@media (max-aspect-ratio: 1 / 1) {
	.fund-page { grid-template-rows: auto auto; height: auto; min-height: 100vh; min-height: 100dvh; }

	.fund-page .screen { container-type: normal; padding-bottom: 6vw; }

	.fund-page .stage { width: 100%; aspect-ratio: auto; }

	.fund-page .canvas { height: auto; padding: 9cqw 0 8cqw; }

	.fund-page .zh {
		--u: calc(100cqw / 760);
		position: relative;
		left: auto;
		top: auto;
		display: block;
		margin: 0 auto;
	}

	.fund-page .en {
		position: static;
		display: block;
		margin-top: 5cqw;
		font-size: 5.1cqw;
		line-height: 1.2;
		text-align: center;
	}

	.fund-page .posters {
		position: static;
		gap: 3cqw;
		margin-top: 9cqw;
	}

	.fund-page .poster { width: 29.5cqw; }

	.fund-page .invite {
		position: static;
		margin-top: 9cqw;
		font-size: 6cqw;
	}

	.fund-page .site-footer { justify-content: center; min-height: 15vh; overflow: visible; padding-top: 14px; padding-bottom: 14px; text-align: center; }
	.fund-page .footer-links { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
	.fund-page * { transition: none !important; }
}
