* {
    scroll-behavior: smooth;
}

html {
    overflow-x: hidden;
}

a {
    text-decoration: none;
}

.bookshelf {
  width: 100%;
  height: 320px;
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  background-color: #3a3028;
}

.book {
  width: 50px;
  height: 280px;
  position: relative;
  margin-left: 5px;
  top: 30px;
  transform-style: preserve-3d;
  transform: translateZ(0) rotateY(0);
  transition: transform 1s;
}

.side {
  position: absolute;
  border: 2px solid black;
  border-radius: 3px;
  font-weight: bold;
  color: black;
  text-align: center;
  transform-origin: center left;
}

.spine {
  position: relative;
  width: 50px;
  height: 280px;
  /* Patterns from: https://projects.verou.me/css3patterns/ */
  background-color: #2A2935;
  transform: rotateY(0deg) translateZ(0px);
}

.spine-title {
  margin: 2px;
  position: absolute;
  top: 5px;
  left: 0px;
  font-size: 15px;
  color: gold;
  writing-mode: vertical-rl;
  text-orientation: sideways;
}

.spine-author {
  position: absolute;
  color: goldenrod;
  bottom: 0px;
  left: 0%; /* no idea why 20% centers it */
  font-size: 10px;    
}

.top {
  width: 50px;
  height: 190px;
  top: -2px;  /* hmm, why -2 and not 0? */
  background-image: linear-gradient(90deg, white 90%, gray 10%);
  background-size: 5px 5px;
  transform: rotateX(90deg) translateZ(95px) translateY(-95px);
}

.cover {
  width: 190px;
  height: 280px;
  top: 0px;
  background-image: url("../RESOURCES/LIBRARY/cover-book.jpg");
  background-size: contain;
  background-repeat: round;
  left: 50px;
  transform: rotateY(90deg) translateZ(0);
  transition: transform 1s;
}

.book:hover {
  z-index: 1;
  transform: rotateX(-25deg) rotateY(-40deg) rotateZ(-15deg) translateY(50px)
    translateX(-30px);
}

@import url('https://fonts.googleapis.com/css?family=Cormorant+Garamond:300,400,600|Tulpen+One&display=swap');

:root {
  /* colors */
  --body-bg: #FAFAFA;
  --page-bg: #F5F5F5;
  --dark-text: #2A2935;
  
  /* spacing */
  /* this is what defines the global scale */
  --baseline: 12px;
  
  /* fonts */
  --book-title: 'Tulpen One', sans-serif;
  --title: 'Cormorant Garamond', serif;
  --body: 'Cormorant Garamond', serif;
  --base-size: var(--baseline) * 1.2;
}

* {
  box-sizing: border-box;
}

body {
  background-color: #2A2935;
  color: #fff;
  font-family: "MedievalSharp", cursive;
  font-weight: 400;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.cover-inner {
  width: calc(var(--baseline) * 60);
  height: calc(var(--baseline) * 42.6);
  box-shadow: 0 0 100px rgba(0, 0, 0, .3);
}

.book-inner {
  width: 100%;
  height: 100%;
  display: flex;
  perspective: 1200px;
  
  &__page {
    position: relative;
    width: 50%;
    height: 100%;
    display: grid;
    transform: rotateY(0deg);
    transition: transform 0.9s cubic-bezier(0.645, 0.045, 0.355, 1);
    transform-origin: 0% 0%;
    background-color: var(--page-bg);
    background-image: linear-gradient(90deg, rgba(227,227,227,1) 0%, rgba(247,247,247,0) 18%);
    
    &:nth-of-type(1) {
      background-image: linear-gradient(-90deg, rgba(227,227,227,1) 0%, rgba(247,247,247,0) 18%);
    }

    &--1 {
      cursor: pointer;
      overflow: hidden;
      
      img {
        width: 100%;
        max-width: 100%;
        height: auto;
      }
    }
    
    &--2 {
      position: absolute;
      right: 0;
      pointer-events: none;
      transform-style: preserve-3d;
      background-color: var(--page-bg);
      background-image: linear-gradient(90deg, rgba(227,227,227,1) 0%, rgba(247,247,247,0) 18%);
    }
    
    &--4 {
      cursor: pointer;
      padding: 0 calc(var(--baseline) * 3);
    }
    
    &-front {
      position: absolute;
      width: 100%;
      height: 100%;
      transform: rotateY(0deg) translateZ(1px);
    }
    
    &-back {
      position: absolute;
      width: 100%;
      height: 100%;
      padding: 0 calc(var(--baseline) * 1.8);
      transform: rotateY(180deg) translateZ(1px);
    }
    
    .page__content {
      padding: var(--baseline);
      height: 100%;
      position: relative;
      text-align: center;
      
      &-book-title {
        font-family: var(--book-title);
        font-size: calc(var(--base-size) * 3);
        font-weight: bold;
        text-transform: uppercase;
        letter-spacing: 3px;
        color: var(--dark-text);
        margin-top: calc(var(--baseline) * 5);
        margin-bottom: calc(var(--baseline) * 2);
      }
      
      &-author {
        font-family: var(--title);
        font-size: calc(var(--base-size) * 1.2);
        font-weight: 100;
        text-transform: uppercase;
        color: var(--dark-text);
        border-top: 1px solid var(--dark-text);
        border-bottom: 1px solid var(--dark-text);
        display: inline-block;
        padding: calc(var(--baseline) / 2) calc(var(--baseline) / 5);
        margin-bottom: calc(var(--baseline) * 6);
      }
      
      &-credits {
        font-family: var(--title);
        text-transform: uppercase;
        font-size: calc(var(--base-size) * 0.8);
        margin-bottom: calc(var(--baseline) * 2);
        letter-spacing: 1px;
        
        span {
          display: block;
          font-size: calc(var(--base-size) * 1.2);
          letter-spacing: 0;
        }
      }
      
      &-copyright {
        position: absolute;
        width: calc(100% - (var(--baseline) * 2));
        bottom: calc(var(--baseline) * 2);
        font-family: var(--title);
        font-size: calc(var(--base-size) * 0.8);
        text-transform: uppercase;
      }
      
      &-title {
        font-family: var(--title);
        font-size: calc(var(--base-size) * 1);
        text-transform: uppercase;
        letter-spacing: 1px;
        margin-top: calc(var(--baseline) * 5);
        margin-bottom: calc(var(--baseline) * 3);
      }
      
      &-table {
        width: 100%;
        margin-top: calc(var(--baseline) * 2);
        
        td {
          font-family: var(--title);
          font-size: calc(var(--base-size) * 1);
          padding-bottom: calc(var(--baseline) * 1.5);
          text-transform: uppercase;
        }
      }
      
      &-blockquote {
        margin-bottom: calc(var(--baseline) * 2);
      }
      
      &-blockquote-text {
        font-family: var(--title);
        font-size: calc(var(--base-size) * 0.67);
        font-style: italic;
        text-align: justify;
      }
      
      &-blockquote-reference {
        font-family: var(--title);
        font-size: calc(var(--base-size) * 0.7);
        margin-top: calc(var(--baseline) * 0.3);
        float: right;
        text-transform: uppercase;
      }
      
      &-text {
        font-family: var(--title);
        font-size: calc(var(--base-size) * 0.67);
        text-align: justify;
        text-indent: var(--baseline);
      }
    }
    .page__number {
      position: absolute;
      bottom: var(--baseline);
      width: calc(100% - (var(--baseline) * 2));
      font-family: var(--title);
      font-size: calc(var(--base-size) * 0.67);
      text-align: center;
    }
  }
  
  input[type="radio"] {
    display: none;
    
    &:checked+.book__page {
      transition: transform 0.9s cubic-bezier(0.645, 0.045, 0.355, 1);
      transform: rotateY(-180deg);
    }
  }
}

.library-wrapper {
  z-index: 10;
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.library-wrapper h1 {
  text-shadow: rgba(219, 224, 255, 0.9) 0px 0px 18px;
}

/* Initial Entrance Buttons */
.library-entrance {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  z-index: 10; 
}

.library-entrance button {
  width: 250px;
  height: 400px;
  border: none;
  border-radius: 14px;
  background-size: cover;
  background-position: center;
  margin: 10px;
  padding: 10px 20px;
  font-size: 16px;
  cursor: pointer;
  color: #fff;
  font-family: "MedievalSharp", cursive;
  font-weight: 400;
  text-shadow: rgba(163,175,255,0.9) 0px 0px 18px;
  transition: all 0.3s ease;
}

.library-entrance button:hover {
  transform: scale(1.05);
  box-shadow: 0px 0px 15px 5px rgba(163,175,255,0.7);
}

/* Button images */
.hist-entrance {
  background-image: url('../RESOURCES/IMAGES/door1.jpg');
}

.sci-entrance {
  background-image: url('../RESOURCES/IMAGES/door2.jpg');
}

.tech-entrance {
  background-image: url('../RESOURCES/IMAGES/door3.jpg');
}

.background {
  background-image: url("../RESOURCES/LIBRARY/BACKGROUNDS/librarybkg.jpg");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  height: 100vh;
  width: 100vw;
  z-index: 0;
  position: fixed;
  top: 0;
  left: 0;
  opacity: 0.5;
  
}

.hist-section {
  display: none;
  
}


.math-section {
  display: none;
}


.sci-section {
  display: none;
}

.go-back {
  margin-top: 20px;
  padding: 10px 20px;
  background-color: #444;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-family: "MedievalSharp", cursive;
  font-size: 16px;
  cursor: pointer;
  text-shadow: rgba(163, 175, 255, 0.9) 0px 0px 10px;
}

.go-back:hover {
  background-color: #666;
}
