/* popy.rocks B2B Katalog — Flipbook viewer. B2B: white field, ink type, one
   brand-red accent. No lore, no emoji-as-decoration. Matches the print catalog. */
:root {
  --ink: #0C1010;
  --body: #2E2E2E;
  --muted: #8C8C8C;
  --red: #ED311E;
  --line: #E4E4E0;
  --bg: #F2F2EF;
  --topbar-h: 52px;
  --bottombar-h: 34px;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', 'Helvetica Neue', Arial, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ---- top bar ---- */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 5;
}
.brand {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
.brand .hl { color: var(--red); }
.subtitle {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  border-left: 1px solid var(--line);
  padding-left: 12px;
}
.spacer { flex: 1; }

.lang-select {
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  max-width: 44vw;
}
.btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 11px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
  white-space: nowrap;
}
.btn:hover { border-color: var(--red); color: var(--red); }
.btn.icon { font-size: 15px; padding: 6px 9px; }

/* ---- stage / flipbook ---- */
.stage {
  position: relative;
  height: calc(100% - var(--topbar-h) - var(--bottombar-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 8px;
}
.flipbook { margin: 0 auto; }
/* StPageFlip (HTML render mode) wraps each .page-img; give pages a paper look. */
.flipbook .stf__item, .flipbook .page-img { background: #fff; }
.flipbook .page-img { overflow: hidden; box-shadow: 0 1px 6px rgba(0,0,0,0.12); }
.flipbook img { display: block; width: 100%; height: 100%; object-fit: contain; }

.navbtn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 64px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.92);
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
  border-radius: 8px;
  cursor: pointer;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
}
.navbtn:hover { border-color: var(--red); color: var(--red); }
.navbtn.prev { left: 6px; }
.navbtn.next { right: 6px; }
.navbtn:disabled { opacity: 0.25; cursor: default; border-color: var(--line); color: var(--ink); }

/* ---- bottom bar ---- */
.bottombar {
  height: var(--bottombar-h);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-top: 1px solid var(--line);
}
.page-info {
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}
.page-info b { color: var(--red); font-weight: 700; }

/* ---- loader ---- */
.loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 20;
  transition: opacity 0.3s ease;
}
.loader.hidden { opacity: 0; pointer-events: none; }
.spinner {
  width: 38px; height: 38px;
  border: 3px solid var(--line);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-text { font-size: 13px; color: var(--body); letter-spacing: 0.04em; }

/* ---- error ---- */
.errorbox {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: none;            /* the [hidden] attr is overridden by a class rule, so gate explicitly */
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  font-size: 15px;
  color: var(--body);
  line-height: 1.6;
  z-index: 25;
}
.errorbox:not([hidden]) { display: flex; }
.errorbox b { color: var(--ink); }

/* progressive-load badge (pages filling in after the book is shown) */
.fill-status {
  position: fixed;
  right: 12px;
  bottom: calc(var(--bottombar-h) + 10px);
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  border-radius: 6px;
  z-index: 15;
  opacity: 0.85;
}
.fill-status[hidden] { display: none; }

@media (max-width: 640px) {
  .subtitle { display: none; }
  .navbtn { width: 36px; height: 54px; font-size: 24px; }
  .stage { padding: 8px 4px; }
}
