header {
  position: static;
  top: 0;
  background-color: var(--barva-pozadi);
  z-index: 100;
  border-bottom: 1.5px solid var(--pm-color);
  padding-block: 0.8rem;
  font-family: var(--header-font);
}

header > .container {
  display: grid;
  position: relative;
  grid-template-areas:
    'logo lang'
    'logo links';
}

.lang-dropdown {
  grid-area: lang;
  justify-self: end;
  position: relative;
}

.lang-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0rem;
  background: transparent;
  border: 0 solid var(--pm-color);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--pm-color);
  transition:
    background 0.2s,
    border-color 0.2s;
}

.lang-dropdown-toggle:focus {
  outline: none;
  border-color: var(--pm-color);
}
.lang-dropdown-toggle:hover {
  /* background: rgba(0, 0, 0, 0.03); */
  color: #333;
}

.lang-flag {
  width: 20px;
  height: auto;
  border-radius: 2px;
}

.lang-arrow {
  transition: transform 0.2s;
}

.lang-dropdown.open .lang-arrow {
  transform: rotate(180deg);
}

.lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 160px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  list-style: none;
  padding: 0.4rem 0;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition:
    opacity 0.2s,
    transform 0.2s,
    visibility 0.2s;
  z-index: 1000;
}

.lang-dropdown.open .lang-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  text-decoration: none;
  color: #333;
  font-size: 0.9rem;
  transition: background 0.15s;
}

.lang-option:hover {
  background: var(--pm-color-light);
  color: white;
}

.lang-option.active {
  background: var(--pm-color-light);
  color: white;
  /* font-weight: 600; */
}

.lang-option img {
  width: 22px;
  height: auto;
  border-radius: 2px;
}

.logo-wrapper {
  grid-area: logo;
  /* max-height: clamp(50px, 5vh, 150px); */
  height: 90px;
}

.logo {
  max-height: 100%;
  width: auto;
  max-width: 90%;
}

nav {
  grid-area: links;
  align-self: self-end;
  justify-self: end;
}

/* DESKTOP STYLES (Default or Min-width) */
@media screen and (min-width: 801px) {
  header {
    position: sticky;
  }

  #menuToggle input,
  #menuToggle span {
    display: none;
  }

  #menuList {
    display: flex;
    gap: 1rem;
    padding: 0;
    margin: 0;
    list-style-type: none;
    align-self: end;
    justify-self: end;
  }

  #menuList li {
    padding: 0;
    font-size: 0.9rem;
  }

  #menuList a {
    text-decoration: none;
    color: var(--pm-color);
    font-size: 1.2rem;
    /* text-transform: uppercase; */
    font-weight: 600;
  }

  #menuList a:hover {
    color: var(--text-color);
  }

  .mobile-lang {
    display: none;
  }
}

/* MOBILE STYLES */
@media screen and (max-width: 800px) {
  .lang-dropdown {
    display: none;
  }

  nav {
    grid-area: lang;
    align-self: self-end;
  }

  #menuToggle {
    display: block;
    position: relative;
    grid-area: lang;
    right: 3vw;
    top: 3vw;
    z-index: 500;
    user-select: none;
    -webkit-user-select: none;
  }

  #menuToggle input {
    display: block;
    width: 38px;
    height: 38px;
    position: absolute;
    top: -7px;
    left: -3px;
    cursor: pointer;
    opacity: 0;
    z-index: 2;
    -webkit-touch-callout: none;
  }

  #menuToggle span {
    display: block;
    width: 40px;
    height: 6px;
    margin-bottom: 5px;
    position: relative;
    background: var(--pm-color);
    border-radius: 3px;
    z-index: 1;
    transform-origin: 4px 0px;
    transition:
      transform 0.5s cubic-bezier(0.77, 0.2, 0.05, 1),
      background 0.5s cubic-bezier(0.77, 0.2, 0.05, 1),
      opacity 0.55s ease;
  }

  #menuToggle span:first-child {
    transform-origin: 0% 0%;
  }

  #menuToggle span:nth-last-child(2) {
    transform-origin: 0% 100%;
  }

  #menuToggle input:checked ~ span {
    opacity: 1;
    transform: rotate(45deg) translate(-9px, -18px);
  }

  #menuToggle input:checked ~ span:nth-last-child(3) {
    opacity: 0;
    transform: rotate(0deg) scale(0.2, 0.2);
  }

  #menuToggle input:checked ~ span:nth-last-child(2) {
    transform: rotate(-45deg) translate(-5px, 16px);
  }

  #menuList {
    position: absolute;
    width: 100vw;
    top: -35px;
    right: 0;
    left: auto;
    z-index: 101;
    padding: 50px;
    background: var(--barva-pozadi);
    list-style-type: none;
    -webkit-font-smoothing: antialiased;
    transition: opacity 0.2s cubic-bezier(0.77, 0.2, 0.05, 1);
    display: none;
    gap: 0.8rem;
    border-bottom: 1px solid var(--pm-color);
  }

  #menuList li {
    font-size: 30px;
    line-height: 1;
  }

  #menuList a {
    text-decoration: none;
  }

  #menuToggle:has(input:checked) ~ #menuList {
    display: grid;
  }

  .mobile-lang {
    display: block;
    display: flex;
    align-items: center;
    place-items: center;
  }
  .mobile-lang.margin {
    margin-top: 1.5rem;
  }

  .mobile-lang img {
    width: 30px;
    max-height: 30px;
  }

  .flag-and-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }
}
