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

/* Remove default margin */
h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
ul,
ol,
dl,
dd {
  margin: 0 0 1.5rem;
}

/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
ul[role="list"],
ol[role="list"] {
  list-style: none;
}

/* Set core root defaults */
html:focus-within {
  scroll-behavior: smooth;
}

html {
  line-height: 1.5;
  font-family: Roboto, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

/* Set core body defaults */
body {
  min-height: 100vh;
  text-rendering: optimizeSpeed;
  line-height: 1.5;
  margin: 0;
}

/* A elements that don't have a class get default styles */
a {
  text-decoration-skip-ink: auto;
  color: #36bf7f;
}

a:hover,
a:focus {
  color: #d96666;
}

/* Make images easier to work with */
img,
picture,
svg {
  max-width: 100%;
  display: block;
}

svg {
  fill: currentColor;
}

svg:not(:root) {
  overflow: hidden;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
  font: inherit;
}

/* Remove all animations, transitions and smooth scroll for people that prefer not to see them */
@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

:root {
  --color-bg: #1d1e18;

  --color-primary: #c6d4ff;
  --color-primary-dark: #7799ff;
  --color-primary-light: #d5dffe;

  --color-accent: #dc3545;
  --color-text-1: #2c060f;
  --color-text-2: #1d1e18;
  --color-text-title: #4b4b7c;
  --color-catname: #c9eb60;

  --font-h1: 1.802rem;
  --font-h2: 1.602rem;
  --font-h3: 1.424rem;
  --font-h4: 1.266rem;
  --font-h5: 1.125rem;
  --font-small: 0.889rem;
  --font-overlay: 1.5rem;
  --spinner-height: 4rem;
  --header-font: 3.25rem;
}

body {
  background-color: var(--color-bg);
}

.container {
  width: min(60em, 100%);
  margin: 0 auto;
}

.search--container {
  padding-top: 2rem;
  padding-bottom: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  border-radius: 0.5em;
  justify-content: center;
  background-color: var(--color-primary);
  color: var(--color-text-2);
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.result--container {
  background-color: var(--color-primary);
  min-height: 100vh;
  border-radius: 0.5em;
}

.result-title {
  text-align: center;
  font-size: var(--font-h2);
  text-transform: uppercase;
  margin: 1rem;
  color: var(--color-text-1);
  color: var(--color-text-title);
  font-size: var(--header-font);
  font-family: "Bungee";
}

.search--category--select {
  padding: 0.4rem 2rem;
  border-radius: 0.25em;
  font-weight: bold;
  align-self: center;
}

.search--label {
  font-weight: bold;
  font-size: var(--font-h5);
  padding: 0.5rem 1rem;
}

.cat-card-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  justify-items: center;
  gap: 0.5rem;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.cat-card {
  border-radius: 0.125em;
  position: relative;
  max-height: 10rem;
  width: 100%;
}

.cat-image {
  border-radius: 0.5em;
  border: solid 0.125em var(--color-primary-dark);
  background-color: var(--color-primary-dark);
  height: 100%;
  width: 100%;
  object-fit: cover;
  display: block;
}

.cat-name-container {
  background-color: rgba(0, 0, 0, 0.7);
  bottom: 0;
  left: 0;
  position: absolute;
  width: 100%;
  border-bottom-left-radius: 0.5em;
  border-bottom-right-radius: 0.5em;
}

.cat-card:hover .cat-name-container {
  height: 30%;
}

.cat-name {
  color: var(--color-catname);
  margin: 0 auto;
  text-align: center;
  font-size: var(--font-h5);
}

.error--container {
  padding: 1rem;
  background-color: var(--color-accent);
  color: var(--color-primary-light);
  border-radius: 0.5em;
}

.error--container:empty {
  display: none;
}

.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;

  place-content: center;
  width: 100vw;
  height: 100vh;
  background-color: hsla(0, 0%, 0%, 0.7);
  color: goldenrod;
  font-size: var(--font-overlay);
  padding: 5rem;
}

.overlay-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.overlay.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

.loader-circle-wrap {
  width: var(--spinner-height);
  height: var(--spinner-height);
  display: inline-block;
}

.loader-spinner {
  fill: none;
  stroke-width: 0.25rem;
  stroke-dasharray: 101.09px 201.09px;
  stroke-dashoffset: 101.09px;
  transform: rotate(-90deg);
  animation-name: spinner;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.75, 0, 0.25, 1);
  animation-iteration-count: infinite;
}

.loader-spinner circle {
  stroke: goldenrod;
}

@keyframes spinner {
  0% {
    stroke-dashoffset: 101.09px;
    transform: rotate(-90deg);
  }
  100% {
    stroke-dashoffset: -201.09px;
    transform: rotate(630deg);
  }
}

@media only screen and (min-width: 45em) {
  :root {
    --font-h1: 2.488rem;
    --font-h2: 2.074rem;
    --font-h3: 1.728rem;
    --font-h4: 1.44rem;
    --font-h5: 1.2rem;
    --font-small: 0.833rem;
    --font-overlay: 2.5rem;
    --spinner-height: 5rem;
    --header-font: 3.6rem;
  }

  .cat-card-container {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media only screen and (min-width: 60em) {
  :root {
    --font-h1: 3.052rem;
    --font-h2: 2.441rem;
    --font-h3: 1.953rem;
    --font-h4: 1.563rem;
    --font-h5: 1.25rem;
    --font-small: 0.8rem;
    --font-overlay: 3rem;
    --spinner-height: 7rem;
    --header-font: 4rem;
  }

  .cat-card-container {
    grid-template-columns: repeat(6, 1fr);
  }
}
