/* Language switcher and non-Latin type. Loaded after the design's own stylesheet on every page. */

.langsel { position: relative; }

.langsel__sum {
  display: inline-flex; align-items: center; gap: .4em;
  list-style: none; cursor: pointer;
  font: inherit; font-size: .78rem; letter-spacing: .04em;
  padding: .42em .6em; border: 1px solid currentColor; border-radius: 2px;
  opacity: .82;
}
.langsel__sum::-webkit-details-marker { display: none; }
.langsel__sum:hover, .langsel[open] .langsel__sum { opacity: 1; }
.langsel__globe { display: inline-flex; transform: translateY(1px); }
.langsel__cur { white-space: nowrap; }
.langsel__code { display: none; }

.langsel__list {
  position: absolute; z-index: 60; inset-inline-end: 0; top: calc(100% + .45rem);
  margin: 0; padding: .35rem 0; list-style: none; min-width: 11.5rem;
  background: #F3EDE0; color: #2C1B2E;
  border: 1px solid rgba(44, 27, 46, .18);
  box-shadow: 0 18px 40px -20px rgba(44, 27, 46, .55);
}
.langsel__list a {
  display: block; padding: .45rem .9rem; text-decoration: none; color: inherit;
  font-size: .84rem; letter-spacing: .01em; white-space: nowrap;
}
.langsel__list a:hover { background: rgba(44, 27, 46, .07); }
.langsel__list a[aria-current="true"] { font-weight: 700; }
.langsel__list a[aria-current="true"]::after { content: " ✓"; }

/* Narrow screens: the native name eats the action cluster, so the summary shows the globe and the language's
   own short form while the full name stays in the accessible name (visually hidden, not display:none) and
   in the open list. The panel then hangs off the header rather than off the summary, so it can never run
   off the edge of a phone screen. */
@media (max-width: 767px) {
  .langsel { position: static; }
  .langsel__sum { min-height: 2.75rem; padding: .3em .5em; gap: .3em; font-size: .72rem; }
  .langsel__cur { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .langsel__code { display: inline; }
  .langsel__list { inset-inline: auto 1rem; top: calc(100% + .3rem); min-width: 0; max-width: calc(100vw - 2rem); }
  .langsel__list a { white-space: normal; }
}

/* Non-Latin scripts: the display faces are Latin-only, so give each script a stack that
   renders at the same weight and rhythm instead of falling through to an arbitrary serif. */
html:lang(zh-Hant) :is(body, h1, h2, h3, h4, h5, h6, .hdr__nav a, .btn) {
  font-family: "PingFang TC", "Noto Sans TC", "Source Han Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}
html:lang(ko) :is(body, h1, h2, h3, h4, h5, h6, .hdr__nav a, .btn) {
  font-family: "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
}
html:lang(ar) :is(body, h1, h2, h3, h4, h5, h6, .hdr__nav a, .btn),
html:lang(fa) :is(body, h1, h2, h3, h4, h5, h6, .hdr__nav a, .btn) {
  font-family: "Geeza Pro", "Noto Naskh Arabic", "Noto Sans Arabic", "Tahoma", system-ui, sans-serif;
  letter-spacing: 0;
}
html:lang(hy) :is(body, h1, h2, h3, h4, h5, h6, .hdr__nav a, .btn) {
  font-family: "Noto Sans Armenian", "Mshtakan", "DejaVu Sans", system-ui, sans-serif;
}

/* Right-to-left. Direction and glyph shaping come from the dir attribute, and a.css is written in logical
   properties, so the layout mirrors on its own; what follows is only what logical properties cannot express. */
/* No list indentation to mirror: a.css resets every list (margin 0, padding 0, no markers), so a
   padding-inline-start here only pushed the trio and board grids 1.2em in from the edge in RTL,
   out of line with the headings above them. Lists in this design carry no markers to sit on a start edge. */

/* Directional glyphs and motion. The link's arrow points the way the text reads, so it is mirrored, and every
   hover nudge moves toward the end of the line (left in RTL). The underline wipe retracts toward the end edge
   instead of the right one. The external-link mark stays as it is: an up-right arrow is the outbound convention
   in every script, and mirroring it would point up-left, so only its nudge flips. */
[dir="rtl"] .link::after { transform: scaleX(-1); }
[dir="rtl"] .link:hover::after { transform: scaleX(-1) translateX(.3rem); }
[dir="rtl"] .link:hover { background-position: 0 100%; }
[dir="rtl"] a:hover .ext { transform: translate(-.15em, -.15em); }
[dir="rtl"] .cat__sum:hover .cat__t { transform: translateX(-.35rem); }
/* the nav underline grows from the start edge and retracts toward the end, as in English */
[dir="rtl"] .hdr__nav a::after { transform-origin: left; }
[dir="rtl"] .hdr__nav a:hover::after, [dir="rtl"] .hdr__nav a[aria-current="page"]::after { transform-origin: right; }

/* Bidi isolates around the Latin runs in the translated board names leave no break opportunity, so on the
   narrowest phones the board's 1fr tracks grow to the min-content of the longest name and push past the
   viewport edge. Below 360px let those strings break rather than bulge (anywhere also feeds min-content
   sizing, which is what the tracks need); above it the tracks stay uneven but intact, see lane notes. */
@media (max-width: 359px) {
  [dir="rtl"] .person__name, [dir="rtl"] .person__role, [dir="rtl"] .person__org { overflow-wrap: anywhere; }
}
/* No flex reversal: a row already lays its items right-to-left under dir="rtl", so row-reverse would put the
   primary button back on the left. Kept as a note so nobody adds it again. */
