/* Ali Baba Flipbook – styles (scoped to .abfb) */
.abfb {
  --abfb-gold: #b5a06a;
  --abfb-ink: #1a1c19;
  --abfb-cream: #f2efe6;
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: var(--abfb-h, 85vh);
  min-height: 420px;
  margin: 0 auto;
  background: var(--abfb-ink);
  color: var(--abfb-cream);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  overflow: hidden;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  outline: none;
}
.abfb *, .abfb *::before, .abfb *::after { box-sizing: border-box; }
.abfb:fullscreen { height: 100%; border-radius: 0; }
.abfb:-webkit-full-screen { height: 100%; border-radius: 0; }
.abfb--init, .abfb--init * { transition: none !important; }

/* Stage */
.abfb .abfb-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: pan-y;
  background: radial-gradient(ellipse at center, #2a2d28 0%, var(--abfb-ink) 75%);
}
.abfb .abfb-slide {
  width: calc(var(--w, 300px) * 2);
  height: var(--h, 424px);
  flex: 0 0 auto;
  transition: transform .85s cubic-bezier(.45, .05, .25, 1);
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, .55));
}
.abfb--single .abfb-slide { width: var(--w, 300px); transform: none !important; }

/* Spread mode */
.abfb .abfb-book {
  position: relative;
  width: 100%;
  height: 100%;
  perspective: calc(var(--w, 300px) * 7);
  -webkit-perspective: calc(var(--w, 300px) * 7);
}
.abfb .abfb-sheet {
  position: absolute;
  left: 50%;
  top: 0;
  width: 50%;
  height: 100%;
  transform-origin: left center;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform .85s cubic-bezier(.45, .05, .25, 1);
  will-change: transform;
  cursor: pointer;
}
.abfb .abfb-sheet.is-flipped { transform: rotateY(-180deg); }
.abfb .abfb-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--abfb-cream);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.abfb .abfb-back { transform: rotateY(180deg); }
.abfb .abfb-face::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.abfb .abfb-front::after { background: linear-gradient(to right, rgba(0,0,0,.30), rgba(0,0,0,.08) 4%, transparent 11%); }
.abfb .abfb-back::after  { background: linear-gradient(to left,  rgba(0,0,0,.30), rgba(0,0,0,.08) 4%, transparent 11%); }
.abfb--single .abfb-book { display: none; }

/* Single-page mode */
.abfb .abfb-single { display: none; position: relative; width: 100%; height: 100%; overflow: hidden; background: var(--abfb-cream); }
.abfb--single .abfb-single { display: block; }
.abfb .abfb-track { display: flex; height: 100%; transition: transform .45s cubic-bezier(.3, .1, .2, 1); }
.abfb .abfb-pg { flex: 0 0 100%; height: 100%; }

.abfb img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none !important;
  margin: 0 !important;
  padding: 0;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* Toolbar */
.abfb .abfb-bar {
  flex: 0 0 52px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  background: #111310;
  border-top: 1px solid rgba(181, 160, 106, .35);
}
.abfb .abfb-grp { flex: 1 1 0; display: flex; align-items: center; gap: 2px; min-width: 0; }
.abfb .abfb-grp--c { justify-content: center; flex: 0 0 auto; }
.abfb .abfb-grp--r { justify-content: flex-end; }
.abfb .abfb-btn {
  appearance: none; -webkit-appearance: none;
  margin: 0; padding: 0; min-height: 0;
  width: 38px; height: 38px;
  display: inline-grid; place-items: center;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--abfb-cream);
  box-shadow: none; text-decoration: none; line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.abfb .abfb-btn:hover { background: rgba(181, 160, 106, .22); color: #fff; }
.abfb .abfb-btn:focus-visible { outline: 2px solid var(--abfb-gold); outline-offset: 1px; }
.abfb .abfb-btn[disabled] { opacity: .3; cursor: default; background: transparent; }
.abfb .abfb-btn.is-on { background: var(--abfb-gold); color: var(--abfb-ink); }
.abfb .abfb-ind {
  min-width: 96px; text-align: center;
  font: 600 13px/1 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  letter-spacing: .06em; color: var(--abfb-gold);
  font-variant-numeric: tabular-nums;
}

/* Overlay panels (thumbnails, zoom) */
.abfb .abfb-panel {
  display: none;
  position: absolute;
  left: 0; right: 0; top: 0; bottom: 52px;
  z-index: 500;
  overflow: auto;
  background: #111310;
  -webkit-overflow-scrolling: touch;
}
.abfb .abfb-panel.is-open { display: block; }
.abfb .abfb-x {
  position: sticky; top: 8px; float: right; margin: 8px 8px 0 0; z-index: 2;
  background: rgba(0, 0, 0, .55);
}
.abfb .abfb-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 16px;
  padding: 24px;
  clear: both;
}
.abfb .abfb-th {
  appearance: none; -webkit-appearance: none;
  margin: 0; padding: 0; border: 0; background: none; box-shadow: none;
  color: var(--abfb-cream); cursor: pointer; text-align: center;
  font: 600 12px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
.abfb .abfb-th span { display: block; margin-top: 6px; letter-spacing: .05em; }
.abfb .abfb-th .abfb-thimg { aspect-ratio: 595 / 842; outline: 2px solid transparent; outline-offset: 2px; background: var(--abfb-cream); transition: outline-color .15s, transform .15s; }
.abfb .abfb-th:hover .abfb-thimg { transform: translateY(-2px); outline-color: rgba(181, 160, 106, .6); }
.abfb .abfb-th.is-cur .abfb-thimg { outline-color: var(--abfb-gold); }
.abfb .abfb-th.is-cur span { color: var(--abfb-gold); }
.abfb .abfb-zwrap { display: flex; justify-content: center; width: max-content; min-width: 100%; padding: 16px; clear: both; }
.abfb .abfb-zwrap img { flex: 0 0 auto; width: 1241px; height: auto; object-fit: contain; }

@media (max-width: 520px) {
  .abfb .abfb-ind { min-width: 74px; }
  .abfb .abfb-btn { width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .abfb .abfb-sheet, .abfb .abfb-slide, .abfb .abfb-track { transition-duration: .01s !important; transition-delay: 0s !important; }
}

/* Language switcher */
.abfb .abfb-lang {
  width: auto; height: 28px; padding: 0 9px; margin: 0 1px;
  border-radius: 6px;
  font: 700 12px/1 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  letter-spacing: .06em; color: rgba(242, 239, 230, .75);
}
.abfb .abfb-lang.is-on { background: var(--abfb-gold); color: var(--abfb-ink); }
.abfb .abfb-lang.is-on:hover { background: var(--abfb-gold); color: var(--abfb-ink); }
@media (max-width: 520px) { .abfb .abfb-lang { padding: 0 6px; font-size: 11px; } }
