.top-search {
  background-color: var(--background);
  top: 0;
  z-index: 99;
  position: relative;
  width: 100%;
  padding: 10px 0;
}

.search-settings {
  display: flex;
  column-gap: 12px;
  align-items: center;
  width: 100%;
  position: relative;
}

.search-bar {
  border: 1px solid var(--searchBarBorder);
  border-radius: var(--borderRadius-base);
  height: 48px;
  position: relative;
  width: 100%;
}

.top-search .search-bar .search-input {
  background-color: var(--searchSearch);
  border: 1px solid transparent;
  border-radius: var(--borderRadius-base);
  color: var(--searchAccentMain);
  position: relative;
  height: 46px;
  padding: 8px 35px 8px 43px;
  width: 100%;
  transition: var(--transition-all);
}

.top-search .search-bar .search-input::placeholder {
  color: var(--searchAccentMain);
  opacity: 0.5;
}

.top-search .search-bar .search-input:focus {
  border: 1px solid var(--searchBarFocusColor);
  border-radius: calc(var(--borderRadius-base) - 1px);
  position: relative;
  box-shadow: 0px 4px 20px 0px var(--searchBarBorderColor) inset;
}

.top-search .search-bar .search-label {
  position: relative;
}

.top-search .search-bar .search-button {
  font-size: var(--text-sm);
  color: var(--searchAccentMain);
  background-color: transparent;
  border: none;
  cursor: pointer;
  left: 11px;
  opacity: 0.5;
  padding: 5px 1px 5px 5px;
  position: absolute;
  top: 60%;
  transform: translateY(-60%);
  z-index: 99;
  transition: var(--transition-all);
}

.top-search .search-bar.selected .search-button,
.top-search .search-bar .search-button:hover,
.top-search .search-bar .search-button:focus {
  color: var(--top-searchLanguageAccentBar);
  opacity: 1;
}

.top-search .search-bar .search-close-button {
  font-size: var(--text-md);
  color: var(--searchAccentMain);
  background-color: transparent;
  border: none;
  cursor: pointer;
  right: 11px;
  margin: 0;
  opacity: 0.5;
  padding: 5px 1px 5px 0;
  position: absolute;
  transform: scaleY(0);
  top: calc(50% - 13px);
  transition: var(--transition-all);
  z-index: 99;
}

.top-search .search-bar .search-close-button:hover {
  opacity: 0.7;
}

.top-search .search-settings button.icon-settings {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.top-search .search-settings .icon-settings {
  font-size: var(--text-xl);
  float: right;
  color: var(--iconAction);
  text-decoration: none;
  border: none;
  transition: color 0.3s ease-in-out;
  background-color: transparent;
  cursor: pointer;
  padding: 0;
}

.top-search .search-settings .icon-settings:hover {
  color: var(--iconActionHover);
}
.top-search .search-settings .icon-settings:visited {
  color: var(--iconAction);
}

@media screen and (max-width: 768px) {
  /* Code and blockquotes take the full gutter on small screens,
     so we need the search to the same */
  .top-search {
    padding-left: calc(var(--content-gutter) + 36px);
    padding-right: var(--content-gutter);
    margin-left: calc(-1 * var(--content-gutter));
    margin-right: calc(-1 * var(--content-gutter));
    width: calc(2 * var(--content-gutter) + 100%);
  }

  .search-settings {
    width: 100%;
    box-sizing: border-box;
  }
}

body.search-focused .search-bar .search-close-button {
  transform: scaleY(1);
  transition: var(--transition-all);
}

@media screen and (hover: hover) {
  body.search-focused .top-search {
    position: sticky !important;
  }

  body.search-focused .sidebar-button {
    position: fixed !important;
  }
}

@media screen and (hover: none) {
  body.scroll-sticky .top-search {
    position: sticky !important;
  }

  body.scroll-sticky .sidebar-button {
    position: fixed !important;
  }
}
