:root {
  --text-color: #3a382c;
  --text-color-accent: #5f5b45;
  --background: #f0eee7;
  --background-accent: #f7f6f3;
  --accent: #d6293d;
  --accent-dark: #930e1e;
  --white: #fff;
  --selected-tag: #9a6b13;
  --transition: 0.2s;
}

html,
body,
div,
span,
p,
a,
small,
label,
aside,
main,
footer,
header {
  border: 0;
  font: inherit;
  font-size: 1em;
  margin: 0;
  padding: 0;
}

article,
aside,
main,
footer,
header {
  display: block;
}

*,
*::after,
*::before {
  box-sizing: border-box;
}

body {
  background: var(--background);
  color: var(--text-color);
  font-family: -apple-system, BlinkMacSystemFont, "avenir next", avenir,
    "segoe ui", "helvetica neue", helvetica, Cantarell, Ubuntu, roboto, noto,
    arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

i {
  font-style: normal;
  font-family: -apple-system, BlinkMacSystemFont, "avenir next", avenir,
    "segoe ui", "helvetica neue", helvetica, Cantarell, Ubuntu, roboto, noto,
    arial, sans-serif;
}

h1 {
  font-size: 1.2em;
  margin: 0;
}

h2,
h3 {
  margin-bottom: 0.5em;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-dark);
}

.container {
  margin: 0 auto;
  padding: 0 1em;
}

@media (width >= 800px) {
  .container {
    display: flex;
    grid-gap: 2em;
    padding: 0;
  }
}

header {
  background: var(--accent);
  border-bottom: 1px solid var(--background);
  margin-bottom: 1em;
  padding: 0.25em 0.75em 0.5em;
  display: flex;
  flex-direction: column;
  grid-gap: 3px;
  color: var(--white);
  justify-content: space-between;
}

@media (width >= 800px) {
  header {
    margin-bottom: 0;
    flex-direction: row;
    align-items: center;
    padding: 0.25em 1em;
  }

  header .title {
    display: flex;
    align-items: center;
    grid-gap: 1em;
  }
}

.sidebar {
  display: none;
}

@media (width >= 800px) {
  .sidebar {
    display: block;
    background: var(--background-accent);
    padding: 0 1em 2em;
    width: 35%;
    max-width: 450px;
  }
}

.sidebar a {
  text-decoration: underline;
}

button[is="tag-button"] {
  color: var(--text-color-accent);
  background: transparent;
  cursor: pointer;
  border: 1px solid #e9e6d5;
  padding: 0 0.5em;
  border-radius: 3px;
  border-left-width: 5px;
  border-bottom-width: 3px;
  border-bottom-color: #d6d2bc;
  font: inherit;
  vertical-align: middle;
}

button[is="tag-button"].active,
button[is="tag-button"]:has(:checked),
button[is="tag-button"]:hover {
  background: var(--white);
  border-color: var(--selected-tag);
  color: var(--selected-tag);
}

.content {
  position: relative;
  flex-grow: 1;
  padding-right: 1em;
}

.select-group-container {
  display: flex;
  flex-wrap: wrap;
  grid-gap: 0.5em;
}

@media (width >= 980px) {
  .content {
    display: flex;
    grid-gap: 2em;
  }

  .selects {
    order: 2;
    max-width: 200px;
    flex-shrink: 0;
  }

  .results {
    width: 500px;
    flex-grow: 1;
    max-width: 675px;
  }

  .select-group-container {
    flex-flow: column nowrap;
    grid-gap: 1em;
  }
}

@media (width >= 800px) {
  .select-tags {
    display: none;
  }
}

.select-group {
  display: flex;
  flex-direction: column;
}

select {
  border: 1px solid #e9e6d5;
  border-radius: 3px;
  padding: 0.25em 0.5em;
  font-size: 1em;
  background: var(--white);
  color: var(--text-color);
}

input[type="checkbox"] {
  accent-color: var(--accent);
}

input[type="text"] {
  border: 1px solid #e9e6d5;
  border-radius: 3px;
  padding: 0.25em 0.5em;
  font-size: 1em;
  background: var(--white);
  color: var(--text-color);
}

.select-group label {
  font-weight: bold;
  font-size: 12px;
  text-transform: uppercase;
  display: flex;
  grid-gap: 0.5em;
  align-items: center;
}

.screen-reader-only {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

search-status {
  margin-bottom: 1em;
  margin-top: 1em;
  min-height: 25px;
  display: flex;
  align-items: center;
  grid-gap: 0.25em;
  flex-wrap: wrap;
}

search-status div {
  display: inline-flex;
}

search-status .search-filter {
  align-items: center;
  grid-gap: 0.25em;
  background-color: var(--background-accent);
  padding: 0 0.5em;
  border-radius: 3px;
  border: 1px solid #e9e6d5;
  display: flex;
}

.clear-button {
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--accent);
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  font-size: 1em;
}

.clear-button:hover {
  color: var(--accent-dark);
}

.clear-button svg {
  height: 1em;
  width: 1em;
}

search-status .btn-clear {
  padding: 0 1em;
}

pagination-buttons {
  margin-bottom: 1em;
  display: flex;
  grid-gap: 0.5em;
}

.families {
  list-style: none;
  padding: 0;
  margin: 0;
}

.families > li {
  margin-bottom: 1em;
}

.family-link {
  background: var(--white);
  border-radius: 3px 3px 0 0;
  color: var(--text-color);
  padding: 1em;
  position: relative;
}

@media (width >= 800px) {
  .family-link {
    padding: 1em 2em 0.5em;
  }
}

.family-title {
  font-size: 1.75em;
  overflow: hidden;
}

.family-title-small {
  color: var(--text-color-accent);
}

.family-tags {
  background: var(--background-accent);
  border-radius: 0 0 3px 3px;
  padding: 0.5em 1em;
  flex-direction: column;
  position: relative;
  display: flex;
  justify-content: space-between;
  grid-gap: 0.5em;
}

@media (width >= 800px) {
  .family-tags {
    padding: 0.5em 2em;
    flex-direction: row;
    align-items: center;
  }
}

.family-tags-container {
  display: flex;
  flex-wrap: wrap;
  grid-gap: 3px;
}

.family-meta-container {
  display: flex;
  justify-content: space-between;
  flex-flow: column wrap;
  grid-column-gap: 0.5em;
}

@media (width >= 800px) {
  .family-meta-container {
    flex-direction: row;
  }

  .family-meta {
    display: flex;
    justify-content: space-between;
    grid-gap: 0.25em;
  }
}

.family-meta ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  grid-gap: 0.25em;
  margin: 0;
  padding: 0;
}

.family-meta li {
  display: flex;
  align-items: center;
  grid-gap: 0.25em;
}

.family-meta li:not(:first-child)::before {
  content: "•";
  color: var(--text-color-accent);
}

.family-meta span {
  position: relative;
}

.family-meta span[aria-label]:hover {
  cursor: help;
}

.family-meta span[aria-label]:hover::before {
  border-color: transparent transparent var(--accent);
  border-style: solid;
  border-width: 5px;
  content: "";
  display: block;
  left: 48%;
  position: absolute;
  top: 77%;
}

.family-meta span[aria-label]:hover::after {
  background: var(--accent);
  border-radius: 5px;
  color: var(--white);
  content: attr(aria-label);
  display: block;
  left: 0;
  padding: 0.5em;
  position: absolute;
  text-align: left;
  top: 1.5em;
  width: 200%;
  z-index: 100;
}

.family-meta-links {
  flex-shrink: 0;
  display: flex;
  grid-gap: 1em;
}

@media (width >= 800px) {
  .family-meta-links {
    justify-content: space-between;
  }
}

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 9px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.btn {
  border-radius: 3px;
  background: var(--white);
  border: 1px solid var(--accent);
  box-shadow: 0 0.1em var(--accent-dark);
  color: var(--accent);
  cursor: pointer;
  padding: 0.25em 1em;
  transition: background var(--transition);
  font-size: 1em;
  width: fit-content;
}

.btn:hover:not([disabled]) {
  background: var(--white);
  color: var(--accent-dark);
  transition: background var(--transition);
}

.btn:active:not([disabled]) {
  box-shadow: none;
  position: relative;
  top: 0.1em;
}

.btn[disabled] {
  border-color: var(--text-color);
  box-shadow: none;
  color: var(--text-color);
  cursor: default;
}

.btn.active {
  background: var(--accent);
  color: var(--white);
}

.hide {
  display: none;
}

.mobile {
  display: flex;
}

@media (width >= 800px) {
  .mobile {
    display: none;
  }
}

sort-by {
  display: flex;
  grid-gap: 0.5em;
  align-items: center;
  margin: 1em 0;
  font-size: 14px;
}

sort-by .label {
  font-weight: bold;
  text-transform: uppercase;
}

.btn-group {
  display: flex;
}

.btn-group button {
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--white);
  color: var(--accent);
  cursor: pointer;
  padding: 0.1em 0.5em;
  font-size: 1em;
  width: fit-content;
}

.btn-group button.active {
  background: var(--accent);
  color: var(--white);
}

.btn-group button:nth-child(1) {
  border-right: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.btn-group button:nth-child(2) {
  border-left: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.btn-group button:hover:not(.active) {
  background: var(--background-accent);
}
