/*
 * Repair Workbench article blocks.
 * Uses the article-blue theme variables (--m-*) with fallbacks, so the blocks follow the
 * forum's light and dark palettes. Loaded on every page; selectors only match article BBCode,
 * in forum posts (.content) and on the workbench review page (.rw2-article).
 */
.content, .rw2-article {
	--rw-tip: #e9f5ee;
	--rw-tip-ink: #1f4d36;
	--rw-tip-mark: #2e8b57;
	--rw-warn: #fff0ea;
	--rw-warn-ink: #6b2410;
	--rw-reply: #e7f0fa;
	--rw-hot: var(--m-hot, #e5421f);
	--rw-accent: var(--m-accent, #2f6fa8);
	--rw-paper: var(--m-paper, #fbfaf6);
	--rw-line: var(--m-line, #c5d5e5);
	--rw-muted: var(--m-muted, #53657a);
	--rw-ink: var(--m-ink, #1d2b3a);
	--rw-icon: FontAwesome, var(--m-sans, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif);
}
@media (prefers-color-scheme: dark) {
	.content, .rw2-article {
		--rw-tip: #16331f;
		--rw-tip-ink: #c9ecd5;
		--rw-tip-mark: #6fcf97;
		--rw-warn: #3a1d14;
		--rw-warn-ink: #ffd2c2;
		--rw-reply: #1d3550;
	}
}

/* Line breaks phpBB adds between blocks */
:is(.content, .rw2-article) .art-case + br, :is(.content, .rw2-article) .art-tip + br, :is(.content, .rw2-article) .art-warn + br, :is(.content, .rw2-article) .art-steps + br,
:is(.content, .rw2-article) .art-ask + br, :is(.content, .rw2-article) .art-reply + br, :is(.content, .rw2-article) .art-stamp + br, :is(.content, .rw2-article) .art-timeline + br,
:is(.content, .rw2-article) .art-cta + br, :is(.content, .rw2-article) .art-case > br, :is(.content, .rw2-article) .art-steps > br, :is(.content, .rw2-article) .art-timeline > br,
:is(.content, .rw2-article) .art-row > br { display: none; }

/* Repair file card: a ticket listing the case at a glance */
:is(.content, .rw2-article) .art-case {
	position: relative;
	margin: 28px 0;
	padding: 44px 22px 10px;
	background: var(--rw-paper);
	border: 1px solid var(--rw-line);
	border-top: 5px solid var(--rw-accent);
	border-radius: 4px 4px 10px 10px;
	box-shadow: 0 4px 14px var(--m-shadow, rgba(29, 43, 58, .12));
}
:is(.content, .rw2-article) .art-case::before {
	content: "\f0ad\00a0\00a0維修檔案";
	position: absolute;
	top: 12px;
	left: 22px;
	font-family: var(--rw-icon);
	font-size: 14px;
	font-weight: 700;
	letter-spacing: .12em;
	color: var(--rw-accent);
}
:is(.content, .rw2-article) .art-row {
	display: grid;
	grid-template-columns: 6.5em minmax(0, 1fr);
	gap: 14px;
	padding: 10px 0;
	border-top: 1px dashed var(--rw-line);
	line-height: 1.6;
}
:is(.content, .rw2-article) .art-row:first-child { border-top: 0; }
:is(.content, .rw2-article) .art-row strong { color: var(--rw-muted); font-weight: 600; font-size: .9em; }

/* Practical tip */
:is(.content, .rw2-article) .art-tip {
	position: relative;
	margin: 24px 0;
	padding: 16px 20px 16px 58px;
	background: var(--rw-tip);
	color: var(--rw-tip-ink);
	border-radius: 6px;
	line-height: 1.7;
}
:is(.content, .rw2-article) .art-tip::before {
	content: "\f0eb";
	position: absolute;
	left: 18px;
	top: 14px;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--rw-tip-mark);
	color: #fff;
	font-family: FontAwesome;
	font-size: 16px;
	line-height: 28px;
	text-align: center;
}
:is(.content, .rw2-article) .art-tip strong { display: inline-block; margin-bottom: 2px; }

/* Caution */
:is(.content, .rw2-article) .art-warn {
	margin: 24px 0;
	padding: 14px 20px;
	background: var(--rw-warn);
	color: var(--rw-warn-ink);
	border-left: 6px solid var(--rw-hot);
	border-radius: 0 6px 6px 0;
	line-height: 1.7;
}
:is(.content, .rw2-article) .art-warn::before {
	content: "\f071\00a0\00a0注意";
	display: block;
	margin-bottom: 4px;
	font-family: var(--rw-icon);
	font-weight: 700;
	color: var(--rw-hot);
	letter-spacing: .08em;
}

/* Numbered steps */
:is(.content, .rw2-article) .art-steps { counter-reset: rw-step; margin: 26px 0; }
:is(.content, .rw2-article) .art-step {
	position: relative;
	counter-increment: rw-step;
	padding: 2px 0 22px 58px;
	line-height: 1.7;
}
:is(.content, .rw2-article) .art-step::before {
	content: counter(rw-step);
	position: absolute;
	left: 0;
	top: 0;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: var(--rw-accent);
	color: #fff;
	font-family: var(--m-serif, Georgia, serif);
	font-size: 19px;
	font-weight: 700;
	line-height: 38px;
	text-align: center;
	box-shadow: 0 3px 8px var(--m-shadow, rgba(29, 43, 58, .18));
}
:is(.content, .rw2-article) .art-step:not(:last-child)::after {
	content: "";
	position: absolute;
	left: 18px;
	top: 42px;
	bottom: 4px;
	border-left: 2px dashed var(--rw-line);
}
:is(.content, .rw2-article) .art-step strong { display: inline-block; font-size: 1.05em; margin-bottom: 2px; }

/* Customer and technician dialogue */
:is(.content, .rw2-article) .art-ask, :is(.content, .rw2-article) .art-reply {
	position: relative;
	width: fit-content;
	max-width: 82%;
	margin: 14px 0;
	padding: 12px 18px;
	border-radius: 18px;
	line-height: 1.7;
}
:is(.content, .rw2-article) .art-ask {
	background: var(--rw-paper);
	border: 1px solid var(--rw-line);
	border-bottom-left-radius: 4px;
}
:is(.content, .rw2-article) .art-reply {
	margin-left: auto;
	background: var(--rw-reply);
	border-bottom-right-radius: 4px;
}
:is(.content, .rw2-article) .art-ask::before, :is(.content, .rw2-article) .art-reply::before {
	display: block;
	margin-bottom: 2px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .1em;
}
:is(.content, .rw2-article) .art-ask::before { content: "客人"; color: var(--rw-muted); }
:is(.content, .rw2-article) .art-reply::before { content: "老麥"; color: var(--rw-accent); text-align: right; }

/* Ink stamp for the outcome */
:is(.content, .rw2-article) .art-stamp {
	display: block;
	width: fit-content;
	margin: -6px 18px 22px auto;
	padding: 6px 16px;
	border: 3px double var(--rw-hot);
	border-radius: 8px;
	color: var(--rw-hot);
	font-family: var(--m-serif, Georgia, serif);
	font-size: 22px;
	font-weight: 800;
	letter-spacing: .18em;
	transform: rotate(-6deg);
	opacity: .88;
	mix-blend-mode: multiply;
}
@media (prefers-color-scheme: dark) { :is(.content, .rw2-article) .art-stamp { mix-blend-mode: normal; } }

/* Repair timeline for repeat visits */
:is(.content, .rw2-article) .art-timeline {
	position: relative;
	margin: 28px 0;
	padding-left: 26px;
	border-left: 3px solid var(--rw-line);
}
:is(.content, .rw2-article) .art-tl { position: relative; padding: 0 0 22px 14px; line-height: 1.7; }
:is(.content, .rw2-article) .art-tl::before {
	content: "";
	position: absolute;
	left: -36px;
	top: 6px;
	width: 13px;
	height: 13px;
	border-radius: 50%;
	background: var(--rw-accent);
	border: 3px solid var(--rw-paper);
	box-shadow: 0 0 0 1px var(--rw-line);
}
:is(.content, .rw2-article) .art-tl strong { display: inline-block; color: var(--rw-accent); }

/* Closing invitation */
:is(.content, .rw2-article) .art-cta {
	margin: 48px 0 12px;
	padding: 26px 24px;
	text-align: center;
	background: linear-gradient(135deg, var(--m-head-b, #fff3ec), var(--rw-paper));
	border: 1px solid var(--rw-line);
	border-radius: 10px;
	font-size: 1.05em;
	line-height: 1.7;
}
:is(.content, .rw2-article) .art-cta-text { margin-bottom: 14px; }
:is(.content, .rw2-article) .art-cta-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
:is(.content, .rw2-article) a.art-cta-btn, :is(.content, .rw2-article) a.art-consult {
	display: inline-block;
	border-radius: 999px;
	background: #c8381a;
	font-weight: 700;
	text-decoration: none;
	box-shadow: 0 3px 10px rgba(200, 56, 26, .25);
}
:is(.content, .rw2-article) a.art-cta-btn { padding: 10px 26px; }
:is(.content, .rw2-article) a.art-consult { padding: 2px 14px; margin: 0 2px; font-size: .92em; line-height: 1.8; box-shadow: none; }
/* Theme link colours must not reach the buttons: text, label spans and icons stay white. */
:is(.content, .rw2-article) :is(a.art-cta-btn, a.art-consult), :is(.content, .rw2-article) :is(a.art-cta-btn, a.art-consult):is(:link, :visited, :hover, :focus, :active),
:is(.content, .rw2-article) :is(a.art-cta-btn, a.art-consult) span, :is(.content, .rw2-article) :is(a.art-cta-btn, a.art-consult)::before { color: #fff !important; text-decoration: none !important; }
:is(.content, .rw2-article) :is(a.art-cta-btn, a.art-consult):is(:hover, :focus) { background: #ad2f14; }
:is(.content, .rw2-article) :is(a.art-cta-btn, a.art-consult):focus-visible { outline: 3px solid var(--rw-accent); outline-offset: 3px; }
:is(.content, .rw2-article) a.art-cta-btn::before, :is(.content, .rw2-article) a.art-consult::before { content: "\f086\00a0\00a0"; font-family: FontAwesome; }
/* Secondary button: the repair guide sits beside the consultation button. */
:is(.content, .rw2-article) a.art-cta-btn.art-cta-alt { background: var(--rw-paper); border: 2px solid #c8381a; padding: 8px 24px; box-shadow: none; }
:is(.content, .rw2-article) a.art-cta-btn.art-cta-alt, :is(.content, .rw2-article) a.art-cta-btn.art-cta-alt:is(:link, :visited, :hover, :focus, :active),
:is(.content, .rw2-article) a.art-cta-btn.art-cta-alt span, :is(.content, .rw2-article) a.art-cta-btn.art-cta-alt::before { color: #c8381a !important; }
:is(.content, .rw2-article) a.art-cta-btn.art-cta-alt:is(:hover, :focus) { background: #fff1ec; }
:is(.content, .rw2-article) a.art-cta-btn.art-cta-alt::before { content: "\f0f6\00a0\00a0"; }

/*
 * Labels follow the language of the article itself (:lang), not only the page: the review
 * page shows the Chinese and English drafts side by side, each marked with its own lang.
 */
:is(.content, .rw2-article) .art-en { display: none; }
:is(.content, .rw2-article) .art-zh:lang(en) { display: none; }
:is(.content, .rw2-article) .art-en:lang(en) { display: inline; }
:is(.content, .rw2-article) .art-case:lang(en)::before { content: "\f0ad\00a0\00a0Repair file"; }
:is(.content, .rw2-article) .art-warn:lang(en)::before { content: "\f071\00a0\00a0Caution"; }
:is(.content, .rw2-article) .art-ask:lang(en)::before { content: "Customer"; }
:is(.content, .rw2-article) .art-reply:lang(en)::before { content: "MYDC"; }

@media (max-width: 480px) {
	:is(.content, .rw2-article) .art-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
	:is(.content, .rw2-article) .art-ask, :is(.content, .rw2-article) .art-reply { max-width: 92%; }
	:is(.content, .rw2-article) .art-stamp { margin-right: 4px; }
}

/*
 * Baseline for the original article blocks ([lead], [h2], [pair], [stack], [afilm], [adiagram],
 * [note], [verdict], [card]) copied from article-blue. :where() keeps these rules at the lowest
 * specificity, so forums that use article-blue keep its own rules and every other style
 * (draft forums, the review page) gets the same look.
 */
:where(.content, .rw2-article) .art-h2 { color: var(--m-ink, #1d2b3a); border-bottom: 0; font-family: var(--m-serif, "Noto Serif TC", "Songti TC", serif); font-size: 1.5em; font-weight: 600; line-height: 1.35; margin: 48px 0 0; padding-top: 18px; border-top: 2px solid var(--rw-line); }
:where(.content, .rw2-article) .art-lead { font-size: 1.1em; color: var(--rw-muted); margin: 16px 0 0; }
:where(.content, .rw2-article) .art-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 24px 0; align-items: start; }
:where(.content, .rw2-article) .art-film { margin: 24px auto; max-width: 320px; background: var(--m-frame, #fdfcf8); padding: 12px 12px 14px; border-radius: 3px; box-shadow: 0 6px 18px var(--m-shadow, rgba(29, 43, 58, .18)); font-size: .9em; line-height: 1.6; color: #4b5a6a; }
:where(.content, .rw2-article) .art-pair .art-film { margin: 0 auto; max-width: 360px; width: 100%; }
:where(.content, .rw2-article) .art-pair .art-film:nth-child(2n+1) { transform: rotate(-1deg); }
:where(.content, .rw2-article) .art-pair .art-film:nth-child(2n) { transform: rotate(1deg); }
:where(.content, .rw2-article) .art-diagram { margin: 26px 0; background: #fff; border: 1px solid var(--rw-line); border-radius: 4px; padding: 10px; text-align: center; font-size: .9em; line-height: 1.6; color: #3d4d5e; }
:where(.content, .rw2-article) .art-note { background: var(--m-note, #fff7d6); color: var(--m-note-ink, #4a3d0a); padding: 18px 20px; border-radius: 2px; margin: 0; }
:where(.content, .rw2-article) .art-verdict { background: var(--rw-paper); border-left: 6px solid var(--rw-accent); padding: 16px 20px; margin: 24px 0; font-weight: 500; }
:where(.content, .rw2-article) .art-card { background: var(--rw-paper); padding: 14px 16px; border-radius: 4px; }
:where(.content, .rw2-article) .art-stack { display: flex; flex-direction: column; gap: 16px; align-self: center; min-width: 0; }
:where(.content, .rw2-article) .art-stack .art-verdict { margin: 0; }
:where(.content, .rw2-article) .art-pair > .art-note, :where(.content, .rw2-article) .art-pair > .art-card { align-self: center; }
:where(.content, .rw2-article) .art-att .inline-attachment { margin: 0 0 10px; padding: 0; }
:where(.content, .rw2-article) .art-att .inline-attachment dl { margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; float: none; width: auto; max-width: none; }
:where(.content, .rw2-article) .art-att .inline-attachment dl dt { display: block; float: none; width: auto; margin: 0; padding: 0; border: 0; background: transparent; }
:where(.content, .rw2-article) .art-att .inline-attachment dl dd { display: none; }
:where(.content, .rw2-article) .art-att .inline-attachment img, :where(.content, .rw2-article) .art-att img.postimage, :where(.content, .rw2-article) .art-att video { display: block; width: 100%; max-width: 100%; height: auto; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; }
:where(.content, .rw2-article) .art-att br, :where(.content, .rw2-article) .art-stack > br, :where(.content, .rw2-article) .art-pair > br,
:where(.content, .rw2-article) .art-h2 + br, :where(.content, .rw2-article) .art-lead + br, :where(.content, .rw2-article) figure + br,
:where(.content, .rw2-article) .art-pair + br, :where(.content, .rw2-article) .art-note + br, :where(.content, .rw2-article) .art-verdict + br,
:where(.content, .rw2-article) .art-card + br, :where(.content, .rw2-article) .art-stack + br { display: none; }
@media (prefers-color-scheme: dark) {
	:where(.content, .rw2-article) .art-diagram { background: #1e2d3e; color: #c9d6e3; }
	:where(.content, .rw2-article) .art-film { color: #c9d6e3; }
}
@media (max-width: 480px) {
	:where(.content, .rw2-article) .art-pair { grid-template-columns: minmax(0, 1fr); }
}
