/* Preview Who Posted - badges in Topic Preview popup */
.whoposted_badges {
	clear: both;
	margin-top: 10px;
	padding-top: 8px;
	border-top: 1px solid var(--tp-border, rgba(0, 0, 0, 0.12));
	line-height: 1.5;
	text-align: right;
	text-wrap: balance;
}

.whoposted_badge {
	display: inline-block;
	background: rgba(0, 0, 0, 0.06);
	border-radius: 4px;
	padding: 0px 5px;
	margin: 0px 1px;
	font-size: 9px;
	white-space: nowrap;
	border: 1px solid white;
}

.whoposted_name {
	font-weight: bold;
}

.whoposted_count {
	margin-left: 3px;
	opacity: 0.65;
	font-size: 9px;
}

.whoposted_count::before {
	content: "(";
}

.whoposted_count::after {
	content: ")";
}

/* Avatar container: override fixed height and center contents */
.topic_preview_avatar {
	height: auto !important;
	display: flex;
	flex-direction: column;
	align-items: center;
}

/* Username label below avatar */
.topic_preview_avatar_username {
	text-align: center;
	font-size: 8px;
	font-weight: bold;
	margin-top: 2px;
	max-width: 80px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

#topic_preview .previewwhoposted_tex3_code {
	display: inline;
	padding: 0 2px;
	border-radius: 3px;
	background: rgba(0, 0, 0, 0.05);
	font-family: Consolas, Monaco, "Courier New", monospace;
	font-size: 0.95em;
	white-space: normal;
	word-break: break-word;
}

#topic_preview .topic_preview_first,
#topic_preview .topic_preview_last,
#topic_preview .raw_tex3,
#topic_preview .raw_tex3 .MathJax,
#topic_preview mjx-container,
#topic_preview mjx-container * {
	overflow: visible !important;
}

#topic_preview mjx-container * {
	max-width: none !important;
}

#topic_preview mjx-container[jax="CHTML"] {
	font-size: 1.08em;
	line-height: 1.25;
	padding-top: 0.08em;
	padding-bottom: 0.12em;
}

/* Restore MathJax CHTML structural heights overridden by topicpreview's
   .topic_preview_container * { height: auto } wildcard rule.
   Values from MathJax 4.x output/chtml.js stylesheet. */
#topic_preview mjx-line {
	height: .06em !important;
	min-height: 1px !important;
}

#topic_preview mjx-nstrut {
	height: .054em !important;
}

#topic_preview mjx-dstrut {
	height: .505em !important;
}

#topic_preview mjx-linestrut,
#topic_preview mjx-tstrut {
	height: 1em !important;
}

#topic_preview mjx-none {
	height: 1px !important;
}

#topic_preview mjx-stretchy-v > mjx-ext {
	height: 100% !important;
}

#topic_preview mjx-container[jax="CHTML"] mjx-line,
#topic_preview mjx-container[jax="CHTML"] mjx-sqrt > mjx-box {
	border-top-style: solid !important;
	border-top-color: currentColor !important;
	border-top-width: 1px !important;
}

/* SVG output: prevent topicpreview's .topic_preview_container * { height: auto }
   from zeroing out SVG geometry attributes (rect height → 0 hides fraction bars,
   sqrt overlines, etc.). The JS fixSvgGeometry() handles per-element inline styles;
   this rule provides a CSS-level safety net for the top-level <svg>. */
#topic_preview mjx-container[jax="SVG"] > svg {
	height: auto !important;
	width: auto !important;
}

#topic_preview .raw_tex3 {
	vertical-align: middle;
}

#topic_preview .topic_preview_section_title_link {
	color: inherit;
	text-decoration: underline;
	pointer-events: auto;
}

#topic_preview .topic_preview_section_title_link:hover,
#topic_preview .topic_preview_section_title_link:focus {
	text-decoration-thickness: 2px;
}

/* Dark mode (DarkReader) - make all <hr> visible inside topic preview popup.
   Uses linear-gradient for background-image because DarkReader does not
   transform colors inside gradient functions. */
[data-darkreader-scheme="dark"] .topic_preview_content hr,
[data-darkreader-scheme="dark"] #topic_preview hr {
	border: none !important;
	height: 1px !important;
	background-image: linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2)) !important;
	background-color: transparent !important;
}

[data-darkreader-scheme="dark"] #topic_preview .previewwhoposted_tex3_code {
	background: rgba(255, 255, 255, 0.08);
}
