@import url("https://fonts.googleapis.com/css2?family=Inter:wght@500&family=Poppins:wght@400&family=Rubik&display=swap");

:root {
  --bg-color: #081b29;
  --cover-color: linear-gradient(45deg, #00abf0, #006e9a);
}

* {
  margin: 0px;
  padding: 0px;
}

body {
  font-family: "Poppin", sans-serif;
  background-color: var(--bg-color);
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Poppins", sans-serif;
}

.book {
  width: 400px;
  height: 600px;
  position: relative;
  transition-duration: 1s;
  perspective: 1500;
}

input {
  display: none;
}

.cover,
.back-cover {
  background: var(--cover-color);
  width: 100%;
  height: 100%;
  border-radius: 0 15px 15px 0;
  box-shadow: 0 0 5px rgb(41, 41, 41);
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center left;
}

.cover {
  position: absolute;
  z-index: 4;
  transition: transform 1s;
}

.cover img {
  border-radius: 0 15px 15px 0;
  width: 100%;
  height: 100%;
}

.cover label {
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.back-cover {
  position: relative;
  z-index: -1;
}

.backcover-page {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 0 15px 15px 0;
  background: var(--cover-color);
  top: 0;
  opacity: 0;
  transition: 0.8s;
}

.page {
  position: absolute;
  background-color: white;
  width: 390px;
  height: 580px;
  border-radius: 0 15px 15px 0;
  margin-top: 10px;
  transform-origin: left;
  transform-style: preserve-3d;
  transform: rotateY(0deg);
  transition-duration: 1.5s;
}

.page img {
  width: 100%;
  height: 100%;
  border-radius: 15px 0 0 15px;
}

.front-page {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  box-sizing: border-box;
}

.back-page {
  transform: rotateY(180deg);
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  z-index: 99;
}

.content {
  padding: 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.content p {
  text-align: justify;
  padding-top: 20px;
  font-size: 14px;
}

.content .img {
  height: 200px;
  width: 270px;
  position: relative;
}

.content .img img {
  position: absolute;
  height: 100%;
  width: 100%;
}

.next,
.prev {
  position: absolute;
  bottom: 1em;
  cursor: pointer;
}

.next {
  right: 1em;
  color: gray;
}

.prev {
  left: 1em;
  color: gray;
}

#page1 {
  z-index: 3;
}

#page2 {
  z-index: 2;
}

#page3 {
  z-index: 1;
}

#page4 {
  z-index: 0;
}

#checkbox-cover:checked ~ .book {
  transform: translateX(200px);
}

#checkbox-cover:checked ~ .book .cover {
  transition: transform 1.5s, z-index 0.5s 0.5s;
  transform: rotateY(-180deg);
  z-index: 1;
}

#checkbox-cover:checked ~ .book .cover .backcover-page {
  opacity: 1;
}

#checkbox-cover:checked ~ .book .page {
  box-shadow: 0 0 3px rgb(99, 98, 98);
}

#checkbox-page1:checked ~ .book #page1 {
  transform: rotateY(-180deg);
  z-index: 2;
}

#checkbox-page2:checked ~ .book #page2 {
  transform: rotateY(-180deg);
  z-index: 3;
}

#checkbox-page3:checked ~ .book #page3 {
  transform: rotateY(-180deg);
  z-index: 4;
}

#checkbox-page4:checked ~ .book #page4 {
  transform: rotateY(-180deg);
  z-index: 5;
}

.last-img {
  margin-top: 132px;
}

@media (max-width: 992px) {
  .book {
    width: 340px;
    height: 510px;
  }

  .page {
    width: 329px;
    height: 491px;
  }

  #checkbox-cover:checked ~ .book {
    transform: translateX(170px);
  }

  .content {
    padding: 15px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .content h1 {
    font-size: 1.5rem;
  }

  .content p {
    font-size: 0.83rem;
  }

  .content .img {
    height: 158px;
    width: 224px;
  }

  .next,
  .prev {
    bottom: 1em;
  }

  .last-img {
    margin-top: 120px;
  }
}

@media (max-width: 768px) {
  .book {
    width: 286px;
    height: 460px;
  }

  .page {
    width: 275px;
    height: 441px;
  }

  #checkbox-cover:checked ~ .book {
    transform: translateX(147px);
  }

  .content {
    padding: 15px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .content h1 {
    font-size: 1.3rem;
  }

  .content p {
    font-size: 0.7rem;
  }

  .content .img {
    height: 143px;
    width: 194px;
  }

  .next,
  .prev {
    bottom: 0.9em;
    font-size: 15px;
  }

  .last-img {
    margin-top: 100px;
  }
}

@media (max-width: 576px) {
  .book {
    width: 190px;
    height: 300px;
  }

  .page {
    margin-top: 7px;
    width: 182px;
    height: 284px;
  }

  #checkbox-cover:checked ~ .book {
    transform: translateX(97px);
  }

  .content h1 {
    font-size: 14px;
  }

  .content p {
    padding-top: 5px;
    font-size: 0.48rem;
  }

  .content .img {
    height: 84px;
    width: 100px;
    position: relative;
  }

  .next,
  .prev {
    bottom: 0.9em;
    font-size: 10px;
  }

  .last-img {
    margin-top: 60px;
  }
}
