/**
 * Blanky Nordic — Japanese typography.
 *
 * Applies to :lang(ja) only, so a multilingual page gets the right treatment
 * on each language. Font families (the Japanese fallback) are not touched.
 *
 * Selectors are written `.x:lang(ja)`, not `:lang(ja) .x`: the first also
 * matches when the lang attribute is on the element itself, such as one
 * Japanese post title inside an English list.
 *
 * Corrects the things that break when this Latin editorial design meets
 * Japanese text:
 *   1. faux italic — there is no Japanese italic; the browser slants the glyphs
 *   2. tracking — 0.2em spacing splits Japanese words apart
 *   3. heading line spacing — 1.3 is tight for Japanese glyphs
 *
 * @package Blanky_Nordic
 * @since   3.5.0
 */

:lang(ja) {
	font-feature-settings: "palt" 1;
	line-break: strict;
	overflow-wrap: anywhere;
	word-break: normal;
}

/* Running text reads more evenly without proportional metrics. */
p:lang(ja),
li:lang(ja),
dd:lang(ja),
blockquote:lang(ja) {
	font-feature-settings: normal;
}

/* 1. No faux italic. The links inside titles are listed too: they carry their own style. */
:is(
	.nordic-wordmark--compact,
	.nordic-intro__title,
	.nordic-card__title,
	.nordic-card__title a,
	.nordic-entry__title,
	.nordic-entry__content .wp-block-quote,
	.nordic-author-box__name,
	.nordic-author-box__name a,
	.nordic-post-nav .post-navigation-link__title,
	.nordic-related__title,
	.nordic-sidebar__title,
	.nordic-comments .wp-block-comments-title,
	.nordic-comments .comment-reply-title,
	.nordic-footer__title,
	.nordic-page__title
):lang(ja) {
	font-style: normal;
}

/* 2. Tighter tracking on uppercase-style labels, which do not uppercase in Japanese. */
:is(.nordic-label, .nordic-nav, .nordic-entry__tags .wp-block-post-terms__prefix, .nordic-post-nav .post-navigation-link__label):lang(ja) {
	letter-spacing: 0.08em;
}

/* 3. Headings: a little more line spacing and tracking. */
:is(.nordic-intro__title, .nordic-card__title, .nordic-entry__title, .nordic-page__title):lang(ja) {
	letter-spacing: 0.04em;
	line-height: 1.45;
}

.nordic-masthead .nordic-wordmark:lang(ja) {
	letter-spacing: 0.02em;
}
