/* αBook — language switcher
   Shared by the homepage (which carries its own dark palette in site.css) and
   the document pages (which use tokens.css). It therefore borrows no variables
   from either: the control draws itself in currentColor so it sits correctly on
   the dark hero and on paper alike, and the menu is an explicit paper panel that
   reads over both. */

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.langswitch {
  position: relative;
  font-family: inherit;
}

.langswitch__btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 6px 10px;
  color: inherit;
  font: inherit;
  font-size: 14px;
  line-height: 1;
  background: transparent;
  border: 1px solid currentColor;
  border-radius: 999px;
  opacity: .72;
  cursor: pointer;
  transition: opacity .15s ease, background-color .15s ease;
}

.langswitch__btn:hover,
.langswitch__btn[aria-expanded="true"] { opacity: 1; }

.langswitch__globe {
  width: 17px;
  height: 17px;
  flex: none;
}

.langswitch__caret {
  width: 11px;
  height: 11px;
  flex: none;
  transition: transform .18s ease;
}

.langswitch__btn[aria-expanded="true"] .langswitch__caret { transform: rotate(180deg); }

/* The name of the language you are reading. Dropped on small screens, where the
   globe alone carries the meaning and the header has no room to spare. */
.langswitch__current { white-space: nowrap; }

.langswitch__menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  right: 0;
  min-width: 156px;
  margin: 0;
  padding: 6px;
  list-style: none;
  color: #211a15;
  background: #fbf7f0;
  border: 1px solid rgba(33, 26, 21, .14);
  border-radius: 12px;
  box-shadow: 0 18px 44px -12px rgba(0, 0, 0, .45);
}

.langswitch__menu[hidden] { display: none; }

.langswitch__menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  padding: 10px 12px;
  color: inherit;
  font-size: 15px;
  line-height: 1.2;
  text-decoration: none;
  border-radius: 8px;
}

.langswitch__menu a:hover,
.langswitch__menu a:focus-visible { background: rgba(33, 26, 21, .07); }

.langswitch__menu a[aria-current] { font-weight: 600; }

/* the tick that marks the language already in use */
.langswitch__menu a[aria-current]::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a0521c;
}

@media (max-width: 380px) {
  .langswitch__current { display: none; }
  .header-actions { gap: 12px; }
}

/* Touch devices get real targets. 44px is the smallest thing a finger hits
   reliably; the control was 33px tall, which is a miss waiting to happen.
   Pointer-based devices keep the compact chip — a mouse does not need 44px. */
@media (pointer: coarse) {
  .langswitch__btn {
    min-height: 44px;
    padding-inline: 14px;
  }

  .langswitch__menu a { min-height: 44px; }

  /* the "Home" link sharing this header row */
  .header-actions a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  .foot__lang,
  .site-footer__lang { gap: 4px 8px; }

  .foot__lang a,
  .foot__lang span[aria-current],
  .site-footer__lang a,
  .site-footer__lang span[aria-current] {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding-inline: 8px;
  }
}

/* ------------------------------------------------------- footer language */

/* The footer list is the plain, always-visible counterpart to the control in
   the header: no menu to open, just the three languages named. */

.foot__lang,
.site-footer__lang {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  font-size: 14px;
  letter-spacing: .04em;
}

.site-footer__lang { margin-top: 10px; }

.foot__lang-label,
.site-footer__lang-label {
  letter-spacing: 0;
  opacity: .8;
}

.foot__lang a,
.site-footer__lang a {
  text-decoration: none;
  opacity: .65;
  transition: opacity .15s ease;
}

.foot__lang a:hover,
.site-footer__lang a:hover { opacity: 1; }

.foot__lang [aria-current],
.site-footer__lang [aria-current] {
  font-weight: 600;
  opacity: 1;
}

/* --------------------------------------------------------- translated docs */

/* The owner's choice: a translation is informational and the English text
   governs. Said once, quietly, at the top of the document rather than buried. */
.legal-note {
  max-width: 62ch;
  margin: 0 0 32px;
  padding: 12px 16px;
  color: #625548;
  font-size: 14px;
  line-height: 1.5;
  background: rgba(181, 164, 146, .14);
  border-left: 3px solid rgba(165, 98, 38, .55);
  border-radius: 0 6px 6px 0;
}

/* Nine languages is too many for one line in a footer, so the row wraps and
   the label holds the start of it. */
.foot__lang,
.site-footer__lang { flex-wrap: wrap; }

/* A nine-item menu is taller than the hero's top strip on a short screen;
   let it scroll rather than run off the bottom. */
.langswitch__menu {
  max-height: min(70vh, 460px);
  overflow-y: auto;
}
