/* Переключатель языка европейской версии.

   Сайт нарисован как лист бумаги с чернильными надписями: рукописный шрифт
   SundayRegular, первая буква в пунктах меню красная. Переключатель повторяет
   этот язык: квадратик с неровными, будто от руки, краями, внутри — код языка,
   первая буква красная. Список языков — такой же квадратный лист в две колонки.

   Кнопка живёт в шапке: на широких экранах — слева от корзины, на узких —
   рядом с кнопкой мобильного меню. */

.page-lang {
  position: absolute;
  top: 22px;
  /* свободная полоса шапки: правее круглого логотипа и левее корзины */
  right: 250px;
  z-index: 130;
}

.lang-switcher {
  position: relative;
  font-family: SundayRegular, Arial, Tahoma, sans-serif;
  line-height: 1;
}

/* --- квадратик --- */

.lang-switcher-current {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  display: block;
  width: 46px;
  height: 46px;
  margin: 0;
  padding: 0;
  background: #fff;
  color: #000;
  border: 2px solid #231f20;
  /* разные радиусы по углам — квадрат выходит слегка неровным, от руки */
  border-radius: 14px 5px 12px 4px / 4px 13px 5px 14px;
  font: 23px/42px SundayRegular, Arial, Tahoma, sans-serif;
  letter-spacing: 1px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, transform .15s ease;
}

.lang-switcher-current::-moz-focus-inner {
  border: 0;
  padding: 0;
}

.lang-switcher-ink {
  color: #d82929;
}

.lang-switcher-current:hover {
  border-color: #d82929;
  /* лёгкий наклон: квадратик «подпрыгивает», как приклеенная наклейка */
  transform: rotate(-2.5deg);
}

.lang-switcher-current:hover .lang-switcher-ink {
  color: #000;
}

.lang-switcher-current:focus {
  outline: none;
  border-color: #d82929;
}

.lang-switcher.is-open .lang-switcher-current {
  border-color: #d82929;
  transform: rotate(0);
}

/* --- лист со языками --- */

.lang-switcher-sheet {
  position: absolute;
  top: 100%;
  right: -4px;
  margin-top: 12px;
  padding: 14px 18px 16px;
  box-sizing: border-box;
  width: 330px;
  max-width: calc(100vw - 24px);
  max-height: 70vh;
  overflow-y: auto;
  background: #fff;
  border: 2px solid #231f20;
  border-radius: 20px 7px 18px 6px / 6px 18px 7px 20px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .14);
}

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

.lang-switcher-list {
  margin: 0;
  padding: 0;
  list-style: none;
  -webkit-columns: 2;
  -moz-columns: 2;
  columns: 2;
  -webkit-column-gap: 18px;
  -moz-column-gap: 18px;
  column-gap: 18px;
  font-family: Arial, Tahoma, sans-serif;
  font-size: 14px;
}

.lang-switcher-list li {
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  break-inside: avoid;
}

.lang-switcher-list a {
  display: block;
  padding: 5px 2px;
  color: #000;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-switcher-list a > b {
  font-family: SundayRegular, Arial, Tahoma, sans-serif;
  font-weight: normal;
  font-size: 15px;
  color: #999;
  margin-right: 7px;
}

.lang-switcher-list a:hover,
.lang-switcher-list a:focus {
  color: #d82929;
  outline: none;
}

.lang-switcher-list a:hover > b,
.lang-switcher-list a:focus > b {
  color: #d82929;
}

.lang-switcher-list .is-active a {
  color: #d82929;
}

.lang-switcher-list .is-active a > b {
  color: #d82929;
}

.lang-switcher-list .is-active a > span {
  border-bottom: 1px solid;
}

/* --- узкие экраны --- */

/* На экранах уже 1200 точек страница сжимается: логотип поднимается к самому
   верху, а шапка становится теснее. Квадратик уходит в полосу над логотипом —
   единственное место, где он никому не мешает. */
@media (max-width: 1199px) {
  .page-lang {
    top: 8px;
    right: 250px;
  }

  .lang-switcher-current {
    width: 40px;
    height: 40px;
    font-size: 20px;
    line-height: 36px;
  }

  .lang-switcher-sheet {
    width: 290px;
    padding: 12px 14px 14px;
  }
}

/* На телефоне шапка перестраивается целиком: квадратик прижимается к правому
   верхнему углу, список языков становится в одну колонку. */
@media (max-width: 479px) {
  .page-lang {
    top: 6px;
    right: 8px;
  }

  .lang-switcher-current {
    width: 36px;
    height: 36px;
    font-size: 18px;
    line-height: 32px;
  }

  .lang-switcher-list {
    -webkit-columns: 1;
    -moz-columns: 1;
    columns: 1;
  }

  .lang-switcher-sheet {
    width: 200px;
    max-height: 60vh;
  }
}
