/* The language bar (Notion #851).
 *
 * Above the header, in the site's own brand colour, on every page of every
 * version. On the English site it offers the translation; on a translated site
 * it is the way back. It is deliberately loud — the practices that asked for
 * this have neighbourhoods where more than half of the people reading the page
 * cannot read the page — and deliberately one line tall, so that being loud
 * costs nothing above the fold.
 *
 * It is a normal block element rather than a fixed one: it scrolls away with
 * the top of the page and leaves the sticky header to stick to the viewport,
 * which is what it already did before this existed.
 */

.leap-i18n {
  /* --leap-primary is per-site; the fallback is the template's own blue, for a
     migrated site whose stylesheet predates the variable. */
  background: var(--leap-primary, #2d40ea);
  color: #fff;
  font-family: inherit;
  line-height: 1.35;
  /* A translated page may be RTL while the bar sits inside an LTR document. */
  text-align: start;
}

.leap-i18n[hidden] {
  display: none;
}

.leap-i18n__inner {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  max-width: 78rem;
  margin: 0 auto;
  padding: 0.5rem var(--page-padding-mobile, 1.25rem);
  min-height: 2.5rem;
}

.leap-i18n__globe {
  flex: 0 0 auto;
  width: 1.125rem;
  height: 1.125rem;
  opacity: 0.9;
}

.leap-i18n__message {
  margin: 0;
  min-width: 0;
  font-size: 0.9375rem;
  font-weight: 500;
}

/* Beside the sentence, not across the bar from it. Pinned to the far edge the
   chip reads as a second, unrelated control — a cookie banner's "Accept" — and
   on a translated page, where there is no sentence, it left a globe alone on
   one side and a word alone on the other. */
.leap-i18n__links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.leap-i18n__chip {
  display: inline-block;
  padding: 0.25rem 0.6875rem;
  border: 1px solid rgb(255 255 255 / 0.45);
  border-radius: 999px;
  /* 16px at phone width: anything smaller and iOS Safari zooms the page on a
     tap and never zooms back (the same rule the mobile-touch guard enforces
     for form controls). */
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

@media (hover: hover) {
  .leap-i18n__chip:hover {
    background: rgb(255 255 255 / 0.16);
    border-color: rgb(255 255 255 / 0.8);
  }
}

.leap-i18n__chip:focus-visible,
.leap-i18n__close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.leap-i18n__close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* 44px: the bar is one line tall and the dismiss is the only control on it
     a visitor can hit by accident. */
  width: 2.75rem;
  height: 2.75rem;
  /* `auto` at the start edge is what pushes this — and only this — to the far
     side; logical properties so it lands correctly on an RTL page. */
  margin-block: -0.625rem;
  margin-inline: auto -0.5rem;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  opacity: 0.75;
  cursor: pointer;
}

.leap-i18n__close svg {
  width: 1rem;
  height: 1rem;
}

@media (hover: hover) {
  .leap-i18n__close:hover {
    opacity: 1;
  }
}

@media (min-width: 48rem) {
  .leap-i18n__inner {
    padding-inline: var(--page-padding-desktop, 1.25rem);
  }

  .leap-i18n__chip {
    font-size: 0.875rem;
  }
}

/* Narrow phones: the sentence and the chip both need the full width, so they
   stack rather than squeezing the sentence to two words per line. */
@media (max-width: 26rem) {
  .leap-i18n__inner {
    flex-wrap: wrap;
    row-gap: 0.375rem;
  }

  .leap-i18n__message {
    flex: 1 1 100%;
    order: 2;
    font-size: 0.875rem;
  }

  .leap-i18n__links {
    order: 3;
    flex: 1 1 100%;
  }
}

@media print {
  .leap-i18n {
    display: none;
  }
}
