@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&family=Playfair+Display:ital,wght@0,700;1,400&display=swap");

/* Makes sizing easier to control */
* {
  box-sizing: border-box;
}


/* Background behind the book */
body {
  margin: 0;
  padding: 2rem;

  background-color: #32174d;

  background-image: repeating-linear-gradient(
    120deg,
    #32174d 0,
    #32174d 3rem,
    #4a214e 3rem,
    #4a214e 4.5rem,
    #32174d 4.5rem,
    #32174d 7rem
  );

  background-attachment: fixed;

  color: #2f1820;
  font-family: "Open Sans", sans-serif;
  line-height: 1.6;
}


/* entire storybook */
.book {
  width: 100%;
  max-width: 70rem;
  margin: 0 auto;
}


/* Book cover */
.book-cover {
  max-width: 50rem;
  margin: 0 auto 3rem;
  padding: 2.5rem;
  text-align: center;
  background-color: #f5e6c8;
  border: 0.25rem solid #d4a437;
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.45);
}


/* Main title */
h1 {
  margin: 0;
  color: #32174d;
  font-family: "Playfair Display", serif;
  font-size: 3rem;
  line-height: 1.2;
}


/* Subtitle */
.subtitle {
  margin: 0.75rem 0;
  color: #5c1018;
  font-family: "Playfair Display", serif;
  font-size: 1.5rem;
  font-style: italic;
}


/* Author information */
.author {
  margin: 0 0 1.5rem;
  color: #2f1820;
  font-size: 1rem;
}


/* Image on the cover */
.book-cover img {
  width: 100%;
  height: auto;
  display: block;
  border: 0.2rem solid #d4a437;
}


/* Adds space between the book spreads */
main {
  display: grid;
  gap: 3rem;
}


/* Holds two book pages beside each other */
.book-spread {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.45);
}


/* Individual book page */
.book-page {
  position: relative;
  min-height: 34rem;
  padding: 2.5rem 2.5rem 4rem;
  background-color: #f5e6c8;
  border: 0.1rem solid #d4a437;
}


/* Shadow on the inside of the left page */
.book-page:first-child {
  box-shadow: inset -1.5rem 0 2rem -1.2rem rgba(0, 0, 0, 0.8);
}

/* Shadow on the inside of the right page */
.book-page:last-child {
  box-shadow: inset 1.5rem 0 2rem -1.2rem rgba(0, 0, 0, 0.8);
}

/* Story section headings */
h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: #5c1018;
  font-family: "Playfair Display", serif;
  font-size: 2rem;
  line-height: 1.2;
  text-align: center;
}


/* Gold decoration below every section heading */
h2::after {
  content: "— ⚜ —";
  display: block;
  margin-top: 0.5rem;
  color: #d4a437;
  font-size: 1.2rem;
}


/* Regular story paragraphs */
.book-page p {
  margin-top: 0;
  font-size: 1rem;
}


/* Large first letter at the beginning of text pages */
.book-page > p:not(.page-number):not(.image-caption):first-of-type::first-letter {
  float: left;
  margin-right: 0.4rem;
  color: #5c1018;
  font-family: "Playfair Display", serif;
  font-size: 3rem;
  font-weight: bold;
  line-height: 0.9;
}


/* All images inside the book pages */
.book-page img {
  width: 100%;
  height: auto;
  display: block;
  border: 0.2rem solid #d4a437;
}


/* Pages that mainly contain an image */
.image-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
}


/* Captions underneath images */
.image-caption {
  margin: 1rem 0 0;
  color: #5c1018;
  font-family: "Playfair Display", serif;
  font-size: 1.1rem;
  font-style: italic;
  text-align: center;
}


/* Page numbers */
.page-number {
  position: absolute;
  right: 0;
  bottom: 0.75rem;
  left: 0;
  margin: 0;
  color: #5c1018;
  font-family: "Playfair Display", serif;
  text-align: center;
}


/* question on the final page */
.final-question {
  margin-top: 1.5rem;
  color: #5c1018;
  font-family: "Playfair Display", serif;
  font-size: 1.4rem;
  font-style: italic;
  font-weight: bold;
  text-align: center;
}


/* Footer */
footer {
  max-width: 50rem;
  margin: 3rem auto 0;
  padding: 1.5rem;
  text-align: center;
  background-color: #32174d;
  border: 0.15rem solid #d4a437;
  color: #f5e6c8;
}


/* Removing extra space above footer text */
footer p {
  margin-top: 0;
}


/* Project Gutenberg link */
footer a {
  color: #d4a437;
}


/* Link color when the mouse is over it */
footer a:hover {
  color: #f5e6c8;
}


/* Changes the book layout for smaller screens */
@media (max-width: 48rem) {

  body {
    padding: 1rem;
  }

  .book-cover {
    padding: 1.5rem;
  }

  h1 {
    font-size: 2.2rem;
  }

  .subtitle {
    font-size: 1.25rem;
  }

  /* Places each page underneath the previous page */
  .book-spread {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    box-shadow: none;
  }

  .book-page {
    min-height: auto;
    padding: 2rem 1.5rem 4rem;
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.4);
  }


  h2 {
    font-size: 1.7rem;
  }
}

/* Choices that lead to the next stories */
.story-choices {
  max-width: 50rem;
  margin: 0 auto;
  padding: 2rem;
  text-align: center;
  background-color: #f5e6c8;
  border: 0.2rem solid #d4a437;
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.45);
}


/* Makes each choice look like a storybook button */
.story-choices a {
  display: block;
  margin: 1rem 0;
  padding: 1rem;

  background-color: #32174d;
  border: 0.15rem solid #d4a437;

  color: #f5e6c8;
  font-family: "Playfair Display", serif;
  font-size: 1.1rem;
  text-decoration: none;
}


