*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-weight: normal;
}

@font-face {
  font-weight: 400;
  font-style: normal;
  font-family: "Share Tech Mono";
  src: url("share-tech-mono-v15-latin-regular.woff2") format("woff2");
  font-display: swap;
}

body {
  min-height: 100vh;
  background-color: #0a0a0a;
  color: #fff;
  text-transform: uppercase;
  font-size: 12px;
  font-family: "Share Tech Mono", monospace;
  padding: 10vh 5vw;
  user-select: none;
}

h1 {
  text-align: left;
  margin-bottom: 0;
  letter-spacing: normal;
  line-height: 1.3;
  font-size: 120%;
}

.collection-layout {
  width: min(100%, 1600px);
  margin-inline: auto;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 4rem;
  align-items: start;
}

.filters {
  position: sticky;
  top: 2rem;
  display: grid;
  gap: 2rem;
  transition: gap 220ms ease, background-color 220ms ease;
}

.filters.is-scrolled {
  gap: 1.5rem;
  background-color: rgb(10 10 10 / 94%);
  z-index: 2;
}

.filters fieldset {
  border: 0;
  display: grid;
  gap: .75rem;
}

.filters legend {
  margin-bottom: 1rem;
  color: #aaa;
}

.filters label {
  display: flex;
  align-items: center;
  gap: .75rem;
  cursor: pointer;
}

.filter-count {
  margin-left: -.5rem;
  color: #777;
}

.filters input {
  appearance: none;
  display: grid;
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  border: 1px solid #555;
  background: transparent;
  cursor: pointer;
  place-content: center;
}

.filters input::before {
  width: 7px;
  height: 4px;
  border-bottom: 1px solid #fff;
  border-left: 1px solid #fff;
  border-color: #d0b05f;
  content: "";
  opacity: 0;
  rotate: -45deg;
  translate: 0 -1px;
}

.filters input:checked::before {
  opacity: 1;
}

.filters input:hover,
.filters input:focus-visible {
  border-color: #fff;
}

.filters input:focus-visible {
  outline: 1px solid #fff;
  outline-offset: 2px;
}

.clear-filters {
  border: 0;
  padding: .5rem 0;
  text-align: left;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.clear-filters:hover,
.clear-filters:focus-visible {
  border-color: #d0b05f;
}

.collection {
  min-width: 0;
}

.result-count {
  margin-bottom: 1rem;
  color: #aaa;
}

#model-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
  align-items: start;
}

#model-grid figure {
  position: relative;
  min-width: 0;
  opacity: 0;
  translate: 0 16px;
  transition: opacity 400ms ease, translate 400ms ease;
}

#model-grid figure.is-visible {
  opacity: 1;
  translate: 0 0;
}

#model-grid figure.is-exiting {
  opacity: 0;
  translate: 0 8px;
  transition-duration: 180ms;
}

#model-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / .7;
  object-position: top center;
  object-fit: cover;
}

.image-placeholder {
  display: grid;
  width: 100%;
  aspect-ratio: 1 / .7;
  place-items: center;
  border: 1px solid #333;
  background: #151515;
  color: #777;
}

#model-grid figcaption {
  display: block;
  width: fit-content;
  max-width: 100%;
  padding: .5rem .75rem;
  background-color: #000;
  color: #fff;
  translate: .75rem -50%;
  font-size: 11px;
}

.tags {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .4rem;
  list-style: none;
  max-width: calc(100% - 2rem);
  margin: 0;
  z-index: 1;
}

.tag {
  padding: .35rem .6rem;
  background-color: #333;
  color: #fff;
  font-size: 10px;
}

.tag-state-build {
  background-color: #228384;
}

.tag-state-building {
  background-color: #2a6bbf;
}

.tag-state-stored {
  background-color: #504e61;
}

.tag-state-otw {
  background-color: #d0b05f;
  color: #111;
}

.tag-state-wishlist {
  background-color: #de866e;
}

.tag-scale {
  background-color: #333;
}

.tag-special {
  background-color: #813d63;
}

@media screen and (max-width: 800px) {
  body {
    padding: 8vh 5vw;
  }

  @media (prefers-reduced-motion: reduce) {
    .filters,
    #model-grid figure {
      transition: none;
    }
  }

  h1 {
    margin-bottom: 0;
  }

  .collection-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .filters {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
  }

  .clear-filters {
    grid-column: 1 / -1;
  }

  #model-grid {
    gap: 1rem;
  }

  #model-grid figcaption {
    translate: 0 -25%;
    padding: .4rem;
    font-size: 10px;
    line-height: 1.4;
  }

  .tags {
    top: .5rem;
    right: .5rem;
    gap: .25rem;
    max-width: calc(100% - 1rem);
  }

  .tag {
    padding: .3rem .4rem;
    font-size: 9px;
  }
}