/* The reading edition has the same mandatory footer functions as the ResearchOS. */
html[data-theme=light]{--bg:#f2ebdf;--paper:#273b32;--line:#a2ac98;--gold:#896126;--soft:#e4decd}
body:has(.read-footer){padding-bottom:40px}
.read-footer{position:fixed;z-index:10;bottom:3px;left:3px;right:3px;display:flex;align-items:center;gap:12px;background:var(--bg);padding:5px 12px;min-height:32px}
.read-footer .footer-author{margin-right:auto}.read-footer button{font-size:10px;padding:4px 7px}.read-footer button[aria-pressed=true]{color:var(--gold);border-color:var(--gold)}
body:has(.read-footer) dialog{background:var(--bg);color:var(--paper);border:1px solid var(--line);max-width:min(600px,90vw);max-height:80dvh;overflow:auto;font:16px/1.6 Georgia,serif;padding:24px}
body:has(.read-footer) dialog::backdrop{background:#0009}body:has(.read-footer) dialog h2{margin-top:0}
/* Outside fullscreen, expose the ordinary scrolling product rather than a
   permanently viewport-clamped application shell. */
html[data-reader-boundary] body.product-app:not(.console-takeover):not(.research-immersive-active){height:auto!important;min-height:100dvh;overflow:auto!important}
html[data-reader-boundary] body.product-app:not(.console-takeover):not(.research-immersive-active) main{height:auto!important;min-height:100dvh;overflow:visible!important}
body.product-app:not(.console-takeover):not(.research-immersive-active) .console{height:auto!important;min-height:100dvh;overflow:visible!important}
body.product-app:not(.console-takeover):not(.research-immersive-active) .operating-system{min-height:65dvh}
body.product-app:not(.console-takeover):not(.research-immersive-active) #system-grid{height:auto!important;max-height:none!important}
/* The witness cartridge carries source text in either dominant-display state. */
.console.research-immersive[data-cartridge=witnesseth][data-immersive-mode=visual] .narrative-window{display:none!important;flex:0!important;height:0!important;padding:0!important}
.console.research-immersive[data-cartridge=witnesseth][data-immersive-mode=visual] :is(.visual-panes,.geometry-space){width:100%!important;height:100%!important;flex:1!important;padding:0!important;gap:0!important}
.console.research-immersive[data-cartridge=witnesseth][data-immersive-mode=visual] #system-grid{display:block!important;width:100%!important;height:100%!important;max-width:none!important;object-fit:fill!important;touch-action:manipulation}
.console.research-immersive[data-cartridge=witnesseth] .matrix-immersive-tools{display:flex!important;position:absolute;right:8px;top:max(6px,env(safe-area-inset-top));gap:5px;z-index:6}
/* Keep the mandatory compact footer reachable in window view. */
body.product-app:not(.console-takeover):not(.research-immersive-active) .reader-footer{position:fixed!important;bottom:3px;left:3px;right:3px;z-index:8}
body.product-app:not(.console-takeover):not(.research-immersive-active) .console{padding-bottom:40px!important}
body.product-app:not(.console-takeover):not(.research-immersive-active) .bezel{height:auto!important;overflow:visible!important;flex:0 0 auto!important}
body.product-app:not(.console-takeover):not(.research-immersive-active) .bezel>div{flex-wrap:wrap;gap:6px;min-width:0}
@media(max-width:700px){
 .product-app .reader-header{display:flex!important;flex-wrap:wrap!important;align-items:center;gap:6px!important;padding:6px 8px!important}
 .product-app .reader-header>.reader-wordmark{position:static!important;order:0;flex:1 1 auto;max-width:calc(100% - 115px)!important;font-size:10px}
 .product-app .reader-header>[data-reader-fullscreen]{position:static!important;order:1;margin-left:auto}
 .product-app .reader-header>.transport{order:2;flex:1 1 100%!important;width:100%;display:flex!important;flex-wrap:wrap!important;gap:5px;min-width:0}
 .product-app .reader-header .transport .library-select{flex:1 1 100%;max-width:100%;width:100%}
 .product-app .reader-header .transport select{max-width:100%!important}
 body.product-app:not(.console-takeover):not(.research-immersive-active) .operating-system{min-height:0!important;flex:0 0 auto!important}
 body.product-app:not(.console-takeover):not(.research-immersive-active) :is(.work-area,.visual-panes,.geometry-space){min-height:0!important;height:auto!important;padding:0!important}
 body.product-app:not(.console-takeover):not(.research-immersive-active) #system-grid{width:100%!important;height:auto!important;aspect-ratio:3/2}
 .product-app .bezel #cartridges{min-width:0;max-width:100%;flex:1}
}
