/* Tilted Headings — values come from :root custom properties set in the Customizer. */

/* While measuring: the same side padding as the final boxes, cloned onto every line,
   so the browser wraps the words with that padding already taken into account. */
.th-measure {
	padding-left: calc(var(--th-pad-x, 0.4em) + var(--th-bw-left, 0px));
	padding-right: calc(var(--th-pad-x, 0.4em) + var(--th-bw-right, 0px));
	-webkit-box-decoration-break: clone;
	box-decoration-break: clone;
}

.th-split {
	isolation: isolate;
}

.th-split > .th-line {
	display: block;
	position: relative;
	width: -moz-fit-content;
	width: fit-content;
	max-width: 100%;
	box-sizing: border-box;
	margin: 0 0 var(--th-gap, 0.3em);
	padding: var(--th-pad-y, 0.1em) var(--th-pad-x, 0.4em);
	color: var(--th-text, inherit);
}

.th-split > .th-line:last-child {
	margin-bottom: 0;
}

/* Follow the heading's own alignment. */
.th-split[data-th-align="center"] > .th-line {
	margin-left: auto;
	margin-right: auto;
}
.th-split[data-th-align="right"] > .th-line {
	margin-left: auto;
}

/* The background and border live on a pseudo-element so they can tilt on their own. */
.th-split > .th-line::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	box-sizing: border-box;
	background: var(--th-bg, transparent);
	border-style: var(--th-border-style, solid);
	border-color: var(--th-border-color, currentColor);
	border-width: var(--th-bw-top, 0px) var(--th-bw-right, 0px) var(--th-bw-bottom, 0px) var(--th-bw-left, 0px);
	border-radius: var(--th-radius, 0px);
	transform: rotate(var(--th-angle, 0deg));
	pointer-events: none;
}

/* "Tilt the text too": rotate the whole line instead of just its box. */
.th-rotate-text .th-split > .th-line {
	transform: rotate(var(--th-angle, 0deg));
}
.th-rotate-text .th-split > .th-line::before {
	transform: none;
}

@media print {
	.th-split > .th-line,
	.th-split > .th-line::before {
		transform: none !important;
	}
}
