/* Story books: cloth covers, a wooden shelf, and a page-turning reader (assets/books.js). */

/* ---------- covers ---------- */
.bk-cover {
  --w: 150px; position: relative; display: block; width: var(--w); aspect-ratio: 2 / 3; flex: none;
  border-radius: 3px 7px 7px 3px; color: var(--foil);
  background:
    linear-gradient(90deg, #0006 0, #0000 7%, #fff1 8.5%, #0000 11%),
    repeating-linear-gradient(45deg, #ffffff07 0 2px, #0000 2px 4px),
    repeating-linear-gradient(-45deg, #00000012 0 2px, #0000 2px 5px),
    radial-gradient(120% 90% at 30% 20%, color-mix(in srgb, var(--cloth) 80%, #fff) 0, var(--cloth) 55%, color-mix(in srgb, var(--cloth) 70%, #000) 100%);
  box-shadow: inset -2px 0 3px #0005, inset 3px 0 2px #fff2, 0 1px 1px #0003, 6px 10px 22px -8px #000a;
  overflow: hidden;
}
.bk-cover.big { --w: min(250px, 60vw); }
.bk-spine { position: absolute; inset: 0 auto 0 0; width: 9%; background: linear-gradient(90deg, #0005, #0001 60%, #fff2 90%, #0002); }
.bk-frame {
  position: absolute; inset: 8% 8% 8% 15%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .55em;
  border: 1.5px solid color-mix(in srgb, var(--foil) 85%, transparent); outline: 1px solid color-mix(in srgb, var(--foil) 45%, transparent);
  outline-offset: 3px; border-radius: 2px; padding: .6em .4em; text-align: center;
}
.bk-orn {
  width: 46%; aspect-ratio: 1; background: var(--foil); opacity: .9;
  -webkit-mask: url("/assets/alpana-white.svg") center / contain no-repeat; mask: url("/assets/alpana-white.svg") center / contain no-repeat;
}
.bk-title {
  font-family: "Tiro Bangla", Georgia, serif; font-weight: 400; line-height: 1.2; font-size: calc(var(--w) * .135);
  background: linear-gradient(180deg, color-mix(in srgb, var(--foil) 70%, #fff) 0, var(--foil) 45%, color-mix(in srgb, var(--foil) 70%, #000) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 1px 0 #0007);
}
.bk-rule { width: 40%; height: 1px; background: currentColor; opacity: .7; }
.bk-author { font-family: "Tiro Bangla", Georgia, serif; font-size: calc(var(--w) * .075); opacity: .92; }

/* ---------- the shelf ---------- */
.bk-head .h1-en { max-width: 46ch; }
.bk-row { margin-top: 2.2rem; }
.bk-row h2 { margin-bottom: .2rem; }
.bk-shelf {
  position: relative; display: flex; gap: clamp(18px, 4vw, 40px); overflow-x: auto; padding: 26px 18px 34px; scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}
.bk-shelf::after { /* the plank, under the covers (150px wide = 225px tall, below 26px padding) */
  content: ""; position: absolute; left: 0; right: 0; top: calc(26px + 225px - 4px); height: 22px; z-index: 0; border-radius: 3px;
  background: linear-gradient(180deg, #8a5a33 0, #6b4325 40%, #4a2c17 100%);
  box-shadow: 0 10px 18px -8px #0008, inset 0 2px 0 #c08a5a66;
  min-width: 100%; width: max(100%, var(--sw, 100%));
}
.bk-item { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 12px; width: 150px; flex: none; color: inherit; text-decoration: none; scroll-snap-align: start; }
.bk-item .bk-cover { transform: perspective(700px) rotateY(-8deg); transform-origin: left center; transition: transform .45s cubic-bezier(.2,.8,.2,1), box-shadow .45s; }
.bk-item:hover .bk-cover, .bk-item:focus-visible .bk-cover { transform: perspective(700px) rotateY(-18deg) translateY(-8px); box-shadow: inset -2px 0 3px #0005, 14px 18px 30px -10px #000b; }
.bk-meta { display: flex; flex-direction: column; font-size: .9rem; line-height: 1.3; margin-top: 16px; }
.bk-kind { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.bk-meta span { color: var(--muted); }
.bk-progress { display: block; height: 3px; margin-top: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bk-progress[hidden], .bk-continue[hidden] { display: none; }
.bk-progress i { display: block; height: 100%; width: 0; background: var(--accent); }
.bk-continue { margin-top: 1.2rem; }
.bk-continue a { display: inline-flex; align-items: center; gap: 14px; padding: 10px 16px 10px 10px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); text-decoration: none; color: inherit; }
.bk-continue .bk-cover { --w: 54px; }
.bk-continue small { display: block; color: var(--muted); }

/* ---------- homepage band ---------- */
.bk-home .bk-home-lead { margin: -.2rem 0 .4rem; max-width: 62ch; }
.bk-home .bk-continue { margin: .8rem 0 0; }

/* ---------- book page ---------- */
.bk-hero { display: grid; grid-template-columns: auto 1fr; gap: clamp(24px, 5vw, 60px); align-items: center; margin: 1.2rem 0 2rem; }
.bk-hero-cover .bk-cover { transform: perspective(900px) rotateY(-12deg); }
.bk-hero h1 { margin: 0; font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1.1; }
.bk-by { margin: .4rem 0 0; font-size: 1.1rem; }
.bk-en { margin: .2rem 0 1rem; color: var(--muted); font-style: italic; }
.bk-blurb { max-width: 60ch; }
.bk-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 1.2rem; }
.bk-toc { list-style: none; padding: 0; margin: 0; columns: 2 320px; column-gap: 32px; }
.bk-toc li { break-inside: avoid; }
.bk-toc a { display: grid; grid-template-columns: 2.2em 1fr auto; gap: 10px; align-items: baseline; padding: 10px 4px; border-bottom: 1px dashed var(--line); color: inherit; text-decoration: none; }
.bk-toc a:hover .toc-t { color: var(--accent); }
.toc-n { color: var(--muted); font-variant-numeric: tabular-nums; }
.toc-t { font-family: "Tiro Bangla", Georgia, serif; font-size: 1.12rem; }
.toc-time { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.bk-toc a.read .toc-n::after { content: " ✓"; color: var(--leaf, #3d6b3a); }
.bk-toc a.here { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.bk-src { margin-top: 1.6rem; font-size: .85rem; }
@media (max-width: 640px) { .bk-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; } .bk-actions { justify-content: center; } }

/* ---------- the reader ---------- */
html.reading, html.reading body { overflow: hidden; height: 100%; }
html.reading .site-header, html.reading .site-footer, html.reading .paar, html.reading #main, html.reading .skip { visibility: hidden; }
.reader {
  --pg: #fffdf7; --ink: #1f1813; --soft: #8b7a68; --desk: #2b211b; --edge: #e9e0cf;
  --fs: 1.18rem; --lh: 1.85; --face: "Tiro Bangla", Georgia, serif;
  position: fixed; inset: 0; z-index: 1000; display: grid; grid-template-rows: auto 1fr auto; background: var(--desk);
  background-image: radial-gradient(120% 80% at 50% 40%, color-mix(in srgb, var(--cloth) 30%, var(--desk)) 0, var(--desk) 70%);
  color: var(--ink); -webkit-tap-highlight-color: transparent;
}
.reader[data-paper="sepia"] { --pg: #f3e7cf; --ink: #3a2816; --soft: #8f7655; --edge: #dccaa6; }
.reader[data-paper="night"] { --pg: #191512; --ink: #d8ccb6; --soft: #8a7d6b; --desk: #0c0a08; --edge: #2a231d; }
.reader[data-font="sans"] { --face: "Hind Siliguri", system-ui, sans-serif; }

.r-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; color: #f3e9d8; transition: opacity .35s, transform .35s; z-index: 3; }
.r-top { padding-top: max(8px, env(safe-area-inset-top)); }
.r-foot { padding-bottom: max(10px, env(safe-area-inset-bottom)); font-size: .82rem; }
.reader.immersive .r-bar { opacity: 0; pointer-events: none; }
.reader.immersive .r-top { transform: translateY(-8px); }
.reader.immersive .r-foot { opacity: .55; pointer-events: auto; }
.reader.immersive .r-foot .r-seek { visibility: hidden; }
.r-btn { min-width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; border: 0; background: #ffffff14; color: inherit; font: inherit; font-size: 1.05rem; cursor: pointer; text-decoration: none; }
.r-btn:hover { background: #ffffff26; }
.r-aa { font-family: Georgia, serif; font-weight: 700; }
.r-music { position: relative; }
.r-music[hidden] { display: none; }
.r-music .rm-on, .r-music .rm-bars { display: none; }
.r-music .rm-off { opacity: .55; position: relative; }
.r-music .rm-off::after { content: ""; position: absolute; left: -3px; right: -3px; top: 50%; height: 1.5px; background: currentColor; transform: rotate(-35deg); }
.r-music.playing { background: #e0b04a2e; color: #f5d27f; }
.r-music.playing .rm-off { display: none; }
.r-music.playing .rm-bars { display: flex; align-items: flex-end; gap: 2px; height: 14px; }
.rm-bars b { width: 3px; background: currentColor; border-radius: 1px; animation: rmb 1.1s ease-in-out infinite; }
.rm-bars b:nth-child(2) { animation-delay: -.4s; }
.rm-bars b:nth-child(3) { animation-delay: -.75s; }
@keyframes rmb { 0%, 100% { height: 4px; } 50% { height: 14px; } }
.r-grid { flex-wrap: wrap; }
.r-grid button { flex: 1 0 30%; }
.r-vol { margin-top: 8px; gap: 10px; font-size: .9rem; }
.r-vol input { flex: 1; accent-color: #e0b04a; }
.r-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; text-align: center; }
.r-title b { font-family: "Tiro Bangla", Georgia, serif; font-weight: 400; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-title span { font-size: .8rem; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: "Tiro Bangla", Georgia, serif; }
.r-pg { min-width: 7.5em; font-variant-numeric: tabular-nums; }
.r-left { min-width: 7.5em; text-align: right; opacity: .8; }
.r-seek { flex: 1; accent-color: #e0b04a; }

.r-stage { position: relative; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 4px clamp(0px, 2vw, 24px); }
.r-book {
  --bw: 680px; position: relative; height: 100%; max-height: 1000px; width: min(100%, var(--bw));
  background: var(--pg); border-radius: 3px; overflow: hidden;
  box-shadow: 0 0 0 1px #0002, 0 30px 60px -20px #000c, 0 12px 24px -12px #0009;
}
/* paper grain and page edges */
.r-book::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1; opacity: .5;
  background: radial-gradient(130% 100% at 50% 0, #0000 60%, #0000000d 100%), repeating-radial-gradient(circle at 30% 20%, #0000 0 2px, #00000005 2px 3px); }
.reader[data-paper="night"] .r-book::before { opacity: .25; }
.r-page-edge { position: absolute; top: 4px; bottom: 4px; right: -1px; width: 6px; z-index: 0;
  background: repeating-linear-gradient(90deg, var(--edge) 0 1px, var(--pg) 1px 2px); opacity: .9; }
.reader.spread .r-book { --bw: 1280px; max-height: 920px; }
.reader.spread .r-book::after { /* the gutter between two pages */
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 70px; transform: translateX(-50%); pointer-events: none; z-index: 1;
  background: linear-gradient(90deg, #0000 0, #00000014 40%, #00000030 50%, #00000014 60%, #0000 100%);
}
.r-view { --px: clamp(22px, 6vw, 64px); --py: clamp(28px, 5vh, 56px); position: absolute; inset: var(--py) var(--px); overflow: hidden; z-index: 2; }
.reader.spread .r-view { --px: 64px; }
.r-text {
  height: 100%; column-fill: auto; column-gap: calc(var(--px) * 2); will-change: transform;
  font-family: var(--face); font-size: var(--fs); line-height: var(--lh); color: var(--ink);
  font-kerning: normal; text-rendering: optimizeLegibility;
}
.r-text.anim { transition: transform .5s cubic-bezier(.3,.7,.2,1); }
.r-text p { margin: 0; text-indent: 1.6em; text-align: justify; hyphens: auto; orphans: 2; widows: 2; }
.r-text p + p { margin-top: .15em; }
.r-chead { text-align: center; margin: 1.5em 0 2em; break-inside: avoid; }
.r-text p.first { text-indent: 0; }
.r-text p.first::first-letter { font-size: 2.3em; line-height: 1; float: left; padding: .08em .1em 0 0; color: var(--cloth); }
.reader[data-paper="night"] .r-text p.first::first-letter { color: #d9a441; }
.r-text p.epi { text-indent: 0; text-align: right; font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: .82em; color: var(--soft); margin: 0 0 .2em 25%; }
.r-text p.epi + p.epi { margin-bottom: 1.6em; }
.r-text p.verse { text-indent: 0; text-align: left; margin: .7em 0 .7em 1.6em; font-style: italic; }
.r-text p.verse.first::first-letter { font-style: normal; }
.r-text p.say { text-indent: 0; margin-top: .45em; padding-left: 1.2em; text-indent: -1.2em; text-align: left; }
.r-text p.say .who { font-weight: 400; color: var(--cloth); letter-spacing: .02em; }
.r-text p.say .who::after { content: " ।"; opacity: .0; }
.reader[data-paper="night"] .r-text p.say .who { color: #d9a441; }
.r-text p.stage { text-indent: 0; text-align: center; font-style: italic; color: var(--soft); margin: .6em 0; }
.r-text p.brk { text-indent: 0; text-align: center; color: var(--soft); letter-spacing: .4em; margin: 1em 0; break-inside: avoid; }
.r-cbook { margin: 0; color: var(--soft); font-size: .78em; letter-spacing: .08em; }
.r-part { margin: .6em 0 0; color: var(--soft); }
.r-chead h1 { margin: .35em 0 .2em; font-family: var(--face); font-weight: 400; font-size: 1.9em; line-height: 1.25; color: var(--ink); }
.r-orn { display: block; width: 64px; height: 64px; margin: .4em auto 0; background: var(--cloth); opacity: .75;
  -webkit-mask: url("/assets/alpana-white.svg") center / contain no-repeat; mask: url("/assets/alpana-white.svg") center / contain no-repeat; }
.reader[data-paper="night"] .r-orn { background: #b88a3a; }
.r-end { break-before: column; break-inside: avoid; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 60%; text-align: center; font-family: "Hind Siliguri", system-ui, sans-serif; }
.r-end-k { margin: 0; color: var(--soft); font-size: .8em; letter-spacing: .12em; text-transform: uppercase; }
.r-fin { margin: 0; font-family: "Tiro Bangla", Georgia, serif; font-size: 1.6em; }
.r-end .btn { font-size: .85em; }

/* page-turn effect: a curl shadow sweeping across the page */
.r-turn { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0; }
.reader[data-turn="curl"] .r-turn.go-next { animation: curlNext .55s cubic-bezier(.3,.6,.2,1); }
.reader[data-turn="curl"] .r-turn.go-prev { animation: curlPrev .55s cubic-bezier(.3,.6,.2,1); }
@keyframes curlNext {
  0% { opacity: 1; background: linear-gradient(270deg, #0000 0, #0000 96%, #0000002a 98%, #fff3 99%, #0000 100%); }
  100% { opacity: 1; background: linear-gradient(270deg, #0000 0, #00000022 6%, #ffffff38 9%, #0000 16%, #0000 100%); opacity: 0; }
}
@keyframes curlPrev {
  0% { opacity: 1; background: linear-gradient(90deg, #0000 0, #0000 96%, #0000002a 98%, #fff3 99%, #0000 100%); }
  100% { opacity: 1; background: linear-gradient(90deg, #0000 0, #00000022 6%, #ffffff38 9%, #0000 16%, #0000 100%); opacity: 0; }
}
.reader[data-turn="none"] .r-text.anim { transition: none; }

/* tap zones */
.r-zone { position: absolute; top: 0; bottom: 0; z-index: 4; border: 0; background: transparent; cursor: pointer; padding: 0; }
.r-prev { left: 0; width: 28%; cursor: w-resize; }
.r-next { right: 0; width: 28%; cursor: e-resize; }
.r-mid { left: 28%; right: 28%; cursor: default; }
.r-zone:focus-visible { outline: 2px solid #e0b04a88; outline-offset: -6px; }
.reader.at-start .r-prev, .reader.at-end-final .r-next { cursor: default; }
.reader.on-last .r-mid { pointer-events: none; } /* let taps reach the "Next" button */
.reader.on-last .r-prev, .reader.on-last .r-next { width: 12%; }

/* panels */
.r-panel {
  position: absolute; z-index: 6; top: calc(56px + env(safe-area-inset-top)); right: 12px; width: min(330px, calc(100vw - 24px)); max-height: calc(100% - 130px); overflow: auto;
  padding: 14px 16px 16px; border-radius: 16px; background: #221a15f2; color: #f3e9d8; box-shadow: 0 20px 50px -10px #000c; backdrop-filter: blur(10px);
}
.r-drawer { left: 12px; right: auto; }
.r-ph { margin: .8em 0 .45em; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; opacity: .65; }
.r-ph:first-child { margin-top: 0; }
.r-row { display: flex; gap: 6px; align-items: center; }
.r-row button { flex: 1; padding: 9px 6px; border: 1px solid #ffffff22; border-radius: 10px; background: #ffffff0d; color: inherit; font: inherit; font-size: .9rem; cursor: pointer; }
.r-row button[aria-pressed="true"] { border-color: #e0b04a; background: #e0b04a22; }
.r-fs-val { min-width: 4em; text-align: center; font-variant-numeric: tabular-nums; }
.pp-white { background: #fffdf7 !important; color: #1f1813 !important; }
.pp-sepia { background: #f3e7cf !important; color: #3a2816 !important; }
.pp-night { background: #191512 !important; color: #d8ccb6 !important; }
.r-drawer ol { list-style: none; margin: 0; padding: 0; }
.r-drawer li a { display: block; padding: 8px 10px; border-radius: 8px; color: inherit; text-decoration: none; font-family: "Tiro Bangla", Georgia, serif; }
.r-drawer li a:hover { background: #ffffff12; }
.r-drawer li.on a { background: #e0b04a26; color: #f5d27f; }
.r-shelf { display: block; margin-top: 10px; padding: 8px 10px; color: #f5d27f; }

.r-hint { position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%); z-index: 5; margin: 0; padding: 8px 14px; border-radius: 99px;
  background: #000a; color: #fff; font-size: .82rem; pointer-events: none; opacity: 0; transition: opacity .6s; white-space: nowrap; }
.r-hint.show { opacity: 1; }

/* no-JS: plain scrolling text */
.reader:not(.ready) { position: static; display: block; background: var(--pg); }
.reader:not(.ready) .r-stage, .reader:not(.ready) .r-book, .reader:not(.ready) .r-view { position: static; height: auto; max-height: none; overflow: visible; }
.reader:not(.ready) .r-text { columns: auto; height: auto; max-width: 42em; margin: 0 auto; padding: 24px; }
.reader:not(.ready) .r-zone, .reader:not(.ready) .r-foot, .reader:not(.ready) .r-panel, .reader:not(.ready) .r-hint { display: none; }

@media (max-width: 700px) {
  .r-stage { padding: 0; }
  .r-book { border-radius: 0; max-height: none; box-shadow: none; }
  .r-page-edge { display: none; }
  .r-view { --px: 22px; --py: 22px; }
  .r-left { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .r-text.anim { transition-duration: .01s; }
  .reader .r-turn { animation: none !important; }
}


/* ---------- the page flip (assets/books.js flip()) ---------- */
.r-book { perspective: 2400px; }
.r-leaf { position: absolute; top: 0; bottom: 0; z-index: 3; transform-style: preserve-3d; pointer-events: none; will-change: transform; }
.r-leaf.fwd { transform-origin: left center; }
.r-leaf.back { transform-origin: left center; transform: rotateY(-180deg); }
.r-leaf.back.sp { transform-origin: right center; transform: none; }
.r-leaf-face { position: absolute; top: 0; bottom: 0; left: 0; overflow: hidden; background: var(--pg); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.r-leaf-face.rev { transform: rotateY(180deg); }
.r-leaf-face.blank { background: linear-gradient(90deg, #0000001a, #0000 20%), var(--pg); }
.r-leaf-inner { position: absolute; top: 0; bottom: 0; }
.r-leaf-inner .r-view { z-index: 0; }
.r-leaf-shade { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.r-leaf.fwd .r-leaf-shade { background: linear-gradient(90deg, #0000 40%, #00000040 100%); }
.r-leaf.back .r-leaf-shade { background: linear-gradient(270deg, #0000 40%, #00000040 100%); }
.r-leaf.go { animation: leafFwd .72s cubic-bezier(.45,.05,.3,1) forwards; }
.r-leaf.back.go { animation-name: leafBack; }
.r-leaf.back.sp.go { animation-name: leafBackSp; }
.r-leaf.go .r-leaf-shade { animation: leafShade .72s ease-in-out forwards; }
@keyframes leafFwd { 0% { transform: rotateY(0) translateZ(0); } 50% { transform: rotateY(-90deg) translateZ(6px); } 100% { transform: rotateY(-180deg); } }
@keyframes leafBack { 0% { transform: rotateY(-180deg); } 50% { transform: rotateY(-90deg) translateZ(6px); } 100% { transform: rotateY(0); } }
@keyframes leafBackSp { 0% { transform: rotateY(0); } 50% { transform: rotateY(90deg) translateZ(6px); } 100% { transform: rotateY(180deg); } }
@keyframes leafShade { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- the library: bookcase with books standing spine-out ---------- */
.lib-room { margin-top: 1.4rem; }
.lib-case {
  --wood: #5a3620; --wood-d: #3a2213; --wood-l: #8a5a33;
  position: relative; max-width: 700px; margin: 0 auto; padding: 0 22px 22px; border-radius: 10px 10px 4px 4px;
  background:
    repeating-linear-gradient(90deg, #ffffff06 0 2px, #0000 2px 9px, #00000010 9px 11px, #0000 11px 23px),
    linear-gradient(90deg, var(--wood-d), var(--wood) 6%, var(--wood-l) 50%, var(--wood) 94%, var(--wood-d));
  box-shadow: 0 40px 70px -30px #2a1208cc, inset 0 0 0 1px #00000040, inset 0 2px 0 #c08a5a55;
}
.lib-crown { position: relative; height: 54px; margin: 0 -22px 14px; border-radius: 10px 10px 0 0; display: grid; place-items: center;
  background: linear-gradient(180deg, #7a4c2a, #4a2b16); box-shadow: inset 0 -6px 10px -6px #000a, inset 0 2px 0 #c08a5a66; }
.lib-crown span { padding: 4px 18px; border-radius: 3px; font-size: .72rem; letter-spacing: .3em; text-transform: uppercase; color: #3a2410;
  background: linear-gradient(180deg, #f3d98b, #c99a3d 55%, #a87a2a); box-shadow: 0 1px 0 #fff6 inset, 0 2px 4px #0007; }
.lib-shelf { position: relative; padding: 26px 16px 0; margin-bottom: 30px;
  background: linear-gradient(180deg, #24140b 0, #3b2314 18%, #452a18 100%);
  box-shadow: inset 0 14px 22px -10px #000c, inset 10px 0 18px -12px #000a, inset -10px 0 18px -12px #000a; }
.lib-shelf::after { /* the plank */
  content: ""; position: absolute; left: -10px; right: -10px; bottom: -22px; height: 22px; border-radius: 2px;
  background: linear-gradient(180deg, #a06c3e 0, #7a4c2a 35%, #4e2e18 100%); box-shadow: 0 10px 14px -6px #000b, inset 0 1px 0 #e0a86a88;
}
.lib-label { position: absolute; z-index: 2; left: 50%; bottom: -20px; transform: translateX(-50%); padding: 2px 12px; font-size: .64rem;
  letter-spacing: .18em; text-transform: uppercase; color: #3a2410; border-radius: 2px; white-space: nowrap;
  background: linear-gradient(180deg, #f1d488, #c4953a); box-shadow: 0 1px 2px #0008, inset 0 1px 0 #fff8; }
.lib-row { display: flex; align-items: flex-end; gap: 3px; min-height: 356px; overflow-x: auto; padding: 18px 6px 0; scrollbar-width: none; }
.lib-row::-webkit-scrollbar { display: none; }

.lib-spine { position: relative; flex: none; width: var(--t); height: var(--h); text-decoration: none; transform-origin: bottom center;
  transition: transform .35s cubic-bezier(.2,.8,.2,1), filter .35s, opacity .3s; outline-offset: 4px; }
.lib-spine:hover, .lib-spine:focus-visible { transform: translateY(-14px) rotate(-1.5deg); filter: brightness(1.12); }
.lib-spine.pulled { transform: translateY(-46px); opacity: 0; }
.sp-face {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 0; border-radius: 3px 3px 1px 1px;
  color: var(--foil);
  background:
    linear-gradient(90deg, #0007 0, #0000 18%, #ffffff1c 42%, #0000 62%, #0006 100%),
    repeating-linear-gradient(0deg, #ffffff06 0 2px, #0000 2px 4px),
    var(--cloth);
  box-shadow: 0 2px 6px #0008, inset 0 1px 0 #fff2;
}
.sp-band { flex: none; width: 100%; height: 7px; border-top: 1.5px solid var(--foil); border-bottom: 1.5px solid var(--foil); opacity: .85; }
.sp-orn { flex: none; width: calc(var(--t) * .55); aspect-ratio: 1; background: var(--foil); opacity: .85;
  -webkit-mask: url("/assets/alpana-white.svg") center / contain no-repeat; mask: url("/assets/alpana-white.svg") center / contain no-repeat; }
.sp-title { flex: 1; min-height: 0; writing-mode: vertical-rl; font-family: "Tiro Bangla", Georgia, serif; font-weight: 400;
  font-size: clamp(18px, calc(var(--t) * .36), 27px); line-height: 1; white-space: nowrap; overflow: hidden;
  background: linear-gradient(90deg, color-mix(in srgb, var(--foil) 70%, #fff), var(--foil), color-mix(in srgb, var(--foil) 70%, #000));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.sp-author { flex: none; writing-mode: vertical-rl; font-family: "Tiro Bangla", Georgia, serif; font-size: 13px; opacity: .85; white-space: nowrap; max-height: 34%; overflow: hidden; }
.lib-spine .bk-progress { position: absolute; left: 4px; right: 4px; bottom: -6px; height: 3px; margin: 0; background: #0006; }

/* decorations */
.lib-decor { flex: none; position: relative; pointer-events: none; }
.lib-stack { display: flex; flex-direction: column-reverse; align-items: center; margin-left: 18px; }
.lib-stack i { display: flex; width: var(--w); height: 22px; margin-top: -1px; border-radius: 2px;
  background: linear-gradient(180deg, #ffffff26, #0000 30%, #0005), var(--c); box-shadow: 0 2px 3px #0007; }
.lib-stack i:nth-child(2) { transform: translateX(6px) rotate(-1deg); }
.lib-stack i::after { content: ""; width: 8px; height: 100%; margin-left: auto; background: repeating-linear-gradient(180deg, #efe4cc 0 1px, #cdbf9f 1px 2px); }
.lib-stack-s { margin-left: 22px; }
.lib-bookend { width: 16px; height: 150px; margin-left: 4px; border-radius: 2px 2px 0 0;
  background: linear-gradient(90deg, #8a6a2a, #e3c06a 40%, #a8822e); box-shadow: 2px 3px 6px #0008; }
.lib-bookend::after { content: ""; position: absolute; left: -26px; bottom: 0; width: 42px; height: 8px; background: linear-gradient(180deg, #e3c06a, #8a6a2a); border-radius: 2px; }
.lib-lamp { width: 90px; height: 210px; margin-left: auto; margin-right: 18px; }
.lib-lamp b { position: absolute; left: 50%; bottom: 0; width: 6px; height: 150px; transform: translateX(-50%); background: linear-gradient(90deg, #6a4a1c, #e3c06a, #6a4a1c); }
.lib-lamp b::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 56px; height: 10px; transform: translateX(-50%); border-radius: 50% 50% 4px 4px; background: linear-gradient(180deg, #e3c06a, #7a5a22); }
.lib-lamp i { position: absolute; left: 50%; top: 0; width: 90px; height: 60px; transform: translateX(-50%); clip-path: polygon(22% 0, 78% 0, 100% 100%, 0 100%);
  background: linear-gradient(180deg, #f6e2b0, #e8c47a); }
.lib-lamp::after { content: ""; position: absolute; left: -60px; right: -60px; top: 40px; height: 190px; background: radial-gradient(55% 70% at 50% 0, #ffd98a40, #0000 70%); }
.lib-plant { width: 80px; height: 150px; margin-left: auto; margin-right: 22px; }
.lib-plant b { position: absolute; left: 50%; bottom: 0; width: 58px; height: 52px; transform: translateX(-50%); clip-path: polygon(0 0, 100% 0, 86% 100%, 14% 100%);
  background: linear-gradient(90deg, #8a3c1e, #c86a3c 45%, #8a3c1e); }
.lib-plant i { position: absolute; left: 50%; bottom: 48px; width: 22px; height: 78px; margin-left: -11px; border-radius: 50% 50% 50% 50% / 80% 80% 20% 20%; transform-origin: bottom center;
  background: linear-gradient(90deg, #2f5a2a, #5d8f48); }
.lib-plant i:nth-child(1) { transform: rotate(-38deg); }
.lib-plant i:nth-child(2) { transform: rotate(-12deg); height: 92px; }
.lib-plant i:nth-child(3) { transform: rotate(16deg); height: 86px; }
.lib-plant i:nth-child(4) { transform: rotate(40deg); height: 70px; }

/* ---------- picking a book off the shelf ---------- */
.lib-pick { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; }
.lib-pick[hidden] { display: none; }
.lp-backdrop { position: absolute; inset: 0; background: radial-gradient(80% 70% at 50% 45%, #2a1a10e6, #0d0806f5); opacity: 0; transition: opacity .45s; }
.lib-pick.in .lp-backdrop { opacity: 1; }
.lp-stage { position: relative; display: flex; align-items: center; gap: clamp(24px, 5vw, 64px); padding: 24px; max-width: 980px; width: 100%; justify-content: center; }
.lp-book { --W: 240px; --H: 360px; --T: 40px; flex: none; width: var(--W); height: var(--H); perspective: 1600px; }
.lp-3d { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; will-change: transform; }
.lp-face { position: absolute; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.lp-front, .lp-back, .lp-inner { left: 0; top: 0; width: var(--W); height: var(--H); }
.lp-front { transform: translateZ(calc(var(--T) / 2)); transform-origin: left center; transition: transform 1s cubic-bezier(.45,.05,.2,1); }
.lp-front .bk-cover { --w: var(--W); width: 100%; height: 100%; aspect-ratio: auto; }
.lp-back { transform: rotateY(180deg) translateZ(calc(var(--T) / 2)); background: var(--cloth); border-radius: 7px 3px 3px 7px; }
.lp-spine { left: calc((var(--W) - var(--T)) / 2); top: 0; width: var(--T); height: var(--H); transform: rotateY(-90deg) translateZ(calc(var(--W) / 2)); }
.lp-spine .sp-face { --t: var(--T); border-radius: 2px; }
.lp-pages { left: calc((var(--W) - var(--T)) / 2); top: 3px; width: var(--T); height: calc(var(--H) - 6px); transform: rotateY(90deg) translateZ(calc(var(--W) / 2 - 3px));
  background: repeating-linear-gradient(90deg, #f3ead6 0 1px, #d8ccb0 1px 2px); }
.lp-inner { transform: translateZ(calc(var(--T) / 2 - 1px)); background: #fbf5e8; border-radius: 2px 6px 6px 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  box-shadow: inset 12px 0 18px -10px #0004; color: #3a2816; }
.lp-inner-t { font-family: "Tiro Bangla", Georgia, serif; font-size: 1.5rem; text-align: center; padding: 0 16px; }
.lp-orn { width: 54px; height: 54px; background: var(--cloth); opacity: .7; -webkit-mask: url("/assets/alpana-white.svg") center / contain no-repeat; mask: url("/assets/alpana-white.svg") center / contain no-repeat; }
.lib-pick.opening .lp-front { transform: translateZ(calc(var(--T) / 2)) rotateY(-165deg); }
.lp-info { position: relative; max-width: 440px; color: #f3e9d8; opacity: 0; transform: translateX(20px); transition: opacity .5s .35s, transform .5s .35s; }
.lib-pick.in .lp-info { opacity: 1; transform: none; }
.lib-pick.opening .lp-info { opacity: 0; transition-delay: 0s; }
.lp-kind { margin: 0; font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: #e0b04a; }
.lp-info h2 { margin: .2rem 0 .3rem; font-size: clamp(2rem, 5vw, 3rem); color: #fff5e3; }
.lp-by { margin: 0 0 1rem; opacity: .85; }
.lp-blurb { line-height: 1.6; opacity: .92; }
.lp-facts { color: #c9b89c !important; font-size: .9rem; }
.lp-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 1.2rem; }
.lp-info .btn.ghost, .lp-info .btn.ghost:hover { color: #f3e9d8 !important; background: transparent !important; border: 1px solid #f3e9d877 !important; box-shadow: none !important; }
.lp-close { position: absolute; right: -6px; top: -30px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #ffffff1a; color: #fff; font-size: 1.5rem; cursor: pointer; }
.lp-close:hover { background: #ffffff33; }
html.lib-open { overflow: hidden; }

@media (max-width: 720px) {
  .lib-case { padding: 0 10px 18px; }
  .lib-crown { margin: 0 -10px 12px; height: 44px; }
  .lib-shelf { padding: 20px 8px 0; }
  .lib-row { min-height: 300px; }
  .lib-lamp, .lib-plant { margin-right: 6px; }
  .lp-stage { flex-direction: column; gap: 18px; padding: 18px; overflow-y: auto; max-height: 100%; }
  .lp-book { --W: 170px; --H: 255px; --T: 30px; }
  .lp-info { text-align: center; }
  .lp-info h2 { font-size: 2rem; }
  .lp-actions { justify-content: center; }
  .lp-blurb { font-size: .95rem; }
  .lp-close { position: fixed; right: 12px; top: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .lp-3d, .lp-front, .lp-info, .lp-backdrop { transition: none !important; }
}
