/* Language menu, and the per-script type fixes the translated pages need.
   Loaded after styles.css; on the English page only the menu rules apply. */
/* The language menu is a nav item like the others; its list opens in the same paper panel as the phone menu. */
.lang-toggle{position:relative;display:inline-flex;align-items:center;margin:0;padding:9px 0;border:0;background:none;color:inherit;font-size:10px;letter-spacing:.15em;text-transform:uppercase;cursor:pointer}
.lang-toggle span{position:relative}
.lang-toggle span:after{content:"";position:absolute;right:100%;bottom:-6px;left:0;height:1px;background:var(--rose);transition:right .3s}
.lang-toggle:hover span:after,.lang-toggle:focus-visible span:after,.lang-toggle[aria-expanded="true"] span:after{right:0}
.lang-toggle:after{content:"";display:inline-block;width:4px;height:4px;margin:0 0 2px 9px;border-right:1px solid var(--gold);border-bottom:1px solid var(--gold);transform:rotate(45deg);transition:transform .3s}
.lang-toggle[aria-expanded="true"]:after{margin-bottom:-1px;transform:rotate(-135deg)}
.lang-list[hidden]{display:none}
/* Desktop: a small dropdown under the switch, 10px below the header, on solid paper.
   A short list on top (this page, the browser's language, English), a hairline, then the rest scrolls. */
.lang-list{position:absolute;z-index:2;top:calc(100% + 10px);right:-1px;width:236px;padding:8px 22px 10px;background:#fbf8f7;border:1px solid var(--line);box-shadow:0 22px 50px rgba(23,22,27,.14)}
.lang-top{padding-bottom:6px;border-bottom:1px solid var(--line)}
.lang-rest{max-height:240px;margin:0 -22px;padding:6px 22px 0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:rgba(25,23,28,.18) transparent}
.lang-list a{display:block}
.desktop-nav .lang-list a{padding:9px 0;font:400 15px/1.2 var(--serif);letter-spacing:0;text-transform:none;transition:color .2s}
.desktop-nav .lang-list a:after{display:none}
.lang-list a:hover,.lang-list a:focus-visible,.lang-list a[aria-current="true"]{color:var(--rose)}
@media(max-width:900px){
  .mobile-nav{max-height:calc(100vh - 92px);max-height:calc(100dvh - 92px);overflow-y:auto;overscroll-behavior:contain}
  .mobile-nav:has(.lang-list:not([hidden])){background:#fbf8f7}
  .lang-menu--mobile .lang-toggle{width:100%;justify-content:flex-start;padding:26px 0 10px;font-size:9px}
  .lang-menu--mobile .lang-toggle span:after{display:none}
  .lang-menu--mobile .lang-list{position:static;width:auto;padding:0;background:none;border:0;box-shadow:none}
  .lang-menu--mobile .lang-rest{max-height:280px;margin:0;padding:6px 0 0}
  .mobile-nav .lang-list a{padding:10px 0;border:0;font:400 18px/1.2 var(--serif)}
}

/* Words that follow the name in the greeting use the welcome face at a smaller size. */
.hero-name-tail{margin-left:.12em;font:400 .5em/1 var(--serif);letter-spacing:0;color:var(--rose-dark)}

/* Long words in the large headings break and hyphenate instead of overflowing. */
html:not(:lang(en)) :is(h1,h2,h3,.venture-meta p,.art-caption,.world-index-label,.closing-meta,.site-footer span){overflow-wrap:break-word;-webkit-hyphens:auto;hyphens:auto;hyphenate-limit-chars:12 5 5}
/* The name and the short word that follows it (Japanese です, Hindi हूँ) stay on one line. */
html:not(:lang(en)) .hero-name{white-space:nowrap}
/* Japanese and Chinese break headings between phrases, not inside a word, where the browser can. */
html:is(:lang(ja),:lang(zh)) :is(h1,h2,h3,.hero-welcome,.perception-lens span,.closing-note){word-break:auto-phrase}
html:lang(ko) :is(h1,h2,h3,p,.hero-welcome,.perception-lens span){word-break:keep-all}

/* Fonts for scripts the Latin stack does not cover. Latin names keep the original faces. */
:root:lang(ja){--serif:"Iowan Old Style","Hiragino Mincho ProN","Yu Mincho","Noto Serif JP",serif;--sans:"Helvetica Neue","Hiragino Sans","Hiragino Kaku Gothic ProN","Yu Gothic","Noto Sans JP",sans-serif}
:root:lang(ko){--serif:"Iowan Old Style","AppleMyungjo","Nanum Myeongjo","Noto Serif KR",serif;--sans:"Helvetica Neue","Apple SD Gothic Neo","Malgun Gothic","Noto Sans KR",sans-serif}
:root:lang(zh-Hans){--serif:"Iowan Old Style","Songti SC","STSong","Noto Serif SC","SimSun",serif;--sans:"Helvetica Neue","PingFang SC","Microsoft YaHei","Noto Sans SC",sans-serif}
:root:lang(zh-Hant){--serif:"Iowan Old Style","Songti TC","Noto Serif TC","PMingLiU",serif;--sans:"Helvetica Neue","PingFang TC","Microsoft JhengHei","Noto Sans TC",sans-serif}
:root:lang(th){--serif:"Iowan Old Style","Thonburi","Noto Serif Thai","Leelawadee UI",serif;--sans:"Helvetica Neue","Thonburi","Noto Sans Thai","Leelawadee UI",sans-serif}
:root:lang(hi){--serif:"Iowan Old Style","Kohinoor Devanagari","Devanagari Sangam MN","Noto Serif Devanagari","Nirmala UI",serif;--sans:"Helvetica Neue","Kohinoor Devanagari","Noto Sans Devanagari","Nirmala UI",sans-serif}
:root:lang(bn){--serif:"Iowan Old Style","Kohinoor Bangla","Bangla Sangam MN","Noto Serif Bengali","Nirmala UI",serif;--sans:"Helvetica Neue","Kohinoor Bangla","Noto Sans Bengali","Nirmala UI",sans-serif}

/* These scripts have no italics and break under tight negative tracking. */
html:is(:lang(ja),:lang(ko),:lang(zh),:lang(th),:lang(hi),:lang(bn)) :is(em,.hero-welcome,.perception-lens,.perception-lens span,.practice-kicker,blockquote){font-style:normal}
html:is(:lang(ja),:lang(ko),:lang(zh),:lang(th),:lang(hi),:lang(bn)) :is(h1,h2,h3,.hero-welcome,.hero-hello,.practice-kicker,.constellation-word,.perception-word,.perception-lens){letter-spacing:0}
html:is(:lang(th),:lang(hi),:lang(bn)) *{letter-spacing:0!important}

/* Taller lines where marks sit above and below the letters (and for full height CJK glyphs). */
html:is(:lang(ja),:lang(ko),:lang(zh)) :is(.hero h1,.practice h2,.venture h3,.about h2,.closing h2){line-height:1.16}
html:is(:lang(th),:lang(hi),:lang(bn)) :is(.hero h1,.practice h2,.venture h3,.about h2,.closing h2){line-height:1.32}
html:is(:lang(th),:lang(hi),:lang(bn)) :is(.constellation-word,.perception-lens span){line-height:1.35}
html:lang(vi) :is(.hero h1,.practice h2,.venture h3,.about h2,.closing h2){line-height:1.12}
/* Thai floating words are longer; let them wrap onto two lines inside the graphic. */
html:lang(th) .constellation-word{max-width:110px}
