/* Language menu in the top bar (a plain <details>, so it opens without JS) and the first-visit language hint. */
.lang { position: relative; --text: #111827; --fill-hover: rgb(0 0 0 / .05); }  /* the same ink as the .button next to it (Sign in) */
/* the trigger is a product button: pill, quiet fill on hover and while open */
.lang summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 22px; border-radius: 999px; cursor: pointer;
  color: var(--text); font-size: var(--fs-m); line-height: var(--lh-m); font-weight: var(--fw-r); user-select: none; transition: background-color .2s ease; }
.lang summary::-webkit-details-marker { display: none; }
.lang summary:hover, .lang[open] summary { background: var(--fill-hover); }
.lang summary svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.lang summary .chev { width: 16px; height: 16px; stroke-width: 2.5; transition: transform .2s; }
.lang[open] .chev { transform: rotate(180deg); }
/* the panel is the product's menu: milky glass, large corners, pill rows; the chosen language is .semiactive (the quiet fill, always on) */
.lang ul { position: absolute; inset-inline-end: 0; top: calc(100% + 14px); min-width: 200px; margin: 0; padding: 8px; list-style: none; border-radius: 28px;
  background: rgb(255 255 255 / .92); backdrop-filter: blur(26px) saturate(140%); -webkit-backdrop-filter: blur(26px) saturate(140%); transition: background-color .3s;
  border: 1px solid rgb(255 255 255 / .7); box-shadow: 0 16px 48px rgb(20 40 90 / .16), 0 0 0 1px rgb(20 40 90 / .05); display: grid; gap: 2px; }
.lang a { display: flex; align-items: center; height: 44px; padding: 0 22px; border-radius: 999px; color: var(--text); text-decoration: none;
  font-size: var(--fs-m); line-height: var(--lh-m); font-weight: var(--fw-r); transition: background-color .2s ease; }
.lang a:hover, .lang a[aria-current] { background: var(--fill-hover); }

.lang-hint { position: fixed; z-index: 30; inset-inline: 16px; bottom: 20px; margin-inline: auto; width: fit-content; max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 18px; border-radius: 999px; background: rgb(255 255 255 / .96);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: 0 12px 40px rgb(20 40 90 / .22), 0 0 0 1px rgb(20 40 90 / .06);
  font-size: var(--fs-m); line-height: var(--lh-m); color: var(--text); }
.lang-hint a { padding: 8px 16px; border-radius: 999px; background: var(--cobalt); color: #fff; text-decoration: none; font-weight: var(--fw-b); white-space: nowrap; }
.lang-hint button { all: unset; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; }
.lang-hint button:hover { background: rgb(21 73 212 / .08); }
@media (max-width: 800px) {
  .lang summary { padding: 0 8px; gap: 4px; }
  .lang summary svg { width: 18px; height: 18px; }
  .lang summary .chev { width: 14px; height: 14px; }
  .lang-hint { border-radius: 20px; }
}
@media (max-width: 480px) { .lang summary span, .lang summary .chev { display: none; } }

/* Arabic: the page mirrors. Chart and figures stay left to right (the bars grow from the left edge). */
html[dir="rtl"] body { font-family: 'Figtree', 'Segoe UI', 'Noto Sans Arabic', 'Geeza Pro', Tahoma, system-ui, sans-serif; }
html[dir="rtl"] .answers-fig, html[dir="rtl"] .stats strong { direction: ltr; }
html[dir="rtl"] .plan ul, html[dir="rtl"] .doc ul { padding-left: 0; padding-right: 20px; }
html[dir="rtl"] .ask { padding-left: 0; padding-right: var(--sp-xl); }

/* RU and AR: the corpus figures sit in the middle of the arch (icon and number in a row, the caption centred under them);
   the longer captions in these languages no longer hang off the right edge. */
html:not([lang="en"]) .stats { align-items: center; justify-content: center; text-align: center; }
html:not([lang="en"]) .stats > div { justify-content: center; justify-items: center; }
html:not([lang="en"]) .stats > div > span { grid-column: 1 / -1; max-width: 22ch; }

/* A backdrop-filter inside another one blurs nothing: the bar's own glass made it the menu's backdrop root, so the menu saw only
   the bar. The bar's blur moves to a layer behind it (same look), and the menu blurs the page itself. */
.nav.glass { position: relative; backdrop-filter: none; -webkit-backdrop-filter: none; }
.nav.glass::before { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  backdrop-filter: blur(26px) saturate(140%); -webkit-backdrop-filter: blur(26px) saturate(140%); }

/* the menu takes the top bar's colour: white at the top of the page, the bar's blue tint once scrolled (styles.css .nav) */
.nav-wrap.scrolled .lang ul { background: rgb(205 219 255 / .92); }
@supports (background: color-mix(in srgb, red 50%, blue)) {
  .nav-wrap .lang ul, .nav-wrap.scrolled .lang ul { background: color-mix(in srgb, rgb(205 219 255 / .92) calc(var(--nav-p, 0) * 100%), rgb(255 255 255 / .92)); transition: none; }
}

/* The grey of the bar's text: the links, the language button and Sign in read as one (#647181, as .nav-links a; the product's
   .button carries its own greys, so the value is spelled out). They darken on hover like the links. */
.nav-actions .button:not(.lens), .lang summary { color: #647181; transition: color .2s, background-color .2s ease; }
.nav-actions .button:not(.lens):hover, .lang summary:hover, .lang[open] summary { color: #111827; }

/* Burger (built by js/nav.js): where the nav links leave the bar (max-width 1200px) the burger holds them and the language menu.
   The panel is as wide as the bar (it is positioned against .nav) and eases in and out; the three lines turn into a cross. */
.burger { display: none; --text: #111827; --fill-hover: rgb(0 0 0 / .05); }
@media (max-width: 1200px) {
  .has-burger .nav-actions .lang { display: none; }
  .has-burger .burger { display: block; }
  .burger-btn { all: unset; box-sizing: border-box; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; cursor: pointer; color: var(--text); transition: background-color .2s ease; }
  .burger-btn:hover, .burger.is-open .burger-btn { background: var(--fill-hover); }
  .burger-btn:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; }
  .burger-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
  .burger-btn path { transform-box: fill-box; transform-origin: center; transition: transform .32s cubic-bezier(.4, 0, .2, 1), opacity .2s ease; }
  .burger.is-open .b1 { transform: translateY(5px) rotate(45deg); }
  .burger.is-open .b2 { opacity: 0; transform: scaleX(0); }
  .burger.is-open .b3 { transform: translateY(-5px) rotate(-45deg); }
  .burger-panel { position: absolute; inset-inline: 0; top: calc(100% + 10px); max-height: calc(100vh - 110px); overflow-y: auto; padding: 8px; border-radius: 28px;
    background: rgb(255 255 255 / .96); backdrop-filter: blur(26px) saturate(140%); -webkit-backdrop-filter: blur(26px) saturate(140%);
    border: 1px solid rgb(255 255 255 / .7); box-shadow: 0 16px 48px rgb(20 40 90 / .16), 0 0 0 1px rgb(20 40 90 / .05); display: grid; gap: 6px;
    opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(-10px) scale(.98); transform-origin: top;
    transition: opacity .22s ease, transform .3s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .3s; }
  .burger.is-open .burger-panel { opacity: 1; visibility: visible; pointer-events: auto; transform: none; transition-delay: 0s; }
  .burger-links { display: grid; gap: 2px; }
  .burger-panel a { display: flex; align-items: center; min-height: 48px; padding: 0 22px; border-radius: 999px; color: var(--text); text-decoration: none;
    font-size: var(--fs-m); line-height: var(--lh-m); font-weight: var(--fw-r); transition: background-color .2s ease; }
  .burger-panel a:hover { background: var(--fill-hover); }
  .burger-links .burger-signin { font-weight: var(--fw-m); }
  .burger-langs { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 6px 4px; border-top: 1px solid rgb(20 40 90 / .08); }
  .burger-langs a { flex: 1 1 0; justify-content: center; min-height: 40px; padding: 0 12px; background: var(--fill-hover); font-size: var(--fs-s); line-height: var(--lh-s); white-space: nowrap; }
  .burger-langs a[aria-current] { background: var(--cobalt); color: #fff; font-weight: var(--fw-m); }
}
@media (prefers-reduced-motion: reduce) { .burger-panel, .burger-btn path { transition: none; } }
