/* Locale typography for the internal multilingual preview.
 * This layer reaches both the public portal and older member/search shells.
 * Page structure, spacing and media are intentionally unchanged. */
html:is([lang="en"],[lang="es"],[lang="fr"],[lang="de"],[lang="it"],[lang="ro"],[lang="pl"],[lang="nl"],[lang="sv"],[lang="nb"],[lang="da"],[lang="tr"],[lang="pt"]){
  --i18n-serif:"Iowan Old Style","Palatino Linotype","Book Antiqua",Georgia,"Times New Roman",serif;
  --i18n-sans:Inter,"SF Pro Text","Helvetica Neue",Arial,sans-serif;
  --i18n-mono:"SFMono-Regular","IBM Plex Mono","DM Mono",monospace;
}
html:lang(ru){--i18n-serif:Georgia,"Times New Roman",serif;--i18n-sans:Inter,"Helvetica Neue",Arial,sans-serif;--i18n-mono:"SFMono-Regular","IBM Plex Mono","DM Mono",monospace}
html:lang(vi){--i18n-serif:Georgia,"Times New Roman",serif;--i18n-sans:Inter,"SF Pro Text","Helvetica Neue",Arial,sans-serif;--i18n-mono:"SFMono-Regular","IBM Plex Mono","DM Mono",monospace}
html:lang(ja){--i18n-serif:"Yu Mincho","Hiragino Mincho ProN","Noto Serif JP",serif;--i18n-sans:"Hiragino Sans","Yu Gothic","Noto Sans JP",sans-serif;--i18n-mono:"Hiragino Sans","Yu Gothic","Noto Sans JP",sans-serif}
html:lang(ko){--i18n-serif:"Noto Serif KR",AppleMyungjo,Batang,serif;--i18n-sans:"Apple SD Gothic Neo","Noto Sans KR","Malgun Gothic",sans-serif;--i18n-mono:"Apple SD Gothic Neo","Noto Sans KR","Malgun Gothic",sans-serif}
html:lang(hi){--i18n-serif:"Noto Serif Devanagari","Kohinoor Devanagari","Devanagari Sangam MN",serif;--i18n-sans:"Noto Sans Devanagari","Kohinoor Devanagari","Devanagari Sangam MN",sans-serif;--i18n-mono:"Noto Sans Devanagari","Kohinoor Devanagari",sans-serif}
html:is([lang="ar"],[lang="fa"]){--i18n-serif:"Noto Naskh Arabic","Geeza Pro",serif;--i18n-sans:"Noto Sans Arabic","Geeza Pro",Tahoma,Arial,sans-serif;--i18n-mono:"Noto Sans Arabic","Geeza Pro",Tahoma,Arial,sans-serif}
html:lang(he){--i18n-serif:"Noto Serif Hebrew","New Peninim MT","Times New Roman",serif;--i18n-sans:"Noto Sans Hebrew","Arial Hebrew",Arial,sans-serif;--i18n-mono:"Noto Sans Hebrew","Arial Hebrew",Arial,sans-serif}

html:not(:lang(zh-Hans)):not(:lang(zh-Hant)){
  --xm-serif:var(--i18n-serif);
  --xm-sans:var(--i18n-sans);
  --xm-mono:var(--i18n-mono);
  --serif:var(--i18n-serif);
  --sans:var(--i18n-sans);
  --mono:var(--i18n-mono);
}
html:not(:lang(zh-Hans)):not(:lang(zh-Hant)) body{
  font-family:var(--i18n-sans)!important;
  font-kerning:normal;
  font-variant-ligatures:common-ligatures contextual;
}
html:not(:lang(zh-Hans)):not(:lang(zh-Hant)) body :is(h1,h2,h3,h4,h5,h6,blockquote,.member-brand strong){font-family:var(--i18n-serif)!important}
html:not(:lang(zh-Hans)):not(:lang(zh-Hant)) body :is(input,textarea,select,option,button,.dialogue-source-notice){font-family:var(--i18n-sans)!important}
html:is([lang="hi"],[lang="ja"],[lang="ko"],[lang="ar"],[lang="he"],[lang="fa"]) body :is(
  h1,h2,h3,h4,h5,h6,p,li,dt,dd,label,legend,button,a,span,strong,b,small,
  input,textarea,select,option,time,figcaption,blockquote,summary
){
  letter-spacing:normal!important;
  text-transform:none!important;
  font-kerning:normal;
  font-variant-ligatures:common-ligatures contextual;
}
html:is([lang="hi"],[lang="ja"],[lang="ko"],[lang="ar"],[lang="he"],[lang="fa"]) body :is(
  button,input,textarea,select,option,label,
  .team-brand-tagline,.member-kicker,.control-kicker,.admin-kicker,
  .mfa-kicker,.network-date,.academic-kicker,.editorial-kicker,
  .events-kicker,.event-city,.event-meta,.event-source,
  time,figcaption,small,.hero-eyebrow,.footer-rights,
  .corpus-unavailable,.dialogue-number,.dialogue-article-meta span,
  .dialogue-back,.event-brand-label,.call-status,#bookCount,
  #bookLanguageSummary,.civilization-hero-main,.civilization-hero-subtitle
){
  font-family:var(--i18n-sans)!important;
  letter-spacing:normal!important;
  text-transform:none!important;
}
html:lang(ja) body :is(h1,h2,h3,h4,h5,h6,p,li,dd,figcaption,blockquote){line-break:strict;word-break:normal;overflow-wrap:anywhere;hyphens:none}
html:lang(ko) body :is(h1,h2,h3,h4,h5,h6,p,li,dd,figcaption,blockquote){line-break:strict;word-break:keep-all;overflow-wrap:anywhere;hyphens:none}
html:is([lang="hi"],[lang="ar"],[lang="he"],[lang="fa"]) body :is(h1,h2,h3,h4,h5,h6,p,li,dd,figcaption,blockquote){line-break:auto;word-break:normal;overflow-wrap:break-word;hyphens:none}

/* The compact pre-portal account/search shell predates the 23-locale menu.
 * At very narrow widths its translated controls need a second flex line. */
@media(max-width:420px){
  html:not(:lang(zh-Hans)):not(:lang(zh-Hant)) .header-inner{
    padding-inline:12px!important;
    justify-content:center;
  }
  html:not(:lang(zh-Hans)):not(:lang(zh-Hant)) .header-right{
    width:100%;
    min-width:0;
    justify-content:center;
    flex-wrap:wrap;
    gap:6px;
  }
  html:not(:lang(zh-Hans)):not(:lang(zh-Hant)) .header-right>*{max-width:100%}
  html:not(:lang(zh-Hans)):not(:lang(zh-Hant)) :is(.header-right .nav-link,.header-right .user-btn,.header-right .lang-btn){
    white-space:normal;
    text-align:center;
  }
}

/* Narrow-screen overflow guards found by the 21-locale rendered audit. They
 * change wrapping only when translated text or identifiers exceed the box. */
@media(max-width:640px){
  html:not(:lang(zh-Hans)):not(:lang(zh-Hant)) .member-card h1{
    min-inline-size:0;
    max-inline-size:100%;
    overflow-wrap:anywhere;
    word-break:normal;
  }
  html:lang(tr) .cosmos-title{
    font-size:15vw!important;
  }
  /* A single-column grid written as `1fr` still has an automatic min-content
   * floor. Korean publication names can exceed that floor at 320px. */
  html:not(:lang(zh-Hans)):not(:lang(zh-Hant)) body.reception-page .academic-grid{
    min-inline-size:0;
    max-inline-size:100%;
    grid-template-columns:minmax(0,1fr)!important;
  }
  html:not(:lang(zh-Hans)):not(:lang(zh-Hant)) body.reception-page .academic-card{
    min-inline-size:0;
    max-inline-size:100%;
  }
}

body.book-detail-page .book-detail-edition-grid{
  min-inline-size:0;
  max-inline-size:100%;
  grid-template-columns:minmax(0,1fr);
}
body.book-detail-page .book-detail-edition,
body.book-detail-page .book-detail-edition>div{
  min-inline-size:0;
  max-inline-size:100%;
}
body.book-detail-page :is(.book-detail-edition h3,.book-detail-edition dd){
  max-inline-size:100%;
  overflow-wrap:anywhere!important;
  word-break:normal!important;
}
@media(max-width:760px){
  body.book-detail-page .book-detail-edition{
    grid-template-columns:minmax(0,1fr);
  }
}
