/* Lettore di riviste sfogliabili (SpiderMax). Colori personalizzabili: --sfb-bg, --sfb-fg, --sfb-ac (anche con data-accent). */
.sfb { --sfb-bg: #14171b; --sfb-fg: #f3f4f6; --sfb-ac: #e8590c; position: relative; display: flex; flex-direction: column; width: 100%; height: 520px; background: var(--sfb-bg); color: var(--sfb-fg);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; outline: 0; box-sizing: border-box; border-radius: 6px; -webkit-tap-highlight-color: transparent; container-type: inline-size; }
.sfb *, .sfb *::before, .sfb *::after { box-sizing: border-box; }
.sfb-page { position: relative; height: 100vh; height: 100dvh; border-radius: 0; }
.sfb-embed { height: 520px; }
.sfb-fs, .sfb:fullscreen { position: fixed; inset: 0; width: 100%; height: 100% !important; z-index: 2147483000; border-radius: 0; }
.sfb:-webkit-full-screen { width: 100%; height: 100% !important; border-radius: 0; }

.sfb-stage { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.sfb-zoomed .sfb-stage { touch-action: none; cursor: grab; }
.sfb-zoom { transform-origin: 50% 50%; }   /* niente will-change: il browser rasterizzerebbe la pagina a scala 1 e poi la ingrandirebbe (sfocata) */
.sfb-book { position: relative; perspective: 2600px; transform: translateX(var(--sfb-sx, 0%)); transition: transform .7s cubic-bezier(.45, .05, .3, 1); }
.sfb-slot { position: absolute; top: 0; width: 50%; height: 100%; }
.sfb-l { left: 0; } .sfb-r { left: 50%; }
.sfb-single .sfb-r { left: 0; width: 100%; } .sfb-single .sfb-l { display: none; }
.sfb-pg { position: absolute; inset: 0; background: #fff; overflow: hidden; }
.sfb-pg.sfb-empty { background: transparent; }
.sfb-pg img { display: block; width: 100%; height: 100%; object-fit: fill; opacity: 0; transition: opacity .25s; pointer-events: none; }
.sfb-pg.sfb-ld img { opacity: 1; }
.sfb-pg.sfb-nofade img { transition: none; }
.sfb-wait .sfb-stage { cursor: progress; }
.sfb-wait .sfb-stage::after { content: ""; position: absolute; right: 16px; top: 16px; width: 22px; height: 22px; border: 3px solid rgba(255, 255, 255, .25); border-top-color: var(--sfb-ac); border-radius: 50%; animation: sfbspin .8s linear infinite; z-index: 7; }
.sfb-pg:not(.sfb-empty):not(.sfb-ld)::before { content: ""; position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px; border: 3px solid rgba(0, 0, 0, .12); border-top-color: var(--sfb-ac); border-radius: 50%; animation: sfbspin .8s linear infinite; }
@keyframes sfbspin { to { transform: rotate(360deg); } }
/* ombra del dorso al centro e leggero bordo */
.sfb-book:not(.sfb-single) .sfb-l .sfb-pg:not(.sfb-empty)::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to left, rgba(0, 0, 0, .28), rgba(0, 0, 0, 0) 9%); }
.sfb-book:not(.sfb-single) .sfb-r .sfb-pg:not(.sfb-empty)::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to right, rgba(0, 0, 0, .28), rgba(0, 0, 0, 0) 9%); }
.sfb-slot .sfb-pg:not(.sfb-empty) { box-shadow: 0 6px 26px rgba(0, 0, 0, .5); }
.sfb-single .sfb-r .sfb-pg::after { display: none; }

/* pagina che gira */
.sfb-leaf { position: absolute; top: 0; width: 50%; height: 100%; transform-style: preserve-3d; transition: transform .75s cubic-bezier(.45, .05, .3, 1); z-index: 5; }   /* niente filter qui: appiattirebbe il 3D e il retro della pagina non si vedrebbe mai */
.sfb-lr { left: 50%; transform-origin: left center; } .sfb-ll { left: 0; transform-origin: right center; }
.sfb-lr.sfb-go { transform: rotateY(-180deg); } .sfb-ll.sfb-go { transform: rotateY(180deg); }
.sfb-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; background: #fff; box-shadow: 0 0 22px rgba(0, 0, 0, .35); }
.sfb-face .sfb-pg { box-shadow: none; }
.sfb-back { transform: rotateY(180deg); }
.sfb-face .sfb-pg.sfb-empty, .sfb-face:empty { background: #fff; }

/* link e ricerca sulla pagina */
.sfb-ov { position: absolute; inset: 0; }
.sfb-a { position: absolute; display: block; border-radius: 3px; z-index: 3; cursor: pointer; transition: background .15s, box-shadow .15s; }
.sfb-a:hover, .sfb-a:focus-visible, .sfb-showlinks .sfb-a { background: color-mix(in srgb, var(--sfb-ac) 22%, transparent); box-shadow: 0 0 0 1.5px var(--sfb-ac); }
.sfb-hl { position: absolute; background: rgba(255, 214, 0, .42); mix-blend-mode: multiply; border-radius: 2px; pointer-events: none; z-index: 2; }
.sfb-hl.on { background: rgba(255, 120, 0, .55); box-shadow: 0 0 0 2px rgba(255, 120, 0, .8); }

/* frecce laterali e barra */
.sfb-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 84px; border: 0; background: rgba(0, 0, 0, .28); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s, background .2s; z-index: 6; padding: 0; }
.sfb-ar-l { left: 0; border-radius: 0 10px 10px 0; } .sfb-ar-r { right: 0; border-radius: 10px 0 0 10px; }
.sfb-stage:hover .sfb-arrow, .sfb-arrow:focus-visible { opacity: 1; }
.sfb-arrow:hover { background: rgba(0, 0, 0, .55); }
.sfb-arrow[hidden] { display: none; }
@media (hover: none) { .sfb-arrow { opacity: .7; width: 34px; height: 70px; } }
.sfb-zoomed .sfb-arrow { display: none; }

.sfb-bar { flex: 0 0 auto; height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px; background: rgba(255, 255, 255, .06); border-top: 1px solid rgba(255, 255, 255, .08); position: relative; z-index: 8; }
.sfb-g, .sfb-gc { display: flex; align-items: center; gap: 2px; }
.sfb-gc { flex: 1 1 auto; justify-content: center; gap: 8px; min-width: 0; max-width: 640px; }
.sfb-btn { width: 40px; height: 40px; border: 0; border-radius: 8px; background: transparent; color: inherit; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; text-decoration: none; flex: 0 0 auto; }
.sfb-btn:hover { background: rgba(255, 255, 255, .12); } .sfb-btn.on { background: var(--sfb-ac); color: #fff; }
.sfb-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.sfb-btn:focus-visible, .sfb-arrow:focus-visible, .sfb-th:focus-visible { outline: 2px solid var(--sfb-ac); outline-offset: 1px; }
.sfb-label { min-width: 84px; text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sfb-range { flex: 1 1 120px; min-width: 60px; accent-color: var(--sfb-ac); cursor: pointer; }
/* barra stretta: si misura la larghezza del lettore (non della finestra), quindi vale anche per un lettore incorporato in un contenitore stretto */
@container (max-width: 640px) { .sfb-hide-s { display: none; } .sfb-bar { height: 52px; padding: 0 6px; gap: 4px; } .sfb-gc { gap: 4px; } .sfb-btn { width: 36px; height: 36px; } .sfb-btn svg { width: 19px; height: 19px; } .sfb-label { min-width: 64px; font-size: 13px; } .sfb-panel { bottom: 52px; } }
@container (max-width: 440px) {   /* telefono: lo slider sale su una riga a tutta larghezza sopra i pulsanti */
  .sfb-bar { height: auto; flex-wrap: wrap; align-content: center; padding: 2px 8px 4px; gap: 0 4px; justify-content: space-between; }
  .sfb-gc { display: contents; }
  .sfb-range { order: -1; flex: 0 0 100%; width: 100%; height: 30px; margin: 0; }
  .sfb-g { gap: 0; } .sfb-label { min-width: 72px; padding: 0 4px; text-align: center; }
  .sfb-panel { bottom: 88px; }
}

/* pannello pagine / ricerca */
.sfb-panel { position: absolute; left: 0; top: 0; bottom: 56px; width: min(340px, 100%); background: rgba(20, 23, 27, .97); border-right: 1px solid rgba(255, 255, 255, .1); z-index: 9; display: flex; flex-direction: column; box-shadow: 8px 0 26px rgba(0, 0, 0, .45); }
.sfb-panel[hidden] { display: none; }
.sfb-ph { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 14px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sfb-grid { overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; padding: 12px; align-content: start; }
.sfb-th { border: 2px solid transparent; border-radius: 6px; background: rgba(255, 255, 255, .06); padding: 4px; color: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; font: inherit; font-size: 12px; }
.sfb-th img { width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: contain; background: #fff; }
.sfb-th:hover { background: rgba(255, 255, 255, .14); } .sfb-th.on { border-color: var(--sfb-ac); }
.sfb-sf { padding: 10px 12px 4px; }
.sfb-q { width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08); color: inherit; font: inherit; }
.sfb-q:focus { outline: 2px solid var(--sfb-ac); border-color: transparent; }
.sfb-st { padding: 4px 14px 8px; font-size: 12px; opacity: .75; min-height: 24px; }
.sfb-rs { overflow: auto; padding: 0 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.sfb-r1 { display: flex; gap: 10px; align-items: baseline; text-align: left; border: 0; background: transparent; color: inherit; padding: 7px 8px; border-radius: 6px; cursor: pointer; font: inherit; font-size: 13px; }
.sfb-r1:hover, .sfb-r1.on { background: rgba(255, 255, 255, .12); }
.sfb-r1 b { flex: 0 0 34px; text-align: right; color: var(--sfb-ac); }
.sfb-r1 mark { background: rgba(255, 214, 0, .85); color: #111; border-radius: 2px; padding: 0 1px; }
.sfb-pn-open .sfb-stage { }
@container (max-width: 700px) { .sfb-panel { width: 100%; } }
@media print { .sfb-bar, .sfb-arrow, .sfb-panel { display: none; } }
