html {
  box-sizing: border-box;
}

*, *:before, *:after {
  margin: 0;
  padding: 0;
  box-sizing: inherit;
}

body {
  background-color: #f8f8f8;
  background-image: linear-gradient(#ececec 1px, transparent 1px), linear-gradient(to right, #ececec 1px, #f8f8f8 1px);
  background-size: 2vw 2vw;
  font-family: sans-serif;
}

header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 30px;
  gap: 10px;
  flex-basis: 100vw;
  flex-shrink: 0;
  background-color: #f8f8f885;
  border-bottom: 2px solid teal;
  box-shadow: 0 0 2px grey;
  text-shadow: 0 0 2px rgb(177, 177, 177);
}

.heading {
  flex: 3 1 0%;
}

input {
  height: 40px;
  flex: 0 1 20%;
  font-size: 1.2rem;
  overflow-x: hidden;
  text-shadow: inherit;
  border: 1px solid rgb(158, 158, 158);
  border-radius: 2px;
  padding-left: 5px;
  line-height: 40px;
  transition: 0.01s all ease-in;
}

input:hover {
  border: 1px solid grey;
}

input:focus {
  padding-left: 4px;
  border: 2px solid rgba(100, 148, 237, 0.527);
  outline: rgba(0, 128, 128, 0.105) solid 2px;
}

button {
  display: flex;
  justify-content: center;
  align-content: center;
  align-items: center;
  flex: 0 0 50px;
  height: 50px;
  font-size: 30px;
  line-height: 30px;
  color: teal;
}

input, button {
  box-shadow: 0 0 2px rgb(186, 186, 186);
}

@media (max-width: 550px) {
  header {
    flex-wrap: wrap;
  }

  input {
    flex-grow: 1;
  }

  .heading {
    flex: 0 0 100%;
  }
}

.periodic-table {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: url('./periodic_table.svg') center;
  filter: blur(2.5px) opacity(20%);
  z-index: -1;
}

.periodic-table-base {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: white;
  z-index: -2;
}

main {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 20px;
}

h3 {
  position: absolute;
  top: 0;
  left: 0;
  margin: 10px;
  color: rgb(230, 230, 230);
  text-shadow: 0 0 2px black !important;
}

.card-wrap {
  flex-basis: calc((100% - 20px * 3) / 4);
  filter: drop-shadow(0 0 3px grey);
  position: relative;
}

.card-notch {
  position: absolute;
  top: 0;
  right: 0;
  width: 20px;
  height: 20px;
  background-color: rgba(100, 148, 237, 0.26);
  clip-path:
    polygon(0 0,
      100% 100%,
      100% 0);
  transition: all 0.1s ease;
  border-radius: 1px;
}

.card-notch:hover {
  background-color: rgba(255, 127, 80, 0.482);
}

.card-base {
  height: 300px;
  background-color: teal;
  display: flex;
  justify-content: center;
  align-items: center;
  clip-path:
    polygon(0 0,
      calc(100% - 27px) 0,
      100% 27px,
      100% 100%,
      0 100%);
  border-radius: 1px;
}

.card {
  position: relative;
  display: flex;
  height: 296px;
  flex: 0 0 calc(100% - 4px);
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  text-shadow: 0 0 2px grey;
  clip-path:
    polygon(0 0,
      calc(100% - 26px) 0,
      100% 26px,
      100% 100%,
      0 100%);
  overflow: hidden;
}

.card p {
  word-break: break-word;
}

@media (max-width: 400px) {
  body {
    background-size: 5vw 5vw;
  }

  .card-wrap {
    flex-basis: 100%;
  }
}

@media (min-width: 401px) and (max-width: 550px) {
  body {
    background-size: 4vw 4vw;
  }

  .card-wrap {
    flex-basis: calc((100% - 20px * 1) / 2);
  }
}

@media (min-width: 551px) and (max-width: 900px) {
  body {
    background-size: 3vw 3vw;
  }

  .card-wrap {
    flex-basis: calc((100% - 20px * 2) / 3);
  }
}

.caption {
  background-color: rgb(230, 230, 230, 0.8);
  padding: 5px 10px;
  gap: 10px;
  border-top: 1px solid rgb(204, 204, 204);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 -1px 1px rgba(135, 135, 135, 0.212);
}

.caption::after {
  content: '⇪';
  transition: all 0.5s ease;
}

img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-position: top;
  object-fit: cover;
  top: 0;
  left: 0;
  z-index: -99;
}

hr {
  border: none;
  height: 2px;
  background-color: grey;
  box-shadow: 0 0 2px grey;
  opacity: 0.4;
}

.hidden {
  position: relative;
  background-color: rgb(230, 230, 230, 0.8);
  padding: 5px 10px;
  width: 100%;
}

.hidden p {
  display: flex;
  justify-content: space-between;
  text-align: right;
}

.hidden span {
  text-align: left;
}

.card:hover .hidden {
  bottom: 0 !important;
  margin-top: 0 !important;
}

.card:hover .caption::after {
  transform: rotate(180deg);
}

.no-results {
  flex-basis: 100%;
  font-size: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.no-results p {
  padding: 0 6px;
  background-color: rgb(230, 230, 230, 0.5);
  text-shadow: 0 0 2px rgb(177, 177, 177);
  border: 6px solid transparent;
  animation-name: grid;
  animation-duration: 1s;
  animation-timing-function: cubic-bezier(0.1, 0.8, 0.2, 1);
  animation-delay: 0s;
  animation-direction: normal;
  animation-iteration-count: infinite;
  animation-fill-mode: none;
  animation-play-state: running;
}

@keyframes grid {
  0%, 100% {
    border-color: transparent;
    border-top-color: crimson;
    border-bottom-color: crimson;
  }

  50% {
    border-color: transparent;
    border-left-color: crimson;
    border-right-color: crimson;
  }
}