/* Per-language typography. Loaded last so it wins over the element and
   single-class rules in the other stylesheets.

   Every font stack in this app is Latin-only -- Verdana, Arial, Helvetica,
   sans-serif -- so CJK text is drawn by whatever the browser falls back to for
   characters none of those carry. That fallback is the viewer's machine, not
   ours: Han renders on most systems, Hangul does not, which is why Korean came
   out as empty squares while Chinese and Japanese looked fine.

   So Korean names real Korean families and, for a viewer who has none of them,
   a webfont. Japanese and Chinese are deliberately left alone -- they render
   correctly today and this is not the change to alter how they look. */

html[lang="ko"] body,
html[lang="ko"] td,   html[lang="ko"] th,
html[lang="ko"] p,    html[lang="ko"] li,     html[lang="ko"] dt,
html[lang="ko"] dd,   html[lang="ko"] div,    html[lang="ko"] span,
html[lang="ko"] a,    html[lang="ko"] label,  html[lang="ko"] legend,
html[lang="ko"] h1,   html[lang="ko"] h2,     html[lang="ko"] h3,
html[lang="ko"] h4,   html[lang="ko"] h5,     html[lang="ko"] h6,
html[lang="ko"] input, html[lang="ko"] select,
html[lang="ko"] textarea, html[lang="ko"] button {
  font-family: "Apple SD Gothic Neo",  /* macOS, iOS */
               "Malgun Gothic",        /* Windows */
               "Noto Sans KR",         /* the webfont below, and most Linux */
               "Nanum Gothic",
               sans-serif;
}

/* Korean is alphabetic and word-spaced, unlike Chinese and Japanese, so the
   browser's default of breaking anywhere splits words down the middle.
   keep-all breaks at spaces, as Korean is written. */
html[lang="ko"] body,
html[lang="ko"] td, html[lang="ko"] th, html[lang="ko"] p, html[lang="ko"] li {
  word-break: keep-all;
  line-height: 1.6;
}

/* The rule above is broad enough to catch the monospace panels, which want to
   stay monospace. */
html[lang="ko"] .tc-mono,
html[lang="ko"] pre,
html[lang="ko"] code {
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
}

/* Hangul appearing inside a page that is not itself Korean -- in practice the
   language switcher, which names every language in its own script on every
   page. Without this the Korean name is the only word on an English, Japanese
   or Chinese page that no font in the stack can draw, and it renders as boxes.
   The layout loads a ~5KB subset of Noto Sans KR on those pages for exactly
   these characters. */
[lang="ko"] {
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR",
               "Nanum Gothic", sans-serif;
}
