/* Hawk Ai — language switcher. Uses the design-system tokens only. */
.i18n-host { display: inline-flex; }
.i18n-switch { position: relative; display: inline-flex; font-family: var(--font-body); }

.i18n-btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper); color: var(--text-2);
  font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.i18n-btn:hover { background: var(--paper-2); color: var(--text); border-color: var(--line-strong); }
.i18n-btn svg { width: 14px; height: 14px; opacity: .6; transition: transform .2s; }
.i18n-switch.open .i18n-btn svg { transform: rotate(180deg); }
.i18n-switch.open .i18n-btn { border-color: var(--brand); color: var(--text); }
.i18n-flag { font-size: 1rem; line-height: 1; }
.i18n-name { max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.i18n-switch.compact .i18n-btn { height: 34px; padding: 0 8px; gap: 5px; }

.i18n-menu {
  /* right-aligned by default: these switchers sit at the right edge of a bar,
     and a left-aligned menu pushes the document's scrollWidth past the viewport. */
  position: absolute; top: calc(100% + 8px); right: 0; left: auto; z-index: 200;
  min-width: 232px; max-height: min(60vh, 460px); overflow: auto;
  padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-l);
  background: var(--paper); box-shadow: var(--shadow-l);
  opacity: 0; transform: translateY(-6px); pointer-events: none;
  transition: opacity .16s ease, transform .18s ease;
}
.i18n-switch.start .i18n-menu { left: 0; right: auto; }
.i18n-switch.up .i18n-menu { top: auto; bottom: calc(100% + 8px); transform: translateY(6px); }
.i18n-switch.open .i18n-menu { opacity: 1; transform: none; pointer-events: auto; }

.i18n-opt {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: var(--radius-s);
  background: none; color: var(--text); font: inherit; font-size: .88rem;
  text-align: start; cursor: pointer;
}
.i18n-opt:hover { background: var(--paper-2); }
.i18n-opt.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.i18n-opt .i18n-en { margin-inline-start: auto; font-size: .72rem; color: var(--text-3); font-weight: 500; }
.i18n-opt.on .i18n-en { color: var(--brand-ink); opacity: .75; }

/* on dark ink surfaces (app topbar in dark theme, footer of the landing page) */
.footer-bottom .i18n-btn,
.card-ink .i18n-btn, .ink-section .i18n-btn {
  background: transparent; border-color: var(--ink-line); color: var(--ink-text-2);
}
.footer-bottom .i18n-btn:hover,
.card-ink .i18n-btn:hover, .ink-section .i18n-btn:hover { background: rgba(255,255,255,.06); color: var(--ink-text); }
.footer-bottom .i18n-switch { vertical-align: middle; }
.footer-bottom .i18n-btn { height: 30px; font-size: .8rem; }

@media (max-width: 640px) {
  .i18n-name { display: none; }
  .i18n-menu { min-width: 200px; }
}

/* ---------------------------------------------------------------------------
   Script-aware typography. The display face is tuned for Latin: CJK and Thai
   need phrase-aware line breaking, or headings snap mid-word ("プロフィ / ール").
   -------------------------------------------------------------------------- */
html[data-lang="ja"] :is(h1, h2, h3, h4, .display, .display-xl, .kpi-label, .lead),
html[data-lang="zh"] :is(h1, h2, h3, h4, .display, .display-xl, .kpi-label, .lead),
html[data-lang="ko"] :is(h1, h2, h3, h4, .display, .display-xl, .kpi-label, .lead) {
  word-break: auto-phrase;
  line-break: strict;
  overflow-wrap: normal;
}
html[data-lang="th"] :is(h1, h2, h3, h4, .display, .display-xl, .lead) {
  line-break: loose;
  word-break: normal;
}
/* CJK sets no tighter than the Latin display face wants to be */
html[data-lang="ja"] :is(.display, .display-xl, h1),
html[data-lang="zh"] :is(.display, .display-xl, h1),
html[data-lang="ko"] :is(.display, .display-xl, h1) { letter-spacing: -.01em; }
/* Devanagari and Thai need a little more leading than a Latin cap height */
html[data-lang="hi"] :is(h1, h2, .display, .display-xl),
html[data-lang="th"] :is(h1, h2, .display, .display-xl) { line-height: 1.25; }
