/* ===== RESET ===== */
* {
  box-sizing: border-box;
}

/* ===== PAGE ===== */
body {
  margin: 0;
  background: radial-gradient(circle at center, #2a2a2a, #0b0b0b);
  font-family: Arial, sans-serif;
  color: white;
}

/* ===== HEADER ===== */
.topbar {
  height: 50px;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-bottom: 2px solid #7c4dff;
}

.topbar a {
  position: absolute;
  left: 15px;
  color: #7c4dff;
  text-decoration: none;
}

/* ===== STAGE ===== */
.stage {
  height: calc(100vh - 50px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

/* ===== BOOK ===== */
.book {
  display: flex;
  align-items: stretch;
  background: transparent;
  padding: 40px;
  border-radius: 12px;
  box-shadow:
    0 40px 80px rgba(0,0,0,0.8);
}

/* ===== SPINE ===== */
.spine {
  width: 22px;
  background: linear-gradient(
    to right,
    #050505,
    #222,
    #050505
  );
}

/* ===== PAGES ===== */
.page {
  width: 320px;
  aspect-ratio: 2 / 3;
  background: white;
  overflow: hidden;
  position: relative;
  box-shadow:
    0 0 0 1px #111,
    0 20px 40px rgba(0,0,0,0.7);
}

.page img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== NAV ===== */
.nav {
  background: none;
  border: none;
  color: #7c4dff;
  font-size: 32px;
  cursor: pointer;
}

.nav:hover {
  text-shadow: 0 0 10px #7c4dff;
}

/* ===== FLIP EFFECT ===== */
.right.flip {
  animation: flip 0.8s cubic-bezier(.25,.8,.25,1);
  transform-origin: left center;
}

@keyframes flip {
  0% {
    transform: rotateY(0deg);
  }
  50% {
    transform: rotateY(-90deg);
  }
  100% {
    transform: rotateY(-180deg);
  }
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  .left,
  .spine {
    display: none;
  }

  .page {
    width: 90vw;
  }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  .right.flip {
    animation: none;
    transform: none;
  }
}
