/* The open book (assets/reader.js) */
.obk{display:flex;flex-direction:column;align-items:center}
.obk-wait{padding:90px 20px;text-align:center;color:var(--dim);font-style:italic;font-size:17px}
.obk-wait a,.obk-hint a{color:var(--gold);text-decoration:underline;text-underline-offset:3px}
.obk-book{--ar:1.28;--tl:2px;--tr:14px;position:relative;width:min(100%,1040px,calc(82vh * var(--ar)));aspect-ratio:var(--ar);perspective:2600px;outline:none;cursor:default;user-select:none;-webkit-user-select:none;touch-action:pan-y;
  box-shadow:0 2px 4px rgba(0,0,0,.4),0 30px 70px rgba(0,0,0,.55);transition:transform 1.1s cubic-bezier(.5,0,.2,1),box-shadow .9s ease}
.obk-book:focus-visible{outline:2px solid var(--gold);outline-offset:14px}
/* the stacked page edges either side, thicker where more of the book lies */
.obk-edge{position:absolute;top:3px;bottom:3px;background:repeating-linear-gradient(90deg,#E9DCBB 0 1px,#BFAF86 1px 2px);transition:width .5s}
.obk-edge.l{right:100%;width:var(--tl);box-shadow:-1px 0 0 #8E7F5C}
.obk-edge.r{left:100%;width:var(--tr);box-shadow:1px 0 0 #8E7F5C}
.obk-pg{position:absolute;top:0;width:50%;height:100%;background:#ECDDB8;overflow:hidden}
.obk-pg.l{left:0}.obk-pg.r{left:50%}
.obk-pg.none{background:#1B2740}
.obk-book img{display:block;width:100%;height:100%;object-fit:fill;mix-blend-mode:multiply;filter:grayscale(1) sepia(.6) contrast(.9) brightness(1.03);transition:opacity .35s;-webkit-user-drag:none}
.wait>img,.none>img{opacity:0}
.obk-pg.wait::after{content:"";position:absolute;inset:0;background:linear-gradient(100deg,transparent 30%,rgba(255,250,235,.5) 50%,transparent 70%) 0 0/250% 100%;animation:obk-wait 1.4s linear infinite}
@keyframes obk-wait{from{background-position:120% 0}to{background-position:-130% 0}}
/* the fold in the middle */
.obk-gutter{position:absolute;top:0;bottom:0;left:50%;width:90px;margin-left:-45px;pointer-events:none;z-index:4;
  background:linear-gradient(90deg,transparent,rgba(60,40,15,.1) 30%,rgba(40,26,8,.34) 49%,rgba(40,26,8,.36) 51%,rgba(60,40,15,.12) 70%,transparent)}
/* the page being turned: a sheet of upright strips (reader.js bends it), each with a front and a back */
.obk-leaf{position:absolute;top:0;left:50%;width:50%;height:100%;z-index:3;transform-style:preserve-3d;pointer-events:none}
.obk-strip{position:absolute;top:0;height:100%;transform-style:preserve-3d;will-change:transform}
.obk-face{position:absolute;inset:0;background:#ECDDB8;overflow:hidden;backface-visibility:hidden;-webkit-backface-visibility:hidden;isolation:isolate}
.obk-face.b{transform:rotateY(180deg)}
.obk-face i{position:absolute;inset:0;background-repeat:no-repeat;mix-blend-mode:multiply;filter:grayscale(1) sepia(.6) contrast(.9) brightness(1.03)}
.obk-face u{position:absolute;inset:0;background-repeat:no-repeat;mix-blend-mode:multiply}
.obk-face b{position:absolute;inset:0;background:rgb(42,27,8);opacity:0;will-change:opacity}
.obk-book.busy{cursor:progress}
.obk-cast{position:absolute;top:1%;height:98%;z-index:2;opacity:0;pointer-events:none;background:rgba(30,20,8,.6);filter:blur(22px);border-radius:30%}
/* passages, highlighted line by line */
.obk-hls{position:absolute;inset:0;z-index:1;pointer-events:none}
.obk-hl{position:absolute;background:rgba(222,182,52,.42);mix-blend-mode:multiply;border-radius:2px;clip-path:inset(0 100% 0 0);transition:opacity .4s}
.obk-hl.dim{opacity:.32}
/* tags: paper tabs standing out of the fore-edge, numbered; the label slides out on hover */
.obk-tags{position:absolute;inset:0;pointer-events:none;z-index:1}
.obk-tag{position:absolute;pointer-events:auto;display:flex;align-items:center;height:30px;margin-top:-15px;padding:0;border:0;cursor:pointer;
  --fc:226,186,92;--ink:#5A3E0C;--rot:0deg;--dx:0px;
  /* a worn paper flag: the sticky end lies on the page and lets it show through, the free end is fuller, a little faded,
     with a soft crease and a lifted, lighter tip; a fine grain over all of it */
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='40'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .32 0 0 0 0 .24 0 0 0 0 .12 0 0 0 .32 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(90deg,transparent 0 58%,rgba(60,40,10,.07) 58.6%,rgba(255,250,235,.16) 59.4%,transparent 60.5%),
    linear-gradient(90deg,transparent 0 84%,rgba(255,250,235,.22) 93%,rgba(60,40,10,.14) 100%),
    linear-gradient(180deg,rgba(255,250,235,.16),transparent 45%,rgba(60,40,10,.08)),
    linear-gradient(90deg,rgba(var(--fc),.55) 0 18px,rgba(var(--fc),.93) 22px);
  color:var(--ink);font:500 13px/1 var(--ui);border-radius:1px 3px 2px 1px;
  box-shadow:0 1px 0 rgba(40,25,5,.22),0 2px 3px -1px rgba(0,0,0,.25);
  transform:translateX(var(--dx)) rotate(var(--rot));
  transition:left .5s cubic-bezier(.3,.7,.2,1),right .5s cubic-bezier(.3,.7,.2,1),transform .3s,filter .3s}
.obk-tag b{flex:0 0 34px;text-align:center;font-weight:500;opacity:.85}
.obk-tag span{display:block;max-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font:italic 400 15px/30px var(--body);transition:max-width .35s ease,padding .35s ease}
.obk-tag em{font:500 11px/1 var(--ui);font-style:normal;letter-spacing:.06em;margin-left:8px;opacity:.7}
/* the sticky end tucks onto the page */
.obk-tag.r{left:calc(100% + var(--tr) - 20px);padding-left:18px}
.obk-tag.l{right:calc(100% + var(--tl) - 20px);padding-right:18px;flex-direction:row-reverse;
  background-position:0 0;background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='40'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .32 0 0 0 0 .24 0 0 0 0 .12 0 0 0 .32 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(270deg,transparent 0 58%,rgba(60,40,10,.07) 58.6%,rgba(255,250,235,.16) 59.4%,transparent 60.5%),
    linear-gradient(270deg,transparent 0 84%,rgba(255,250,235,.22) 93%,rgba(60,40,10,.14) 100%),
    linear-gradient(180deg,rgba(255,250,235,.16),transparent 45%,rgba(60,40,10,.08)),
    linear-gradient(270deg,rgba(var(--fc),.55) 0 18px,rgba(var(--fc),.93) 22px);border-radius:3px 1px 1px 2px}
.obk-tag:hover span,.obk-tag:focus-visible span,.obk-tag.on span{max-width:min(280px,var(--roomr,280px));padding:0 12px 0 2px}
.obk-tag.l:hover span,.obk-tag.l:focus-visible span{padding:0 2px 0 12px}
.obk-tag:not(.here):not(.on){filter:saturate(.85) brightness(.95)}
/* the picked passage: its flag pulled further out and pressed flat, label open */
.obk-tag.on{--rot:0deg;filter:none;box-shadow:0 1px 0 rgba(40,25,5,.25),0 6px 12px -4px rgba(0,0,0,.45);z-index:1}
.obk-tag.r.on{--dx:8px}.obk-tag.l.on{--dx:-8px}
.obk-tag.on span{padding:0 12px 0 2px}.obk-tag.l.on span{padding:0 2px 0 12px}
.obk-tag.l:hover span,.obk-tag.l:focus-visible span,.obk-tag.l.on span{max-width:min(280px,var(--rooml,280px))}
.obk-tag:hover{filter:brightness(1.04)}
.obk-tag:focus-visible{outline:2px solid var(--ivory);outline-offset:2px}
/* one page at a time on narrow screens */
.obk.single .obk-book{overflow:hidden}
.obk.single .obk-pg.l,.obk.single .obk-gutter,.obk.single .obk-edge,.obk.single .obk-tags{display:none}
.obk:not(.single) .obk-marks .chip:not(.ttl){display:none}
.obk.single .obk-pg.r,.obk.single .obk-leaf{left:0;width:100%}
/* controls */
.obk-bar{display:flex;align-items:center;gap:14px;width:min(100%,760px);margin-top:34px}
.obk-bar .ib{flex:0 0 auto}
.obk-bar .ib:disabled{opacity:.35;cursor:default}
.obk-where{flex:0 0 auto;min-width:190px;text-align:center;font-family:var(--ui);font-size:13px;letter-spacing:.04em;color:var(--dim);font-variant-numeric:tabular-nums}
.obk-rail{position:relative;flex:1 1 auto;min-width:0}
.obk-range{display:block;width:100%;height:28px;margin:0;background:transparent;accent-color:var(--gold);cursor:pointer;-webkit-appearance:none;appearance:none}
.obk-range::-webkit-slider-runnable-track{height:2px;background:#3B4B6B}
.obk-range::-moz-range-track{height:2px;background:#3B4B6B}
.obk-range::-webkit-slider-thumb{-webkit-appearance:none;width:14px;height:22px;margin-top:-10px;background:var(--gold);border:0;border-radius:1px}
.obk-range::-moz-range-thumb{width:14px;height:22px;background:var(--gold);border:0;border-radius:1px}
.obk-range:focus-visible{outline:1px solid var(--gold);outline-offset:4px}
.obk-marks{display:flex;flex-wrap:wrap;gap:10px;justify-content:center;margin-top:22px;max-width:900px}
.obk-marks .chip{font-size:15px;padding:8px 14px}
.obk-hint{font-size:13px;line-height:1.6;margin-top:22px;text-align:center;max-width:640px}
.obk:fullscreen{background:var(--navy);justify-content:center;padding:24px 40px}
.obk:fullscreen .obk-book{width:min(100%,calc((100vh - 190px) * var(--ar)))}
.obk:fullscreen .obk-marks,.obk:fullscreen .obk-hint{display:none}
@media (max-width:760px){
.obk-bar{flex-wrap:wrap;justify-content:center;gap:10px 14px;margin-top:24px}
.obk-rail{order:-1;flex:1 1 100%}
.obk-where{min-width:150px}
.obk-full{display:none!important}
}

/* the closed book: the cover alone, centred, a board with a hinge; it slides across as it opens */
.obk.closed .obk-book{transform:translateX(-25%);box-shadow:none;cursor:pointer}
.obk.closed .obk-pg.l,.obk.closed .obk-edge.l,.obk.closed .obk-gutter,.obk.closed .obk-tags,.obk.closed .obk-corner{visibility:hidden}
.obk.closed .obk-pg.r{border-radius:0 4px 4px 0;box-shadow:0 2px 4px rgba(0,0,0,.4),0 30px 70px rgba(0,0,0,.55)}
.obk.closed .obk-pg.r::before{content:"";position:absolute;inset:0 auto 0 0;width:6%;z-index:2;pointer-events:none;
  background:linear-gradient(90deg,rgba(0,0,0,.38),rgba(255,248,230,.10) 35%,rgba(0,0,0,.22) 55%,rgba(0,0,0,0))}
.obk.closed .obk-edge.r{top:6px;bottom:6px}
.obk.closed.single .obk-book{transform:none}
.obk-pg.none{transition:background .4s}
.obk.closed .obk-pg.l.none{background:transparent}

/* the turning corners: the bottom corner of the page lifted, the page beneath showing; it lifts further under the mouse */
.obk-corner{--p:20px;position:absolute;bottom:0;z-index:5;width:max(64px,calc(var(--pgw,400px) * .17));height:max(64px,calc(var(--pgw,400px) * .17));cursor:pointer;transition:opacity .25s}
.obk-corner.r{right:0}.obk-corner.l{left:0}
.obk-corner:hover,.obk-corner:focus-visible{--p:max(58px,calc(var(--pgw,400px) * .14))}
.obk-corner.off,.obk-book.turning .obk-corner{opacity:0;pointer-events:none}
.obk-corner i,.obk-corner b{position:absolute;bottom:0;width:var(--p);height:var(--p);transition:width .38s cubic-bezier(.3,.8,.3,1),height .38s cubic-bezier(.3,.8,.3,1)}
.obk-corner.r i,.obk-corner.r b{right:0}.obk-corner.l i,.obk-corner.l b{left:0}
/* the page beneath, in the shade of the lifted corner */
.obk-corner i{background:#E2D2AC no-repeat;background-size:var(--pgw) var(--pgh);background-blend-mode:multiply;filter:grayscale(1) sepia(.6) contrast(.9) brightness(.95)}
.obk-corner.r i{background-position:right bottom;clip-path:polygon(100% 0,100% 100%,0 100%)}
.obk-corner.l i{background-position:left bottom;clip-path:polygon(0 0,100% 100%,0 100%)}
.obk-corner i::after{content:"";position:absolute;inset:0}
.obk-corner.r i::after{background:linear-gradient(to top left,rgba(40,26,8,0) 20%,rgba(40,26,8,.34) 50%)}
.obk-corner.l i::after{background:linear-gradient(to top right,rgba(40,26,8,0) 20%,rgba(40,26,8,.34) 50%)}
/* the back of the lifted corner, folded over: lit along the curl, falling into shade at its tip */
.obk-corner b{filter:drop-shadow(2px 2px 3px rgba(30,20,8,.38))}
.obk-corner.l b{filter:drop-shadow(-2px 2px 3px rgba(30,20,8,.38))}
.obk-corner s{position:absolute;inset:0}
.obk-corner.r s{clip-path:polygon(0 0,100% 0,0 100%);background:linear-gradient(to top left,#BFAE86 49%,#D9C9A2 50.5%,#F6EDD5 57%,#FBF5E4 64%,#EDE1C2 82%,#DCCBA3 100%)}
.obk-corner.l s{clip-path:polygon(0 0,100% 0,100% 100%);background:linear-gradient(to top right,#BFAE86 49%,#D9C9A2 50.5%,#F6EDD5 57%,#FBF5E4 64%,#EDE1C2 82%,#DCCBA3 100%)}
.obk-corner.nudge i,.obk-corner.nudge b{animation:obk-nudge 1.6s cubic-bezier(.4,0,.3,1)}
@keyframes obk-nudge{0%,100%{width:var(--p);height:var(--p)}35%,50%{width:max(72px,calc(var(--pgw,400px) * .17));height:max(72px,calc(var(--pgw,400px) * .17))}}
.obk.single .obk-corner.l{display:block}

/* search matches on the page */
.obk-hit{position:absolute;background:rgba(214,104,52,.30);mix-blend-mode:multiply;border-radius:2px}
.obk-hit.cur{background:rgba(214,96,40,.48);box-shadow:0 0 0 2px rgba(214,96,40,.55);animation:obk-ping 1.2s ease-out 1.1s 2}
@keyframes obk-ping{0%{box-shadow:0 0 0 2px rgba(214,96,40,.55)}60%{box-shadow:0 0 0 9px rgba(214,96,40,0)}100%{box-shadow:0 0 0 2px rgba(214,96,40,.55)}}

/* ticks along the slider, one for each spread with a match */
.obk-ticks{position:absolute;inset:0;pointer-events:none}
.obk-ticks i{position:absolute;top:7px;width:2px;height:14px;margin-left:-1px;background:#D8784A;border-radius:1px;opacity:.85}
.obk-ticks i.on{background:var(--goldhi);height:18px;top:5px;opacity:1}

/* the search box and its results */
.obk-search{position:relative;width:min(100%,640px);margin:0 auto 30px;z-index:40}
.obk-find{display:block}
.obk-q{display:flex;align-items:center;gap:10px;height:52px;padding:0 10px 0 20px;background:var(--ivory);border:1px solid transparent;border-radius:999px;color:#5B6478;cursor:text;transition:border-color .15s,box-shadow .15s}
.obk-q:focus-within{border-color:var(--gold);box-shadow:0 0 0 4px rgba(201,174,106,.22)}
.obk-search.open .obk-q{border-radius:26px 26px 0 0}
.obk-q input{flex:1;min-width:0;height:100%;border:0;background:transparent;color:var(--navy);font:400 17px var(--body);outline:none}
.obk-q input::placeholder{color:#6B7286;font-style:italic}
.obk-q input::-webkit-search-cancel-button{display:none}
.obk-key{font:500 12px var(--ui);color:#7A8296;border:1px solid #C9C2B2;border-radius:6px;padding:1px 7px}
.obk-q:focus-within .obk-key{display:none}
.obk-count{flex:0 0 auto;font:500 13px var(--ui);color:#5B6478;font-variant-numeric:tabular-nums;white-space:nowrap}
.obk-step,.obk-clear{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid #C9C2B2;border-radius:50%;background:transparent;color:var(--navy);cursor:pointer}
.obk-clear{border:0}
.obk-step[hidden],.obk-clear[hidden],.obk-count:empty{display:none}
.obk-step:hover,.obk-clear:hover{background:#EBE3D2}
.obk-results{position:absolute;left:0;right:0;top:100%;list-style:none;margin:0;padding:4px 0;max-height:min(300px,50vh);overflow:auto;background:#FBF8F1;border:1px solid var(--gold);border-top:1px solid #E4DCCB;border-radius:0 0 18px 18px;box-shadow:0 24px 40px -18px rgba(0,0,0,.6);scrollbar-color:#C9C2B2 transparent}
.obk-results button{display:flex;gap:14px;width:100%;padding:10px 20px;text-align:left;background:none;border:0;color:#2A3247;font:400 15px/1.45 var(--body);cursor:pointer}
.obk-results button:hover,.obk-results button.on{background:#F0E9D8}
.obk-results .obk-rpg{flex:0 0 58px;font:500 12px/1.9 var(--ui);color:#7A6A3F}
.obk-results mark{background:#F6DFA0;color:inherit;border-radius:2px;padding:0 2px}
@media (max-width:600px){.obk-search{margin-bottom:20px}.obk-q{height:48px;padding-left:16px}.obk-q input{font-size:16px}.obk-key{display:none}}
