.fmc-locale { position: relative; color: inherit; }
.fmc-locale > summary { cursor: pointer; display: flex; align-items: center; gap: .45em; min-block-size: 44px; list-style: none; }
.fmc-locale > summary::-webkit-details-marker { display: none; }
.fmc-locale > nav { position: absolute; z-index: 20; inset-block-start: calc(100% + .35rem); inset-inline-end: 0; inline-size: max-content; max-inline-size: calc(100vw - 2rem); max-block-size: min(65dvh, 32rem); overflow-y: auto; overscroll-behavior: contain; box-sizing: border-box; border: 1px solid color-mix(in srgb, CanvasText 15%, transparent); border-radius: 1rem; padding: .35rem; background: Canvas; color: CanvasText; box-shadow: 0 8px 30px rgb(0 0 0 / .14); transform: translateX(var(--fmc-locale-menu-shift-x, 0px)); }
.fmc-locale ul { list-style: none; margin: 0; padding: 0; }
.fmc-locale a { box-sizing: border-box; display: grid; align-items: center; grid-template-columns: 1fr 1em; gap: .7em; padding: .4rem .75rem; min-block-size: 44px; color: inherit; text-decoration: none; border-radius: .6rem; }
.fmc-locale a[aria-current] { font-weight: 600; }
.fmc-locale a[aria-current]::after { content: '✓' / ''; }
.fmc-locale a:hover, .fmc-locale a:focus-visible { background: color-mix(in srgb, CanvasText 8%, Canvas); }
.fmc-locale :is(a, summary):focus-visible { outline: 2px solid Highlight; outline-offset: -2px; }
.fmc-locale-sr { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Shared language menu: preserve complete rows on desktop, scroll only when viewport height requires it. */
.fmc-locale > nav {
  max-block-size: min(40rem, calc(100dvh - 4rem));
}

/* Keep the trigger typography aligned with the original header language link. */
.edition-nav-inner .fmc-locale > summary {
  font: 500 .86rem/1.25 -apple-system, BlinkMacSystemFont, 'PingFang SC', system-ui, sans-serif;
}
/* Some page templates put the chooser directly in the header flex row. */
header.edition-header > .edition-nav-inner:has(.fmc-locale[data-site-language]) {
  width: min(100%, 74rem);
}
.edition-nav-inner > .fmc-locale[data-site-language] { margin-inline-start: auto; }
.edition-nav-inner .fmc-locale > summary > .fmc-language-globe {
  display: inline-block; width: 16px; height: 16px; flex: 0 0 16px;
  background: currentColor;
  -webkit-mask: url(https://1850540354.cdn.123clouddisk.com/1850540354/60659006) center/contain no-repeat;
  mask: url(https://1850540354.cdn.123clouddisk.com/1850540354/60659006) center/contain no-repeat;
  pointer-events: none;
}
@media (max-width: 480px) {
  .edition-nav-inner .fmc-locale > summary { font-size: .8rem; }
}
body.fmc-separators-home header.edition-header .fmc-locale > summary {
  font: 500 14px/1.286 -apple-system, system-ui, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
/* The dropdown has its own Canvas surface; don't inherit the dark masthead's white links. */
@layer systemReading {
  html:root body details.fmc-locale[data-site-language][dir][lang] > nav[aria-label] ul li a[href][lang][hreflang]:is(:link,:visited),
  html:root body details.fmc-locale[data-site-language][dir][lang] > nav[aria-label] ul li a[href][lang][hreflang] bdi {
    color: CanvasText !important;
  }
}

/* Standalone reading and archive utility shells must not inherit body-size text. */
.fmc-locale[data-site-language] > summary { font: 500 14px/1.286 -apple-system, system-ui, "PingFang SC", "Microsoft YaHei", sans-serif; }

/* Apple web locale-link typography; keep the existing hit area and placement. */
html:root body details.fmc-locale[data-site-language] > summary,
html:root body details.fmc-locale[data-site-language] > summary > span[lang] {
  font-size: 12px; font-weight: 400; line-height: 16px;
}

/* The closed site-language control follows the header surface, not muted copy. */
@layer systemReading {
  html:root body details.fmc-locale[data-site-language] > summary,
  html:root body details.fmc-locale[data-site-language] > summary > span[lang] { color: var(--ink, CanvasText) !important; }
  html:root body.fmc-separators-home header.edition-header details.fmc-locale[data-site-language] > summary,
  html:root body.fmc-separators-home header.edition-header details.fmc-locale[data-site-language] > summary > span[lang] { color: #f8f5ee !important; }
}

/* Keep the open homepage chooser above the main-content stacking context. */
body.fmc-separators-home > header.edition-header:has(details.fmc-locale[data-site-language][open]) { z-index: 30 !important; }
