/* The book is a material layer. Every word and diagram remains live HTML. */
#lab.lab-book{height:100svh;min-height:620px;padding:0;position:relative;isolation:isolate;overflow:hidden;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;color:#e3d3b7;background:radial-gradient(ellipse at 53% -8%,#65513a40,transparent 53%),radial-gradient(ellipse at 50% 73%,#30271d35,transparent 64%),#0d0c0a}
#lab.lab-book::before{content:"";position:absolute;inset:0;pointer-events:none;z-index:-1;opacity:.2;background-image:url('/assets/lab/book-reference-v5.png');background-size:cover;filter:blur(100px) brightness(.25);transform:scale(1.2)}
body[data-section='lab'] .channel-nav{visibility:hidden;pointer-events:none}
.book-heading{position:absolute;top:clamp(24px,5vh,56px);left:4vw;right:4vw;font-family:Georgia,'SimSun',serif}
.book-heading h2{font-size:clamp(23px,2.6vw,40px);line-height:1.4;font-weight:400;letter-spacing:.06em}
.book-heading p{margin:9px 0 0;font-size:clamp(13px,1.3vw,19px);letter-spacing:.08em;line-height:1.6;color:#c5b69d}
.book-stage{position:relative;width:min(1000px,80vw,calc((100svh - 250px)*1.5));aspect-ratio:3/2;margin-top:85px;perspective:1600px;flex-shrink:0;touch-action:pan-y;outline-offset:5px;transform:perspective(1700px) translate3d(var(--book-x,0px),var(--book-y,0px),0) rotateX(calc(var(--book-back-angle,12deg) + var(--book-rx,0deg))) rotateY(var(--book-ry,0deg)) rotateZ(var(--book-rz,0deg)) scale(var(--book-scale,1));animation:book-hover 7s ease-in-out infinite alternate;filter:drop-shadow(12px 55px 30px #0009)}
.book-stage::before{content:"";position:absolute;inset:0;background:url('/assets/lab/book-reference-v5.png') center/100% 100% no-repeat;pointer-events:none}
.book-stage:focus-visible{outline:1px solid #b7a385;border-radius:15px}
.book-page{position:absolute;top:15%;height:68.5%;width:31.5%;color:#4a3421;overflow:hidden}
.book-page-left{left:13.5%}.book-page-right{left:55%}
.book-entry{height:100%;display:flex;flex-direction:column;position:relative;font-family:Georgia,'SimSun',serif}
.book-meta{display:flex;align-items:center;justify-content:space-between;gap:8px;border-bottom:1px solid #6d503b60;padding-bottom:9px;font-size:clamp(9px, .82vw,13px);line-height:1.5;letter-spacing:.05em;white-space:nowrap}
.book-meta span:last-child{display:none}
.book-icon{width:52%;height:21%;min-height:32px;flex:0 1 auto;align-self:center;margin:14px 0 10px;color:#75543a;opacity:.82}
.book-entry h3{font-size:clamp(19px,1.8vw,29px);font-weight:500;line-height:1.4;letter-spacing:.035em;margin:0 0 12px}
.book-entry p{font-size:clamp(12px,1.07vw,17px);line-height:1.95;letter-spacing:.025em;margin:0 0 15px;flex-shrink:0}
.book-tags{margin-top:auto;padding-top:10px;border-top:1px solid #80634870;font-size:clamp(9px,.77vw,12px);line-height:1.5;font-style:italic;white-space:normal}
.book-page-number{margin-top:14px;font-size:11px;line-height:1}
.book-page-right .book-page-number{text-align:right}
.book-navigation{position:relative;text-align:center;margin-top:0;flex-shrink:0;min-height:62px;display:flex;flex-direction:column;justify-content:flex-end}
.book-controls{display:flex;align-items:center;justify-content:center;gap:clamp(24px,4vw,62px);font-family:Georgia,'SimSun',serif}
.book-controls button{min-height:40px;padding:8px 10px;font-size:17px;letter-spacing:.08em;color:#e0cdae}
.book-controls button:disabled{opacity:.3;cursor:default}
.book-controls button:hover:not(:disabled){color:#fff0d7}
.book-counter{font-size:16px;letter-spacing:.1em;min-width:110px}
#book-help{font:12px/1.6 Georgia,'SimSun',serif;letter-spacing:.15em;color:#a38e72;margin:5px 0 0}
.book-corner{position:absolute;bottom:9%;width:8%;height:15%;z-index:4;cursor:grab;background:transparent;touch-action:pan-y}
.book-corner-prev{left:6%}.book-corner-next{right:6%}
.book-corner:disabled{pointer-events:none;opacity:0}
.book-stage{user-select:none;-webkit-user-select:none}
.book-page{cursor:pointer}
.book-corner{touch-action:none}
.book-stage.is-turning{cursor:progress}
.book-status{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
.book-turning-canvas{position:absolute;inset:-25% 0 auto;width:100%;height:150%;z-index:5;pointer-events:none}
.book-stage::after{content:"";position:absolute;top:7%;bottom:9%;left:8%;right:8%;background:linear-gradient(90deg,transparent 20%,#34200f 50%,transparent 80%);opacity:var(--turn-shadow,0);pointer-events:none;z-index:3}
.book-stage.is-turning,.book-stage.is-hovered{animation-play-state:paused}
.book-stage.is-turning .book-corner{pointer-events:none}
#lab.lab-book::after{content:"";position:absolute;z-index:-1;bottom:12%;left:26%;width:48%;height:6%;border-radius:50%;background:#0009;filter:blur(23px);animation:book-shadow 7s ease-in-out infinite alternate;pointer-events:none}
@keyframes book-hover{from{translate:0 0}to{translate:0 -8px}}
@keyframes book-shadow{from{opacity:.65;scale:1}to{opacity:.4;scale:.93}}
@media(max-width:700px){
 #lab.lab-book{min-height:620px;gap:15px}
 .book-heading{top:25px;left:7vw;right:7vw}.book-heading h2{font-size:24px;letter-spacing:.02em}.book-heading p{font-size:12px;max-width:300px;line-height:1.8}
 .book-stage{width:min(92vw,420px,calc((100svh - 205px)*.74));aspect-ratio:.74;margin-top:100px;perspective:1100px}
 .book-stage::before{background-size:200% 100%;background-position:right center;border-radius:4px 16px 14px 4px}
 .book-page-left{display:none}.book-page-right{left:15%;top:15%;width:68%;height:68%}
 .book-meta{font-size:10px;letter-spacing:.015em;padding-bottom:7px}.book-meta span:last-child{font-size:9px}
 .book-icon{width:48%;height:23%;margin:14px 0 10px}
 .book-entry h3{font-size:23px;letter-spacing:0;margin-bottom:12px}.book-entry p{font-size:14px;line-height:1.9;letter-spacing:.015em;margin-bottom:12px}
 .book-tags{font-size:10px;padding-top:9px}.book-page-number{font-size:10px;margin-top:12px}
 .book-controls{gap:20px}.book-controls button{font-size:15px}.book-counter{font-size:13px;min-width:80px}#book-help{font-size:11px}
 .book-corner-next{right:7%}.book-corner-prev{left:7%}
 .book-stage{--book-back-angle:8deg}
}
@media(max-height:740px) and (min-width:701px){.book-heading{top:22px}.book-heading h2{font-size:25px}.book-heading p{font-size:13px}.book-stage{width:min(880px,82vw,calc((100svh - 185px)*1.5));margin-top:80px}.book-icon{height:20%;margin:10px 0 6px}.book-entry h3{font-size:21px;margin-bottom:8px}.book-entry p{font-size:12px;line-height:1.8;margin-bottom:8px}.book-tags{font-size:9px;padding-top:7px}.book-page-number{margin-top:8px}.book-controls button{font-size:15px;min-height:32px}.book-counter{font-size:13px}#book-help{font-size:10px;margin-top:0}}
@media(max-height:720px) and (max-width:700px){.book-heading{top:16px}.book-heading h2{font-size:21px}.book-heading p{margin-top:6px;font-size:11px}.book-stage{margin-top:90px;width:min(90vw,calc((100svh - 180px)*.74))}.book-icon{height:17%;min-height:28px;margin:7px 0}.book-entry h3{font-size:20px;margin-bottom:8px}.book-entry p{font-size:12px;line-height:1.85;margin-bottom:8px}.book-tags{font-size:9px;padding-top:6px}.book-page-number{margin-top:8px}.book-controls button{min-height:30px}#lab.lab-book{gap:6px}}
@media(prefers-reduced-motion:reduce){.book-stage{animation:none}#lab.lab-book::after{animation:none}}

/* Reference composition: a pool of warm light above a compact, worn book. */
#lab.lab-book{background:radial-gradient(ellipse at 51% -5%,#b78d5c52,transparent 38%),radial-gradient(ellipse at 50% 63%,#67503b30,transparent 62%),#100e0c}
#lab.lab-book::before{inset:0;opacity:.22;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23fff' filter='url(%23n)' opacity='.25' d='M0 0h260v260H0z'/%3E%3C/svg%3E");background-size:260px;filter:none;transform:none;mask-image:radial-gradient(ellipse at 51% 0%,#000,transparent 66%)}
.book-stage{animation:none;--book-back-angle:0deg;filter:drop-shadow(0 30px 24px #0009)}
.book-meta{border:0;padding-bottom:5px;justify-content:flex-start}
.book-meta span:first-child{border-bottom:1px solid #60452b88;padding-bottom:5px}
.book-entry{color:#3c291b}
.book-entry h3{font-weight:600}
.book-tags{border:0;position:relative;padding-top:15px}
.book-tags::before{content:"";position:absolute;top:0;left:0;width:34px;height:1px;background:#80634899}
.book-controls button:disabled{opacity:.6}
@media(min-width:701px){
 .book-heading{top:9vh;left:3.7vw}
 .book-heading h2{font-size:clamp(25px,2.35vw,40px);letter-spacing:.06em}
 .book-heading p{font-size:clamp(13px,1.25vw,21px);margin-top:5px;color:#d5c6ae}
 .book-stage{position:absolute;top:17vh;width:min(1100px,64vw,calc((100svh - 250px)*1.73));aspect-ratio:1.6;margin:0}
 .book-page{top:14%;height:68.5%;width:30%}
 .book-page-left{left:15.5%}.book-page-right{left:55%}
 .book-meta{font-size:clamp(10px,1.05vw,18px)}
 .book-icon{width:75%;height:26%;margin:8px 0 18px;opacity:.95;color:#5f432b}
 .book-entry h3{font-size:clamp(21px,1.85vw,31px);margin:0 0 18px;letter-spacing:.02em}
 .book-entry p{font-size:clamp(13px,1.05vw,18px);line-height:1.65;letter-spacing:.04em}
 .book-tags{font-size:clamp(10px,.88vw,15px);white-space:nowrap}
 .book-page-number{font-size:clamp(11px,.9vw,15px);margin-top:24px}
 .book-navigation{position:absolute;bottom:6.5vh;left:0;right:0;margin:0}
 .book-controls{gap:70px}.book-controls button{font-size:21px}.book-counter{font-size:20px;min-width:100px}
 #book-help{font-size:14px;margin-top:8px}
}
@media(max-width:700px){.book-stage{--book-back-angle:0deg}.book-icon{opacity:.95}.book-entry h3{font-size:20px;white-space:normal;overflow-wrap:anywhere}}

/* A room detail in the native modal layer, rather than a scrolling chapter. */
.about-book-dialog{position:fixed;inset:0;width:100vw;height:100svh;max-width:none;max-height:none;padding:0;margin:0;border:0;background:transparent;color:#e3d3b7;overflow:hidden;overscroll-behavior:contain}
.about-book-dialog::backdrop{background:transparent}
body.book-room-open .channel-nav{visibility:hidden;pointer-events:none}
.about-book-dialog::before{content:"";position:absolute;inset:0;background:radial-gradient(ellipse at 51% -5%,#b78d5c52,transparent 38%),radial-gradient(ellipse at 50% 63%,#67503b30,transparent 62%),#100e0c}
.about-book-dialog #lab.lab-book{min-height:0;background:transparent}
.about-book-close{position:absolute;z-index:10;top:28px;right:32px;padding:10px 14px;border:1px solid #d8bd852e;border-radius:3px;background:#16110bc9;color:#e3d3b7;font:13px/1.4 Georgia,'SimSun',serif;cursor:pointer}
.about-book-close:hover{background:#34271be6}
.about-book-close:focus-visible{outline:1px solid #ddc79e;outline-offset:4px}
.about-book-dialog::before{opacity:var(--book-light,1)}
.about-book-dialog .book-heading,.about-book-dialog .book-navigation,.about-book-dialog .about-book-close{opacity:var(--book-copy,1)}
.about-book-dialog.is-opening .book-stage,.about-book-dialog.is-closing .book-stage{pointer-events:none}
.about-book-dialog.has-book-model .book-stage{visibility:hidden}
.book-opening-camera{position:absolute;z-index:5;perspective:1800px;pointer-events:none;transform-origin:50% 50%}
.book-opening-model{position:absolute;inset:0;transform-style:preserve-3d}
.book-opening-half{position:absolute;top:0;width:50%;height:100%;transform-style:preserve-3d}
.book-opening-half--left{left:0;transform-origin:100% 50%}
.book-opening-half--right{right:0;transform-origin:0 50%}
.book-opening-face{position:absolute;inset:0;overflow:hidden;backface-visibility:hidden;transform:translateZ(1px)}
.book-opening-spread{position:absolute;top:0;left:0;width:200%;height:100%;background:url('/assets/lab/book-reference-v5.png') center/100% 100% no-repeat}
.book-opening-half--right .book-opening-spread{left:-100%}
.book-opening-spread::after{content:"";position:absolute;inset:8% 0 9%;background:linear-gradient(90deg,transparent 15%,#301909 100%);opacity:var(--fold-shadow,0);pointer-events:none}
.book-opening-half--right .book-opening-spread::after{background:linear-gradient(90deg,#301909,transparent 85%)}
.book-opening-cover{position:absolute;inset:8% 0 8% 6%;border:2px solid #382418;border-radius:10px 3px 3px 10px;background:#4c3222 url('/assets/lab/book-cover-leather-v1.png') center/100% 100%;box-shadow:inset 0 0 0 3px #bd936733,inset 0 0 18px #160d0ab3;backface-visibility:hidden;transform:rotateY(180deg) translateZ(var(--book-half-depth,12px))}
.book-opening-half--right .book-opening-cover{inset:8% 6% 8% 0;border-radius:3px 10px 10px 3px}
.book-opening-edge{position:absolute;top:8%;bottom:8%;left:6%;width:calc(var(--book-half-depth,12px) + 1px);background:repeating-linear-gradient(90deg,#b89663 0px,#edd4a3 1px,#d4b580 2px);border:1px solid #8b633f;transform-origin:0 50%;transform:rotateY(90deg);backface-visibility:visible}
.book-opening-half--right .book-opening-edge{left:auto;right:6%;transform-origin:100% 50%;transform:rotateY(-90deg)}
@media(max-width:700px){.book-opening-spread.is-single .book-page-left{display:block;left:7.5%;width:34%;top:15%;height:68%}.book-opening-spread.is-single .book-page-right{left:57.5%;width:34%;top:15%;height:68%}}
@media(max-width:700px){.about-book-close{top:10px;right:14px;padding:7px 10px;font-size:11px}.about-book-dialog .book-heading{top:54px}}


.book-opening-spine{position:absolute;left:50%;top:8%;height:84%;width:calc(var(--book-half-depth,12px)*2);transform-origin:0 50%;transform:translateZ(var(--book-half-depth,12px)) rotateY(90deg);background:#4c3222 url('/assets/lab/book-cover-leather-v1.png') center/cover;border:1px solid #382418;border-radius:2px;opacity:var(--bound-spine-opacity,1);backface-visibility:visible}
