/* Aya Yahya v5 (15/11/2026): «نهاوند» book reader (see assets/js/book.js). Stage = the site's dark studio navy, paper pages, one wine accent. */
.rd { position: fixed; inset: 0; z-index: 420; display: flex; flex-direction: column; background: radial-gradient(120% 90% at 50% 45%, #1d1e2c 0%, var(--stage) 55%, var(--stage-2) 100%); color: #f4f1ec; opacity: 0; transition: opacity .34s var(--ease); overscroll-behavior: contain; }
.rd[hidden] { display: none; }
.rd.is-open { opacity: 1; }
html.rd-open, html.rd-open body { overflow: hidden; }
.rd__top, .rd__bot { position: relative; z-index: 3; display: flex; align-items: center; gap: 12px; padding: 10px clamp(12px, 3vw, 28px); }
.rd__top { padding-top: calc(10px + env(safe-area-inset-top)); justify-content: space-between; }
.rd__bot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); justify-content: center; }
.rd__title { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.rd__title b { font-family: var(--serif); font-size: 22px; font-weight: 700; }
.rd__title span { font-size: 12.5px; color: rgba(244, 241, 236, .62); }
.rd__tools { display: flex; align-items: center; gap: 8px; }
.rd__ic { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(244, 241, 236, .18); background: rgba(244, 241, 236, .06); color: #f4f1ec; transition: background .2s, transform .2s; }
.rd__ic:hover { background: rgba(244, 241, 236, .16); }
.rd__ic:active { transform: scale(.94); }
.rd__ic:focus-visible, .rd__nav:focus-visible, .rd__range:focus-visible { outline: 2px solid var(--pink); outline-offset: 3px; }
.rd__ic svg { width: 19px; height: 19px; }
.rd__x { background: #f4f1ec; color: var(--ink); border-color: transparent; }
.rd__x:hover { background: #fff; }
.rd__num { min-width: 92px; text-align: center; font-size: 14px; font-variant-numeric: tabular-nums; color: rgba(244, 241, 236, .82); direction: ltr; }
.rd__range { width: min(520px, 62vw); accent-color: var(--acc-l); height: 28px; cursor: pointer; }
.rd__stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.rd.is-zoomed .rd__stage { cursor: move; }
.rd__zoom { transform-origin: 50% 50%; transition: transform .25s var(--ease); will-change: transform; }
.rd__book { --pw: 300px; --ph: 444px; position: relative; display: flex; direction: ltr; perspective: 2400px; transition: transform .5s var(--ease); }
.rd__slot { position: relative; width: var(--pw); height: var(--ph); }
.rd__slot--l { display: none; }
.is-spread .rd__slot--l { display: block; }
.is-spread .rd__book.is-closed-r { transform: translateX(calc(var(--pw) / 2)); }
.is-spread .rd__book.is-closed-l { transform: translateX(calc(var(--pw) / -2)); }
.rd__pg { position: absolute; inset: 0; background: #fff center / cover no-repeat; box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .25); overflow: hidden; }
.rd__pg img { width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .25s; -webkit-user-drag: none; pointer-events: none; }
.rd__pg.is-in img { opacity: 1; }
.rd__pg.is-empty { background: transparent; box-shadow: none; }
/* paper gutter shading near the spine */
.rd__slot--r .rd__pg::after, .rd__slot--l .rd__pg::after, .rd__leaf .rd__pg::after { content: ''; position: absolute; inset: 0; pointer-events: none; }
.is-spread .rd__slot--r .rd__pg:not(.is-empty)::after { background: linear-gradient(to right, rgba(0, 0, 0, .16), rgba(0, 0, 0, 0) 7%); }
.is-spread .rd__slot--l .rd__pg:not(.is-empty)::after { background: linear-gradient(to left, rgba(0, 0, 0, .16), rgba(0, 0, 0, 0) 7%); }
.rd__slot--r .rd__pg:not(.is-empty) { border-radius: 0 3px 3px 0; }
.is-spread .rd__slot--l .rd__pg:not(.is-empty) { border-radius: 3px 0 0 3px; }
/* the turning leaf */
.rd__leaf { position: absolute; top: 0; width: var(--pw); height: var(--ph); transform-style: preserve-3d; z-index: 5; will-change: transform; }
.rd__leaf--l { left: 0; transform-origin: 100% 50%; }
.rd__leaf--r { left: var(--pw); transform-origin: 0 50%; }
.rd__leaf--one { left: 0; transform-origin: 100% 50%; }
.rd__leaf .rd__pg { -webkit-backface-visibility: hidden; backface-visibility: hidden; box-shadow: 0 calc(30px * var(--lift, 0)) calc(70px * var(--lift, 0)) -20px rgba(0, 0, 0, .65); }
.rd__leaf .rd__back { transform: rotateY(180deg); }
.rd__leaf .rd__back.is-paper { background: #f3efe8; }
.rd__leaf .rd__back.is-paper::after { background: linear-gradient(to left, rgba(0, 0, 0, .06), transparent 30%); }
.rd__shade { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: linear-gradient(to left, rgba(0, 0, 0, .35), rgba(0, 0, 0, 0) 60%); -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.rd__leaf--r .rd__shade { background: linear-gradient(to right, rgba(0, 0, 0, .35), rgba(0, 0, 0, 0) 60%); }
/* side arrows (desktop) */
.rd__nav { position: absolute; top: 50%; z-index: 4; width: 52px; height: 52px; margin-top: -26px; display: grid; place-items: center; border-radius: 50%; background: rgba(244, 241, 236, .1); border: 1px solid rgba(244, 241, 236, .2); color: #f4f1ec; transition: background .2s, opacity .2s; }
.rd__nav:hover { background: var(--acc); border-color: var(--acc); }
.rd__nav:disabled { opacity: .2; pointer-events: none; }
.rd__nav svg { width: 22px; height: 22px; }
.rd__nav--next { left: clamp(10px, 2.4vw, 32px); }
.rd__nav--prev { right: clamp(10px, 2.4vw, 32px); }
.rd__nav--prev svg { transform: scaleX(-1); }
.rd__hint { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); z-index: 4; font-size: 12.5px; color: rgba(244, 241, 236, .55); white-space: nowrap; pointer-events: none; }
.rd.is-zoomed .rd__hint, .rd.is-zoomed .rd__nav { opacity: 0; pointer-events: none; }
.rd__pdf { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(244, 241, 236, .18); font-size: 13.5px; font-weight: 600; color: #f4f1ec; }
.rd__pdf:hover { background: rgba(244, 241, 236, .12); }
.rd__pdf svg { width: 17px; height: 17px; }
@media (max-width: 859px), (orientation: portrait) {
  .rd__nav { display: none; }
  .rd__pdf span { display: none; }
  .rd__pdf { width: 42px; padding: 0; justify-content: center; }
  .rd__title b { font-size: 19px; }
  .rd__range { width: 100%; }
  .rd__bot { flex-wrap: wrap; gap: 4px 12px; }
  .rd__num { order: -1; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .rd, .rd__zoom, .rd__book { transition: none; } }
/* section button: resume line */
.novel__resume { display: block; margin-top: 10px; font-size: 13.5px; color: rgba(244, 241, 236, .7); }
.novel__resume[hidden] { display: none; }
.novel__pdf { color: rgba(244, 241, 236, .7); text-decoration: underline; text-underline-offset: 4px; font-size: 13.5px; }

/* v10 cover: the real front cover (778x1251, ratio .6219) = page 1, full page height, on the spine side */
.rd__pg.is-cover { left: auto; right: 0; width: calc(var(--ph) * .6219); max-width: 100%; background-color: #d8d1c3; border-radius: 0 3px 3px 0; }
.rd:not(.is-spread) .rd__pg.is-cover { left: 0; right: 0; margin-inline: auto; border-radius: 3px; }
.rd__pg.is-cover img { object-fit: cover; }
