/* The paper book: a real 3D paper world (three.js). This file only styles the few labels on top of it. */
.paper{--void:#51443c;--ink:#33364a;--muted:#77705f;--font:"Iowan Old Style","Palatino Linotype",Palatino,"Songti SC",Georgia,serif;--display:var(--font);--display-w:700;
  --hud:#fbf5e6;--hud-ink:#33364a;--hud-r:6px;--key:#3f568a;--key-ink:#fff;--veil:rgba(40,26,14,.55);--card:#fbf5e6;--card-border:1px solid #d9c9a3;--card-r:10px;--card-shadow:0 0 0 5px #fbf5e6,0 0 0 6.5px #c6a559,0 24px 50px rgba(20,10,0,.55);--img-border:1px solid #d9c9a3;--note:#f1e8d2}
html,body{margin:0;height:100%;overflow:hidden;background:#51443c}
/* the keyboard plays this world: the canvas takes no pointer input at all */
canvas{position:fixed;inset:0;width:100%;height:100%;display:block;pointer-events:none;touch-action:none;opacity:0;transition:opacity 1.2s}
.ready canvas{opacity:1}
#wait{position:fixed;inset:0;display:grid;place-items:center;font:italic 18px/1.4 Georgia,"Times New Roman",serif;color:#f1e8d2;letter-spacing:.04em;transition:opacity .6s;pointer-events:none}
.ready #wait{opacity:0}
/* the label: always the paper's full title, wrapped onto as many lines as it needs (never cut short) */
#tag{position:fixed;transform:translate(-50%,-100%);z-index:20;background:#fbf5e6;border:1px solid #c6a559;border-radius:4px;padding:6px 12px 6px 7px;font:italic 600 15px/1.25 Georgia,"Times New Roman",serif;color:#33364a;box-shadow:0 0 0 3px #fbf5e6,0 6px 14px rgba(40,20,0,.35);white-space:normal;max-width:min(88vw,440px);display:flex;align-items:flex-start;gap:8px;pointer-events:none}
#tag[hidden]{display:none}
#tag b{background:#3f568a;color:#fff;border-radius:3px;padding:1px 8px;font:600 12.5px/1.5 ui-sans-serif,system-ui,sans-serif}
#tag b{flex:none;white-space:nowrap}
/* the film is a screening: a dark room, paper curtains, a hung sheet, a projector beam, six medallions in the front row.
   Keyboard only (Enter pauses, F switches the old-projector look, Esc skips). */
#film{position:fixed;inset:0;z-index:60;background:radial-gradient(120% 90% at 50% 38%,#2a1d15 0,#160f0b 55%,#0b0705 100%);opacity:0;visibility:hidden;transition:opacity .6s,visibility .6s;pointer-events:none;overflow:hidden;--w:min(88vw,calc((100vh - 190px) * 16 / 9));--h:calc(var(--w) * 9 / 16);--top:max(34px,calc((100vh - var(--h) - 150px) / 2))}
#film.on{opacity:1;visibility:visible}
#film .stage{position:absolute;left:50%;top:var(--top);width:var(--w);transform:translateX(-50%)}
#film .rod{position:absolute;left:-5%;right:-5%;top:-20px;height:9px;border-radius:5px;background:linear-gradient(#8a6a3c,#5e4526);box-shadow:0 2px 0 rgba(0,0,0,.4)}
#film .rod::before,#film .rod::after{content:"";position:absolute;top:8px;width:2px;height:14px;background:#c6a559}
#film .rod::before{left:8%}#film .rod::after{right:8%}
#film .sheet{position:relative;padding:10px;border-radius:5px;background:#f4ecd8;box-shadow:0 0 0 2px #c6a559,0 26px 60px rgba(0,0,0,.65),0 0 90px rgba(255,236,190,.14);transform:rotate(-.25deg)}
#film .gate{position:relative;aspect-ratio:16/9;overflow:hidden;background:#120d0a;border-radius:3px;will-change:transform}
#film video{display:block;width:100%;height:100%;object-fit:contain;background:#120d0a}
#film .fx{position:absolute;inset:0;pointer-events:none;opacity:0;width:100%;height:100%}
#film.old .gate{border-radius:14px/18px}
#film.old video{filter:sepia(.3) saturate(.86) contrast(1.06) brightness(.97)}
#film.old .grain{opacity:.13;mix-blend-mode:overlay;background-size:128px 128px;animation:grain .5s steps(6) infinite}
#film.old .vig{opacity:1;background:radial-gradient(ellipse at center,rgba(0,0,0,0) 52%,rgba(20,10,4,.3) 82%,rgba(12,6,2,.62) 100%)}
#film.old .scratch{opacity:1;image-rendering:auto}
#film.old .flick{opacity:0;background:#000}
#film.still .grain{animation:none}
@keyframes grain{0%{background-position:0 0}17%{background-position:-37px 53px}33%{background-position:61px -22px}50%{background-position:-84px -71px}67%{background-position:29px 88px}83%{background-position:-55px 17px}100%{background-position:0 0}}
#film .leader{position:absolute;inset:0;display:none;place-items:center;background:radial-gradient(circle,#3a2f25 0,#1a130e 75%);color:#f4ecd8;font:700 clamp(40px,12vw,150px)/1 Georgia,serif}
#film .leader.on{display:grid}
#film .leader::before{content:"";position:absolute;width:min(46%,60vh);aspect-ratio:1;border-radius:50%;border:3px solid rgba(244,236,216,.7);background:conic-gradient(rgba(244,236,216,.22) var(--a,0deg),transparent 0)}
#film .leader::after{content:"";position:absolute;inset:0;background:linear-gradient(rgba(244,236,216,.5),rgba(244,236,216,.5)) center/2px 100% no-repeat,linear-gradient(rgba(244,236,216,.5),rgba(244,236,216,.5)) center/100% 2px no-repeat;opacity:.5}
#film .leader span{position:relative;z-index:1}
/* curtains: two sheets of dark red paper with folds; they part when the screening starts */
#film .curtain{position:absolute;top:0;bottom:0;width:51%;background:repeating-linear-gradient(90deg,#6e2a2a 0 22px,#59201f 22px 30px,#7a3030 30px 52px,#4b1a1a 52px 58px);box-shadow:inset 0 -40px 60px rgba(0,0,0,.45);transition:transform 1.5s cubic-bezier(.6,0,.2,1);z-index:3}
#film .curtain.l{left:0;transform:translateX(0);border-right:4px solid #c6a559}
#film .curtain.r{right:0;transform:translateX(0);border-left:4px solid #c6a559}
#film.open .curtain.l{transform:translateX(-86%)}
#film.open .curtain.r{transform:translateX(86%)}
/* the projector's beam, from behind the front row up to the sheet, with dust drifting in it */
#film .beam{position:absolute;left:0;right:0;bottom:0;top:0;background:linear-gradient(to top,rgba(255,238,196,.26),rgba(255,238,196,.05) 70%,rgba(255,238,196,0));clip-path:polygon(calc(50% - var(--w) / 2) calc(var(--top) + var(--h) + 20px),calc(50% + var(--w) / 2) calc(var(--top) + var(--h) + 20px),calc(100% - 58px) calc(100% - 40px),calc(100% - 86px) calc(100% - 52px));opacity:0;transition:opacity 1s .8s;z-index:1}
#film.open .beam{opacity:1}
#film.paused .beam{opacity:.35}
#film .motes{position:absolute;inset:0;z-index:1;opacity:0;transition:opacity 1s 1s}
#film.open .motes{opacity:1}
#film .motes i{position:absolute;width:3px;height:3px;border-radius:50%;background:rgba(255,244,214,.75);left:calc(52% + var(--x,0) * 1%);bottom:calc(60px + var(--y,0) * 1px);animation:mote 7s linear infinite;animation-delay:calc(var(--d,0) * -1s)}
#film .motes i:nth-child(1){--x:8;--y:20;--d:1}#film .motes i:nth-child(2){--x:16;--y:44;--d:3}#film .motes i:nth-child(3){--x:24;--y:12;--d:5}#film .motes i:nth-child(4){--x:30;--y:36;--d:2}#film .motes i:nth-child(5){--x:12;--y:64;--d:6}#film .motes i:nth-child(6){--x:36;--y:8;--d:4}#film .motes i:nth-child(7){--x:20;--y:80;--d:.5}#film .motes i:nth-child(8){--x:4;--y:52;--d:3.5}#film .motes i:nth-child(9){--x:28;--y:70;--d:5.5}
@keyframes mote{0%{transform:translate(0,0);opacity:0}15%{opacity:.9}85%{opacity:.7}100%{transform:translate(-26px,-46px);opacity:0}}
#film.still .motes i{animation:none;opacity:.6}
/* the front row: six medallions seen from behind, rim-lit in their chapter colours */
#film .row{position:absolute;left:50%;bottom:44px;transform:translateX(-50%);display:flex;gap:clamp(6px,2.2vw,26px);align-items:flex-end;z-index:2}
#film .row i{position:relative;width:clamp(34px,6.4vw,74px);aspect-ratio:1;border-radius:50%;background:#0c0806;box-shadow:inset 0 3px 0 var(--c),0 -6px 18px rgba(255,236,190,.1);display:grid;place-items:center;font-style:normal}
#film .row i::after{content:"";position:absolute;left:50%;top:92%;width:16%;height:60px;margin-left:-8%;background:#0c0806}
#film .row i:nth-child(odd){transform:translateY(7px)}
#film .row b{font:700 clamp(11px,1.7vw,19px)/1 Georgia,serif;color:var(--c);opacity:.5}
#film .proj{position:absolute;right:22px;bottom:30px;width:74px;height:46px;border-radius:8px;background:#0c0806;box-shadow:inset 0 2px 0 #c6a559;z-index:2}
#film .proj i{position:absolute;top:-24px;width:34px;height:34px;border-radius:50%;background:#0c0806;box-shadow:inset 0 0 0 3px #3a2c1c,inset 0 0 0 9px #0c0806,inset 0 0 0 11px #3a2c1c;animation:reel 2.4s linear infinite}
#film .proj i:first-child{left:0}#film .proj i:last-child{right:0;animation-duration:3.1s}
#film.paused .proj i,#film.still .proj i{animation-play-state:paused}
@keyframes reel{to{transform:rotate(360deg)}}
#film .keys{position:absolute;left:50%;bottom:8px;transform:translateX(-50%);display:flex;gap:16px;white-space:nowrap;color:#e9dcc0;font:italic 600 14px/1.4 Georgia,serif;opacity:.85;z-index:4}
#film .keys kbd{font:700 11px/1.5 system-ui,sans-serif;font-style:normal;background:#3f5389;color:#fff;border-radius:5px;padding:1px 7px;margin-right:6px}
#film .lookbtn{display:none;position:absolute;left:12px;top:max(10px,env(safe-area-inset-top));z-index:5;border:1px solid #c6a559;border-radius:14px;background:rgba(20,14,10,.7);color:#e9dcc0;font:600 12px/1 system-ui,sans-serif;padding:8px 12px}
@media (pointer:coarse){#film.on .lookbtn{display:block;pointer-events:auto}}
@media (max-aspect-ratio:3/4){#film{--w:94vw;--top:max(70px,18vh)}#film .keys{font-size:12px;gap:10px;bottom:6px}#film .keys span:nth-child(2){display:none}#film .proj{transform:scale(.7);transform-origin:100% 100%;right:10px}}
@media (max-width:520px){#tag{font-size:13.5px;max-width:92vw}}
.paper .hud{z-index:70}
.paper .hud{max-width:94vw;white-space:normal;text-align:center;line-height:1.5}
/* the sound switch: the one thing on the page that answers a tap or a click (the keyboard uses M) */
#snd{position:fixed;right:max(14px,env(safe-area-inset-right));top:max(14px,env(safe-area-inset-top));display:flex;gap:10px;opacity:0;transition:opacity .8s;z-index:45}
.ready #snd{opacity:.9}
#snd button{position:relative;width:40px;height:40px;border-radius:50%;border:1px solid #c6a559;background:#fbf5e6;color:#33364a;box-shadow:0 0 0 3px #fbf5e6,0 4px 10px rgba(40,20,0,.3);font:600 19px/1 Georgia,serif;transition:background .2s,color .2s;cursor:pointer;padding:0;display:grid;place-items:center}
#snd span{position:relative;display:grid;place-items:center;transform:translateY(-1px)}
/* the shortcut key sits on the symbol, as a small tab at its lower right */
#snd kbd{position:absolute;right:-7px;bottom:-7px;min-width:17px;height:17px;border-radius:5px;background:#3f568a;color:#fff;font:700 10.5px/17px ui-sans-serif,system-ui,sans-serif;text-align:center;box-shadow:0 0 0 2px #fbf5e6}
#snd button.off{background:#d9cfb8;color:#8a8171}
#snd button.off kbd{background:#8a8171}
#snd button.off span::after{content:"";position:absolute;left:-6px;right:-6px;top:50%;height:2px;background:#8a5a4a;transform:rotate(-38deg)}
#snd button:focus{outline:none}
@media (pointer:coarse){#snd button{width:46px;height:46px}}
/* a hint sentence with a bold word in it flows as one line (each hint is a flex box, which would split it) */
.paper .hud .say{font-style:normal;display:inline}
.paper .hud .say strong{font-weight:700}
#tag{width:max-content}
/* the rule card: a paper card that slides out of the left edge like a pull tab while you stand in a mechanism's ring or work it */
/* the grip of the tab, with its arrow, like the paper tab by the stream */

#tag.rule{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:5px 12px;max-width:min(470px,90vw);padding:7px 12px;font-size:14px}
#tag.rule em{flex:1 0 100%;text-align:center;font-style:italic;font-weight:600;font-size:15.5px}
#tag.rule em strong{font-style:normal;color:#b0544c}
#tag.rule span{display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.paper .hud:empty,.hud:empty{display:none}
@media (max-width:520px){#tag.rule{font-size:12.5px;gap:4px 9px}#tag.rule em{font-size:14px}}
#tag .alt{display:flex;align-items:center;gap:6px;margin-top:5px;font-size:.86em;font-weight:500;font-style:italic;opacity:.95}
#tag .alt b{background:#8a6a3f}
/* ---- different screens ----
   Big desktop monitors: the labels, the bottom line, the sound buttons and the cards would look tiny, so they grow.
   (zoom keeps left:50% centring; the label is placed in pixels by the page, so it grows by font size instead.) */
@media (min-width:1800px) and (min-height:950px){
  .paper .cu-card{zoom:1.25;max-height:calc((100svh - 36px) / 1.25)}
  .paper .hud{zoom:1.25}#snd{zoom:1.25}
  #tag{font-size:18.5px;padding:8px 15px 8px 9px;max-width:min(88vw,560px)}#tag b{font-size:15.5px}
  #tag.rule{font-size:17px;max-width:min(600px,90vw);padding:9px 15px}#tag.rule em{font-size:19px}
  #film .keys{font-size:17px}#film .keys kbd{font-size:13.5px}#wait{font-size:22px}}
@media (min-width:2500px) and (min-height:1300px){
  .paper .cu-card{zoom:1.6;max-height:calc((100svh - 36px) / 1.6)}
  .paper .hud{zoom:1.6}#snd{zoom:1.6}
  #tag{font-size:24px;padding:10px 19px 10px 11px;max-width:min(88vw,720px)}#tag b{font-size:20px}
  #tag.rule{font-size:22px;max-width:min(780px,90vw);padding:11px 19px}#tag.rule em{font-size:24.5px}
  #film .keys{font-size:22px}#film .keys kbd{font-size:17px}#wait{font-size:28px}}
/* Short windows (a phone held sideways): cards use the width, their text is a size smaller, and the screening leaves less room for the front row */
@media (max-height:520px){
  .paper .closeup{padding:8px}.paper .cu-card{padding:12px 14px;gap:14px;max-height:calc(100svh - 16px)}.paper .cu-img img{max-height:calc(100svh - 60px)}
  .paper .cu-keys{margin-top:8px;font-size:13px}
  #tag{font-size:13px;padding:4px 9px 4px 5px;max-width:min(62vw,400px)}#tag b{font-size:11.5px}
  #tag.rule{font-size:12px;gap:3px 9px;padding:5px 9px;max-width:min(64vw,440px)}#tag.rule em{font-size:13.5px}
  #film{--w:min(70vw,calc((100vh - 96px) * 16 / 9));--top:max(22px,calc((100vh - var(--h) - 74px) / 2))}
  #film .row{bottom:22px}#film .row i{width:clamp(22px,4vw,34px)}#film .row i::after{height:30px}#film .row b{font-size:10px}
  #film .proj{transform:scale(.6);transform-origin:100% 100%;right:8px;bottom:16px}#film .keys{font-size:11.5px;bottom:3px;gap:10px}
  #snd button{width:38px;height:38px}}
/* A short and wide phone: a card with a picture beside the text, both scrolling inside the card */
@media (max-height:520px) and (min-width:600px){.paper .cu-card{grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr)}}
/* Narrow phones: the label never wider than the screen between the edges */
@media (max-width:420px){#tag{max-width:calc(100vw - 28px)}#tag.rule{max-width:calc(100vw - 24px)}}
/* the touch pad and buttons take less of a short screen */
@media (max-height:520px) and (pointer:coarse){.paper .pad,.paper .pad-a,.paper .pad-b{zoom:.8}}
/* a tall phone: the screen hangs nearer the middle, so the film is not a strip at the very top with a long beam under it */
@media (max-aspect-ratio:3/4){#film{--top:max(70px,calc((100vh - var(--h)) * .36))}}
/* round 13: a title that does not fit its one line scrolls (only in short windows, where the label is kept to a single line); everywhere else it wraps and is all there at once */
#tag .tt{display:block;min-width:0}#tag .tti{display:inline-block}
@media (max-height:520px) and (prefers-reduced-motion:no-preference){#tag{flex-wrap:nowrap;max-width:min(calc(100vw - 250px),640px)}#tag .tt{white-space:nowrap;overflow:hidden;max-width:min(calc(100vw - 320px),560px)}#tag .tti{will-change:transform}}
@media (max-height:520px) and (prefers-reduced-motion:no-preference) and (pointer:fine){#tag{max-width:min(calc(100vw - 60px),760px)}#tag .tt{max-width:min(calc(100vw - 140px),680px)}}
@keyframes tagrun{0%,14%{transform:translateX(0)}58%,80%{transform:translateX(var(--d,0))}94%,100%{transform:translateX(0)}}
/* nothing at the bottom while the phone note is up */
body:has(#phone-note) .hud{display:none}

/* round 15: where a label has no key to offer (the last page and the film before all six chapters are in) a small gold badge with a padlock and the count sits in the key cap's place */
#tag b.lock{background:#b98a2c;display:inline-flex;align-items:center;gap:.34em}
#tag b.lock i{display:inline-block;width:.62em;height:.5em;background:currentColor;border-radius:.12em;position:relative;margin-top:.24em}
#tag b.lock i::before{content:"";position:absolute;left:.11em;bottom:.46em;width:.22em;height:.26em;border:.09em solid currentColor;border-bottom:0;border-radius:.3em .3em 0 0}
/* a tablet held upright: one column and larger, so a paper's card uses the width instead of sitting small in the middle */
@media (min-width:700px) and (max-aspect-ratio:4/5){.paper .cu-card{grid-template-columns:1fr;zoom:1.22;width:min(760px,100%);max-height:calc((100svh - 36px) / 1.22)}.paper .cu-img img{max-height:40svh;width:100%;object-fit:contain}}
@media (pointer:coarse){#film.on{pointer-events:auto}#film .keys span{padding:6px 2px}}#film .keys .ld{opacity:.8}
#film .fclose{display:none;position:absolute;right:max(10px,env(safe-area-inset-right));top:max(10px,env(safe-area-inset-top));z-index:5;width:42px;height:42px;border:1px solid #c6a559;border-radius:50%;background:rgba(20,14,10,.7);color:#e9dcc0;font:800 18px/1 system-ui,sans-serif}@media (pointer:coarse){#film.on.seen .fclose{display:block}}
