/* Bläddra PDF – läsaren. Färger från temat när de finns. */
html.lnfb-open { overflow: hidden; }
.lnfb { --lnfb-bg: #1a1f1b; --lnfb-ink: #f2f4f1; --lnfb-dim: #a9b2aa; --lnfb-accent: var(--c-brand, #3d9a32);
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--lnfb-bg); color: var(--lnfb-ink);
  font: 500 14px/1.3 var(--f-ui, system-ui, -apple-system, "Segoe UI", sans-serif); outline: 0; }
.lnfb--modal { position: fixed; inset: 0; z-index: 100000; animation: lnfb-in .2s ease-out; }
.lnfb--inline { position: relative; height: min(82vh, 760px); border-radius: var(--radius, 8px); overflow: hidden; margin: 1.5em 0; }
@keyframes lnfb-in { from { opacity: 0; } }

.lnfb__bar { display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 18px; border-bottom: 1px solid rgba(255,255,255,.08); min-width: 0; }
.lnfb__title { flex: 1 1 auto; min-width: 0; font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lnfb__pages { flex: none; color: var(--lnfb-dim); font-variant-numeric: tabular-nums; }
.lnfb__tools { flex: none; display: flex; gap: 2px; }
.lnfb__tool { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 8px; background: none; color: var(--lnfb-ink); cursor: pointer; text-decoration: none; }
.lnfb__tool:hover { background: rgba(255,255,255,.1); }
.lnfb__tool:disabled { opacity: .35; cursor: default; background: none; }
.lnfb__tool:focus-visible, .lnfb__nav:focus-visible, .lnfb__range:focus-visible { outline: 2px solid var(--lnfb-accent); outline-offset: 2px; }
.lnfb__close { margin-left: 6px; background: rgba(255,255,255,.08); }

.lnfb__stage { position: relative; display: grid; place-items: center; overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.lnfb__book { position: relative; perspective: 2400px; cursor: pointer; }
.lnfb__page { position: absolute; top: 0; height: 100%; background: #fff; overflow: hidden; }
.lnfb__page canvas, .lnfb__face canvas, .lnfb__zpage canvas { display: block; width: 100%; height: 100%; }
.lnfb__page.is-empty { background: none; }
.lnfb__page--r { right: 0; width: 100%; box-shadow: 0 10px 40px rgba(0,0,0,.45); }
.lnfb.is-spread .lnfb__page--l, .lnfb.is-spread .lnfb__page--r { width: 50%; }
.lnfb.is-spread .lnfb__page--l { left: 0; box-shadow: 0 10px 40px rgba(0,0,0,.45); }
.lnfb.is-spread .lnfb__page--l.is-empty, .lnfb.is-spread .lnfb__page--r.is-empty { box-shadow: none; }
/* Ryggen: skugga mot mitten. */
.lnfb.is-spread .lnfb__page--l:not(.is-empty)::after, .lnfb.is-spread .lnfb__page--r:not(.is-empty)::after { content: ""; position: absolute; top: 0; bottom: 0; width: 6%; pointer-events: none; }
.lnfb.is-spread .lnfb__page--l::after { right: 0; background: linear-gradient(to left, rgba(0,0,0,.18), transparent); }
.lnfb.is-spread .lnfb__page--r::after { left: 0; background: linear-gradient(to right, rgba(0,0,0,.18), transparent); }
.lnfb__page.is-loading, .lnfb__zpage.is-loading { background: #fff linear-gradient(100deg, #fff 30%, #eef0ec 50%, #fff 70%) 0 0 / 200% 100%; animation: lnfb-shine 1.2s linear infinite; }
@keyframes lnfb-shine { to { background-position: -200% 0; } }

/* Bladet som vänds. */
.lnfb__leaf { position: absolute; top: 0; height: 100%; transform-style: preserve-3d; z-index: 3; pointer-events: none; }
.lnfb__leaf--r { right: 0; width: 50%; transform-origin: left center; }
.lnfb__leaf--l { left: 0; width: 50%; transform-origin: right center; }
.lnfb__leaf--single { right: 0; width: 100%; transform-origin: left center; }
.lnfb__face { position: absolute; inset: 0; background: #fff; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.lnfb__face--back { transform: rotateY(180deg); }
.lnfb__face.is-blank { background: transparent; }
.lnfb__shade { position: absolute; inset: 0; background: linear-gradient(to right, rgba(0,0,0,.6), rgba(0,0,0,0) 60%); opacity: 0; pointer-events: none; backface-visibility: hidden; }
.lnfb__leaf--l .lnfb__shade { background: linear-gradient(to left, rgba(0,0,0,.6), rgba(0,0,0,0) 60%); }

.lnfb__nav { position: absolute; top: 50%; z-index: 4; transform: translateY(-50%); width: 48px; height: 72px; display: grid; place-items: center; border: 0; border-radius: 10px; background: rgba(255,255,255,.08); color: var(--lnfb-ink); cursor: pointer; }
.lnfb__nav:hover { background: rgba(255,255,255,.16); }
.lnfb__nav:disabled { opacity: 0; pointer-events: none; }
.lnfb__nav--prev { left: 10px; }
.lnfb__nav--next { right: 10px; }
@media (max-width: 640px) {
  .lnfb__nav { display: none; } /* Svep eller tryck på sidan. */
  .lnfb__bar { padding-left: 12px; gap: 6px; }
  .lnfb__tool { width: 36px; height: 36px; }
  .lnfb__pages { font-size: 13px; }
}

.lnfb__msg { position: absolute; inset: 0; z-index: 5; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--lnfb-dim); text-align: center; padding: 20px; }
.lnfb__msg[hidden] { display: none; }
.lnfb__spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.18); border-top-color: var(--lnfb-accent); animation: lnfb-spin .8s linear infinite; }
@keyframes lnfb-spin { to { transform: rotate(360deg); } }
.lnfb__dl { color: #fff; font-weight: 700; }

.lnfb__foot { padding: 6px 18px 12px; }
.lnfb__range { width: 100%; accent-color: var(--lnfb-accent); }

/* Förstoring. */
.lnfb__zoom { grid-row: 2; grid-column: 1; z-index: 6; overflow: auto; background: var(--lnfb-bg); cursor: grab; touch-action: pan-x pan-y pinch-zoom; }
.lnfb__zoom.is-panning { cursor: grabbing; }
.lnfb__zoom[hidden] { display: none; }
.lnfb__zwrap { display: flex; width: max-content; min-width: 100%; justify-content: center; padding: 16px; gap: 0; box-sizing: border-box; }
.lnfb__zpage { flex: none; background: #fff; box-shadow: 0 10px 40px rgba(0,0,0,.45); }
.lnfb.is-zoomed .lnfb__stage { visibility: hidden; }

@media (prefers-reduced-motion: reduce) { .lnfb--modal { animation: none; } }
