/* Load after style.css. Existing decorative DOM only; no brand/image rules.
   Driver: --book-turn = 0..1; --book-drift = an angle (for example 1.2deg). */
.backdrop > .book {
  --book-turn: 0;
  --book-drift: 0deg;
  width: min(60vw, 900px);
  height: auto;
  aspect-ratio: 1.48;
  top: 21vh;
  right: -2vw;
  opacity: 1;
  transform: perspective(1600px) rotateX(29deg) rotateY(-13deg)
    rotateZ(calc(-18deg + var(--book-drift, 0deg)));
  transform-style: preserve-3d;
  filter: none;
}
/* The veil keeps the reading column quiet. The far-right fore edge stays lit. */
.backdrop::after {
  background: linear-gradient(90deg, #111310 0%, #111310fa 32%,
    #111310e8 49%, #111310b3 65%, #11131059 86%, #11131069);
}
.backdrop > .book::before,
.backdrop > .book::after {
  content: '';
  position: absolute;
  top: -1.8%;
  width: 50.8%;
  height: 104%;
  border: 1px solid #ac8b53;
  border-radius: 3px 9px 12px 3px;
  background: linear-gradient(110deg, #413c2c, #171d18 45%, #31372a);
  box-shadow: inset 0 0 0 6px #1d241c, inset 0 0 0 7px #a88b4955,
    0 13px 0 -3px #151b16, 0 15px 0 -3px #8a7147,
    0 36px 60px #0009;
  transform: translateZ(-13px) rotateY(-5deg);
}
.backdrop > .book::before {
  left: -.9%;
  transform-origin: right center;
  transform: translateZ(-13px) rotateY(9deg);
  border-radius: 9px 3px 3px 12px;
}
.backdrop > .book::after { left: 50%; transform-origin: left center; }
.backdrop > .book > .cover {
  inset: 1% 1.1% 0;
  width: 97.8%;
  height: 100%;
  border: 0;
  border-radius: 5px 7px 12px 9px;
  background: linear-gradient(90deg, #9a8965, #d4c5a0 43%, #2c2a20 49.5%,
    #272a20 50.5%, #d5c49e 58%, #a58e63);
  box-shadow: 0 2px 0 #837555, 0 4px 0 #c5b58d, 0 6px 0 #75694d,
    0 8px 0 #b8a782, 0 10px 0 #665d45, 0 12px 0 #ad996c;
  transform: translateZ(-7px);
}
.backdrop > .book > .leaf {
  top: 0;
  width: 49%;
  height: 98%;
  border: 1px solid #cfbb8a88;
  box-shadow: 0 3px 3px #0005;
  backface-visibility: visible;
  border-radius: 2px 8px 12px 2px;
  background: linear-gradient(90deg, #5a513b 0%, #b8a77e 5%,
    #d2c4a2 15%, #dfd2b0 48%, #bca982 96%, #e3d3aa);
}
.backdrop > .book > .leaf::after {
  inset: 13% 13% 15% 15%;
  border-top: 1px solid #77613a60;
  border-bottom: 1px solid #77613a40;
  opacity: .52;
  background: repeating-linear-gradient(180deg, transparent 0 13px,
    #695b3e55 13px 14px, transparent 14px 20px);
  /* Dense, understated ink texture, not a giant ruled geometric panel. */
  mask-image: linear-gradient(90deg, #000 0 75%, transparent 96%);
}
.backdrop > .book > .leaf-one {
  left: 1%;
  transform-origin: right center;
  transform: translateZ(1px) rotateY(9deg);
  border-radius: 8px 2px 2px 12px;
  background: linear-gradient(90deg, #c5b38b, #e0d2ae 35%, #c8b58d 83%, #514b37);
}
.backdrop > .book > .leaf-two {
  left: 50%;
  transform-origin: left center;
  transform: translateZ(1px) rotateY(-5deg);
}
.backdrop > .book > .leaf-three {
  left: 50%;
  transform-origin: left center;
  transform: translateZ(3px) rotateY(calc(-5deg - var(--book-turn, 0) * 170deg));
  background: linear-gradient(90deg, #746548, #d9cbaa 12%, #e5d8b8 65%, #c5b28b);
  box-shadow: 4px 9px 18px #0005, inset 6px 0 15px #5f513d44;
}
.backdrop > .book > .spine {
  left: calc(50% - 4px);
  top: 0;
  width: 8px;
  height: 99%;
  border-radius: 50%;
  background: linear-gradient(90deg, #1b2118, #6a5a3b 35%, #c6a369 51%, #373a29 75%, #151b15);
  box-shadow: -8px 0 15px #181c1680, 8px 0 15px #181c1680;
  transform: translateZ(4px);
}
@media (max-width: 1000px) {
  .backdrop > .book { width: 80vw; right: -17vw; top: 29vh; }
}
@media (max-width: 700px) {
  .backdrop > .book { width: 92vw; right: -2vw; top: 19vh; }
  .backdrop::after {
    background: linear-gradient(90deg, #111310fc, #111310f5 48%, #111310dc 76%, #111310b0);
  }
}
/* No forced 3D animation, drift, or turning when reduced motion is requested. */
@media (prefers-reduced-motion: reduce) {
  .backdrop > .book {
    transform: perspective(1600px) rotateX(29deg) rotateY(-13deg) rotateZ(-18deg) !important;
    animation: none !important;
    transition: none !important;
  }
  .backdrop > .book > .leaf-three {
    transform: translateZ(3px) rotateY(-7deg) !important;
    animation: none !important;
    transition: none !important;
  }
}
@media print { .backdrop { display: none !important; } }
