/* Переключатель языка — единый для лендинга и для страницы /subtitles.
 *
 * Обычный CSS без переменных и без Tailwind: этот же файл подключает лэйаут
 * телевизора, где утилиты с var(--tw-bg-opacity) движок отбрасывает целиком
 * (подробнее — в шапке subtitles.css).
 */

.lang-switch {
  position: fixed;
  left: auto;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  width: auto;
  width: -moz-max-content;
  width: max-content;
  max-width: calc(100% - 48px);
  box-sizing: border-box;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: rgba(18, 20, 32, 0.98);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1;
}

.lang-switch[open] {
  animation: lang-switch-expand 0.24s ease-out;
}

.lang-switch[open] > summary {
  display: none;
}

/* Кнопка без стандартного маркера раскрытия. */
.lang-switch > summary {
  list-style: none;
}

.lang-switch > summary::-webkit-details-marker {
  display: none;
}

.lang-switch__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: #e5e2ee;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}

.lang-switch__toggle:hover {
  background: #252036;
  color: #ffffff;
}

.lang-switch__toggle:focus {
  outline: none;
  background: #3b2d59;
  color: #ffffff;
}

.lang-switch__globe {
  width: 18px;
  height: 18px;
  margin-right: 9px;
  color: #a78bfa;
  flex-shrink: 0;
}

.lang-switch__current {
  min-width: 0;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Список заменяет кнопку внутри того же блока с закреплённым нижним краем. */
.lang-switch__menu {
  position: static;
  width: auto;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 6px;
  border: 0;
  background: transparent;
  box-sizing: border-box;
  white-space: nowrap;
  animation: lang-switch-in 0.24s ease-out;
}

.lang-switch__item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  color: #aaa8b9;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
}

.lang-switch__item > span {
  min-width: 0;
  white-space: normal;
  overflow-wrap: break-word;
}

.lang-switch__item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.lang-switch__item:focus {
  outline: none;
  color: #ffffff;
  background: rgba(167, 139, 250, 0.25);
}

.lang-switch__item.is-current {
  color: #ede9fe;
  font-weight: 600;
  background: rgba(139, 92, 246, 0.18);
  background-image: linear-gradient(110deg, rgba(139, 92, 246, 0.1), rgba(217, 70, 239, 0.04));
}

.lang-switch__item.is-current:hover,
.lang-switch__item.is-current:focus {
  background-color: rgba(139, 92, 246, 0.32);
}

.lang-switch__check {
  position: absolute;
  right: 5px;
  top: 50%;
  width: 12px;
  height: 12px;
  transform: translateY(-50%);
  color: #c4b5fd;
  flex-shrink: 0;
}

@keyframes lang-switch-expand {
  from { -webkit-clip-path: inset(calc(100% - 44px) 0 0 round 16px); clip-path: inset(calc(100% - 44px) 0 0 round 16px); }
  to   { -webkit-clip-path: inset(0 0 0 round 16px); clip-path: inset(0 0 0 round 16px); }
}

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

@media (max-width: 479px) {
  .lang-switch {
    right: 16px;
    bottom: 16px;
    max-width: calc(100% - 32px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lang-switch[open],
  .lang-switch__menu { animation: none; }
  .lang-switch__toggle,
  .lang-switch__item { transition: none; }
}
