/* Booklet reading pages (/books/...). Loaded only there, on top of page.css. RTL Arabic, long-form reading:
   one comfortable text column, the part's own TOC beside it on wide screens, collapsible above it on phones. */
.book { --ar: "Segoe UI", Tahoma, "Noto Sans Arabic", "Geeza Pro", Arial, sans-serif; font-family: var(--ar); }
.book h1, .book .kick, .book .crumbs ol { letter-spacing: 0; text-transform: none; }
.book .kick { font: 600 14px/1.6 var(--ar); }
.book .kick a { color: inherit; text-decoration: none; border-bottom: 1px dotted currentColor; }
.book h1 { line-height: 1.3; }
.book .crumbs ol { font: 500 13px/1.5 var(--ar); }
.book .crumbs li + li::before { margin: 0 0 0 6px; }
.book .btn { font-family: inherit; }
.book [hidden] { display: none !important; }
.book code { font: .9em/1.4 var(--mono); padding: .1em .35em; border-radius: 4px; background: #15213a; color: var(--cu-hi); unicode-bidi: isolate; }
.book bdi { unicode-bidi: isolate; }

/* cover page */
.bk-meta { margin: -10px 0 24px; color: var(--hx-mute); font-size: 15px; }
.bk-book { justify-self: center; perspective: 1400px; padding: 10px 0 30px; }
.bk-3d { position: relative; width: 250px; height: 350px; transform-style: preserve-3d; transform: rotateY(-24deg) rotateX(4deg);
  transition: transform .8s cubic-bezier(.2, .7, .2, 1); }
.bk-book:hover .bk-3d { transform: rotateY(-8deg) rotateX(2deg); }
.bk-face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 26px 22px 30px; overflow: hidden; border-radius: 3px 8px 8px 3px; text-align: center; color: #fff;
  background: radial-gradient(240px 200px at 70% 18%, rgba(45, 212, 191, .22), transparent 70%), linear-gradient(160deg, #13223f, #0a1222 70%);
  border: 1px solid rgba(240, 178, 122, .35); box-shadow: inset 0 0 0 6px rgba(10, 16, 29, .5), inset 0 0 0 7px rgba(240, 178, 122, .25), 0 30px 60px rgba(0, 0, 0, .45);
  transform: translateZ(14px); }
.bk-traces { position: absolute; inset: 0; width: 100%; height: 100%; color: rgba(201, 138, 82, .45); }
.bk-chip { position: absolute; top: 76px; left: 50%; width: 88px; height: 64px; margin-left: -44px; border-radius: 6px;
  background: linear-gradient(150deg, #24324d, #111a2c); border: 1px solid #33456a; display: grid; place-items: center; box-shadow: 0 0 30px rgba(45, 212, 191, .25); }
.bk-chip b { font: 700 22px/1 var(--mono); color: var(--hx-accent); }
.bk-chip i { position: absolute; width: 8px; height: 3px; background: var(--cu); }
.bk-chip i:nth-child(1) { top: 14px; left: -9px; } .bk-chip i:nth-child(2) { top: 30px; left: -9px; } .bk-chip i:nth-child(3) { top: 46px; left: -9px; }
.bk-chip i:nth-child(4) { top: 14px; right: -9px; } .bk-chip i:nth-child(5) { top: 30px; right: -9px; } .bk-chip i:nth-child(6) { top: 46px; right: -9px; }
.bk-ttl { position: relative; font: 800 30px/1.25 var(--ar); }
.bk-stt { position: relative; font-size: 14px; color: var(--hx-soft); }
.bk-by { position: relative; margin-top: 14px; padding-top: 10px; border-top: 1px solid rgba(240, 178, 122, .4); font-size: 13px; color: var(--cu-hi); }
.bk-spine { position: absolute; top: 0; bottom: 0; right: 100%; width: 28px; transform-origin: right; transform: rotateY(-90deg) translateX(14px);
  background: linear-gradient(90deg, #8a5a32, #c98a52 50%, #8a5a32); border-radius: 3px 0 0 3px; }
.bk-pages { position: absolute; top: 4px; bottom: 4px; left: 100%; width: 26px; transform-origin: left; transform: rotateY(90deg) translateX(-12px);
  background: repeating-linear-gradient(90deg, #e9e2d4 0 2px, #cfc6b4 2px 3px); }
@media (max-width: 900px) { .bk-book { order: -1; padding: 0; } .bk-3d { width: 190px; height: 266px; } .bk-ttl { font-size: 22px; } .bk-stt { font-size: 12.5px; } .bk-face { padding: 18px 16px 22px; } .bk-chip { top: 26px; transform: scale(.62); } }
@media (prefers-reduced-motion: reduce) { .bk-3d { transition: none; transform: none; } .bk-book:hover .bk-3d { transform: none; } }

.bk-front { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; padding-top: 64px; padding-bottom: 80px; }
.bk-front h2 { margin: 0 0 20px; font-size: 26px; }
@media (max-width: 900px) { .bk-front { grid-template-columns: 1fr; gap: 40px; padding-top: 44px; } }
.bk-parts { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--hx-line); }
.bk-parts a { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 4px;
  border-bottom: 1px solid var(--hx-line); color: var(--hx-ink); text-decoration: none; transition: background-color .2s; }
.bk-parts a:hover { background: rgba(45, 212, 191, .05); color: var(--hx-ink); }
.bk-parts a:hover b { color: var(--hx-accent); }
.bk-no { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid #2a3a57; border-radius: 6px; font: 700 14px/1 var(--mono); color: var(--cu-hi); }
.bk-pt { display: flex; flex-direction: column; gap: 2px; }
.bk-pt small { font-size: 12px; color: var(--hx-mute); }
.bk-pt b { font-size: 17px; line-height: 1.5; transition: color .2s; }
.bk-sub { font-size: 13px; line-height: 1.6; color: var(--hx-mute); }
.bk-min { font-size: 13px; color: var(--hx-mute); white-space: nowrap; padding-top: 6px; }

/* part page */
.bk-progress { position: fixed; top: 0; right: 0; left: 0; z-index: 40; height: 3px; pointer-events: none; }
.bk-progress span { display: block; height: 100%; width: 100%; background: linear-gradient(270deg, var(--hx-accent), var(--cu-hi));
  transform-origin: right; transform: scaleX(var(--p, 0)); }
.bk-head .wrap { position: relative; padding-top: 28px; padding-bottom: 40px; }
.bk-head h1 { max-width: 860px; font-size: clamp(30px, 4.4vw, 50px); margin: 0; }
.bk-body { display: grid; grid-template-columns: minmax(0, 720px) 260px; justify-content: space-between; gap: 56px; padding-top: 48px; padding-bottom: 40px; }
.bk-side { order: 2; position: sticky; top: 96px; align-self: start; max-height: calc(100vh - 120px); overflow: auto; font-size: 14px; }
.bk-side details { padding: 4px 0 12px; border-bottom: 1px solid var(--hx-line); }
.bk-side details + details { margin-top: 10px; }
.bk-side summary { cursor: pointer; padding: 6px 0; font-weight: 700; color: var(--cu-hi); }
.bk-side ol { margin: 6px 0 0; padding: 0; list-style: none; }
.bk-side li a { display: block; padding: 5px 10px 5px 0; border-right: 2px solid transparent; color: var(--hx-mute); text-decoration: none; line-height: 1.55; }
.bk-side li a:hover, .bk-side li a.on { color: var(--hx-ink); border-right-color: var(--hx-accent); }
.bk-side li a[aria-current] { color: var(--hx-accent); }
@media (max-width: 1000px) {
  .bk-body { grid-template-columns: 1fr; gap: 24px; padding-top: 28px; }
  .bk-side { order: 0; position: static; max-height: none; overflow: visible; }
  .bk-side details { padding: 4px 14px 10px; border: 1px solid var(--hx-line); border-radius: 8px; background: var(--hx-surface); }
}

/* the reading column */
.prose { font-size: 18.5px; line-height: 2; color: #dbe4f0; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.15em; }
.prose h2 { margin: 2.2em 0 .6em; font-size: 26px; line-height: 1.45; color: #fff; }
.prose h3 { margin: 1.8em 0 .5em; font-size: 21px; line-height: 1.5; color: var(--cu-hi); }
.prose h4 { margin: 1.6em 0 .4em; font-size: 18.5px; color: var(--hx-accent); }
.prose ul, .prose ol { margin: 0 0 1.2em; padding: 0 1.4em 0 0; }
.prose li { margin: 0 0 .45em; }
.prose li > ul, .prose li > ol { margin: .45em 0 .2em; }
.prose li::marker { color: var(--cu); }
.prose strong { color: #fff; }
.prose hr { margin: 2.4em auto; width: 80px; border: 0; border-top: 1px solid #2a3a57; }
.prose pre { margin: 0 0 1.4em; padding: 16px 20px; overflow-x: auto; border: 1px solid var(--hx-line); border-radius: 8px; background: #0c1424; text-align: left; }
.prose pre code { padding: 0; background: none; color: #a7f3d0; font-size: 15px; line-height: 1.8; }
@media (max-width: 600px) { .prose { font-size: 17.5px; line-height: 1.95; } .prose h2 { font-size: 22px; } .prose h3 { font-size: 19px; } }

.bk-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding-top: 24px; padding-bottom: 72px; }
.bk-pager a { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; border: 1px solid var(--hx-line); border-radius: 10px;
  background: var(--hx-surface); color: var(--hx-ink); text-decoration: none; transition: border-color .2s, transform .2s; }
.bk-pager a:hover { border-color: var(--cu-hi); transform: translateY(-2px); color: var(--hx-ink); }
.bk-pager small { font-size: 13px; color: var(--cu-hi); }
.bk-pager b { font-size: 17px; line-height: 1.5; }
.bk-next { text-align: left; grid-column: 2; }
@media (max-width: 600px) { .bk-pager { grid-template-columns: 1fr; } .bk-next { grid-column: auto; order: -1; } }
.bk-end { margin-top: -40px; padding-bottom: 80px; color: var(--hx-soft); }
.bk-end p { max-width: 720px; }
@media (prefers-reduced-motion: reduce) { .bk-pager a, .bk-parts a { transition: none; } .bk-pager a:hover { transform: none; } }
