/* RESET */
body {
  margin: 0;
  overflow: hidden;
  font-family: "Comic Sans MS", cursive;
}

/* BACKGROUND */
#background {
  position: fixed;
  inset: 0;
  background: url("1-background.webp") center/cover no-repeat;
  z-index: -10;
}

/* DIARY COVER */
#diary-cover {
  width: 320px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 2;
}

/* BOOK */
#book {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* UNDERLAY (static notebook lines behind pages) */
#underlayer {
  display: flex;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  gap: 0;
  z-index: 0;
}

#underlayer img {
  width: 380px;
  height: 500px; /* match page height */
}

/* PAGE CONTAINER */
#pages {
  display: flex;
  position: relative;
  justify-content: center;
  perspective: 1400px;
  z-index: 2;
}

/* PAGE */
.page {
  position: relative;
  width: 380px;
  height: 500px;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  z-index: 2;
}

/* PAGE IMAGE */
.page-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

/* PAGE CONTENT (text) */
.page-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 48px 44px;
  box-sizing: border-box;
  z-index: 2;
  font-family: "Patrick Hand", "Comic Neue", cursive;
  font-size: 22px;
  letter-spacing: 0.5px;
  line-height: 1.5;
  color: #2e2e2e;
  overflow-wrap: break-word;
}

/* Links */
.page-content a {
  color: #8a8a8a;
  text-decoration: none;
}
.page-content a:hover {
  color: #ff9fcf;
}

/* Buttons */
.page-button {
  position: absolute;
  bottom: 10px;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
}

.left { left: 10px; }
.right { right: 10px; }

/* Page origins */
.left-page { transform-origin: right center; }
.right-page { transform-origin: left center; }

/* Close button — under pages */
#closeDiary {
  position: absolute;
  top: calc(100% + 20px);
  left: 50%;
  transform: translateX(-50%);
  background: none;
  border: none;
  font-size: 14px;
  opacity: 0.6;
  cursor: pointer;
}
