:root {
  --stagger-delay: 100ms;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Press Start 2P", system-ui;
}

body {
  background-image: url("Images/background.avif");
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
}

header {
  position: relative;
  text-align: center;
  font-weight: 400;
  font-style: normal;
  margin-top: 20px;
  letter-spacing: 0.3em;
  color: rgb(255, 255, 255);
  text-shadow: 2px 2px 8px #d91c1c;
}

#timer {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  /*timer will be translated horizontally by 50% of its own width in the left direction (0.5 * width) */
  font-size: 20px;
}

.wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.main-container {
  display: flex;
  align-items: center;
  min-height: calc(100vh - 100px);
}

.card-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.2rem;
}

.card {
  width: 100px;
  height: 100px;
  position: relative;
  perspective: 1000px;
  animation: entrance 700ms ease-out;
  animation-fill-mode: backwards;
  cursor: pointer;
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  /* font-size: 2rem; */
  border-radius: 10px;
  transition: transform 0.5s;
}

.front-face img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  transform: rotateY(180deg);
}

.back-face {
  transform: rotateY(0deg);
  background-image: url("Images/back-face.jpg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  border-radius: 20px;
}

.card .front-face {
  transform: rotateY(180deg);
  transition: transform 0.5s ease;
}

.card.flipped .front-face {
  transform: rotateY(180deg);
}

.card .back-face {
  transform: rotateY(0deg);
  transition: transform 0.5s ease;
}

.card.flipped .back-face {
  transform: rotateY(-180deg);
}

#reset {
  border: none;
  border-radius: 10px;
  padding: 5px 5px;
  font-size: 16px;
  color: white;
  background-color: #d6360e;
  text-shadow: 1px 1px 1px #b9930a;
  cursor: pointer;
  transition: transform 0.1s ease-out;
  margin: -30px 0 100px 0;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5); /* 50% opacity */
}

.bx.bx-reset {
  font-size: 30px;
  vertical-align: middle;
}

#reset:hover {
  transform: scale(0.95);
}

@keyframes entrance {
  from {
    opacity: 0;
    transform: scale(0.3);
    filter: hue-rotate(180deg);
  }
  to {
    opacity: 1;
    transform: scale(1);
    filter: hue-rotate(0deg);
  }
}

.card:nth-child(1) {
  animation-delay: calc(1 * var(--stagger-delay));
}

.card:nth-child(2) {
  animation-delay: calc(2 * var(--stagger-delay));
}

.card:nth-child(3) {
  animation-delay: calc(3 * var(--stagger-delay));
}

.card:nth-child(4) {
  animation-delay: calc(4 * var(--stagger-delay));
}

.card:nth-child(5) {
  animation-delay: calc(5 * var(--stagger-delay));
}

.card:nth-child(6) {
  animation-delay: calc(6 * var(--stagger-delay));
}

.card:nth-child(7) {
  animation-delay: calc(7 * var(--stagger-delay));
}

.card:nth-child(8) {
  animation-delay: calc(8 * var(--stagger-delay));
}

.card:nth-child(9) {
  animation-delay: calc(9 * var(--stagger-delay));
}

.card:nth-child(10) {
  animation-delay: calc(10 * var(--stagger-delay));
}

.card:nth-child(11) {
  animation-delay: calc(11 * var(--stagger-delay));
}

.card:nth-child(12) {
  animation-delay: calc(12 * var(--stagger-delay));
}

.card:nth-child(13) {
  animation-delay: calc(13 * var(--stagger-delay));
}

.card:nth-child(14) {
  animation-delay: calc(14 * var(--stagger-delay));
}

.card:nth-child(15) {
  animation-delay: calc(15 * var(--stagger-delay));
}

.card:nth-child(16) {
  animation-delay: calc(16 * var(--stagger-delay));
}
