/* -------------------------------- 

File#: _1_language-picker
Title: Language Picker
Descr: A custom selector allowing users to choose their preferred language on a page
Usage: codyhouse.co/license

-------------------------------- */
/* reset */
*, *::after, *::before {
  box-sizing: border-box;
}

/** {
  font: inherit;
  margin: 0;
  padding: 0;
  border: 0;
}*/

/*body {
  background-color: hsl(0, 0%, 100%);
  font-family: system-ui, sans-serif;
  color: hsl(230, 7%, 23%);
  font-size: 1rem;
}*/
/*
h1, h2, h3, h4 {
  line-height: 1.2;
  color: hsl(230, 13%, 9%);
  font-weight: 700;
}

h1 {
  font-size: 2.0736rem;
}

h2 {
  font-size: 1.728rem;
}

h3 {
  font-size: 1.25rem;
}

h4 {
  font-size: 1.2rem;
}

ol, ul, menu {
  list-style: none;
}

button, input, textarea, select {
  background-color: transparent;
  border-radius: 0;
  color: inherit;
  line-height: inherit;
  appearance: none;
}

textarea {
  resize: vertical;
  overflow: auto;
  vertical-align: top;
}

a {
  color: hsl(250, 84%, 54%);
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

img, video, svg {
  display: block;
  max-width: 100%;
}*/

@media (min-width: 64rem) {
  /*body {
    font-size: 1.25rem;
  }

  h1 {
    font-size: 3.051rem;
  }

    h2 {
    font-size: 2.44rem;
  }

    h3 {
    font-size: 1.75rem;
  }

    h4 {
    font-size: 1.5625rem;
  }*/
}

/* variables */
:root {
  /* colors */
  --li4-color-primary-hsl: 250, 84%, 54%;
  --li4-color-bg-hsl: 0, 0%, 100%;
  --li4-color-contrast-high-hsl: 230, 7%, 23%;
  --li4-color-contrast-higher-hsl: 230, 13%, 9%;
  --li4-color-bg-light-hsl: 0, 0%, 100%;
  --li4-color-white-hsl: 0, 0%, 100%;
  --li4-color-bg-dark-hsl: 240, 4%, 95%;
  --li4-color-bg-lighter-hsl: 0, 0%, 100%;
  --li4-color-black-hsl: 230, 13%, 9%;

  /* spacing */
  --li4-space-3xs: 0.25rem;
  --li4-space-2xs: 0.375rem;
  --li4-space-xs: 0.5rem;
  --li4-space-sm: 0.75rem;
}

@media(min-width: 64rem){
  :root {
    /* spacing */
    --li4-space-3xs: 0.375rem;
    --li4-space-2xs: 0.5625rem;
    --li4-space-xs: 0.75rem;
    --li4-space-sm: 1.125rem;
  }
}

/* buttons */
.li4-btn {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: 1em;
  white-space: nowrap;
  text-decoration: none;
  background: hsl(var(--li4-color-bg-dark-hsl));
  color: hsl(var(--li4-color-contrast-higher-hsl));
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: all 0.2s ease;
  will-change: transform;
  padding: var(--li4-space-2xs) var(--li4-space-2xs);
  border-radius: 0.25em;
}

.li4-btn:focus-visible {
  box-shadow: 0px 0px 0px 2px hsl(var(--li4-color-bg-hsl)), 0px 0px 0px 4px hsla(var(--li4-color-contrast-higher-hsl), 0.15);
  outline: none;
}

.li4-btn:active {
  transform: translateY(2px);
}

.li4-btn--subtle {
  background: hsl(var(--li4-color-bg-lighter-hsl));
  color: hsl(var(--li4-color-contrast-higher-hsl));
  box-shadow: rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 1px 3px 1px;
}

.li4-btn--subtle:hover {
  background: hsl(var(--li4-color-bg-light-hsl));
  box-shadow: inset 0px 1px 0px hsla(var(--li4-color-white-hsl), 0.1), 0px 0px 0px 1px hsla(var(--li4-color-black-hsl), 0.02), 0px 1px 3px -1px hsla(var(--li4-color-black-hsl), 0.2), 0 0.1px 0.3px rgba(0, 0, 0, 0.06),0 1px 2px rgba(0, 0, 0, 0.12);
}

.li4-btn--subtle:focus {
  box-shadow: rgba(50, 50, 93, 0.25) 0px 6px 12px -2px, rgba(0, 0, 0, 0.3) 0px 3px 7px -3px;
}

.li4-icon {
  height: var(--li4-size, 1em);
  width: var(--li4-size, 1em);
  display: inline-block;
  color: inherit;
  fill: currentColor;
  line-height: 1;
  flex-shrink: 0;
  max-width: initial;
}

/* component */
:root {
  --picker-vertical-gap: 4px;
}

.language-picker {

    display: inline-block;
    position: relative;
    margin-right: 10px;
}

.language-picker__form {
  display: none;
}

.language-picker__button {
    /*font: inherit;
    margin: 0;
    padding: 0;*/
    border: 0;
}

.language-picker__button .li4-icon {
    height: 16px;
    width: 16px;
}
.language-picker__button .li4-icon:first-of-type {
  margin-right: var(--li4-space-3xs);
}
.language-picker__button .li4-icon:last-of-type {
  margin-left: var(--li4-space-3xs);
}

.language-picker__dropdown {
  position: absolute;
  left: 0;
  top: 100%;
  width: 200px;
  max-height: 400px;
  overflow: auto;
  background-color: hsl(var(--li4-color-bg-light-hsl));
  box-shadow: inset 0 0 0.5px 1px hsla(0, 0%, 100%, 0.075), 0 0.9px 1.5px rgba(0, 0, 0, 0.03),0 3.1px 5.5px rgba(0, 0, 0, 0.08),0 14px 25px rgba(0, 0, 0, 0.12);
  padding: var(--li4-space-3xs) 0;
  border-radius: 0.25em;
  z-index: 5;
  margin-top: var(--picker-vertical-gap);
  margin-bottom: var(--picker-vertical-gap);
  --space-unit: 1rem;
  --text-unit: 1rem;
  font-size: var(--text-unit);
  visibility: hidden;
  opacity: 0;
  transition: visibility 0s 0.2s, opacity 0.2s;
}

.language-picker__dropdown--right {
  right: 0;
  left: auto;
}

.language-picker__dropdown--up {
  top: auto;
}

.language-picker__button[aria-expanded=true] + .language-picker__dropdown {
  visibility: visible;
  opacity: 1;
  transition: visibility 0s, opacity 0.2s;
}

.language-picker__item {
  display: flex;
  align-items: center;
  text-decoration: none;
  padding: var(--li4-space-2xs) var(--li4-space-sm);
  color: hsl(var(--li4-color-contrast-high-hsl));
  transition: background 0.2s;
}
.language-picker__item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.language-picker__item:hover {
  background-color: hsla(var(--li4-color-contrast-higher-hsl), 0.075);
}
.language-picker__item:focus {
  outline: none;
}
.language-picker__item[aria-selected=true] {
  position: relative;
  background-color: hsl(var(--li4-color-primary-hsl));
  color: hsl(var(--li4-color-white-hsl));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.language-picker__item[aria-selected=true]:focus {
  outline: 2px solid hsla(var(--li4-color-primary-hsl), 0.2);
}
.language-picker__item[aria-selected=true]::after {
  content: "";
  height: 16px;
  width: 16px;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpolyline stroke-width='2' stroke='%23ffffff' fill='none' stroke-linecap='round' stroke-linejoin='round' points='1,9 5,13 15,3 '/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpolyline stroke-width='2' stroke='%23ffffff' fill='none' stroke-linecap='round' stroke-linejoin='round' points='1,9 5,13 15,3 '/%3E%3C/svg%3E");
  margin-left: auto;
}

.language-picker__flag {
  display: flex;
  align-items: center;
}
.language-picker__flag::before {
  display: none;
  flex-shrink: 0;
  content: "";
  height: 16px;
  width: 16px;
  border-radius: 50%;
  margin-right: var(--li4-space-2xs);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
}
.language-picker__dropdown .language-picker__flag::before {
  margin-right: var(--li4-space-xs);
}

.language-picker--flags .language-picker__flag::before {
  display: inline-block;
  display: inline-flex;
}
.language-picker--flags .language-picker__button .li4-icon:first-of-type {
  display: none;
}

.language-picker--hide-label .language-picker__button .li4-icon {
  margin-left: 0;
}
.language-picker--hide-label .language-picker__button .li4-icon:first-of-type {
  display: none;
}
.language-picker--hide-label .language-picker__button em {
  display: none;
}
.language-picker--hide-label .language-picker__button .language-picker__flag::before {
  margin-right: var(--li4-space-3xs);
}

.language-picker--hide-label .language-picker__flag::before {
  display: inline-block;
  display: inline-flex;
}

/* utility classes */
.li4-sr-only {
  position: absolute;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  overflow: hidden;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

.language-picker__list{
    padding: 0 !important;
}

.language-picker__flag--ar::before {
  background-image: url("/img/flags/ar.svg");
}

.language-picker__flag--az::before {
  background-image: url("/img/flags/az.svg");
}

.language-picker__flag--de::before {
  background-image: url("/img/flags/de.svg");
}

.language-picker__flag--en::before {
  background-image: url("/img/flags/en.svg");
}

.language-picker__flag--es::before {
  background-image: url("/img/flags/es.svg");
}

.language-picker__flag--fa::before {
  background-image: url("/img/flags/fa.svg");
}

.language-picker__flag--fr::before {
  background-image: url("/img/flags/fr.svg");
}

.language-picker__flag--hi::before {
  background-image: url("/img/flags/hi.svg");
}

.language-picker__flag--it::before {
  background-image: url("/img/flags/it.svg");
}

.language-picker__flag--ja::before {
  background-image: url("/img/flags/ja.svg");
}

.language-picker__flag--ka::before {
  background-image: url("/img/flags/ka.svg");
}

.language-picker__flag--pt::before {
  background-image: url("/img/flags/pt.svg");
}

.language-picker__flag--ru::before {
  background-image: url("/img/flags/ru.svg");
}

.language-picker__flag--sq::before {
  background-image: url("/img/flags/sq.svg");
}

.language-picker__flag--tr::before {
  background-image: url("/img/flags/tr.svg");
}

.language-picker__flag--uk::before {
  background-image: url("/img/flags/uk.svg");
}

.language-picker__flag--zh::before {
  background-image: url("/img/flags/zh.svg");
}

@media screen and (max-width: 991px){
  .language-picker{
    margin-right: 0;
  }

  .language-picker__dropdown{
    right: 0;
        left: auto;
  }
}
