/* ═══════════════════ LANGUAGE PICKER (i18n.js) ═══════════════════ */
/* Own colours, so the same picker fits the website and the linktree page. */

/* The navigation links and the language button sit together at the right. */
.nav-end {
  display: flex;
  align-items: center;
  gap: 24px;
}

.lang-host {
  display: inline-flex;
  align-items: center;
}

/* On the linktree page the picker floats in the top-right corner. */
.lang-host.lang-float {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  z-index: 60;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 10, 26, 0.6);
  color: #e0e4f0;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.lang-btn:hover,
.lang-btn[aria-expanded='true'] {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

.lang-btn:focus-visible,
.lang-tile:focus-visible,
.lang-close:focus-visible {
  outline: 2px solid #00cccc;
  outline-offset: 2px;
}

/* Flags: 30×20 SVG with a thin ring, as on niiii.org. */
.lang-flag {
  display: inline-flex;
  flex: none;
  width: 30px;
  height: 20px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.lang-flag svg {
  display: block;
  width: 100%;
  height: 100%;
}

.lang-btn-flag {
  width: 22px;
  height: 15px;
  border-radius: 3px;
}

.lang-flag-slot {
  display: inline-flex;
}

/* ---- full-screen list ---- */

.lang-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  padding: 20px;
  background: rgba(5, 5, 15, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: lang-fade 0.2s ease;
}

@keyframes lang-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.lang-dialog {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 980px;
  max-height: 100%;
  margin: auto;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0e0e22;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  color: #e0e4f0;
}

.lang-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lang-head h2 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}

.lang-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}

.lang-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lang-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 24px 32px;
}

.lang-group {
  margin-top: 20px;
}

.lang-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8890a8;
}

.lang-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

@media (min-width: 640px) {
  .lang-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }
}

@media (min-width: 960px) {
  .lang-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.lang-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  background: #12122a;
  color: #e0e4f0;
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.1s;
}

.lang-tile:hover {
  border-color: rgba(0, 102, 255, 0.45);
  background: #161636;
}

.lang-tile:active {
  transform: scale(0.98);
}

.lang-tile[aria-current='true'] {
  border-color: #0066ff;
  background: rgba(0, 102, 255, 0.14);
}

.lang-tile-flag {
  width: 36px;
  height: 24px;
  border-radius: 5px;
}

.lang-group-flag {
  width: 22px;
  height: 15px;
  border-radius: 3px;
}

.lang-tile-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lang-tile-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.lang-tile-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #8890a8;
}

/* Phones: the list takes the whole screen. */
@media (max-width: 639px) {
  .lang-overlay {
    padding: 0;
  }

  .lang-dialog {
    max-width: none;
    max-height: none;
    height: 100%;
    border-radius: 0;
    border: 0;
  }

  .lang-head {
    padding: max(16px, env(safe-area-inset-top)) 18px 14px;
  }

  .lang-body {
    padding: 4px 18px max(24px, env(safe-area-inset-bottom));
  }
}
