/* EFL Books Hub — in-region app styles.
 * Loads after public.css (tokens, cards, typography come from there).
 * Everything follows the theme's data-theme: paper, ink, spine, shadows. */

/* ---- book landing (inside the region) ---- */
.efl-hub-bookgrid{display:grid;grid-template-columns:250px minmax(0,1fr);gap:28px;align-items:start;margin:4px 0 26px}
.efl-hub-jacket{position:relative;aspect-ratio:2/3;border-radius:6px 14px 14px 6px;overflow:hidden;
	background:linear-gradient(158deg,color-mix(in srgb,#4a6cf7 70%,var(--bw-bg)),color-mix(in srgb,#4a6cf7 22%,var(--bw-bg)));
	box-shadow:0 2px 6px rgba(6,10,26,.4),0 22px 44px -16px rgba(6,10,26,.7)}
html[data-theme="light"] .efl-hub-jacket{box-shadow:0 2px 6px rgba(20,32,70,.16),0 22px 44px -16px rgba(20,32,70,.32)}
.efl-hub-jacket img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
/* designed fallback jacket (no cover art) */
.efl-hub-jacket-mock{position:absolute;inset:0;display:none;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:22px;text-align:center;
	background:
		radial-gradient(120% 80% at 82% -8%,rgba(255,255,255,.16),transparent 55%),
		linear-gradient(158deg,color-mix(in srgb,var(--spine,#4a6cf7) 80%,#0b1128),color-mix(in srgb,var(--spine,#4a6cf7) 24%,#0b1128))}
.efl-hub-jacket.no-img .efl-hub-jacket-mock{display:flex}
.efl-hub-jacket-mock>svg{width:40px;height:40px;color:rgba(255,255,255,.42)}
.efl-hub-mock-title{font-size:16px;font-weight:800;line-height:1.3;color:#fff;text-shadow:0 1px 4px rgba(0,0,0,.5);
	display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden}
.efl-hub-mock-tag{font-size:9.5px;font-weight:800;letter-spacing:.09em;text-transform:uppercase;color:rgba(255,255,255,.72)}
/* card fallback jacket: the .efl-hub-mock sits over the (missing) image */
.efl-hub-mock{flex-direction:column;gap:8px;padding:18px 16px;text-align:center;
	background:
		radial-gradient(120% 80% at 82% -8%,rgba(255,255,255,.16),transparent 55%),
		linear-gradient(158deg,color-mix(in srgb,var(--spine,#4a6cf7) 80%,#0b1128),color-mix(in srgb,var(--spine,#4a6cf7) 24%,#0b1128))}
.efl-hub-card.no-cover .efl-bw-rbook-info,
.efl-hub-card.no-cover .efl-bw-rbook-scrim,
.efl-hub-card .efl-bw-rbook-face.no-img .efl-bw-rbook-info,
.efl-hub-card .efl-bw-rbook-face.no-img .efl-bw-rbook-scrim{display:none}
.efl-hub-mock-title{font-size:13px;font-weight:800;line-height:1.28;color:#fff;text-shadow:0 1px 3px rgba(0,0,0,.5);
	display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.efl-hub-mock .efl-hub-mock-title{margin-top:2px}
.efl-hub-title{margin:6px 0 4px;font-size:27px;font-weight:800;letter-spacing:-.02em;color:var(--bw-text);overflow-wrap:anywhere}
.efl-hub-by{margin:0 0 8px;font-size:13.5px;color:var(--bw-dim)}
.efl-hub-by b{color:var(--bw-text)}
.efl-hub-stats{margin:0 0 12px;font-size:12.5px;font-weight:700;color:var(--bw-muted)}
.efl-hub-desc{margin:0 0 18px;font-size:14px;line-height:1.65;color:var(--bw-dim);max-width:58ch}
.efl-hub-chapters h3{margin:0 0 12px;font-size:14.5px;font-weight:800;color:var(--bw-text)}
.efl-hub-chapters ol{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:7px}
.efl-hub-chapters button{appearance:none;cursor:pointer;font:inherit;width:100%;text-align:left;
	display:flex;align-items:center;gap:12px;padding:12px 14px;border:1px solid var(--bw-line);border-radius:12px;
	background:var(--bw-bg2);color:var(--bw-text);transition:border-color .15s,transform .12s}
.efl-hub-chapters button:hover{border-color:color-mix(in srgb,var(--bw-blue) 45%,var(--bw-line2));transform:translateX(3px)}
.efl-hub-ch-n{flex:none;width:24px;height:24px;border-radius:8px;display:grid;place-items:center;
	font-size:11px;font-weight:800;color:#fff;background:linear-gradient(135deg,var(--bw-g1),var(--bw-g2))}
.efl-hub-ch-t{flex:1;min-width:0;font-size:13.5px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.efl-hub-ch-au{flex:none;color:var(--bw-blue)}
.efl-hub-ch-au svg{width:14px;height:14px;display:block}
.efl-hub-ch-w{flex:none;font-size:11px;font-weight:700;color:var(--bw-muted)}
.efl-hub-sel{width:auto;min-width:128px;flex:none}
.efl-hub-reads{pointer-events:none}

/* ---- the open book ---- */
/* paper + ink derive from the theme so both modes feel native */
.efl-hub-stage{--paper:#f9f6ee;--paper2:#efe9db;--ink:#232323;--edge:rgba(35,30,20,.16)}
html[data-theme] .efl-hub-stage{}
:root:not([data-theme="light"]) .efl-hub-stage,
html[data-theme="dark"] .efl-hub-stage{--paper:color-mix(in srgb,var(--bw-bg2) 86%,#8a7a55);--paper2:color-mix(in srgb,var(--bw-bg2) 72%,#000);--ink:var(--bw-text);--edge:rgba(0,0,0,.5)}
html[data-theme="light"] .efl-hub-stage{--paper:#fbf8f1;--paper2:#efe9dc;--ink:#26241f;--edge:rgba(60,50,30,.18)}

.efl-hub-readerwrap{max-width:1120px;margin:0 auto}
.efl-hub-audiobar{max-width:min(calc(var(--pw, 480px) * 2 + 60px), 96vw);margin:0 auto 14px;
	padding:8px 10px;border:1px solid var(--bw-line);border-radius:14px;background:var(--bw-bg2)}
.efl-hub-audiobar audio{width:100%;display:block;height:38px;color-scheme:light}
/* dark theme: let the browser draw native dark controls (light theme keeps its current look) */
:root:not([data-theme="light"]) .efl-hub-audiobar audio{color-scheme:dark}
html[data-theme="light"] .efl-hub-audiobar audio{color-scheme:light}
.efl-hub-stage{position:relative;display:flex;justify-content:center;padding:18px 0 10px;perspective:1600px;max-width:100%}
.efl-hub-bookframe{max-width:100%}
.efl-hub-bookframe{position:relative;display:flex;background:transparent;
	filter:drop-shadow(0 26px 34px rgba(6,10,26,.45))}
html[data-theme="light"] .efl-hub-bookframe{filter:drop-shadow(0 26px 34px rgba(30,40,80,.25))}
.efl-hub-page{position:relative;width:var(--pw);height:var(--ph);background:var(--paper);color:var(--ink);overflow:hidden}
.efl-hub-page.is-left{border-radius:10px 2px 2px 10px;
	background:linear-gradient(90deg,var(--paper) 88%,var(--paper2));box-shadow:inset -14px 0 22px -14px var(--edge)}
.efl-hub-page.is-right{border-radius:2px 10px 10px 2px;
	background:linear-gradient(270deg,var(--paper) 88%,var(--paper2));box-shadow:inset 14px 0 22px -14px var(--edge)}
.efl-hub-page.is-single{border-radius:10px;box-shadow:inset 0 0 18px -12px var(--edge)}
.efl-hub-page--blank{background:var(--paper2)}
.efl-hub-spine{width:6px;flex:none;background:linear-gradient(90deg,var(--paper2),rgba(0,0,0,.28),var(--paper2))}
.efl-hub-page-n{position:absolute;bottom:9px;left:0;right:0;text-align:center;font-size:10.5px;font-weight:700;color:color-mix(in srgb,var(--ink) 45%,transparent);pointer-events:none}

/* the columned text flow: outer clip is exactly one page; the inner track is a
 * multi-column box slid sideways by whole pages via transform. */
.efl-hub-clip{position:relative;overflow:hidden;box-sizing:border-box}
.efl-hub-cols{box-sizing:border-box;column-fill:auto;-webkit-column-fill:auto;
	transform-origin:top left;transition:transform .01s;will-change:transform}
.efl-hub-cols[dir="rtl"]{transform-origin:top right}
.efl-hub-cols>*{break-inside:avoid-column}
.efl-hub-cols p,.efl-hub-cols li{break-inside:auto;overflow-wrap:break-word;word-wrap:break-word;hyphens:auto;-webkit-hyphens:auto}
.efl-hub-cols .efl-bw-page-title{font-size:1.42em;font-weight:800;line-height:1.25;margin:0 0 .55em;color:inherit;break-after:avoid-column}
.efl-hub-cols p{margin:0 0 .95em;line-height:1.72;text-align:left}
.efl-hub-cols[dir="rtl"]{text-align:right}
.efl-hub-cols img{max-width:100%;height:auto;display:block;border-radius:6px;margin:.4em auto;break-inside:avoid-column}
.efl-hub-cols figure{margin:.6em 0;break-inside:avoid-column;max-width:100%}
.efl-hub-cols figure img{margin:0 auto}
.efl-hub-cols figcaption{font-size:.82em;color:color-mix(in srgb,var(--ink) 55%,transparent);text-align:center;margin-top:.3em}
.efl-hub-cols h2,.efl-hub-cols h3{color:inherit;break-after:avoid-column;overflow-wrap:break-word}
.efl-hub-cols h3{font-size:1.15em;font-weight:800;margin:.2em 0 .5em}
.efl-hub-cols ul,.efl-hub-cols ol{margin:0 0 .95em;padding-inline-start:1.4em}
.efl-hub-cols li{margin:0 0 .4em;line-height:1.7}
.efl-hub-cols blockquote{margin:.8em 0;padding:.2em 1em;border-inline-start:3px solid color-mix(in srgb,var(--ink) 30%,transparent);color:color-mix(in srgb,var(--ink) 80%,transparent);break-inside:avoid-column}
.efl-hub-cols a{color:inherit;text-decoration:underline;text-underline-offset:2px}
.efl-hub-cols strong,.efl-hub-cols b{font-weight:800}
.efl-hub-cols .efl-bw-read-plain{white-space:pre-wrap;line-height:1.72;overflow-wrap:break-word}
/* right-to-left books: proper Arabic-script typesetting */
.efl-hub-cols[dir="rtl"]{text-align:right;hyphens:none;-webkit-hyphens:none}
.efl-hub-cols[dir="rtl"] p{text-align:right;line-height:1.95;letter-spacing:0}
.efl-hub-cols[dir="rtl"] .efl-bw-page-title{text-align:right;line-height:1.45}
.efl-hub-cols[dir="rtl"] .efl-bw-read-plain{line-height:1.95;text-align:right}
.efl-hub-cols[dir="rtl"] li{line-height:1.9}
.efl-hub-cols[dir="rtl"] blockquote{line-height:1.9}
.efl-hub-cols>*:first-child{margin-top:0}
.efl-hub-cols table{max-width:100%;border-collapse:collapse;font-size:.92em}
.efl-hub-cols pre{max-width:100%;overflow-x:auto;white-space:pre-wrap;word-wrap:break-word}
.efl-hub-cols code{overflow-wrap:break-word}
.efl-hub-cols iframe,.efl-hub-cols video,.efl-hub-cols embed{max-width:100%}
.efl-hub-cols hr{border:0;border-top:1px solid color-mix(in srgb,var(--ink) 20%,transparent);margin:1em 0}

/* click zones */
.efl-hub-zone{appearance:none;border:0;background:transparent;cursor:pointer;position:absolute;top:18px;bottom:10px;width:16%;min-width:56px;padding:0}
.efl-hub-zone--left{left:0}
.efl-hub-zone--right{right:0}
.efl-hub-zone::after{content:"";position:absolute;top:50%;transform:translateY(-50%);width:34px;height:34px;border-radius:50%;
	background:color-mix(in srgb,var(--bw-bg2) 80%,transparent);border:1px solid var(--bw-line2);
	opacity:0;transition:opacity .18s;
	background-repeat:no-repeat;background-position:center;background-size:14px}
.efl-hub-zone--right::after{right:10px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888fb0' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E")}
.efl-hub-zone--left::after{left:10px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888fb0' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 6-6 6 6 6'/%3E%3C/svg%3E")}
.efl-hub-stage:hover .efl-hub-zone::after{opacity:.9}

/* the turning leaf */
.efl-hub-leaf{position:absolute;top:0;height:var(--ph);width:var(--pw);z-index:6;transform-style:preserve-3d;
	transition:transform .68s cubic-bezier(.35,.1,.22,1);pointer-events:none}
.efl-hub-leaf.from-right{right:0;transform-origin:left center;transform:rotateY(0deg)}
.efl-hub-leaf.from-right.is-turning{transform:rotateY(-180deg)}
.efl-hub-leaf.from-left{left:0;transform-origin:right center;transform:rotateY(0deg)}
.efl-hub-leaf.from-left.is-turning{transform:rotateY(180deg)}
.efl-hub-leaf-face{position:absolute;inset:0;background:var(--paper);overflow:hidden;backface-visibility:hidden;-webkit-backface-visibility:hidden}
.efl-hub-leaf-back{transform:rotateY(180deg)}
.efl-hub-leaf.from-right .efl-hub-leaf-face{border-radius:2px 10px 10px 2px}
.efl-hub-leaf.from-left .efl-hub-leaf-face{border-radius:10px 2px 2px 10px}
.efl-hub-leaf-shade{position:absolute;inset:0;pointer-events:none;opacity:0;transition:opacity .68s;
	background:linear-gradient(90deg,rgba(0,0,0,.34),transparent 55%)}
.efl-hub-leaf.is-turning .efl-hub-leaf-shade{opacity:1}
/* single-page mode: the leaf covers the lone page */
.efl-hub-stage:not(.is-spread) .efl-hub-leaf{left:auto;right:auto}

.efl-hub-progress{display:flex;align-items:center;justify-content:space-between;gap:12px;
	max-width:min(calc(var(--pw, 480px) * 2 + 60px), 96vw);margin:12px auto 0;
	font-size:12px;font-weight:700;color:var(--bw-muted)}
.efl-hub-progress span:first-child{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

@media (prefers-reduced-motion:reduce){
	.efl-hub-leaf{transition:none}
}
@media (max-width:720px){
	.efl-hub-bookgrid{grid-template-columns:1fr}
	.efl-hub-jacket{max-width:210px}
	.efl-hub-title{font-size:22px}
	.efl-hub-zone{width:22%}
	.efl-hub-chapters button{padding:11px 12px}
	.efl-hub-ch-w{display:none}
}
@media (max-width:620px){
	/* the shelf bar stacks: search on its own row, filters share the next */
	.efl-bw-view .efl-bw-libbar{flex-wrap:wrap}
	.efl-bw-view .efl-bw-libbar .efl-bw-libq{flex:1 1 100%}
	.efl-hub-sel{flex:1 1 calc(50% - 6px);min-width:0}
	.efl-hub-cta{width:100%}
	.efl-hub-cta .efl-bw-btn{flex:1 1 auto}
	.efl-hub-progress{flex-wrap:wrap;justify-content:center;text-align:center}
	.efl-hub-audiobar{padding:6px 8px}
}
@media (max-height:540px){
	/* short landscape phones: trim chrome so the book fits */
	.efl-hub-stage{padding:8px 0 6px}
	.efl-hub-audiobar{margin-bottom:8px}
}
/* read CTA row (Continue / Start over) */
.efl-hub-cta{display:flex;align-items:center;gap:10px;flex-wrap:wrap}

/* ---- My books: save controls ---- */
.efl-hub-save{appearance:none;cursor:pointer;position:absolute;top:9px;left:9px;z-index:3;
	width:32px;height:32px;border-radius:11px;display:grid;place-items:center;padding:0;
	border:1px solid rgba(255,255,255,.30);background:rgba(9,13,28,.42);color:#fff;
	-webkit-backdrop-filter:blur(6px) saturate(1.1);backdrop-filter:blur(6px) saturate(1.1);
	box-shadow:0 2px 8px rgba(4,8,22,.28);
	transition:background .18s ease,border-color .18s ease,box-shadow .2s ease,transform .14s ease}
.efl-hub-save svg{width:15px;height:15px;transition:fill .18s ease,transform .18s ease}
.efl-hub-save:hover{transform:translateY(-1px) scale(1.07);border-color:rgba(255,255,255,.6);
	box-shadow:0 5px 14px rgba(4,8,22,.36)}
.efl-hub-save:active{transform:scale(.96)}
.efl-hub-save:focus-visible{outline:2px solid #fff;outline-offset:2px}
/* saved (dark): filled with the brand gradient, gold-pin fill, soft violet glow */
.efl-hub-save.is-on{
	background:linear-gradient(140deg,var(--bw-g1),var(--bw-g2) 58%,var(--bw-g3));
	border-color:rgba(255,255,255,.42);color:#fff;
	box-shadow:0 4px 14px -2px color-mix(in srgb,var(--bw-g2) 62%,transparent),
		0 0 0 1px color-mix(in srgb,var(--bw-g2) 30%,transparent),
		inset 0 1px 0 rgba(255,255,255,.28)}
.efl-hub-save.is-on svg{fill:currentColor}
.efl-hub-save.is-on:hover{transform:translateY(-1px) scale(1.07);
	box-shadow:0 7px 20px -3px color-mix(in srgb,var(--bw-g2) 70%,transparent),
		0 0 0 1px color-mix(in srgb,var(--bw-g2) 40%,transparent),
		inset 0 1px 0 rgba(255,255,255,.32)}
/* idle (light): frosted white chip with dark ink so it reads on any cover */
html[data-theme="light"] .efl-hub-save{background:rgba(255,255,255,.86);color:#26324e;
	border-color:rgba(20,32,70,.16);box-shadow:0 2px 8px rgba(20,32,70,.16)}
html[data-theme="light"] .efl-hub-save:hover{border-color:rgba(20,32,70,.3);
	box-shadow:0 5px 14px rgba(20,32,70,.22)}
html[data-theme="light"] .efl-hub-save:focus-visible{outline-color:var(--bw-blue)}
/* saved (light): same brand gradient, brighter ring, white pin — pops off the cover */
html[data-theme="light"] .efl-hub-save.is-on{border-color:rgba(255,255,255,.75);
	box-shadow:0 4px 14px -2px color-mix(in srgb,var(--bw-g2) 45%,transparent),
		0 0 0 1px color-mix(in srgb,var(--bw-g1) 34%,transparent),
		inset 0 1px 0 rgba(255,255,255,.4)}
/* the book-page pill toggle */
.efl-hub-savebtn svg{width:14px;height:14px;transition:fill .18s ease}
.efl-hub-savebtn.is-on{color:#fff;border-color:transparent;
	background:linear-gradient(135deg,var(--bw-g1),var(--bw-g2) 60%,var(--bw-g3));
	box-shadow:0 3px 12px -3px color-mix(in srgb,var(--bw-g2) 55%,transparent)}
.efl-hub-savebtn.is-on svg{fill:currentColor}
.efl-hub-savebtn.is-on:hover{filter:brightness(1.06);
	box-shadow:0 5px 16px -3px color-mix(in srgb,var(--bw-g2) 65%,transparent)}

/* ---- My books chip in the bar ---- */
.efl-hub-chip{appearance:none;cursor:pointer;font:inherit;display:inline-flex;align-items:center;gap:7px;
	padding:0 13px;height:40px;border-radius:12px;flex:none;
	border:1px solid var(--bw-line2);background:var(--bw-bg2);color:var(--bw-dim);
	font-size:12.5px;font-weight:750;transition:color .15s,border-color .15s,background .15s}
.efl-hub-chip svg{width:14px;height:14px}
.efl-hub-chip b{font-size:10.5px;font-weight:800;min-width:18px;height:18px;padding:0 5px;border-radius:9px;
	display:grid;place-items:center;background:var(--bw-code);color:var(--bw-muted)}
.efl-hub-chip:hover{color:var(--bw-text);border-color:color-mix(in srgb,var(--bw-blue) 40%,var(--bw-line2))}
.efl-hub-chip.is-on{color:#fff;border-color:transparent;background:linear-gradient(135deg,var(--bw-g1),var(--bw-g2))}
.efl-hub-chip.is-on b{background:rgba(255,255,255,.22);color:#fff}
.efl-hub-chip.is-on svg{fill:currentColor}

/* ---- pager (theme tokens, both modes) ---- */
.efl-hub-pagerwrap{display:flex;flex-direction:column;align-items:center;gap:10px;margin:18px 0 4px}
.efl-hub-count{font-size:12px;font-weight:700;color:var(--bw-muted)}
.efl-hub-pager{display:flex;align-items:center;gap:6px;flex-wrap:wrap;justify-content:center}
.efl-hub-pager button{appearance:none;cursor:pointer;font:inherit;min-width:34px;height:34px;padding:0 9px;
	border-radius:10px;border:1px solid var(--bw-line2);background:var(--bw-bg2);color:var(--bw-dim);
	font-size:13px;font-weight:750;transition:color .15s,border-color .15s,background .15s}
.efl-hub-pager button:hover:not(:disabled):not(.is-cur){color:var(--bw-text);border-color:color-mix(in srgb,var(--bw-blue) 45%,var(--bw-line2))}
.efl-hub-pager button:disabled{opacity:.38;cursor:default}
.efl-hub-pager button.is-cur{color:#fff;border-color:transparent;background:linear-gradient(135deg,var(--bw-g1),var(--bw-g2));cursor:default}
.efl-hub-pager-gap{color:var(--bw-muted);padding:0 2px;font-weight:800}
.efl-hub-gridboot{grid-column:1/-1}
.efl-hub-card{cursor:pointer}
.efl-hub-card:focus-visible{outline:2px solid var(--bw-blue);outline-offset:3px}
@media (max-width:620px){
	.efl-hub-chip{flex:1 1 auto;justify-content:center}
}
