@import url('https://cdn.jsdelivr.net/gh/lipis/flag-icons@7.2.3/css/flag-icons.min.css');

.lang-switcher {
  position: relative;
  margin-left: 4px;
  flex-shrink: 0;
}

@media (min-width: 901px) {
  .nav-inner .logo-link {
    order: 1;
  }

  .nav-inner .nav-links {
    order: 2;
    flex: 1;
    justify-content: flex-end;
  }

  .nav-inner .lang-switcher {
    order: 3;
    margin-left: 10px;
  }

  .nav-inner .menu-toggle {
    order: 4;
  }
}

.lang-switcher__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  letter-spacing: 0.04em;
  color: var(--slate, #334155);
  background: rgba(132, 204, 22, 0.08);
  border: 1px solid rgba(132, 204, 22, 0.35);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition, 0.2s ease);
}

.lang-switcher__btn:hover,
.lang-switcher__btn[aria-expanded='true'] {
  background: rgba(132, 204, 22, 0.15);
  border-color: rgba(132, 204, 22, 0.55);
  color: var(--green, #14532d);
}

.lang-switcher__flag.fi {
  width: 1.25em;
  height: 0.94em;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12);
  flex-shrink: 0;
}

.lang-switcher__btn svg {
  width: 14px;
  height: 14px;
  opacity: 0.75;
}

.lang-switcher__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 168px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.15);
  z-index: 1200;
}

.lang-switcher__menu[hidden] {
  display: none;
}

.lang-switcher__menu li button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--slate, #334155);
}

.lang-switcher__menu .lang-switcher__flag.fi {
  width: 1.35em;
  height: 1em;
}

.lang-switcher__menu .lang-switcher__label {
  flex: 1;
}

.lang-switcher__menu li button:hover {
  background: var(--green-light, #ecfccb);
  color: var(--green, #14532d);
}

.lang-switcher__menu li button.is-active {
  background: rgba(132, 204, 22, 0.2);
  font-weight: 600;
  color: var(--green, #14532d);
}

@media (max-width: 900px) {
  .nav-inner {
    flex-wrap: wrap;
    gap: 8px;
  }

  .lang-switcher {
    order: 2;
    margin-left: auto;
    margin-right: 8px;
  }

  .menu-toggle {
    order: 3;
  }

  .nav-links.open ~ .lang-switcher,
  .nav-inner .lang-switcher {
    z-index: 1103;
  }
}
