/*
 * Site header — one slim brand bar (redesigned 2026-11-21).
 * Desktop (>= 1024px): brand | 作品 panel · studio links | 線上課程 · YouTube.
 * Below 1024px: brand | 選單 button that opens a full-width sheet, then a slim 線上課程 strip.
 * Markup: inc/site-header.php. Both menus are <details>; site-header.js only closes them.
 */

/*
 * The root rules use `html body header.fb-mast` on purpose: the site's database
 * global styles (Site Editor custom CSS) still style `body .wp-site-blocks > header`
 * for the retired header (overflow: hidden, z-index: 20, own background and
 * ::before texture). That overflow would clip the 作品 panel, so these rules must
 * out-rank it whatever order the stylesheets print in.
 */
html body header.fb-mast {
	--fbm-ink: #08141d;
	--fbm-ink2: #10293a;
	--fbm-plum: #221c36;
	--fbm-text: #f6efe2;
	--fbm-mute: rgba(246, 239, 226, .66);
	--fbm-gold: #d9b26a;
	--fbm-vermilion: #d2503b;
	--fbm-line: rgba(217, 178, 106, .22);
	position: relative;
	z-index: 60;
	overflow: visible;
	margin: 0 !important;
	border-bottom: 0;
	box-shadow: 0 10px 30px rgba(4, 10, 18, .28);
	color: var(--fbm-text);
	background:
		radial-gradient(60rem 12rem at 12% 0%, rgba(210, 80, 59, .20), transparent 70%),
		radial-gradient(50rem 14rem at 88% 0%, rgba(130, 100, 190, .18), transparent 70%),
		linear-gradient(100deg, var(--fbm-ink), var(--fbm-ink2) 55%, var(--fbm-plum));
	font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}

html body header.fb-mast::before { content: none; }

html body header.fb-mast::after {
	content: "";
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	height: 1px;
	opacity: .75;
	background: linear-gradient(90deg, transparent, var(--fbm-vermilion) 25%, var(--fbm-gold) 50%, var(--fbm-vermilion) 75%, transparent);
}

.fb-mast *,
.fb-mast *::before,
.fb-mast *::after { box-sizing: border-box; }

.fb-mast a { color: inherit; text-decoration: none; }
.fb-mast ul { margin: 0; padding: 0; list-style: none; }
.fb-mast small { display: block; font-size: .62rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--fbm-mute); }

.fb-mast .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.fb-mast__bar {
	display: flex;
	align-items: center;
	gap: clamp(16px, 2.4vw, 40px);
	max-width: 1440px;
	min-height: 76px;
	margin: 0 auto;
	padding: 10px clamp(16px, 3.4vw, 48px);
}

/* Brand */
.fb-mast__brand { display: flex; flex: none; align-items: center; gap: 12px; border-radius: 14px; }
.fb-mast__brand img { width: 56px; height: 56px; filter: drop-shadow(0 0 14px rgba(255, 205, 120, .32)); }
.fb-mast__name strong {
	display: block;
	font-family: "Noto Serif TC", Georgia, serif;
	font-size: 1.12rem;
	font-weight: 800;
	letter-spacing: .12em;
	line-height: 1.2;
	color: #fff7e6;
}
.fb-mast__name small { margin-top: 3px; font-size: .64rem; letter-spacing: .3em; color: var(--fbm-gold); }

/* Desktop navigation */
.fb-mast__nav { margin-left: auto; }
.fb-mast__nav > ul { display: flex; align-items: center; gap: 4px; }
.fb-mast__nav > ul > li > a,
.fb-mast__drop > summary {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 9px 16px 8px;
	border-radius: 12px;
	font-size: .98rem;
	font-weight: 700;
	letter-spacing: .06em;
	line-height: 1.25;
	cursor: pointer;
	transition: background-color .18s ease, color .18s ease;
}
.fb-mast__nav > ul > li > a small,
.fb-mast__drop > summary small { margin-top: 2px; font-size: .58rem; }
.fb-mast__nav > ul > li > a:hover,
.fb-mast__drop > summary:hover,
.fb-mast__drop[open] > summary { background: rgba(255, 255, 255, .07); }
.fb-mast__nav > ul > li > a[aria-current="page"]::after {
	content: "";
	position: absolute;
	right: 30%;
	bottom: 2px;
	left: 30%;
	height: 2px;
	border-radius: 2px;
	background: var(--fbm-gold);
}

.fb-mast summary { list-style: none; }
.fb-mast summary::-webkit-details-marker { display: none; }
.fb-mast__drop > summary { flex-direction: row; gap: 8px; }
.fb-mast__drop > summary small { display: none; }
.fb-mast__chev {
	width: 7px;
	height: 7px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-2px) rotate(45deg);
	transition: transform .2s ease;
}
.fb-mast__drop[open] .fb-mast__chev { transform: translateY(1px) rotate(225deg); }

.fb-mast__panel {
	position: absolute;
	top: calc(100% - 4px);
	right: clamp(16px, 3.4vw, 48px);
	left: clamp(16px, 3.4vw, 48px);
	max-width: 1344px;
	margin: 0 auto;
	padding: 26px 28px 18px;
	border: 1px solid var(--fbm-line);
	border-radius: 22px;
	background: linear-gradient(160deg, rgba(14, 34, 48, .97), rgba(30, 25, 50, .97));
	box-shadow: 0 30px 70px rgba(0, 0, 0, .5);
	backdrop-filter: blur(16px);
	animation: fbm-in .2s ease both;
}

@keyframes fbm-in {
	from { opacity: 0; transform: translateY(-6px); }
	to { opacity: 1; transform: none; }
}

/* Works panel (shared by desktop panel and mobile sheet).
 * Desktop: three even columns — 戲劇 | 節目 | 音樂 above 幕後 — each a list of
 * one-line rows (thumbnail, title, English title, tag). */
.fb-works {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	grid-template-areas: "drama shows music" "drama shows backstage";
	grid-template-rows: auto 1fr;
	gap: 18px 30px;
}
.fb-works__group:nth-child(1) { grid-area: drama; }
.fb-works__group:nth-child(2) { grid-area: shows; }
.fb-works__group:nth-child(3) { grid-area: music; }
.fb-works__group:nth-child(4) { grid-area: backstage; }
.fb-works__group h2 {
	display: flex;
	align-items: baseline;
	gap: 10px;
	margin: 0 0 8px;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--fbm-line);
	color: var(--fbm-gold);
	font-family: inherit;
	font-size: .92rem;
	font-weight: 800;
	letter-spacing: .2em;
	line-height: 1.3;
}
.fb-works__group h2 small { display: inline; font-size: .58rem; }
.fb-works__group ul { display: grid; gap: 4px; }

.fb-work {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 7px 8px;
	border: 1px solid transparent;
	border-radius: 14px;
	transition: background-color .18s ease, border-color .18s ease;
}
.fb-work:hover,
.fb-work:focus-visible { background: rgba(255, 255, 255, .06); border-color: var(--fbm-line); }
.fb-work[aria-current="page"] { background: rgba(217, 178, 106, .12); border-color: rgba(217, 178, 106, .45); }
.fb-work img {
	flex: none;
	width: 104px;
	height: 65px;
	border-radius: 10px;
	object-fit: cover;
	background: rgba(255, 255, 255, .06);
	box-shadow: 0 6px 16px rgba(0, 0, 0, .35);
	transition: transform .25s ease;
}
.fb-work:hover img { transform: scale(1.04); }
.fb-work__copy { min-width: 0; line-height: 1.35; }
.fb-work__copy strong,
.fb-work__copy small,
.fb-work__copy em { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fb-work__copy strong { font-size: 1rem; font-weight: 750; letter-spacing: .04em; color: #fff; }
.fb-work__copy small { margin-top: 1px; font-size: .6rem; letter-spacing: .08em; text-transform: none; }
.fb-work__copy em { margin-top: 3px; font-size: .74rem; font-style: normal; color: rgba(246, 239, 226, .58); }

.fb-works__all { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--fbm-line); text-align: right; }
.fb-works__all a { color: var(--fbm-gold); font-size: .88rem; font-weight: 700; letter-spacing: .04em; }
.fb-works__all a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* YouTube call to action */
.fb-mast__yt {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	border-radius: 999px;
	background: linear-gradient(135deg, #e0533a, #b8322a);
	box-shadow: 0 8px 22px rgba(200, 60, 45, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
	color: #fff !important;
	font-size: .9rem;
	font-weight: 800;
	letter-spacing: .05em;
	white-space: nowrap;
	transition: transform .18s ease, box-shadow .18s ease;
}
.fb-mast__yt:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(200, 60, 45, .45), inset 0 1px 0 rgba(255, 255, 255, .25); }
.fb-mast__yt span[aria-hidden] { font-size: .72rem; }

/* Online course: a gold outline pill beside YouTube (desktop), a slim strip under the bar (below 1024px). */
.fb-mast__course {
	display: inline-flex;
	flex: none;
	align-items: center;
	padding: 9px 16px;
	border: 1px solid rgba(217, 178, 106, .7);
	border-radius: 999px;
	background: rgba(217, 178, 106, .1);
	color: #f3d593 !important;
	font-size: .9rem;
	font-weight: 800;
	letter-spacing: .05em;
	white-space: nowrap;
	transition: background-color .18s ease, transform .18s ease;
}
.fb-mast__course:hover { background: rgba(217, 178, 106, .2); transform: translateY(-1px); }
/* The label is several flex items (icon, optional 「AI 劇」, 線上課程); only the icon gets a gap. */
.fb-mast__course > span[aria-hidden] { margin-right: 7px; font-size: 1rem; }
/* Pull YouTube in beside the course pill: the two calls to action read as one pair. */
.fb-mast__bar > .fb-mast__course { margin-right: calc(10px - clamp(16px, 2.4vw, 40px)); }

/* Viewer support: a rose outline pill, first of the three calls to action (2026-11-26). */
.fb-mast__support {
	display: inline-flex;
	flex: none;
	align-items: center;
	padding: 9px 16px;
	border: 1px solid rgba(240, 150, 160, .7);
	border-radius: 999px;
	background: rgba(240, 150, 160, .1);
	color: #f7c3c9 !important;
	font-size: .9rem;
	font-weight: 800;
	letter-spacing: .05em;
	white-space: nowrap;
	transition: background-color .18s ease, transform .18s ease;
}
.fb-mast__support:hover { background: rgba(240, 150, 160, .2); transform: translateY(-1px); }
.fb-mast__support > span[aria-hidden] { margin-right: 7px; font-size: 1rem; }
.fb-mast__bar > .fb-mast__support { margin-right: calc(10px - clamp(16px, 2.4vw, 40px)); }

.fb-mast__strip { display: none; }

.fb-mast a:focus-visible,
.fb-mast summary:focus-visible { outline: 2px solid var(--fbm-gold); outline-offset: 3px; }

/* Mobile menu: hidden on desktop */
.fb-mast__mobile { display: none; }

@media (max-width: 1180px) {
	.fb-mast__nav > ul > li > a,
	.fb-mast__drop > summary { padding-inline: 11px; }
	.fb-mast__support,
	.fb-mast__course,
	.fb-mast__yt { padding-inline: 14px; }
}

/* The third pill (贊助) made the nav labels wrap onto two lines between 1024 and 1240px (measured
   2026-11-26); 贊助支持 shortens to 贊助 first, then the three pill icons step aside. */
@media (max-width: 1280px) {
	.fb-mast__bar > .fb-mast__support .fb-mast__support-tail { display: none; }
}
@media (max-width: 1240px) {
	.fb-mast__bar > a > span[aria-hidden] { display: none; }
}

/* 1024-1120px: the full 「AI 劇線上課程」 label pushed 關於工作室 and RSS 訂閱 onto two lines. */
@media (max-width: 1120px) {
	.fb-mast__course-lead { display: none; }
	.fb-work img { width: 84px; height: 53px; }
	/* With three pills the bar still wrapped at 1024-1100px; trim the paddings a little more. */
	.fb-mast__nav > ul > li > a,
	.fb-mast__drop > summary { padding-inline: 8px; }
	.fb-mast__support,
	.fb-mast__course,
	.fb-mast__yt { padding-inline: 12px; }
}

@media (max-width: 1023px) {
	.fb-mast__nav,
	.fb-mast__bar > .fb-mast__support,
	.fb-mast__bar > .fb-mast__course,
	.fb-mast__bar > .fb-mast__yt { display: none; }
	.fb-mast__bar { min-height: 64px; padding-block: 8px; }
	.fb-mast__brand img { width: 46px; height: 46px; }
	.fb-mast__name strong { font-size: 1rem; }
	.fb-mast__name small { font-size: .56rem; letter-spacing: .24em; }

	.fb-mast__mobile { display: block; margin-left: auto; }
	.fb-mast__mobile > summary {
		display: flex;
		align-items: center;
		gap: 9px;
		padding: 9px 14px;
		border: 1px solid var(--fbm-line);
		border-radius: 12px;
		background: rgba(255, 255, 255, .05);
		font-size: .92rem;
		font-weight: 700;
		letter-spacing: .08em;
		cursor: pointer;
	}
	.fb-mast__burger { display: grid; gap: 4px; width: 18px; }
	.fb-mast__burger i { display: block; height: 2px; border-radius: 2px; background: currentColor; transition: transform .2s ease, opacity .2s ease; }
	.fb-mast__mobile[open] .fb-mast__burger i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
	.fb-mast__mobile[open] .fb-mast__burger i:nth-child(2) { opacity: 0; }
	.fb-mast__mobile[open] .fb-mast__burger i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

	.fb-mast__sheet {
		position: absolute;
		top: 100%;
		right: 0;
		left: 0;
		max-height: calc(100vh - 100px);
		max-height: calc(100dvh - 100px);
		overflow-y: auto;
		overscroll-behavior: contain;
		padding: 18px 16px 24px;
		border-top: 1px solid var(--fbm-line);
		background: linear-gradient(170deg, #0c1f2c, #1d1830);
		box-shadow: 0 30px 60px rgba(0, 0, 0, .55);
		animation: fbm-in .2s ease both;
	}
	.fb-works { grid-template-columns: 1fr; grid-template-areas: none; grid-template-rows: none; gap: 18px; }
	.fb-works__group:nth-child(n) { grid-area: auto; }
	.fb-works__group ul { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
	.fb-work { flex-direction: column; align-items: stretch; gap: 7px; padding: 6px; background: rgba(255, 255, 255, .035); }
	.fb-work img { width: 100%; height: auto; aspect-ratio: 16 / 10; }
	.fb-work:hover img { transform: none; }
	.fb-work__copy strong,
	.fb-work__copy small { white-space: normal; }
	.fb-work__copy strong { font-size: .9rem; }
	.fb-work__copy em { display: none; }
	.fb-works__all { text-align: center; }

	.fb-mast__sheet-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
	.fb-mast__sheet-links a {
		display: block;
		padding: 12px 6px;
		border: 1px solid var(--fbm-line);
		border-radius: 12px;
		background: rgba(255, 255, 255, .04);
		font-size: .88rem;
		font-weight: 700;
		text-align: center;
	}
	.fb-mast__sheet-links a[aria-current="page"] { border-color: var(--fbm-gold); }
	.fb-mast__sheet > .fb-mast__support,
	.fb-mast__sheet > .fb-mast__yt { display: flex; justify-content: center; margin-top: 14px; padding: 13px; }
	.fb-mast__sheet > .fb-mast__support + .fb-mast__yt { margin-top: 10px; }

	.fb-mast__strip {
		display: flex;
		align-items: center;
		gap: 10px;
		min-height: 36px;
		padding: 6px clamp(16px, 3.4vw, 48px);
		border-top: 1px solid var(--fbm-line);
		background: linear-gradient(90deg, rgba(217, 178, 106, .16), rgba(217, 178, 106, .05));
		color: #f3d593;
		font-size: .82rem;
		font-weight: 700;
		letter-spacing: .04em;
		line-height: 1.3;
	}
	.fb-mast__strip-tag { flex: none; padding: 2px 9px; border: 1px solid rgba(217, 178, 106, .6); border-radius: 999px; font-size: .76rem; }
	.fb-mast__strip-title { min-width: 0; overflow: hidden; color: var(--fbm-text); white-space: nowrap; text-overflow: ellipsis; }
	.fb-mast__strip-go { flex: none; margin-left: auto; }
}

/* Phones under 430px: 「我一個人拍完 22 集 AI 連續劇」 fits whole where the full title was cut. */
@media (max-width: 429px) {
	.fb-mast__strip-lead { display: none; }
}

@media (max-width: 380px) {
	.fb-mast__name small { display: none; }
	/* At 320px the 選單 button wrapped onto two lines and the bar grew from 64px to 86px. */
	.fb-mast__brand img { width: 40px; height: 40px; }
	.fb-mast__mobile > summary { gap: 7px; padding-inline: 11px; white-space: nowrap; }
	/* The whole strip is the link; dropping the arrow keeps the short title whole on a 320px phone. */
	.fb-mast__strip { gap: 8px; }
	.fb-mast__strip-go { display: none; }
	.fb-mast__sheet-links a { padding-inline: 4px; font-size: .84rem; }
}

@media (prefers-reduced-motion: reduce) {
	.fb-mast *,
	.fb-mast__panel,
	.fb-mast__sheet { animation: none !important; transition: none !important; }
}
