/* Vedatom — 3D book shelf and sample reader (Books page). Everything is scoped to
   .b3 (the shelf) and .b3r (the reader) so nothing leaks into the page's own styles.
   Mounted by books3d.js into <div id="shelf3d"></div>. */
@property --b3glow { syntax: '<color>'; inherits: true; initial-value: #3a2a10; }

.b3 { --ink: #070a12; --paper: #f2ecdd; --gold: #ecc45f; --muted: rgba(242,236,221,.64);
  --bw: min(250px, 46vw, 30vh); --bh: calc(var(--bw) * 1.5);
  position: relative; overflow: hidden; background: var(--ink); color: var(--paper);
  font-family: 'Manrope', system-ui, sans-serif; padding: 10px 0 64px; transition: --b3glow 1.1s ease; }
.b3 *, .b3r * { box-sizing: border-box; }
.b3-ambient { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(55% 46% at 50% 36%, color-mix(in srgb, var(--b3glow) 62%, transparent), transparent 70%); }
.b3-head { position: relative; text-align: center; font-size: 11px; letter-spacing: .26em; text-transform: uppercase; color: var(--gold); font-weight: 800; }
.b3-count { color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 10px; letter-spacing: .2em; }

.b3-stage { position: relative; height: calc(var(--bh) * 1.32); perspective: 1500px; perspective-origin: 50% 40%;
  touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; margin-top: 8px; }
.b3-stage.dragging { cursor: grabbing; }
.b3-track div { max-width: none; }   /* exempt from the site-wide phone cap on divs */
.b3-track { position: absolute; inset: 0; transform-style: preserve-3d; }

/* a book: front, back, spine, page block, top and bottom edges */
.b3-book { --bd: calc(var(--bw) * .1); position: absolute; left: 50%; top: 50%; width: var(--bw); height: var(--bh);
  margin: calc(var(--bh) / -2) 0 0 calc(var(--bw) / -2); transform-style: preserve-3d; will-change: transform; }
/* NB: never will-change: opacity, and no opacity < 1 on the near books: either flattens the book into a picture */
.b3-book .f { position: absolute; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.b3-book .fr { inset: 0; transform: translateZ(calc(var(--bd) / 2)); border-radius: 1px 5px 5px 1px; overflow: hidden; background: #222; }
.b3-book .fr img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.b3-book .fr::before { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,.42) 0, rgba(255,255,255,.2) 1.6%, rgba(0,0,0,.18) 3.4%, rgba(255,255,255,.06) 5%, transparent 8%),
              linear-gradient(115deg, rgba(255,255,255,.14) 0%, transparent 32%, transparent 72%, rgba(255,255,255,.05) 100%); }
.b3-book .bk { inset: 0; transform: rotateY(180deg) translateZ(calc(var(--bd) / 2)); background: var(--spine, #2a2116); border-radius: 5px 1px 1px 5px; }
.b3-book .bk { overflow: hidden; }
.b3-book .bk img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.b3-book .sp { top: 0; height: 100%; width: var(--bd); left: calc(50% - var(--bd) / 2);
  transform: rotateY(-90deg) translateZ(calc(var(--bw) / 2));
  background: linear-gradient(90deg, rgba(0,0,0,.5) 0%, rgba(255,255,255,.14) 22%, rgba(255,255,255,.05) 52%, rgba(0,0,0,.2) 78%, rgba(0,0,0,.55) 100%), var(--spine, #2a2116);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: calc(var(--bh) * .05) 0; overflow: hidden; }
.b3-book .sp .mk { width: calc(var(--bd) * .5); height: calc(var(--bd) * .5); max-width: 18px; max-height: 18px; border-radius: 50%; border: 1.5px solid var(--gold); opacity: .85; flex: none; }
.b3-book .sp .st { writing-mode: vertical-rl; font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: clamp(6px, calc(var(--bd) * .46), 17px);
  color: #f4e7c4; letter-spacing: .05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-height: 62%; text-shadow: 0 1px 1px rgba(0,0,0,.5); }
.b3-book .sp .sa { writing-mode: vertical-rl; font-size: clamp(5px, calc(var(--bd) * .24), 9px); font-weight: 800; letter-spacing: .16em; color: rgba(236,196,95,.9); white-space: nowrap; flex: none; }
.b3-book.thin .sp .sa, .b3-book.thin .sp .mk { display: none; }
.b3-book .sp .bd { position: absolute; left: 0; right: 0; height: 2px; background: rgba(236,196,95,.55); }
.b3-book .pg { top: 1.2%; height: 97.6%; width: calc(var(--bd) * .94); left: calc(50% - var(--bd) * .47);
  transform: rotateY(90deg) translateZ(calc(var(--bw) / 2 - 2px));
  background: repeating-linear-gradient(90deg, #f3ead6 0 1px, #dccfb2 1px 2px, #efe5cd 2px 3px);
  box-shadow: inset 5px 0 8px rgba(0,0,0,.2), inset -5px 0 8px rgba(0,0,0,.14); }
.b3-book .tp, .b3-book .bt { left: .6%; width: 97.4%; height: calc(var(--bd) * .94); top: calc(50% - var(--bd) * .47); background: repeating-linear-gradient(0deg, #f3ead6 0 1px, #d8caad 1px 2px); }
.b3-book .tp { transform: rotateX(90deg) translateZ(calc(var(--bh) / 2 - 2px)); }
.b3-book .bt { transform: rotateX(-90deg) translateZ(calc(var(--bh) / 2 - 2px)); }
.b3-book .sh { position: absolute; inset: 0; transform: translateZ(calc(var(--bd) / 2 + .5px)); background: #05070d; opacity: var(--shade, 0); pointer-events: none; border-radius: 1px 5px 5px 1px; }
.b3-book .fl { position: absolute; left: 50%; bottom: 0; width: 130%; height: 60px; margin-left: -65%;
  transform: rotateX(90deg) translateZ(calc(var(--bh) / -2 - 2px));
  background: radial-gradient(closest-side, rgba(0,0,0,.7), transparent); filter: blur(6px); opacity: var(--floor, .7); }

.b3-info { position: relative; text-align: center; padding: 0 20px; min-height: 210px; }
.b3-info .in { transition: opacity .35s ease, transform .45s cubic-bezier(.22,.61,.36,1); }
.b3-info.swap .in { opacity: 0; transform: translateY(10px); }
.b3-chip { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; padding: 5px 12px; border-radius: 999px; }
.b3-chip.now { color: #9be3b5; background: rgba(28,122,67,.22); }
.b3-chip.soon { color: #f1c27a; background: rgba(224,146,31,.18); }
.b3-chip.other { color: #9cc4ee; background: rgba(47,121,196,.2); }
.b3-title { font-family: 'Cormorant Garamond', serif; font-weight: 500; font-size: clamp(30px, 4.4vw, 48px); line-height: 1.05; margin: 12px 0 4px; }
.b3-sub { font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: clamp(17px, 2.1vw, 21px); color: var(--muted); }
.b3-te { font-size: 15px; color: rgba(242,236,221,.72); margin-top: 6px; font-family: 'Kohinoor Telugu', 'Noto Sans Telugu', 'Nirmala UI', sans-serif; }
/* Telugu titles: Cormorant has no Telugu, so use the system's Telugu face */
.b3-title[lang="te"], .b3-sub[lang="te"] { font-family: 'Kohinoor Telugu', 'Noto Sans Telugu', 'Nirmala UI', sans-serif; font-style: normal; }
.b3-title[lang="te"] { font-size: clamp(26px, 3.8vw, 40px); font-weight: 600; line-height: 1.25; }
.b3-sub[lang="te"] { font-size: clamp(15px, 1.9vw, 18px); }
.b3-te[lang="en"] { font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 17px; }
.b3-book .sp .st[lang="te"], .b3-book .sp .sa[lang="te"] { font-family: 'Kohinoor Telugu', 'Noto Sans Telugu', 'Nirmala UI', sans-serif; letter-spacing: 0; }
.b3-lang { display: inline-flex; gap: 2px; margin-top: 12px; padding: 3px; border: 1px solid rgba(242,236,221,.25); border-radius: 999px; }
.b3-lang button { font: inherit; font-size: 12.5px; font-weight: 700; color: var(--muted); background: transparent; border: 0; border-radius: 999px; padding: 7px 15px; cursor: pointer; line-height: 1.2; }
.b3-lang button[lang="te"] { font-family: 'Kohinoor Telugu', 'Noto Sans Telugu', 'Nirmala UI', sans-serif; font-size: 13.5px; }
.b3-lang button[aria-pressed="true"] { background: var(--gold); color: #171106; }
.b3-lang button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.b3-meta { font-size: 12px; color: rgba(242,236,221,.5); margin-top: 6px; letter-spacing: .04em; }
.b3-act { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.b3-btn { font: inherit; font-size: 13.5px; font-weight: 800; border-radius: 999px; padding: 12px 22px; cursor: pointer; border: 0; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; line-height: 1.2; }
.b3-btn.gold { background: var(--gold); color: #171106; }
.b3-btn.ghost { background: transparent; color: var(--paper); border: 1px solid rgba(242,236,221,.28); }
.b3-btn.ghost:hover { border-color: var(--gold); }
.b3-btn:focus-visible, .b3-nav button:focus-visible, .b3-dots button:focus-visible, .b3r button:focus-visible, .b3r a:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.b3-nav { position: absolute; left: 0; right: 0; top: calc(10px + var(--bh) * .66 + 8px); display: flex; justify-content: space-between; padding: 0 3vw; pointer-events: none; z-index: 3; }
.b3-nav button { pointer-events: auto; width: 50px; height: 50px; border-radius: 50%; border: 1px solid rgba(242,236,221,.22); background: rgba(10,13,22,.5);
  backdrop-filter: blur(8px); color: var(--paper); font-size: 20px; cursor: pointer; transition: background .2s, transform .2s; }
.b3-nav button:hover { background: rgba(236,196,95,.18); transform: scale(1.06); }
.b3-dots { position: relative; display: flex; gap: 7px; justify-content: center; margin-top: 22px; }
.b3-dots button { width: 7px; height: 7px; padding: 0; border: 0; border-radius: 4px; background: rgba(242,236,221,.28); transition: width .35s, background .35s; cursor: pointer; }
.b3-dots button.on { width: 22px; background: var(--gold); }
.b3-hint { position: relative; text-align: center; font-size: 11.5px; color: rgba(242,236,221,.42); letter-spacing: .05em; margin-top: 12px; }

/* ---------- sample reader ---------- */
.b3r { --gold: #ecc45f; --paper: #f2ecdd; position: fixed; inset: 0; z-index: 2147483000; display: flex; flex-direction: column; color: #f2ecdd; font-family: 'Manrope', system-ui, sans-serif;
  background: radial-gradient(70% 60% at 50% 50%, rgba(40,32,18,.55), rgba(5,7,13,.97)), rgba(5,7,13,.92);
  opacity: 0; pointer-events: none; transition: opacity .45s; }
.b3r.on { opacity: 1; pointer-events: auto; }
.b3r-top { display: flex; align-items: center; gap: 14px; padding: 16px 22px; }
.b3r-title { flex: 1; font-family: 'Cormorant Garamond', serif; font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b3r-count { font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: rgba(242,236,221,.64); white-space: nowrap; font-variant-numeric: tabular-nums; }
.b3r-x { width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(242,236,221,.25); background: transparent; color: #f2ecdd; font-size: 16px; cursor: pointer; flex: none; }
.b3r-stage { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
/* the open book is flat (page order follows z-index); each leaf turns in its own 3D */
.b3r-book { position: relative; perspective: 2600px; transition: transform .8s cubic-bezier(.3,.1,.2,1); }
.b3r-shadow { position: absolute; top: 3%; bottom: -2%; left: 0; right: 0; z-index: 0; background: radial-gradient(closest-side, rgba(0,0,0,.6), transparent); filter: blur(18px); }
.b3r-leaf { position: absolute; top: 0; height: 100%; transform-origin: left center; transform-style: preserve-3d; transition: transform .95s cubic-bezier(.32,.08,.2,1); }
.b3r-leaf.turned { transform: rotateY(-180deg); }
.b3r-pf { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; background: #fbf8f1; display: flex; align-items: center; justify-content: center; }
.b3r-pf.pb { transform: rotateY(180deg); }
.b3r-pf canvas, .b3r-pf img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.b3r-pf.cover img { object-fit: cover; }
.b3r-pf::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(0,0,0,.22), rgba(0,0,0,.06) 4%, transparent 10%); }
.b3r-pf.pb::after { background: linear-gradient(270deg, rgba(0,0,0,.22), rgba(0,0,0,.06) 4%, transparent 10%); }
.b3r-pf.cover::after { background: linear-gradient(90deg, rgba(0,0,0,.4), rgba(255,255,255,.15) 2%, transparent 7%); }
.b3r-pf::before { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0; background: linear-gradient(90deg, rgba(0,0,0,.05), rgba(0,0,0,.32)); }
.b3r-pf.pb::before { background: linear-gradient(270deg, rgba(0,0,0,.05), rgba(0,0,0,.32)); }
.b3r-leaf.moving .b3r-pf::before { animation: b3turn .95s ease; }
@keyframes b3turn { 45% { opacity: 1; } 100% { opacity: 0; } }
.b3r-load { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: rgba(36,29,18,.4); }
.b3r-inside { width: 100%; height: 100%; background: var(--spine, #2a2116); display: flex; align-items: center; justify-content: center; }
.b3r-inside span { font-family: 'Cormorant Garamond', serif; font-style: italic; color: rgba(244,231,196,.6); font-size: 18px; }
.b3r-end { position: absolute; top: 0; height: 100%; z-index: 0; background: #fbf8f1; color: #241d12; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 8%; }
.b3r-end h3 { font-family: 'Cormorant Garamond', serif; font-weight: 500; font-size: 28px; margin: 0; }
.b3r-end p { margin: 0; font-size: 14px; line-height: 1.6; color: rgba(36,29,18,.72); }
.b3r.single .b3r-leaf { transition: transform .95s cubic-bezier(.32,.08,.2,1), opacity .2s; }
.b3r.single .b3r-leaf.turned { opacity: 0; transition: transform .95s cubic-bezier(.32,.08,.2,1), opacity .35s .6s; }
.b3r-hint { text-align: center; font-size: 11.5px; color: rgba(242,236,221,.42); padding-bottom: 6px; }
.b3r-bar { display: flex; gap: 10px; justify-content: center; padding: 12px 16px 24px; flex-wrap: wrap; }
.b3r-msg { color: rgba(242,236,221,.8); font-size: 14px; text-align: center; padding: 20px; }

@media (max-width: 640px) {
  .b3-nav { display: none; }
  .b3r-bar .b3-btn { padding: 10px 16px; }
  .b3r-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .b3-info .in, .b3r-leaf, .b3r-book, .b3r { transition-duration: .01s !important; }
}
