/* Sets the global margin and padding for all elements to 0 to avoid unwanted spacing */
* {
  margin: 0;
  padding: 0;
}

/* Styles for the body of the page */
body {
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Wrapper for the box */
.wrapper {
  margin-top: 5%;
  display: flex;
  gap: 150px;
}

.box-wrapper {
  position: relative;
  width: 500px;
  height: 250px;
  box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.7), 0px 5px 10px rgba(0, 0, 0, 0.7);
  border-radius: 25px;
  overflow: visible;
}

/* Animation when hovering over box-wrapper: rotates the side elements in second */
.box-wrapper:hover .second .side {
  transform: rotateX(0deg);
}

/* Transparency effects for side elements in second on hover */
.box-wrapper:hover .second .side:after {
  opacity: 0;
  transition-delay: 0.2s;
}

/* Animation for the side elements of the main box on hover */
.box-wrapper:hover .first .side:after {
  opacity: 1;
}

.box-wrapper:hover .first .side2 {
  transform: rotateY(-90deg) translateX(250px);
}

.box-wrapper:hover .first .side1 {
  transform: rotateY(-90deg) translateX(-250px);
}

/* Basic styles for elements with the class "box" */
.box {
  position: absolute;
  top: 0;
  left: 0;
  width: 500px;
  height: 250px;
  transition: 0.5s linear all;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 50px;
  background-size: 500px 250px;
}

/* Styles for headings inside the box */
.box h2 {
  color: white;
  font-family: sans-serif;
  width: 200%;
  height: 100%;
  display: flex;
  align-items: baseline;
  justify-content: center;
}

/* Styles for the box sides */
.box .side {
  overflow: hidden;
  position: relative;
  width: 250px;
  height: 250px;
  background-size: 500px 250px;
  transition: 1s cubic-bezier(0.5, -0.03, 0.58, 1.08) transform, 1s opacity;
  will-change: transform, opacity;
}

/* Pseudo-elements after the box sides */
.box .side:after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: 1s cubic-bezier(0.5, -0.03, 0.58, 1.08) opacity;
}

/* Background positioning for the first side */
.box .side1 {
  background-position: 0% 0%;
  transform-origin: left;
  border-radius: 25px 0 0 25px;
}

/* Background positioning for the second side */
.box .side2 {
  background-position: 100% 0;
  transform-origin: right;
  border-radius: 0 25px 25px 0;
}

/* Adjusts the text position for the second side */
.box .side2 h2 {
  transform: translateX(-50%);
}

/* Settings for the main box */
.box.first {
  transform-origin: bottom;
}
.box.first .side {
  background-image: url(./images/1.jpg);
}

/* Transparency for the sides of the main box */
.box.first .side:after {
  opacity: 0;
}
.box.first .side1:after {
  background: linear-gradient(to left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.9));
}
.box.first .side2:after {
  background: linear-gradient(to left, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.5));
}

/* Settings for the top box */
.box.second {
  transform-origin: bottom;
}
.box.second .side1 {
  transform-origin: right;
  transform: rotateY(-90deg) translateX(-250px);
}
.box.second .side1:after {
  background: linear-gradient(to left, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.2));
}
.box.second .side2 {
  transform-origin: left;
  transform: rotateY(90deg) translateX(250px);
}
.box.second .side2:after {
  background: linear-gradient(to left, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.7));
}
.box.second .side {
  background-image: url(./images/2.jpg);
}

/* Styles for the text content box */
.box.text-content {
  opacity: 0;
  transition: 1s ease opacity;
  font-size: 20px;
  font-family: sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.box-wrapper:hover .text-content {
  opacity: 1;
}

.box-name {
  margin-bottom: 20px;
  text-align: center;
  font-size: 25px;
  font-family: sans-serif;
}
