/*
 * Japanese typography (design §4.3). Zero specificity via :where().
 */

:where(body) {
	line-break: strict;
	word-break: normal;
	overflow-wrap: anywhere;
	font-kerning: normal;
}

/* Automatic spacing between Japanese and Latin text where the browser supports it. */
@supports (text-autospace: normal) {
	:where(body) {
		text-autospace: normal;
	}
}

/* Hanging punctuation at line starts (progressive enhancement). */
@supports (text-spacing-trim: trim-start) {
	:where(h1, h2, h3, h4, h5, h6) {
		text-spacing-trim: trim-start;
	}
}

/* Headings: proportional kana/punctuation and balanced line breaks. */
:where(h1, h2, h3, h4, h5, h6) {
	font-feature-settings: "palt";
	text-wrap: balance;
	word-break: auto-phrase;
}

:where(p, li, dd, blockquote, figcaption) {
	text-wrap: pretty;
}

/* Code never gets Japanese letter-spacing or proportional glyphs. */
:where(code, kbd, samp, pre) {
	letter-spacing: 0;
	font-feature-settings: normal;
	overflow-wrap: normal;
}

:where(pre) {
	overflow-x: auto;
	white-space: pre;
}

/* Body copy rhythm inside post content. */
:where(.wp-block-post-content) :where(h2) {
	margin-block-start: var(--wp--preset--spacing--xl);
}

:where(.wp-block-post-content) :where(h3, h4) {
	margin-block-start: var(--wp--preset--spacing--l);
}

:where(.wp-block-post-content) :where(ul, ol) {
	padding-inline-start: 1.4em;
}

:where(.wp-block-post-content) :where(li + li) {
	margin-block-start: 0.35em;
}

/* Ruby and emphasis marks. */
:where(rt) {
	font-size: 0.5em;
	letter-spacing: 0;
}

:where(em) {
	font-style: normal;
	text-emphasis: none;
	font-weight: 700;
}

/* Numbers in tables line up. */
:where(table) {
	font-variant-numeric: tabular-nums;
}

/*
 * Left and right space of text blocks (design studio "文字ブロックの左右の余白"): paragraphs,
 * headings, lists and quotes placed in the content area or in a group, all at once.
 * Default 0 (the content width and the screen's side space still apply).
 */
:where(.is-layout-constrained, .is-layout-flow) > :is(p, h1, h2, h3, h4, h5, h6, ul, ol, .wp-block-quote, .wp-block-neco-heading) {
	padding-inline: var(--wp--custom--text--inline, 0px);
}
