:root {
  --navy: #0b1e3f;
  --navy-deep: #071527;
  --navy-panel: #0e2449;
  --gold: #c8a45c;
  --gold-soft: #e2c98f;
  --gold-dim: rgba(200, 164, 92, 0.55);
  --hairline: rgba(200, 164, 92, 0.28);
  --hairline-soft: rgba(200, 164, 92, 0.16);
  --ivory: #f3ecda;
  --soft: #cdd7e6;
  --muted: #8ea1bd;
  --fa: "Vazirmatn", sans-serif;
  --naskh: "Noto Naskh Arabic", serif;
  --latin: "Marcellus", serif;
}
html {
  overflow: hidden !important;
  overscroll-behavior: none !important;
  -webkit-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
  touch-action: manipulation !important;
  height: 100% !important;
  font-feature-settings: "ss01";
}
body {
  background-image: url("./background.png") !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  margin: 0 !important;
}

.wrapper {
  position: fixed;
  inset: 0 0 52px 0;

  display: flex;
  align-items: center;
  justify-content: center;

  transform: scale(var(--book-scale, 1));
  transform-origin: center center;
}

#catalog {
  transition: transform 1300ms ease;
  flex-shrink: 0;
}

.page {
  user-select: none;
  width: 794px;
  height: 1123px;
  background: var(--navy);
  color: var(--ivory);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  direction: rtl;
  text-align: right;
}

.page:nth-child(odd) {
  box-shadow: inset 5px 0 90px -20px rgba(0, 0, 0, 0.5) !important;
}

.page-shadow::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none; /* so clicks and page drags still reach the page */
  box-shadow: inset 5px 0 90px -20px rgba(0, 0, 0, 0.5);
}

/* =========================
         Side navigation
         ========================= */

.page-click-zone {
  position: fixed;
  top: 0;
  bottom: 15%;
  height: 100vh;
  width: 12%;
  z-index: 20;
  cursor: pointer;
}

.page-click-zone-left {
  left: 0;
}

.page-click-zone-right {
  right: 0;
}

.flipbook-nav {
  position: fixed;
  top: 50%;
  width: 48px;
  height: 48px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  color: white;
  cursor: pointer;
  z-index: 1000;
  transition:
    background 0.2s ease,
    transform 0.2s ease,
    opacity 0.2s ease;
}

.flipbook-nav:hover {
  background: rgba(0, 0, 0, 0.55);
}

.flipbook-nav:active {
  transform: translateY(-50%) scale(0.92);
}

.flipbook-nav svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flipbook-nav-prev {
  left: 24px;
}

.flipbook-nav-next {
  right: 24px;
}

/* =========================
         Bottom navigation
         ========================= */

.flipbook-bottom-nav {
  position: fixed;
  width: 100%;
  bottom: 0;
  height: 50px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 12px;
  box-sizing: border-box;
  background: var(--navy);
  border: 1px solid var(--hairline);
  z-index: 1000;
}

.flipbook-bottom-nav button {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--gold);
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease,
    opacity 0.2s ease;
}

.flipbook-bottom-nav button:hover {
  background: rgba(200, 164, 92, 0.12);
  color: var(--gold-soft);
}

.flipbook-bottom-nav button:active {
  transform: scale(0.9);
}

.flipbook-bottom-nav svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flipbook-page-input {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.flipbook-page-number {
  width: 42px;
  height: 28px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ivory);
  text-align: center;
  font-family: var(--fa);
  font-size: 13px;
  outline: none;
}

.flipbook-page-number:focus {
  border-color: var(--gold);
}

.flipbook-page-number::-webkit-inner-spin-button,
.flipbook-page-number::-webkit-outer-spin-button {
  margin: 0;
}

.flipbook-page-number::-webkit-inner-spin-button,
.flipbook-page-number::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.flipbook-page-number {
  -moz-appearance: textfield;
  appearance: textfield;
}

.flipbook-total-pages {
  color: var(--gold);
}

.flipbook-bottom-img {
  width: 100px;
  height: auto;
}

/* =========================
   Disabled state (first / last page)
   Must stay AFTER the hover/active rules above.
   ========================= */

/* Side chevrons */
.flipbook-nav:disabled,
.flipbook-nav:disabled:hover {
  background: rgba(0, 0, 0, 0.2);
  opacity: 0.35;
  cursor: not-allowed;
}

.flipbook-nav:disabled:active {
  transform: translateY(-50%);
}

/* Bottom chevrons */
.flipbook-bottom-nav button:disabled,
.flipbook-bottom-nav button:disabled:hover {
  background: transparent;
  color: var(--gold);
  opacity: 0.3;
  cursor: not-allowed;
}

.flipbook-bottom-nav button:disabled:active {
  transform: none;
}

/* Click zones: no pointer cursor in the dead direction */
.page-click-zone.is-disabled {
  cursor: default;
}

@media (max-width: 1560px) {
  .page-click-zone {
    width: 3%;
  }
}

@media (max-width: 1200px) {
  .page-click-zone {
    display: none;
  }
}

@media (max-width: 767px) {
  .flipbook-nav {
    display: none;
  }
}
.flipbook-nav:focus,
.flipbook-nav:focus-visible,
.flipbook-bottom-nav button:focus,
.flipbook-bottom-nav button:focus-visible,
.flipbook-mute:focus,
.flipbook-mute:focus-visible {
  outline: none;
  box-shadow: none;
}

/* =========================
   Loading screen
   ========================= */

#flipbook-loader {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  color: var(--ivory);
  font-family: var(--fa);
  opacity: 1;
  visibility: visible;
  transition:
    opacity 300ms ease,
    visibility 300ms ease;
}

#flipbook-loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.flipbook-loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.flipbook-loader-text {
  font-size: 14px;
  color: var(--muted);
}
