:root {
  --x-nav-background-color: #f6f8fa;
  --x-tag-background-color: #e1ecf4;
  --x-tag-color: #39739d;
}

/* Automatically enabled if user has Dark mode enabled */
@media only screen and (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --x-nav-background-color: #1c2128;
    --x-tag-background-color: #3d4951;
    --x-tag-color: #cde1ee;
    --x-logo-url: url("/images/logo-dark.svg");
  }
}

/* Enabled if forced with data-theme="dark" */
[data-theme="dark"] {
  --x-nav-background-color: #1c2128;
  --x-tag-background-color: #3d4951;
  --x-tag-color: #cde1ee;
  --x-logo-url: url("/images/logo-dark.svg");
}

/* Responsive table */
@media only screen and (max-width: 600px) {
  table, thead, tbody, th, td, tr {
    display: block;
  }
  th, td {
    border: none;
    position: relative;
  }
  th::before, td::before {
    position: absolute;
    left: 6px;
    width: 45%;
    padding-right: 10px;
  }
  th::before {
    content: attr(data-th);
  }
}

@media only screen and (max-width: 600px) {
  .hide-on-mobile {
    display: none;
  }
}

body > nav {
  background-color: var(--background-color);
  padding: 0 1rem;
  overflow: hidden;
  align-items: center;
  z-index: 1;
}
body > nav li {
  padding: 0.2rem var(--pico-nav-element-spacing-horizontal);
}
body > nav form {
  margin: 0;
}

body > nav :is(.menu-btn, .menu-icon) {
  display: none;
  cursor: pointer;
  user-select: none;
}
@media (width < 48em) {
  body > nav {
    flex-wrap: wrap;
    & .menu-icon {
      display: block;
    }
    & > ul.menu {
      flex-direction: column;
      align-items: flex-start;
      width: 100%;
      max-height: 0;
      transition: max-height 0.3s ease-out;
      box-shadow: inset 0px 0px 0px 1px var(--pico-dropdown-border-color);
      margin: 0;
      background-color: var(--pico-dropdown-background-color);
      & li {
        width: 100%;
        padding: 0.2rem var(--pico-nav-element-spacing-horizontal);
      }
      & a {
        display: block;
      }
      & a:hover {
        background-color: #888;
      }
    }
    & .menu-btn:checked ~ .menu {
      max-height: 100vh;
    }
  }
}

pre code { font-size: 70% }

#auth_button {
  margin: 0;
  padding: 0.4rem;
}
body > main {
  padding: 0;
}
body > main > article {
  padding: 1rem;
  margin: 0;
}

p.notice, p.alert {
  padding: 15px;
  margin-bottom: 20px;
  border: 1px solid transparent;
  border-radius: 4px;
}

p.notice {
  color: #3c763d;
  background-color: #dff0d8;
  border-color: #d6e9c6;
}

p.alert {
  color: #a94442;
  background-color: #f2dede;
  border-color: #ebccd1;
}

/* If the message is empty, hide the element */
p.notice:empty, p.alert:empty {
  display: none;
}

#search_results {
  display: grid;
  grid-template-columns: 1fr 3fr;
}

#search_results > aside {
  margin-bottom: 0.5rem;
  max-width: 14em;
}

#toggle-query-builder, #toggle-query-builder-button {
  display: none;
}

#toggle-query-builder-button {
  margin-bottom: 0.5rem;
}

@media only screen and (max-width: 768px) {
  #search_results {
    grid-template-columns: 1fr;
  }

  #search_results > aside {
    display: none;
    max-width: none;
  }

  #search_results #toggle-query-builder {
    display: none;
  }

  #search_results #toggle-query-builder:checked + label + aside {
    display: block;
  }

  #search_results > label {
    display: inline-block;
  }
}

#logo {
  content: var(--x-logo-url);
}
.examples > div > div {
  font-size: 85%;
  margin-bottom: 10px;
}

.examples {
  margin-top: 25px;
}
.examples .example-query {
  font-family: var(--pico-font-family-monospace);
}
.category, .examples th {
  color: var(--pico-primary-focus);
}
a.tag {
  text-decoration: none;
}
.examples mark,  .tag > mark {
  background-color: var(--x-tag-background-color);
  color: var(--x-tag-color);
  border-radius: 3px;
}
.taglist .tag > mark {
  display: inline-block;
  margin-bottom: 4px;
}
#supported_tags {
  font-size: 90%;
}
#query > form {
  display: flex;
}
#query input[type="submit"] {
  --pico-border-radius: 0.6rem;
  max-width: 6em;
  margin-left: 4px;
  margin-bottom: 0;
}
#search {
  margin-bottom: 0;
  --pico-border-radius: 0.6rem;
}
#search_actions button, #search_actions input {
  font-size: 80%;
}
#help > article {
  max-width: 80%;
}

#query-builder .filter.custom input {
  width: 100%;
}
#query-builder .filter {
  border: 1px solid var(--pico-form-element-border-color);
  margin: 0 6px 5px 0;
}
#query-builder .titlebar {
  --pico-color: var(--pico-primary-inverse);
  background-color: var(--pico-secondary-background);
  color: var(--pico-color);
  margin-bottom: 5px;
  padding: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#query-builder .content {
  --pico-spacing: 0.3rem;
  padding: 0.2rem;
}
#query-builder .remove-filter{
  border: none;
  background: none;
  cursor: pointer;
  font-weight: bold;
}
#query-builder input,
#query-builder button,
#query-builder select {
  font-size: 0.75rem;
  height: initial;
  padding: 0.2rem;
}

article.result {
  font-size: 85%;
  margin: 0.2rem 0;
  padding: 1rem 1rem 0.1rem 1rem;
}
article.result p a {
  text-decoration: none;
}
