/* Language picker: a flag and the language's own name in the navbar, opening
   a list of every edition of the current page. Shared by every page, so the
   privacy policy, which has its own small stylesheet, carries it too. The
   summary keeps the browser's own disclosure triangle, which turns when the
   panel opens, and the panel hangs from the bar rather than the summary, the
   same pattern as the nfcmint.com family header. Great Circle Map's file,
   whose skeleton this site shares; the fallbacks are Bin Blitz's own tokens from
   css/style.css, since the privacy page defines no --raised. The Chinese,
   Japanese and Korean editions' rules close the file, measured against the
   tagline rule in css/style.css with the editions' own text. */
.lang {
  position: static;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  flex: none;
}
.lang > summary {
  display: list-item;
  list-style-position: inside;
  width: fit-content;
  min-height: 44px;
  padding: 12px 2px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  line-height: 20px;
  color: var(--muted, #B8AFC2);
  white-space: nowrap;
}
.lang > summary::after { content: none; }
.lang[open] > summary, .lang > summary:hover { color: var(--accent, #F2B93B); }
.lang-current {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
  vertical-align: top;
}
.lang-flag {
  display: inline-flex;
  flex: none;
  width: 20px;
  height: 14px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.lang-flag svg { display: block; width: 100%; height: 100%; }
.lang-panel {
  position: absolute;
  z-index: 120;
  top: 100%;
  right: 0;
  width: 220px;
  max-width: 100%;
  padding: 8px;
  background: var(--raised, #1E1A24);
  border: 1px solid var(--line, #3A3344);
  border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}
.lang-panel > nav { display: grid; }
.lang-panel a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line, #3A3344);
  color: var(--text, #F6F0E2);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
}
.lang-panel a:last-child { border-bottom: 0; }
.lang-panel a:hover { color: var(--accent, #F2B93B); text-decoration: none; }
.lang-panel a[aria-current] {
  border-left: 3px solid var(--accent, #F2B93B);
  padding-left: 5px;
  font-weight: 700;
}

/* The privacy policy has no navbar; a slim bar holds the way back and the
   picker. The bar is the panel's anchor there. */
.lang-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 20px 0;
}
.lang-bar .lang-home {
  font-weight: 600;
  font-size: 14px;
  color: var(--accent, #F2B93B);
  text-decoration: none;
}
.lang-bar .lang-home:hover { text-decoration: underline; }

/* In the navbar the picker sits after the links; translated labels run
   long, so the brand never wraps and the links keep tight padding. The
   nav-wrap is positioned, so the panel lines up with the bar's right edge. */
.navbar .lang { margin-left: 12px; }
.navbar .nav-brand { white-space: nowrap; }
.navbar .lang-panel { right: 20px; }

@media (max-width: 800px) {
  .navbar .nav-brand { order: 0; }
  .navbar .lang { order: 1; margin-left: auto; margin-right: 12px; }
  .navbar .nav-toggler { order: 2; }
}

/* Phones: the flag and the triangle alone, the name stays for readers. */
@media (max-width: 480px) {
  .navbar .lang { margin-right: 8px; }
  .lang-name {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
}

/* Chinese, Japanese and Korean editions, after Borax's and The Poker
   Calculator's. Chinese and Japanese break lines by the strict rules, so
   small kana and closing punctuation never start a line, and Japanese
   headings break between phrases. Japanese body text keeps the strict rule
   alone and fills its lines, as Japanese text is set: broken by phrases,
   the hero paragraph ran ragged and split 分別 after Tetris. Korean keeps
   its words whole and breaks at the spaces; without it the tagline broke
   inside a word at every two-line width. The Chinese tagline breaks only
   at its space, after Arman, where it otherwise broke inside the phrase
   after it.
   The display serif has no CJK characters, so the system's serif supplies
   them, and those fill the whole em square: the section titles step down
   a size, a tenth under the English at each width as on the sibling sites
   (42, 36, 31 and 28 px become 38, 32, 28 and 25), and the tagline a fifth,
   so its characters stand about as tall as the English capitals (56, 48,
   46, 44, 36 and 32 px become 45, 38, 37, 35, 29 and 26). Both drop the
   English negative tracking, which crowds those characters. Measured in
   headless Chrome from 320 to 1440 points wide: every tagline holds one or
   two lines inside its column, as the English does, and no section title
   takes more lines than the English's two. */
html:lang(ja),
html:lang(zh) { line-break: strict; }
html:lang(ko) { word-break: keep-all; overflow-wrap: break-word; }
:lang(zh) .tagline { word-break: keep-all; }
:lang(ja) .section-title,
:lang(ja) .tagline,
:lang(ja) .card h3 { word-break: auto-phrase; }
:lang(ja) .home .section-title,
:lang(zh) .home .section-title,
:lang(ko) .home .section-title { font-size: 38px; letter-spacing: 0; }
:lang(ja) .tagline,
:lang(zh) .tagline,
:lang(ko) .tagline { font-size: 45px; letter-spacing: 0; }
/* AppleMyungjo, the Korean serif on Apple devices, sets loose at display
   size, so Korean headings keep a slight negative tracking, as on Borax's
   site; compared at 0, -0.02 and -0.04 em on the tagline and the titles. */
:lang(ko) .home .section-title,
:lang(ko) .tagline { letter-spacing: -0.04em; }

@media (max-width: 960px) {
  :lang(ja) .tagline,
  :lang(zh) .tagline,
  :lang(ko) .tagline { font-size: 38px; }
}

@media (max-width: 760px) {
  :lang(ja) .home .section-title,
  :lang(zh) .home .section-title,
  :lang(ko) .home .section-title { font-size: 32px; }
  :lang(ja) .tagline,
  :lang(zh) .tagline,
  :lang(ko) .tagline { font-size: 35px; }
}

@media (min-width: 761px) and (max-height: 800px) {
  :lang(ja) .tagline,
  :lang(zh) .tagline,
  :lang(ko) .tagline { font-size: 37px; }
}

@media (max-width: 480px) {
  :lang(ja) .home .section-title,
  :lang(zh) .home .section-title,
  :lang(ko) .home .section-title { font-size: 28px; }
  :lang(ja) .tagline,
  :lang(zh) .tagline,
  :lang(ko) .tagline { font-size: 29px; }
}

@media (max-width: 360px) {
  :lang(ja) .home .section-title,
  :lang(zh) .home .section-title,
  :lang(ko) .home .section-title { font-size: 25px; }
  :lang(ja) .tagline,
  :lang(zh) .tagline,
  :lang(ko) .tagline { font-size: 26px; }
}
