/* Hero headline (H1) on the Japanese, Chinese and Thai pages.
   Linked only from the ja-jp, zh-* and th-th locale pages: page-kit/pagekit i18n build adds the <link> inside their
   <!-- i18n:alternates --> block ("script_css" in page-kit/i18n.json). English pages never load it.
   It loads before blog.css / sweatpals.css, so every selector starts with html:lang() to win on specificity.

   Browsers cannot find word boundaries in these scripts: Chinese breaks between any two characters, Thai uses a
   dictionary that splits loanwords (สตูดิ|โอ), and Japanese word-break: auto-phrase (Chrome only) keeps a compound
   such as ダンススタジオ予約システム in one piece, so on a phone it is cut mid-word and widens the hero past the
   screen edge. The H1 translations therefore mark where a line may break with <wbr> (i18n/README.md); the build
   wraps each piece between <wbr>s and spaces in <span class="phrase">, and a piece never breaks. */
html:is(:lang(ja), :lang(zh), :lang(th)) :is(.lp-hero, .hero) h1 .phrase { white-space: nowrap; }

/* An H1 translated without <wbr> still wraps somewhere rather than pushing the hero past the screen edge. */
html:is(:lang(ja), :lang(zh), :lang(th)) :is(.lp-hero, .hero) h1 { overflow-wrap: anywhere; }

/* The article hero (.hero h1, blog.css: 52px, 32px on phones) keeps its own size: at 32px a phone line holds about
   10 characters, so the 8-character pieces fit without the landing-page sizing below. */

/* Japanese and Chinese: about 9 characters per line on phones (100vw - 96px is the hero's text width below
   720px), 64px from tablets up. The longest piece in a translation is 8 characters. */
html:is(:lang(ja), :lang(zh)) .lp-hero h1 {
  font-size: min(64px, calc((100vw - 96px) / 9));
  max-width: 14em;
}

/* Thai: the longest piece is 6.2em, so phones get at most 6.3em per line. */
@media (max-width: 720px) {
  html:lang(th) .lp-hero h1 { font-size: min(46px, calc((100vw - 96px) / 6.3)); }
}
