/* E-profile viewer */
.profile-body { background: radial-gradient(120% 100% at 50% 0%, #16294F, var(--midnight) 60%); min-height: 100vh; color: #fff; }
.profile-body .site-header { position: relative; }
.viewer { width: min(1240px, 100% - 2rem); margin: 0 auto; padding: 1.5rem 0 3rem; }
.hint { text-align: center; color: rgba(255, 255, 255, .6); font-size: var(--fs-sm); margin: 0 0 1rem; }

.book-stage { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; gap: .75rem; }
.turn { width: 52px; height: 52px; border-radius: 50%; border: 1.5px solid rgba(201, 162, 74, .6); background: rgba(255, 255, 255, .04); color: var(--gold-light); cursor: pointer; display: grid; place-items: center; transition: background .15s, transform .15s; }
.turn:hover { background: rgba(201, 162, 74, .18); }
.turn:disabled { opacity: .25; cursor: default; }
.turn svg { width: 24px; height: 24px; }
html[dir="rtl"] .turn svg { transform: scaleX(-1); }

.book { position: relative; display: grid; grid-template-columns: 1fr 1fr; perspective: 2600px; filter: drop-shadow(0 30px 40px rgba(0, 0, 0, .55)); }
html[dir="rtl"] .book { transform: scaleX(-1); }
html[dir="rtl"] .book img { transform: scaleX(-1); }
.page-slot { aspect-ratio: 937 / 668; background: transparent; position: relative; overflow: hidden; }
.page-slot img, .face img { width: 100%; height: 100%; object-fit: cover; display: block; background: #fff; }
.page-slot.left img { border-radius: 10px 0 0 10px; }
.page-slot.right img { border-radius: 0 10px 10px 0; }
.page-slot.left::after, .page-slot.right::after { content: ""; position: absolute; top: 0; bottom: 0; width: 60px; pointer-events: none; }
.page-slot.left::after { right: 0; background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .18)); }
.page-slot.right::after { left: 0; background: linear-gradient(270deg, transparent, rgba(0, 0, 0, .18)); }
.page-slot:empty::after { display: none; }

/* The turning leaf */
.leaf { position: absolute; top: 0; bottom: 0; width: 50%; transform-style: preserve-3d; display: none; pointer-events: none; }
.leaf.on { display: block; }
.leaf.next { left: 50%; transform-origin: left center; }
.leaf.prev { left: 0; transform-origin: right center; }
.leaf .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.leaf .face.back { transform: rotateY(180deg); }
.leaf.next .face.front img { border-radius: 0 10px 10px 0; } .leaf.next .face.back img { border-radius: 10px 0 0 10px; }
.leaf.prev .face.front img { border-radius: 10px 0 0 10px; } .leaf.prev .face.back img { border-radius: 0 10px 10px 0; }
.leaf.animate { transition: transform .9s cubic-bezier(.4, .05, .3, 1); }
.leaf.next.animate { transform: rotateY(-180deg); }
.leaf.prev.animate { transform: rotateY(180deg); }

.toolbar { display: flex; justify-content: center; align-items: center; gap: .75rem; margin-top: 1.25rem; }
.counter { color: var(--gold-light); font-weight: 700; min-width: 5rem; text-align: center; }
.tool { padding: .45rem 1rem; border-radius: var(--r-pill); border: 1px solid rgba(255, 255, 255, .3); background: transparent; color: #fff; font-size: var(--fs-xs); font-weight: 600; cursor: pointer; text-decoration: none !important; }
.tool:hover { background: rgba(255, 255, 255, .1); }

.thumbs { display: flex; gap: .6rem; overflow-x: auto; padding: 1.25rem .25rem .5rem; scrollbar-width: thin; }
.thumbs button { flex: none; position: relative; border: 2px solid transparent; border-radius: 6px; padding: 0; background: none; cursor: pointer; opacity: .6; transition: opacity .15s, border-color .15s; }
.thumbs button img { width: 120px; height: 86px; object-fit: cover; border-radius: 4px; display: block; }
.thumbs button span { position: absolute; inset-inline-end: 4px; bottom: 4px; background: var(--crimson); color: #fff; font-size: .65rem; font-weight: 800; padding: 0 .4rem; border-radius: 4px; }
.thumbs button:hover, .thumbs button.cur { opacity: 1; border-color: var(--gold); }

/* single-page mode */
@media (max-width: 760px) {
  .book-stage { grid-template-columns: 40px 1fr 40px; gap: .4rem; }
  .turn { width: 40px; height: 40px; }
  .book { grid-template-columns: 1fr; }
  .page-slot.left, .leaf { display: none !important; }
  .page-slot.right img, .page-slot.left img { border-radius: 10px; }
  .page-slot::after { display: none; }
  .page-slot.right img { transition: opacity .25s; }
}
.viewer:fullscreen { background: var(--midnight); padding: 2rem; width: 100%; max-width: none; overflow: auto; }
