body {
  min-height: 100vh;
  background-color: #333;
  font-family: sans-serif;
  margin: 0;
}

:root {
  --width: min(1000px, 80vw);
  --height: 80vh;
}

.container {
  overflow: clip;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}
.book-container {
  width: var(--width);
  height: var(--height);
  position: relative;
  background: #f0f0f0;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  cursor: grab;
  touch-action: none;
}

.book-container:active {
  cursor: grabbing;
}

.page {
  width: calc(var(--width) / 2);
  height: var(--height);
  position: absolute;
  top: 0;
  padding: 40px;
  box-sizing: border-box;
  background-color: #fff;
  user-select: none;
  background-image: linear-gradient(to left, rgba(0,0,0,0.12) 0%, rgba(0,0,0,0) 8%);
}

/* Internal spine shadows applied directly to the pages */
#left-front, #left-under {
  left: 0;
  background-image: linear-gradient(to left, rgba(0,0,0,0.12) 0%, rgba(0,0,0,0) 8%);
}
#right-front, #right-under {
  left: 50%;
  background-image: linear-gradient(to right, rgba(0,0,0,0.12) 0%, rgba(0,0,0,0) 8%);
  border-left: 1px solid #ddd;
}

.front-page {
  z-index: 2;
}

.flap {
  width: var(--width);
  height: var(--height);
  position: absolute;
  top: 0; left: 0;
  z-index: 5;
  filter: drop-shadow(0px 0px 10px rgba(0,0,0,0.4));
  pointer-events: none;
  display: none;
}

.flap-content {
  width: calc(var(--width) / 2);
  height: var(--height);
  position: absolute;
  top: 0; left: 0;
  padding: 40px;
  box-sizing: border-box;
  background-color: #fdfdfd; 
}

/* The oversized gradient that will track our fold line */
.fold-gradient {
  position: absolute;
  width: calc(var(--width) * 3);
  height: calc(var(--width) * 3);
  left: calc(var(--width) * -1.5);
  top: calc(var(--width) * -1.5);
  /* 50% is the exact middle (the crease). We apply a dark shadow, a bright highlight, and an ambient fade */
  background: linear-gradient(to right, 
    transparent 49.5%, 
    rgba(0,0,0,0.3) 50%, 
    rgba(255,255,255,0.7) 51.5%, 
    rgba(0,0,0,0.05) 58%,
    transparent 65%
  );
}

h2 { margin-top: 0; color: #333; }
p { color: #666; }
.page-number { position: absolute; bottom: 20px; color: #aaa; font-size: 14px; }

#left-front .page-number, #left-under .page-number { left: 20px; }
#right-front .page-number, #right-under .page-number { right: 20px; }

.flap-content.is-left .page-number { left: 20px; right: auto; }
.flap-content.is-right .page-number { right: 20px; left: auto; }