/* Languages (Nov 2026): fonts and line breaking for scripts the brand font (Montserrat) has no letters for.
   Montserrat stays first so Latin letters and numbers keep the brand look; the browser takes each Chinese,
   Japanese, Korean or Arabic character from the next font in the list that has it, instead of a random
   (often serif) default. Loaded by template/header.php for every language except English. */
html:lang(zh) {
    --hv2-font: "Montserrat", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", system-ui, sans-serif;
}
html:lang(ja) {
    --hv2-font: "Montserrat", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "YuGothic", "Meiryo", "Noto Sans JP", system-ui, sans-serif;
}
html:lang(ko) {
    --hv2-font: "Montserrat", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
}
html:lang(ar) {
    --hv2-font: "Montserrat", "Segoe UI", "Geeza Pro", "Noto Sans Arabic", Tahoma, system-ui, sans-serif;
}
html:lang(zh) body, html:lang(ja) body, html:lang(ko) body, html:lang(ar) body {
    font-family: var(--hv2-font);
}
/* Korean breaks lines between words, not inside them; Chinese and Japanese may break anywhere. */
html:lang(ko) body {
    word-break: keep-all;
    overflow-wrap: anywhere;
}
/* Header on laptops (1200-1599px): Spanish, French, German ... menu words are longer than English, so Sign Up and
   Cart were pushed off a 1366px screen (DEV, 25 Nov 2026). A little smaller menu text, long menu words on two lines,
   tighter gaps, and Sign In as its icon (its word stays readable to screen readers); English is unchanged. */
@media (min-width: 1200px) and (max-width: 1599px) {
    html:not(:lang(en)) .hv2-nav__list { gap: 14px; }
    html:not(:lang(en)) .hv2-nav__link { font-size: 14.5px; white-space: normal; max-width: 8.6em; line-height: 1.15; text-align: center; }
    html:not(:lang(en)) .hv2-header__row { gap: 12px; }
    html:not(:lang(en)) .hv2-header__actions { gap: 10px; }
    html:not(:lang(en)) .hv2-login { position: relative; }
    html:not(:lang(en)) .hv2-login span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
    html:not(:lang(en)) .hv2-signup { padding-left: 16px; padding-right: 16px; }
    html:not(:lang(en)) .hv2-cart { padding: 0 16px; }
}

/* Right-to-left (Arabic): the skip link sat at left:-9999px, which in a right-to-left page is 10,000px of sideways
   scroll, so computers showed a blank first screen (DEV, 25 Nov 2026). Hide it in a way that works both directions. */
html[dir="rtl"] .skip-to-main:not(:focus) {
    left: auto; right: 0; width: 1px; height: 1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
html[dir="rtl"] .skip-to-main:focus { left: auto; right: 10px; }
/* the language list opens under the globe on the other side */
html[dir="rtl"] .hv2-mega--lang { right: auto; left: 0; }
/* Right-to-left: the "go on" arrows in buttons ($arrow in home.php, study_results.php, pv3_sections.php) point left. */
html[dir="rtl"] svg:has(> path[d="M1 6h15M11 1l5 5-5 5"]),
html[dir="rtl"] svg:has(> path[d="M3 10h13M11 4.5l5.5 5.5-5.5 5.5"]),
html[dir="rtl"] svg.pv3-arr {
    transform: scaleX(-1);
}
/* Phones (under 600px): "Warenkorb", "Winkelwagen", "Panier" ... pushed the menu button off the screen, and
   CJK cart words broke onto two lines (DEV, 25 Nov 2026). Other languages show the cart icon and item count only;
   the word stays readable to screen readers. English keeps Steven's "Cart" label. */
@media (max-width: 599px) {
    html:not(:lang(en)) .hv2-cart > span:not(.hv2-cart__count) {
        display: inline; position: absolute; width: 1px; height: 1px; overflow: hidden;
        clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
    }
}
