/* Задача 34, раздел 7. Поиск в шапке. Свой файл — убрать иконку и
   раскрывающийся поиск можно, удалив блок в header.php (см. там же). */

.header-search {
  position: relative;
  display: flex;
  align-items: center;
}

.header-search__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--color-text);
}

.header-search__toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.header-search__toggle:hover {
  color: var(--color-accent-green);
}

.header-search__form {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 20;
  width: 280px;
  padding: 12px;
  background: var(--color-white);
  border: 1px solid var(--header-border-color);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.header-search__input {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--header-border-color);
  border-radius: 6px;
  font-family: var(--font-main);
  font-size: 14px;
}

.header-search__input:focus {
  outline: none;
  border-color: var(--color-accent-green);
}

.header-search__suggestions {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
}

.header-search__suggestions li + li {
  border-top: 1px solid var(--header-border-color);
}

.header-search__suggestions a {
  display: block;
  padding: 8px 6px;
  color: var(--color-text);
  font-size: 14px;
  text-decoration: none;
  border-radius: 4px;
}

.header-search__suggestions a:hover,
.header-search__suggestions a.is-active {
  background: var(--header-panel-bg);
  color: var(--color-accent-green);
}

@media screen and (max-width: 480px) {
  .header-search__form {
    position: fixed;
    top: 60px;
    left: 16px;
    right: 16px;
    width: auto;
  }
}

/* Второй экземпляр — внутри мобильного полноэкранного меню (задача 34,
   раздел 7), не в одном ряду с телефоном/адресом, а отдельной строкой
   между логотипом и пунктами меню. */
.header-search--mobile {
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
}

.header-search--mobile .header-search__form {
  position: static;
  width: 100%;
  max-width: 320px;
  margin: 8px auto 0;
  box-shadow: none;
}
