/* Online reader (flipbook) used by flipbook.php — San Andreas colours */

@font-face {
  font-family: 'Alegreya Sans';
  src: url('../fonts/alegreya-sans-v10-latin-regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Alegreya Sans';
  src: url('../fonts/alegreya-sans-v10-latin-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Alegreya Sans';
  src: url('../fonts/alegreya-sans-v10-latin-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  background: #1c2636;
  font-family: 'Alegreya Sans', Arial, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Shell */
.fb-shell {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #1c2636;
}

/* Stage: arrows + book */
.fb-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
}

/* Side arrows: always visible, greyed out at the first/last page */
.fb-arrow {
  flex: 0 0 64px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
}

.fb-arrow span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  font-size: 1.3rem;
  transition: background 0.2s ease, transform 0.2s ease;
}

.fb-arrow:hover span { background: rgba(255, 255, 255, 0.26); }
.fb-arrow:active span { transform: scale(0.94); }
.fb-arrow:focus-visible { outline: none; }
.fb-arrow:focus-visible span { outline: 2px solid #fff; outline-offset: 2px; }
.fb-arrow:disabled { cursor: default; }
.fb-arrow:disabled span { opacity: 0.25; background: rgba(255, 255, 255, 0.12); }

/* Viewport */
.fb-viewport {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  cursor: zoom-in;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity 0.12s ease;
}

.fb-viewport.zoomed { cursor: grab; }
.fb-viewport.dragging { cursor: grabbing; }
.fb-viewport.swapping { opacity: 0; }

#flipbook {
  transform-origin: top left;
}

#flipbook.smooth {
  transition: transform 0.18s ease;
}

#flipbook .page { background: #fff; }
#flipbook .page:nth-child(odd)  { box-shadow: inset -8px 0 20px rgba(0,0,0,0.15); }
#flipbook .page:nth-child(even) { box-shadow: inset  8px 0 20px rgba(0,0,0,0.15); }

#flipbook img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Hint while zoomed */
.fb-hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.78rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 6;
}

.fb-hint.show { opacity: 1; }

/* Toolbar */
.fb-toolbar {
  flex-shrink: 0;
  height: 52px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 16px;
  background: #151d2a;
  border-top: 1px solid rgba(255,255,255,0.06);
  gap: 12px;
}

.fb-page-num {
  color: rgba(255,255,255,0.75);
  font-size: 0.88em;
  font-weight: 500;
  letter-spacing: 0.3px;
  justify-self: start;
  white-space: nowrap;
}

.fb-zoom {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.07);
  border-radius: 6px;
  padding: 4px 6px;
}

.fb-zoom-btn,
.fb-icon-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.fb-zoom-btn { width: 30px; height: 30px; font-size: 1rem; }
.fb-icon-btn { width: 34px; height: 34px; font-size: 1.05rem; }

.fb-zoom-btn:hover,
.fb-icon-btn:hover { color: #fff; background: rgba(255,255,255,0.12); }

.fb-zoom-btn:disabled { opacity: 0.3; cursor: default; background: none; }

.fb-zoom-btn:focus-visible,
.fb-icon-btn:focus-visible,
.fb-zoom-level:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

.fb-zoom-level {
  background: none;
  border: 0;
  color: rgba(255,255,255,0.8);
  font: inherit;
  font-size: 0.82em;
  font-weight: 500;
  min-width: 46px;
  text-align: center;
  cursor: pointer;
  border-radius: 4px;
}

.fb-zoom-level:hover { color: #fff; }

.fb-toolbar-right {
  display: flex;
  justify-content: flex-end;
}

/* Fullscreen */
.fb-shell:fullscreen          { background: #1c2636; width: 100%; height: 100%; }
.fb-shell:-webkit-full-screen { background: #1c2636; width: 100%; height: 100%; }

/* Narrow screens: arrows float over the book so it gets the full width */
@media (max-width: 700px) {
  .fb-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    z-index: 5;
  }
  .fb-arrow span { width: 40px; height: 40px; background: rgba(0, 0, 0, 0.45); font-size: 1.15rem; }
  .fb-arrow:disabled { display: none; }
  #prev { left: 4px; }
  #next { right: 4px; }
  .fb-toolbar { padding: 0 10px; gap: 8px; }
}


/* ---------- San Andreas additions ---------- */
.fb-page-num { font-size: 1rem; }

/* Close (inside the website popup) and PDF link */
.fb-toolbar-right { gap: 6px; align-items: center; }
.fb-text-btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.25);
  background: none;
  color: rgba(255,255,255,0.85);
  font: inherit; font-size: .92rem; font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.fb-text-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.fb-text-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.fb-text-btn--accent { background: #764e63; border-color: #764e63; color: #fff; }
.fb-text-btn--accent:hover { background: #8d6378; }

/* Loading note until the cover has arrived */
.fb-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  color: rgba(255,255,255,.75);
  font-size: .95rem; letter-spacing: .12em; text-transform: uppercase;
  pointer-events: none;
  z-index: 4;
  transition: opacity .3s ease;
}
.fb-loading.is-done { opacity: 0; }
.fb-loading::before {
  content: '';
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.2); border-top-color: #c9a7b8;
  animation: fb-spin .9s linear infinite;
}
@keyframes fb-spin { to { transform: rotate(360deg); } }

/* Each page: tiny preview at once, spinner while the sharp version loads, then a fade */
#flipbook .page { position: relative; overflow: hidden; }
#flipbook .page .fb-thumb {
  position: absolute; inset: 0;
  background: #eef0f3 center / cover no-repeat;
}
#flipbook .page img { position: relative; opacity: 1; transition: opacity .35s ease; }
#flipbook .page img:not([src]) { opacity: 0; }
#flipbook .page .fb-page-spin {
  position: absolute; z-index: 2; left: 50%; top: 50%;
  width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border-radius: 50%;
  border: 3px solid rgba(28,38,54,.15); border-top-color: #764e63;
  background: rgba(255,255,255,.75);
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
  opacity: 0; transition: opacity .25s ease;
  animation: fb-spin .9s linear infinite;
  pointer-events: none;
}
/* the spinner appears only if loading takes noticeably long */
#flipbook .page.is-loading .fb-page-spin { opacity: 1; transition-delay: .35s; }
#flipbook .page.is-error::after {
  content: 'Seite konnte nicht geladen werden';
  position: absolute; z-index: 2; left: 10%; right: 10%; top: 50%;
  transform: translateY(-50%);
  padding: .6rem .8rem; border-radius: 8px;
  background: rgba(28,38,54,.85); color: #fff;
  font-size: .85rem; text-align: center;
}

@media (max-width: 700px) {
  .fb-text-btn span { display: none; }
  .fb-text-btn { width: 34px; padding: 0; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .fb-loading::before { animation-duration: 2.4s; }
}
