/* Legacy WPBakery pages store a separator in the content. Plain article headings
   get the same mark from CSS so published articles don't need to be rewritten. */
body.trap-site :is(.tr-direct.tr-vc .line, .line.line-50, .line.line-100, .section-title > .line),
body.trap-site :is(.singlePostContent, .noPaddingVC, .entry-content)
	:where(h1, h2, h3, h4, h5, h6) + :is(hr, .wpb_separator, .vc_separator):not(:has(:is(h1, h2, h3, h4, h5, h6, a))),
body.trap-site :is(
	#titleBreadcrumbWrap .page-title,
	.post-title > .heading-title,
	.section-heading,
	.foot-main > div > h2,
	.sidebar .widget_title_wrapper > .widget-title,
	.tr-related > h2,
	.trap-related-pages > h2,
	.related-posts > .row > div > h3,
	.trap-interior :is(.singlePostContent, .noPaddingVC, .entry-content)
		:is(h1, h2, h3, h4, h5, h6, [role="heading"], .vc_custom_heading, .wpb_heading,
			p.pg-title, p:has(> .title_h01:only-child))
):not(:where(
	:empty, .panel-title, .vc_tta-panel-title, .epay-form-title, .btn-red, .btn-white,
	:is(a, nav, dialog, form, button, summary, table, figure, .panel-heading, .list-group-item,
		.vc_tta-panel-heading, .item-content, .trap-report-card, .trap-page-grid, .epay-subscription-form) *,
	.tr-related article *, .related-posts article *, .partner_quote h3:has(+ h4)
)):not(:has(> br:only-child, > .line, + .line, + hr, + .wpb_separator, + .vc_separator))::after {
	content: "";
	display: block;
	position: static;
	box-sizing: border-box;
	width: 50px;
	max-width: 100%;
	height: 6px;
	min-height: 6px;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: var(--trap-red, #bd002d);
	transform: skewX(-14deg);
	transform-origin: left center;
	margin-block-start: 8px;
	margin-inline: var(--trap-rule-start, 0) var(--trap-rule-end, auto);
}

/* Some templates supply their own pseudo-element as well as a separator. */
body.trap-site :is(#titleBreadcrumbWrap, .singlePostContent, .noPaddingVC, .entry-content, .section-title)
	:is(h1, h2, h3, h4, h5, h6):has(+ .line)::after {
	content: none;
	display: none;
}

/* Imported articles sometimes set body-text sizes inside a heading. Use the
   theme's size and weight for that heading level instead of the pasted values. */
body.trap-site :is(.singlePostContent, .noPaddingVC .wpb_text_column, .entry-content)
	:is(h1, h2, h3, h4, h5, h6) > span:only-child[style*="font-size" i] {
	font-size: inherit !important;
}

body.trap-site :is(.singlePostContent, .noPaddingVC .wpb_text_column, .entry-content)
	:is(h1, h2, h3, h4, h5, h6) > span:only-child[style*="font-weight" i] {
	font-weight: inherit !important;
}

body.trap-site :is(.singlePostContent, .noPaddingVC .wpb_text_column, .entry-content)
	:is(h1, h2, h3, h4, h5, h6)[style*="line-height" i] {
	line-height: 1.15 !important;
}

/* Preserve intentional alignment on older Visual Composer sections. */
body.trap-site :is(.text-center, .has-text-align-center, [align="center" i],
	[style*="text-align: center" i], [style*="text-align:center" i]),
body.trap-site :is(.text-center, .has-text-align-center, [align="center" i],
	[style*="text-align: center" i], [style*="text-align:center" i]) + :is(.line, hr, .vc_separator, .wpb_separator) {
	--trap-rule-start: auto;
	--trap-rule-end: auto;
}

body.trap-site :is(.text-right, .has-text-align-right, [align="right" i],
	[style*="text-align: right" i], [style*="text-align:right" i]),
body.trap-site :is(.text-right, .has-text-align-right, [align="right" i],
	[style*="text-align: right" i], [style*="text-align:right" i]) + :is(.line, hr, .vc_separator, .wpb_separator) {
	--trap-rule-start: auto;
	--trap-rule-end: 0;
}

/* Section titles already carry the red rule. Suppress the older card borders. */
body.trap-site .tr-direct .panel {
	border-top-width: 0;
}

body.trap-site.trap-interior :is(section.tr-related, section.trap-page-cards):has(> h2) {
	border-top-width: 0;
	padding-block-start: 0;
}

body.trap-site.trap-interior ul.sidebar > li.widget-container:has(.widget-title) {
	border-top-width: 0;
}

body.trap-site #trap-youth-space .ti-service {
	border-top-width: 0;
	padding-block-start: 0;
}

/* Callouts and quotations keep their own border when separate from a title. */
body.trap-site :is(.tr-direct, .singlePostContent, .entry-content, .noPaddingVC)
	:is(h1, h2, h3, h4, h5, h6) + :is(.tr-facts, blockquote),
body.trap-site :is(.tr-direct, .singlePostContent, .entry-content, .noPaddingVC)
	:is(h1, h2, h3, h4, h5, h6) + :is(.line, hr, .vc_separator, .wpb_separator) + :is(.tr-facts, blockquote),
body.trap-site :is(.singlePostContent, .entry-content, .noPaddingVC) blockquote:has(:is(h1, h2, h3, h4, h5, h6)),
body.trap-site :is(.tr-seekers-project, .trap-studio-booking):has(> :is(h2, h3)) {
	border-inline-start-width: 0;
}

/* The dance schedule sits beneath the section title in the single-column layout. */
@media (max-width: 650px) {
	body.trap-site .trap-dance__layout > .section-heading + .trap-dance__schedule {
		border-inline-start-width: 0;
	}
}

/* The old partner testimonial uses two headings for one quotation. Its
   attribution carries the section mark in place of the extra WPBakery rule. */
body.trap-site .partner_quote:has(h4:last-child) + .gap:has(+ .vc_separator_no_text),
body.trap-site .partner_quote:has(h4:last-child) + .gap + .vc_separator_no_text {
	display: none;
}
