/* Roastme LanguageSwitcher look — flags via flag-icons classes, scoped to Integritee chrome. */

.fi {
  background-size: contain;
  background-position: 50%;
  background-repeat: no-repeat;
  position: relative;
  display: inline-block;
  width: 1.333333em;
  line-height: 1em;
}
.fi:before { content: "\00a0"; }
.fi-gb { background-image: url(/img/flags/gb.svg); }
.fi-es { background-image: url(/img/flags/es.svg); }
.fi-se { background-image: url(/img/flags/se.svg); }

.lang-fi {
  width: 1.15em;
  line-height: 1em;
  border-radius: 2px;
  flex-shrink: 0;
  vertical-align: -0.1em;
}

.lang-switch {
  position: relative;
  display: flex;
  align-items: center;
  height: 34px;
  box-sizing: border-box;
  padding: 5px;
  background: var(--panel, #ffffff);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line-2, #e2e2e2);
  border-radius: 10px;
}
.lang-trigger {
  width: 32px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  opacity: 1;
}
.lang-trigger:hover { opacity: 0.9; }
.lang-trigger,
.lang-trigger:focus,
.lang-trigger:focus-visible,
.lang-trigger .flag {
  outline: none;
  box-shadow: none;
}
.lang-switch .flag {
  width: 26px;
  height: 18px;
  font-size: 18px;
  border-radius: 2px;
  display: block;
  line-height: 18px;
  flex-shrink: 0;
}
.lang-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  max-width: min(240px, calc(100vw - 24px));
  max-height: min(70vh, 320px);
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: color-mix(in srgb, var(--surface, #fff) 94%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line, #e4e4e7);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  display: grid;
  gap: 2px;
}
.lang-menu[hidden] { display: none; }
.lang-menu:focus { outline: none; }
.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text, #18181b);
  font-size: 13px;
  white-space: nowrap;
  opacity: 0.75;
}
.lang-option:hover,
.lang-option.focused {
  background: var(--bg-2, #f4f4f5);
  opacity: 1;
}
.lang-option.selected {
  opacity: 1;
  background: var(--line-2, #e2e2e2);
}
.lang-option.selected .flag,
.lang-option .flag {
  outline: none;
  box-shadow: none;
}
.lang-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-switch-overlay {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 10300;
}

.nav .lang-switch { flex-shrink: 0; }
.side .lang-switch { margin: 8px 10px 4px; align-self: flex-start; }

@media (max-width: 960px) {
  .nav .links { gap: 14px; }
  .lang-switch-overlay { top: 10px; right: 10px; }
}
