/* Touch composition foundation. Existing desktop styles are intentionally intact. */
html.touch-viewport{
 --touch-gutter:clamp(22px,5.65vw,34px);
 --touch-top:calc(88px + env(safe-area-inset-top,0px));
 --touch-bottom:calc(64px + env(safe-area-inset-bottom,0px));
 --touch-section:100svh;
 --pad:var(--touch-gutter);
 -webkit-text-size-adjust:100%;text-size-adjust:100%;
 scroll-padding-top:calc(76px + env(safe-area-inset-top,0px));
}
html.touch-viewport body{overflow-x:clip;min-width:0}
html.touch-viewport main{min-width:0}
html.touch-viewport main :is(h1,h2,h3,p,li,dd,a,button,summary){overflow-wrap:break-word}
html.touch-viewport main :is(h1,h2,h3){text-wrap:balance}
html.touch-viewport :is(button,a,summary,[role=tab]){-webkit-tap-highlight-color:transparent;touch-action:manipulation}
html.touch-viewport :is(button,a,summary):focus-visible{outline:1px solid currentColor;outline-offset:5px}
html.touch-viewport :is(button,a,summary):active{filter:brightness(1.12)}
/* A rotated plus needs its own breathing room inside the tappable row. */
html.touch-viewport main summary>.icon{margin-inline-end:5px;flex-shrink:0}
html.touch-viewport :is(input,textarea,select){font-size:16px;scroll-margin-block:96px}
html.touch-viewport :is([data-chapter],.sf-chapter){scroll-margin-top:0}
html.touch-viewport :is(.chapter-screen,.product-chapter,.q-chapter,.sf-chapter){min-height:var(--touch-section);padding:var(--touch-top) var(--touch-gutter) var(--touch-bottom)}
html.touch-viewport :is(.chapter-inner,.world-content,.q-content){min-width:0;max-width:100%}
html.touch-viewport :is(.chapter-next,.scroll-arrow){min-height:44px;min-width:44px}
html.touch-viewport :is(.scene,.delivery-scene,.q-spatial,.sf-crystal){touch-action:pan-y pinch-zoom}
/* Less screen-relative travel: the scenery moves, while reading stays stable. */
html.touch-viewport.js:not(.motion-paused) [data-chapter][data-motion-ready] :is(.chapter-inner,.world-content,.q-content,.migration-reading){filter:none;opacity:calc(1 - var(--chapter-enter,0)*.22 - var(--chapter-exit,0)*.18);transform:translateY(calc(var(--chapter-enter,0)*14px - var(--chapter-exit,0)*9px))}
html.touch-viewport.js:not(.motion-paused) [data-chapter][data-motion-ready] :is(.chapter-art,.q-spatial,.delivery-instrument,.q-language-instrument,.q-export-instrument,.provenance-instrument,.evidence-package){filter:none;transform:translateY(calc(var(--chapter-enter,0)*12px)) scale(calc(1 - var(--chapter-enter,0)*.025))}
html.touch-viewport.js:not(.motion-paused) .world-opening[data-motion-ready] .world-object{transform:translateY(calc(var(--chapter-exit,0)*-16px));opacity:calc(1 - var(--chapter-exit,0)*.4)}
html.touch-viewport :is(.narrative-panel,.q-tab-panel,.delivery-panel):not([hidden]){animation-duration:.35s;animation-timing-function:ease-out}
html.touch-viewport .reveal{transition-duration:.55s;filter:none}
html.touch-viewport.motion-paused :is(.chapter-inner,.world-content,.q-content,.migration-reading,.chapter-art,.q-spatial){transform:none!important;filter:none!important;opacity:1!important}
@media(min-width:700px){
 html.touch-viewport{--touch-gutter:clamp(36px,5vw,68px);--touch-top:calc(110px + env(safe-area-inset-top,0px));--touch-bottom:calc(76px + env(safe-area-inset-bottom,0px))}
}
@media(max-height:520px) and (orientation:landscape){
 html.touch-viewport{--touch-gutter:max(24px,env(safe-area-inset-left,0px),env(safe-area-inset-right,0px));--touch-top:calc(78px + env(safe-area-inset-top,0px));--touch-bottom:calc(54px + env(safe-area-inset-bottom,0px))}
}
@media(prefers-reduced-motion:reduce){
 html.touch-viewport :is(.chapter-inner,.world-content,.q-content,.migration-reading,.chapter-art,.q-spatial){transform:none!important;filter:none!important;opacity:1!important}
}
