/* Use one scale for the public article and the two WordPress editing canvases. */
:is(#primary article.post > .entry-content, body#tinymce[data-id="content"], .editor-styles-wrapper .is-root-container) {
	--lumo-heading-ink: #332c27;
	--lumo-heading-accent: #b45126;
	--lumo-heading-rule: #d9c6b7;
	--lumo-heading-offset: calc(max(94px, 5.875rem) + var(--wp-admin--admin-bar--height, 0px));
}

:is(#primary article.post > .entry-content, body#tinymce[data-id="content"], .editor-styles-wrapper .is-root-container) :is(h2, h3, h4, h5) {
	box-sizing: border-box;
	max-width: 100%;
	margin-inline: 0;
	padding: 0;
	border: 0 !important;
	background: transparent;
	box-shadow: none;
	color: var(--lumo-heading-ink);
	font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
	font-weight: 700;
	line-height: 1.5;
	letter-spacing: .015em;
	text-align: left;
	text-transform: none;
	text-shadow: none;
	line-break: strict;
	word-break: normal;
	overflow-wrap: anywhere;
	text-wrap: pretty;
	scroll-margin-block-start: var(--lumo-heading-offset);
}

:is(#primary article.post > .entry-content, body#tinymce[data-id="content"], .editor-styles-wrapper .is-root-container) h2 {
	margin-block: clamp(2.25rem, 4vw, 3.25rem) .9rem;
	padding: .1em 0 .1em .55em;
	border-inline-start: 4px solid var(--lumo-heading-accent) !important;
	font-size: clamp(24px, 1.25rem + .65vw, 1.75rem);
}

:is(#primary article.post > .entry-content, body#tinymce[data-id="content"], .editor-styles-wrapper .is-root-container) h3 {
	margin-block: clamp(1.75rem, 3vw, 2.25rem) .7rem;
	padding-block-end: .28em;
	border-block-end: 1px solid var(--lumo-heading-rule) !important;
	font-size: clamp(21px, 1.125rem + .46vw, 1.5rem);
}

:is(#primary article.post > .entry-content, body#tinymce[data-id="content"], .editor-styles-wrapper .is-root-container) h4 {
	margin-block: 1.5rem .45rem;
	color: #773c21;
	font-size: clamp(19px, 1.0625rem + .35vw, 1.3125rem);
}

:is(#primary article.post > .entry-content, body#tinymce[data-id="content"], .editor-styles-wrapper .is-root-container) h5 {
	margin-block: 1.2rem .35rem;
	color: #49413a;
	font-size: clamp(18px, 1rem + .25vw, 1.1875rem);
	font-weight: 600;
}

/* Older posts contain inline font sizes inside otherwise standard headings. */
:is(#primary article.post > .entry-content, body#tinymce[data-id="content"], .editor-styles-wrapper .is-root-container) :is(h2, h3, h4, h5) :is(span, strong)[style*="font-size"] {
	font-size: inherit !important;
}
:is(#primary article.post > .entry-content, body#tinymce[data-id="content"], .editor-styles-wrapper .is-root-container) :is(h2, h3, h4, h5) :is(span, strong)[style*="font-family"] {
	font-family: inherit !important;
}

:is(#primary article.post > .entry-content, body#tinymce[data-id="content"], .editor-styles-wrapper .is-root-container) :is(h2, h3, h4, h5) + :is(h2, h3, h4, h5) {
	margin-block-start: .85rem;
}
:is(#primary article.post > .entry-content, body#tinymce[data-id="content"], .editor-styles-wrapper .is-root-container) > :is(h2, h3, h4, h5):first-child,
:is(#primary article.post > .entry-content, body#tinymce[data-id="content"], .editor-styles-wrapper .is-root-container) li > :is(h2, h3, h4, h5):first-child {
	margin-block-start: 0;
}

/* The table of contents links to a span inside each heading on older posts. */
#primary article.post > .entry-content :is(h2, h3, h4, h5) [id] {
	scroll-margin-block-start: var(--lumo-heading-offset);
}
