/* Alles gescoped onder .bb-book zodat het thema niet wordt beïnvloed. */
.bb-book, .bb-book *, .bb-book *::before, .bb-book *::after { box-sizing: border-box; }
.bb-book { --bb-accent: #e2001a; width: 100%; margin: 0 auto 2rem; color: #1a1a1a; font-family: inherit; line-height: 1.4; outline: none; clear: both; position: relative; }
.bb-book:fullscreen { max-width: none !important; background: #1d1d1d; display: flex; flex-direction: column; justify-content: center; padding: 16px; margin: 0; }
.bb-book:fullscreen .bb-bar { color: #fff; }
.bb-book button { font: inherit; }
.bb-book [hidden] { display: none !important; }

.bb-stage { position: relative; width: 100%; margin: 0 auto; user-select: none; -webkit-user-select: none; touch-action: pan-y; cursor: pointer; }

/* ---------- Opengeslagen boek ---------- */
.bb-book3d { position: relative; width: 100%; height: 100%; perspective: 2600px; transition: transform var(--bb-dur, 1.6s) ease; }
.bb-no-anim .bb-book3d, .bb-no-anim .bb-leaf, .bb-no-anim .bb-sheet { transition: none !important; }
.bb-leaf { position: absolute; top: 0; left: 50%; width: 50%; height: 100%; transform-origin: left center; transform-style: preserve-3d; transition: transform var(--bb-dur, 1.6s) cubic-bezier(.45,.05,.25,1); }
.bb-leaf.bb-flipped { transform: rotateY(-180deg); }
.bb-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; background: #fff; box-shadow: var(--bb-page-shadow, 0 2px 14px rgba(0,0,0,.22)); }
.bb-back { transform: rotateY(180deg); }
.bb-front::after, .bb-back::after { content: ""; position: absolute; top: 0; bottom: 0; width: 7%; pointer-events: none; z-index: 5; }
.bb-front::after { left: 0; background: linear-gradient(to right, rgba(0,0,0,.2), rgba(0,0,0,0)); }
.bb-back::after { right: 0; background: linear-gradient(to left, rgba(0,0,0,.2), rgba(0,0,0,0)); }

/* ---------- Enkele pagina (smalle schermen) ---------- */
.bb-flat { position: relative; width: 100%; height: 100%; overflow: hidden; perspective: 2400px; background: transparent; box-shadow: var(--bb-page-shadow, 0 2px 14px rgba(0,0,0,.22)); }
.bb-sheet { position: absolute; inset: 0; transform-origin: left center; transform-style: preserve-3d; transition: transform var(--bb-dur, 1.6s) cubic-bezier(.45,.05,.25,1); }
.bb-sheet.bb-flipped { transform: rotateY(-180deg); }
.bb-flat .bb-face { box-shadow: none; }
.bb-flat .bb-front::after { background: linear-gradient(to right, rgba(0,0,0,.12), rgba(0,0,0,0)); }
.bb-paper { background: linear-gradient(to left, #f3efe4, #fbf9f3); }

/* ---------- Pagina's ---------- */
.bb-page { position: relative; width: 100%; height: 100%; container-type: size; overflow: hidden; background: #fff; }
.bb-content { padding: 4cqw 4cqw 8cqw; display: flex; }
.bb-figs { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 2cqw; }
.bb-n-3 .bb-figs, .bb-n-4 .bb-figs { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; }
.bb-n-3 .bb-fig:first-child { grid-column: 1 / -1; }
.bb-fig { flex: 1 1 0; min-height: 0; min-width: 0; margin: 0; display: flex; flex-direction: column; }
.bb-photo { flex: 1; min-height: 0; display: flex; align-items: center; cursor: zoom-in; background: transparent; }
.bb-al-links .bb-photo { justify-content: flex-start; }
.bb-al-midden .bb-photo { justify-content: center; }
.bb-al-rechts .bb-photo { justify-content: flex-end; }
.bb-photo img { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; margin: 0; box-sizing: border-box; border-radius: 0; padding: var(--bb-ppad, 0); background: var(--bb-pbg, transparent); border: var(--bb-pborder, 0); box-shadow: var(--bb-pshadow, none); }
.bb-fig figcaption { padding-top: 2cqw; font-size: 3.6cqw; line-height: 1.3; color: #222; }
.bb-fig figcaption strong { display: block; font-size: 4.2cqw; color: var(--bb-accent); }
.bb-fig figcaption span { display: block; }
.bb-al-links figcaption { text-align: left; }
.bb-al-midden figcaption { text-align: center; }
.bb-al-rechts figcaption { text-align: right; }
.bb-full { padding: 0; }
.bb-full .bb-figs { gap: 0; }
.bb-full .bb-photo { justify-content: center; }
.bb-full .bb-photo img { padding: 0; border: 0; box-shadow: none; background: transparent; width: 100%; height: 100%; max-width: 100%; max-height: 100%; }
.bb-num { position: absolute; bottom: 3cqw; font-size: 2.6cqw; color: #777; }
.bb-front .bb-num { right: 11cqw; }
.bb-back .bb-num { left: 11cqw; }
.bb-flat .bb-front .bb-num { right: auto; left: 50%; transform: translateX(-50%); }
.bb-cover { background: var(--bb-accent); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 5cqw; gap: 3cqw; }
.bb-cover img { display: block; width: auto; height: auto; max-width: 100%; max-height: 72%; object-fit: contain; border: .8cqw solid #fff; margin: 0; border-radius: 0; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.bb-cover h2 { margin: 0; padding: 0; color: #fff; font-size: 6.5cqw; line-height: 1.15; }
.bb-cover p { margin: 0; font-size: 3.6cqw; font-style: italic; opacity: .95; }
.bb-end { background: var(--bb-accent); color: #fff; display: flex; align-items: center; justify-content: center; text-align: center; padding: 8cqw; }
.bb-end p { margin: 0; font-size: 3.6cqw; }
.bb-blank { background: #fff; }

/* ---------- Bediening ---------- */
.bb-bar { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; }
.bb-bar button { width: 44px; height: 44px; border: 0; background: var(--bb-accent); color: #fff; font-size: 26px; line-height: 1; cursor: pointer; border-radius: 0; box-shadow: 0 0 0 4px color-mix(in srgb, var(--bb-accent) 22%, transparent); padding: 0; }
.bb-bar button:hover:not(:disabled), .bb-bar button:focus-visible { filter: brightness(1.12); outline: none; }
.bb-bar button:disabled { opacity: .35; cursor: default; box-shadow: none; }
.bb-bar .bb-fs { font-size: 20px; }
.bb-bar .bb-snd { font-size: 22px; position: relative; }
.bb-bar .bb-snd.is-off { opacity: .55; }
.bb-bar .bb-snd.is-off::after { content: ""; position: absolute; left: 8px; right: 8px; top: 50%; height: 3px; background: #fff; transform: rotate(-40deg); }
.bb-label { min-width: 150px; text-align: center; font-size: .95rem; }
.bb-empty { color: #666; }

/* ---------- Lichtbak ---------- */
.bb-lb { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.92); padding: 20px 56px; }
.bb-lb[hidden] { display: none; }
.bb-lb figure { margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; color: #fff; }
.bb-lb-scroll { max-width: calc(100vw - 112px); max-height: calc(100vh - 140px); overflow: auto; }
.bb-lb img { display: block; max-width: none; max-height: none; width: auto; height: auto; margin: 0; border: 0; border-radius: 0; cursor: zoom-in; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.bb-lb.is-zoom img { cursor: zoom-out; }
.bb-lb figcaption { margin-top: 12px; text-align: center; font-size: 1.15rem; line-height: 1.45; max-width: 860px; }
.bb-lb figcaption strong { display: block; }
.bb-lb button { position: absolute; border: 0; background: rgba(255,255,255,.14); color: #fff; cursor: pointer; line-height: 1; border-radius: 0; font-family: inherit; }
.bb-lb button:hover, .bb-lb button:focus-visible { background: var(--bb-accent, #e2001a); outline: none; }
.bb-lb-close { top: 14px; right: 14px; width: 42px; height: 42px; font-size: 28px; }
.bb-lb-nav { top: 50%; transform: translateY(-50%); width: 42px; height: 64px; font-size: 38px; }
.bb-lb-prev { left: 8px; }
.bb-lb-next { right: 8px; }

@media (prefers-reduced-motion: reduce) {
	.bb-leaf, .bb-book3d, .bb-sheet { transition: none !important; }
}

/* Licht voorblad en achterblad */
.bb-cover-licht .bb-cover, .bb-cover-licht .bb-end { background: #fffdf8; color: var(--bb-accent); border: 2.2cqw solid var(--bb-accent); }
.bb-cover-licht .bb-cover h2 { color: var(--bb-accent); }
.bb-cover-licht .bb-cover img { border-color: var(--bb-accent); }

/* Opgekrulde hoeken (rechts onder op de rechterpagina, links onder op de linkerpagina) */
.bb-curl { position: absolute; bottom: 0; width: 7%; aspect-ratio: 1; z-index: 6; cursor: pointer; transition: width .3s ease; animation: bb-peek 1.8s ease-in-out 1.2s 2; }
.bb-curl:hover { width: 13%; }
.bb-curl-r { right: 0; }
.bb-curl-l { left: 0; transform: scaleX(-1); }
.bb-cu, .bb-cf, .bb-cf i { position: absolute; inset: 0; display: block; }
.bb-cu { clip-path: polygon(100% 0, 100% 100%, 0 100%); background: linear-gradient(135deg, #b9b2a2 0%, #e6e1d5 70%); }
.bb-cf { filter: drop-shadow(-2px -2px 3px rgba(0,0,0,.35)); }
.bb-cf i { clip-path: polygon(0 0, 100% 0, 0 100%); background: linear-gradient(135deg, #ffffff 0%, #f2eee2 55%, #d5cfbf 100%); }
.bb-flat .bb-sheet.bb-first .bb-curl-l, .bb-flat .bb-sheet.bb-last .bb-curl-r { display: none; }
/* Steeds één opgekrulde hoek tegelijk: rechtsonder, of linksonder als de muis over de linkerpagina is. */
.bb-stage[data-cs="r"] .bb-curl-l, .bb-stage[data-cs="l"] .bb-curl-r { display: none; }
@keyframes bb-peek { 0%, 100% { width: 7%; } 50% { width: 11%; } }

/* Schaduw op de pagina tijdens het omslaan */
.bb-face::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; z-index: 4; background: linear-gradient(to right, rgba(0,0,0,.42), rgba(0,0,0,0) 70%); }
.bb-back::before { background: linear-gradient(to left, rgba(0,0,0,.42), rgba(0,0,0,0) 70%); }
.bb-leaf.bb-turning .bb-face::before, .bb-sheet.bb-turning .bb-face::before { animation: bb-shade calc(var(--bb-dur, 1.6s) * 1.05) ease-in-out; }
@keyframes bb-shade { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .bb-curl { animation: none; } .bb-leaf.bb-turning .bb-face::before, .bb-sheet.bb-turning .bb-face::before { animation: none; } }

/* Breder dan de tekstkolom */
.bb-book.bb-wide { width: min(96vw, var(--bb-wide, 1500px)); max-width: none; position: relative; left: 50%; margin-left: calc(-0.5 * min(96vw, var(--bb-wide, 1500px))); }
.bb-book.bb-wide:fullscreen { left: 0; margin-left: 0; width: 100%; }

/* Doorzichtig tussenblad (zoals in een echt fotoalbum): draait iets later mee dan de pagina. */
.bb-tissue { pointer-events: none; }
.bb-tissue.bb-leaf, .bb-tissue.bb-sheet { transition: transform calc(var(--bb-dur, 1.6s) * 1.1) cubic-bezier(.4,.1,.3,1) .12s; }
.bb-tissue .bb-face { background: linear-gradient(115deg, rgba(255,255,255,.30) 0%, rgba(247,243,232,.16) 45%, rgba(255,255,255,.26) 100%); box-shadow: none; outline: 1px solid rgba(255,255,255,.35); outline-offset: -1px; }
.bb-tissue .bb-face::after { display: none; }
.bb-tissue .bb-face::before { background: linear-gradient(to right, rgba(0,0,0,.22), rgba(0,0,0,0) 65%); }
.bb-tissue .bb-back::before { background: linear-gradient(to left, rgba(0,0,0,.22), rgba(0,0,0,0) 65%); }
.bb-tissue.bb-turning .bb-face { box-shadow: 0 0 14px rgba(0,0,0,.18); }
.bb-no-anim .bb-tissue { transition: none !important; }
