/* PKPLAST Flipbook – Modern Green Corporate identity */
@font-face { font-family: "Heebo"; src: url("fonts/Heebo-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Heebo"; src: url("fonts/Heebo-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Heebo"; src: url("fonts/Heebo-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

.pkfb {
  --pk-dark: #006838;   /* logo "PK" */
  --pk-lime: #88c040;   /* logo "plast" */
  --pk-mist: #f2f6ef;   /* light neutral */
  --pk-line: #d5e8c3;
  --pk-ink: #1f2a24;
  --pk-grey: #5b6760;
  font-family: "Heebo", "Segoe UI", Arial, sans-serif;
  color: var(--pk-ink);
}

/* ------------------------------------------------------------------ viewer */
.pkfb { position: relative; display: flex; flex-direction: column; width: 100%; height: min(86vh, 900px);
  min-height: 420px; background: var(--pk-mist); border-radius: 14px; overflow: hidden; outline: none;
  box-shadow: 0 1px 0 var(--pk-line) inset; }
.pkfb.pkfb-is-full { position: fixed; inset: 0; z-index: 9999; height: 100vh; height: 100dvh; border-radius: 0; }
.pkfb:fullscreen { height: 100vh; border-radius: 0; }
.pkfb-loading, .pkfb-error { margin: auto; color: var(--pk-grey); font-size: 15px; display: flex; flex-direction: column;
  align-items: center; gap: 14px; text-align: center; padding: 24px; }
.pkfb-error p { margin: 0; }
.pkfb-error-alt a { color: var(--pk-dark); font-weight: 700; }
.pkfb-spinner { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--pk-line); border-top-color: var(--pk-dark);
  animation: pkfb-spin .9s linear infinite; }
@keyframes pkfb-spin { to { transform: rotate(360deg); } }
.pkfb-page-failed { background: repeating-linear-gradient(45deg, #fff, #fff 10px, var(--pk-mist) 10px, var(--pk-mist) 20px); }
.pkfb-page-failed img { visibility: hidden; }

.pkfb-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #fff;
  border-bottom: 3px solid var(--pk-lime); position: relative; z-index: 3; }
.pkfb-title { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; flex: 1 1 0; }
.pkfb-title-main { font-weight: 700; color: var(--pk-dark); font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pkfb-title-sub { font-size: 12.5px; color: var(--pk-grey); }
.pkfb-nav { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.pkfb-counter { min-width: 118px; text-align: center; font-size: 13.5px; color: var(--pk-grey); white-space: nowrap; }
.pkfb-counter b { color: var(--pk-dark); font-weight: 700; }
.pkfb-tools { display: flex; align-items: center; gap: 6px; flex: 1 1 0; justify-content: flex-end; }

.pkfb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; min-width: 38px;
  padding: 0 9px; border: 1px solid var(--pk-line); border-radius: 10px; background: #fff; color: var(--pk-dark);
  cursor: pointer; font: 500 13.5px/1 "Heebo", Arial, sans-serif; text-decoration: none; transition: background .15s, border-color .15s; }
.pkfb-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pkfb-btn:hover { background: var(--pk-mist); border-color: var(--pk-lime); }
.pkfb-btn:focus-visible { outline: 3px solid var(--pk-lime); outline-offset: 1px; }
.pkfb-btn:disabled { opacity: .35; cursor: default; background: #fff; }
.pkfb-download { background: var(--pk-dark); color: #fff; border-color: var(--pk-dark); }
.pkfb-download:hover { background: #00532d; border-color: #00532d; }

.pkfb-stage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: 18px 22px; overflow: hidden;
  background:
    radial-gradient(circle at 0% 100%, transparent 62%, rgba(136,192,64,.10) 62.3%, transparent 63%),
    radial-gradient(circle at 100% 0%, transparent 52%, rgba(0,104,56,.07) 52.3%, transparent 53%),
    var(--pk-mist); }
.pkfb-book-wrap { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.pkfb-book { margin: 0 auto; width: 100%; height: 100%; }
.pkfb-page { background: #fff; overflow: hidden; }
.pkfb-page img { display: block; width: 100% !important; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none;
  background: #fff; }
.pkfb-page img:not([src]) { background: linear-gradient(90deg, #fff, var(--pk-mist), #fff); }

.pkfb-thumbstrip { display: none; gap: 8px; padding: 10px 14px; overflow-x: auto; background: #fff;
  border-top: 1px solid var(--pk-line); scrollbar-width: thin; flex: 0 0 auto; }
.pkfb.pkfb-show-thumbs .pkfb-thumbstrip { display: flex; }
.pkfb-thumb { flex: 0 0 auto; position: relative; border: 2px solid transparent; border-radius: 8px; padding: 0;
  background: var(--pk-mist); cursor: pointer; height: 92px; }
.pkfb-thumb img { height: 100%; width: auto; display: block; border-radius: 6px; }
.pkfb-thumb span { position: absolute; bottom: 4px; inset-inline-start: 4px; background: rgba(0,104,56,.88); color: #fff;
  font-size: 11px; border-radius: 6px; padding: 1px 6px; }
.pkfb-thumb.is-current { border-color: var(--pk-lime); }
.pkfb-thumb:focus-visible { outline: 3px solid var(--pk-lime); }

.pkfb-toast { position: absolute; bottom: 18px; left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--pk-dark); color: #fff; padding: 8px 16px; border-radius: 10px; font-size: 14px; transition: .2s; z-index: 6; }
.pkfb-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* zoom overlay */
.pkfb-zoom-ov { position: absolute; inset: 0; z-index: 8; background: rgba(242,246,239,.98); display: flex; }
.pkfb-zoom-vp { flex: 1; overflow: hidden; display: flex; align-items: center; justify-content: center; touch-action: none; cursor: grab; }
.pkfb-zoom-vp:active { cursor: grabbing; }
.pkfb-zoom-sheet { display: flex; max-width: 96%; max-height: 92%; transform-origin: center center; will-change: transform; }
.pkfb-zoom-sheet img { max-height: 84vh; max-width: 48%; width: auto; height: auto; flex: 0 1 auto; background: #fff;
  box-shadow: 0 4px 18px rgba(0,0,0,.12); }
.pkfb-zoom-sheet img:only-child { max-width: 96%; }
.pkfb-zoom-ctrl { position: absolute; top: 12px; inset-inline-end: 12px; display: flex; gap: 6px; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 860px) {
  .pkfb { height: calc(100vh - 120px); height: calc(100dvh - 120px); min-height: 380px; border-radius: 10px; }
  .pkfb-bar { flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
  .pkfb-title { flex: 1 1 100%; flex-direction: row; gap: 8px; align-items: baseline; }
  .pkfb-nav { order: 2; }
  .pkfb-tools { order: 3; flex: 1 1 auto; }
  .pkfb-download span { display: none; }
  .pkfb-counter { min-width: 84px; font-size: 12.5px; }
  .pkfb-stage { padding: 8px; }
  .pkfb-btn { height: 40px; min-width: 40px; }          /* touch targets */
  .pkfb-thumb { height: 72px; }
  .pkfb-zoom-sheet img { max-width: 96%; }
}
@media (prefers-reduced-motion: reduce) { .pkfb-toast, .pkfb-btn { transition: none; } .pkfb-spinner { animation-duration: 2.4s; } }

/* ------------------------------------------------------------------ pkplast.com theme integration
   The site theme sets  img { width:auto !important; max-width:100% }  and  * { box-sizing:border-box }.
   Page images must fill their page box exactly, hence the !important overrides above. */
.pkfb-zoom-sheet img { width: auto !important; }
.pkfb button { font-family: inherit; line-height: 1; }
@media (max-width: 860px) {
  .pkcat--viewer .pkfb { height: calc(100vh - 90px); height: calc(100dvh - 90px); }
}
