/* Five languages, one layout (2026-10-23). Text that is longer in one language must not push
   buttons, tabs and titles out of shape. Site-wide; loaded after pages-next.css, before mobile.css. */

/* Korean wraps at spaces, not inside a word (the browser default splits Hangul anywhere). */
html[lang="ko"] body{word-break:keep-all;overflow-wrap:break-word}
/* Japanese and Chinese: no line may start with closing punctuation or small kana. */
html[lang="ja"] body,html[lang^="zh"] body{line-break:strict}

/* Headings break into even lines instead of leaving one word alone on the last line. */
h1,h2,h3,.hx-title,.hn-title,.hb-pillar h3{text-wrap:balance}
p,li,figcaption,summary{text-wrap:pretty}

/* Short labels stay on one line in every language. */
.topbar nav a,.top-link,.button,.hx-pill,.hx-dock-btn,.tabs button,.guide-section-nav a,
.update-ver,.update-latest,.hn-state,.nx-status,.nx-ver,.hb-next-tag,.hx-eyebrow span,.hx-tags span,
.community-actions .button,.copy-actions .button,.start-number,.qa-topics a,.qa-topics button{white-space:nowrap}
.button,.hx-pill{max-width:100%;overflow:hidden;text-overflow:ellipsis}
/* Code tool copy buttons: three in a row while they fit, then the row wraps (never a cut label). */
#tool .copy-actions{display:flex!important;flex-wrap:wrap;gap:8px}
#tool .copy-actions .button{flex:1 1 auto;min-width:max-content}
/* Q&A tool illustrations: a row of buttons wraps button by button, never inside a label. */
:is(#guide-beginner,#guide-general) .qa-drawing .u-row .u-btn:not(.fixed){flex:1 1 auto;min-width:max-content;white-space:nowrap}

@media (max-width:720px){
  /* Top navigation: each label takes its own width; the row scrolls sideways only if it cannot fit. */
  .topbar nav{display:flex!important;grid-template-columns:none!important;justify-content:space-between;gap:6px;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}
  .topbar nav::-webkit-scrollbar{display:none}
  .topbar nav a{flex:0 0 auto;padding-inline:4px}
  html[lang="ja"] .topbar nav a,html[lang^="zh"] .topbar nav a{font-size:11.5px;letter-spacing:-.01em}
  /* Home detail picker: the previous/next buttons sat in fixed 44px columns, narrower than
     "← 이전" or "← Previous". Columns follow the buttons instead. */
  #home .detail-picker-head{grid-template-columns:auto minmax(0,1fr) auto!important;column-gap:8px}
  #home .detail-navigation .button{min-width:max-content;padding-inline:12px}
  /* Buttons in a row may wrap to the next row as a whole, never inside their label. */
  .hx-actions,.community-actions,.copy-actions{flex-wrap:wrap}
  /* Q&A tables: the value column keeps one line on wide screens only (English and Japanese ran past the edge). */
  #guide-general .qa-budget td:last-child{white-space:normal}
}
