/* The language switch on the public website, and what the translated pages need.
   Written by hand, NOT copied from the preview (see public/site-locale.js). The switch is the app's
   own language control (.ch-langs / .ch-lang in packages/ui/styles/source/ch.base.css), drawn with
   the website's --cs-* tokens. */

.site-langs { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.site-langs .ch-langs { display: inline-grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding: 3px; border-radius: 12px; background: var(--cs-soft); }
.site-langs .ch-lang { display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; min-height: 32px; border: 0; border-radius: 9px; background: none; font: 500 12px/16px var(--cs-body, system-ui), system-ui, sans-serif; color: var(--cs-muted); white-space: nowrap; cursor: pointer; transition: color .15s; }
.site-langs .ch-lang:hover { color: var(--cs-ink); }
.site-langs .ch-lang.ch-on { background: var(--cs-paper); color: var(--cs-ink); box-shadow: 0 1px 4px #18283d10; cursor: default; }
.site-langs .ch-lang:focus-visible { outline: 2px solid var(--cs-ink); outline-offset: 1px; }
.site-langs .ch-lang:disabled { cursor: progress; }
.site-langs[aria-busy="true"] .ch-lang:not(.ch-on):not(:disabled) { color: var(--cs-ink); opacity: .7; }
.site-langs-error:empty { display: none; }
.site-langs-error { font-size: 12px; color: var(--cs-negative, #b42318); }
@media (pointer: coarse) { .site-langs .ch-lang { min-height: 44px; } }
@media (prefers-reduced-motion: reduce) { .site-langs .ch-lang { transition: none; } }

/* In the footer's bottom row, after the legal links. */
.footer-bottom { flex-wrap: wrap; align-items: center; gap: 12px 22px; }
.footer-bottom .site-langs { margin-left: auto; }
@media (max-width: 700px) {
  .footer-bottom .site-langs { margin-left: 0; align-self: stretch; }
  .footer-bottom .site-langs .ch-langs { display: grid; grid-auto-flow: row; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .footer-bottom .site-langs .ch-lang { padding: 0 6px; }
}

/* /demo has no footer: the switch is the Website language list in its Examples chooser, drawn as
   the chooser's own rows (opendesign/explorations/homepage-new/demo/demo.css .choice). */
#demo-languages .site-langs { align-items: stretch; }
#demo-languages .site-langs .ch-langs { display: grid; grid-auto-flow: row; grid-auto-columns: auto; gap: 3px; padding: 0; background: none; }
#demo-languages .site-langs .ch-lang { justify-content: flex-start; gap: 12px; min-height: 48px; padding: 9px 12px; border-radius: var(--cs-control-radius, 12px); font: 550 14px/1.35 var(--cs-body, system-ui), system-ui, sans-serif; color: var(--cs-ink); text-align: start; }
#demo-languages .site-langs .ch-lang:hover, #demo-languages .site-langs .ch-lang.ch-on { background: var(--cs-soft); box-shadow: none; }
#demo-languages .site-langs .ch-lang.ch-on::after { content: ""; width: 7px; height: 12px; margin: 0 6px 4px auto; border: solid currentColor; border-width: 0 1.8px 1.8px 0; transform: rotate(45deg); }
#demo-languages .site-langs .ch-lang:focus-visible { outline-offset: -3px; }
#demo-languages .site-langs-error { padding: 0 12px; }

/* Japanese wraps between phrases, as the member sign-in screens do (apps/web AuthFrame), and
   Japanese and Chinese headings lose the Latin display type's tight tracking. */
html:lang(ja) body { word-break: auto-phrase; }
html:lang(ja) :is(h1, h2, h3, h4, .eyebrow), html:lang(zh) :is(h1, h2, h3, h4, .eyebrow) { letter-spacing: 0; }
