/* The footer language switcher (views/partials/language-switcher.ejs).

   Opens UPWARD, because it lives in a footer: a menu that drops down from the
   last element on the page opens into nothing and the browser has to scroll to
   show it. */

.lang-switch {
  position: relative;
  display: inline-block;
  font-size: 13px;
  line-height: 1.2;
}

.lang-switch > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 20px;
  color: inherit;
  user-select: none;
}

/* Safari draws its own marker through `list-style: none`. */
.lang-switch > summary::-webkit-details-marker { display: none; }
.lang-switch > summary::marker { content: ''; }

.lang-switch > summary:hover { border-color: rgba(0, 0, 0, 0.35); }
.lang-switch > summary:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.lang-switch[open] .lang-switch-caret { transform: rotate(180deg); }
.lang-switch-caret { font-size: 10px; transition: transform .12s ease; }

.lang-switch-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 1050;
  margin: 0;
  padding: 4px;
  min-width: 100%;
  list-style: none;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.lang-switch-menu a {
  display: block;
  padding: 6px 14px;
  white-space: nowrap;
  border-radius: 7px;
  color: #212529;
  text-decoration: none;
}

.lang-switch-menu a:hover { background: #f1f5f9; }
.lang-switch-menu a[aria-current="true"] { font-weight: 600; background: #eef2ff; }

/* The public footer is dark; the menu itself stays light so the options read. */
.pub-footer .lang-switch > summary { border-color: rgba(255, 255, 255, 0.25); }
.pub-footer .lang-switch > summary:hover { border-color: rgba(255, 255, 255, 0.55); }

/* Near the right edge of a narrow viewport a left-anchored menu overflows. */
@media (max-width: 575.98px) {
  .lang-switch-menu { left: auto; right: 0; }
}
