/* Rutvy sheet 3: one bottom sheet that slides up over a page and shows one view at a time. One .js and one .css, no library.
   Markup:
   <div class="rs-dim" id="dim"></div>                      (optional: faded in behind a view marked modal)
   <div class="rs" id="sheet" role="dialog" aria-label="...">
     <div class="rs-grab" aria-hidden="true"><i class="rs-pill"></i></div>
     <div class="rs-views"></div>                            (sheet3.js puts one view here at a time: <div class="rs-view">...</div>)
   </div>
   sheet3.js sets the sheet's height once (the tallest it may be) and slides it with transform only; the part in view is the view's
   own height. Nothing under the sheet is moved or resized. Its colours are the four variables below, plus two hairline shadows. */
.rs{
  --rs-bg:#fff; --rs-ink:#1D1D1F; --rs-grabber:#C7C7CC; --rs-radius:20px;
  position:absolute; left:0; right:0; bottom:0; z-index:7;
  background:var(--rs-bg); color:var(--rs-ink);
  border-radius:var(--rs-radius) var(--rs-radius) 0 0;
  box-shadow:0 0 0 .5px rgba(0,0,0,.10), 0 -8px 28px rgba(0,0,0,.12);
  transform:translateY(100%); will-change:transform;
  touch-action:none; -webkit-user-select:none; user-select:none; box-sizing:border-box;
}
.rs[data-state=closed]{box-shadow:none; visibility:hidden}
/* white carries on under the sheet, so nothing of the page shows under its foot */
.rs::after{content:""; position:absolute; left:0; right:0; top:100%; height:64px; background:var(--rs-bg)}
/* the grabber: a mark that the sheet can be pulled; the whole sheet takes the pull */
.rs-grab{position:absolute; left:0; right:0; top:0; height:14px; pointer-events:none; z-index:2}
.rs-pill{position:absolute; left:50%; top:6px; width:36px; height:5px; margin-left:-18px; border-radius:3px; background:var(--rs-grabber)}
.rs-views{position:absolute; left:0; right:0; top:0; bottom:0; border-radius:inherit; overflow:hidden}
/* a view: laid from the sheet's top edge, so it rides with the edge as the sheet changes height.
   Going: it fades out in 120 ms. Coming: it fades in over 180 ms, 60 ms later. Opacity only. */
.rs-view{position:absolute; left:0; right:0; top:0; box-sizing:border-box; opacity:0; visibility:hidden;
  transition:opacity 120ms linear, visibility 0s linear 120ms}
.rs-view[data-on="1"]{opacity:1; visibility:visible; transition:opacity 180ms cubic-bezier(.23,1,.32,1) 60ms, visibility 0s}
.rs-view.rs-now{transition:none}
/* a part of a view that scrolls up and down keeps its own pull */
.rs .rs-scroll{overflow-y:auto; overflow-x:hidden; touch-action:pan-y; overscroll-behavior:contain; scrollbar-width:none}
.rs .rs-scroll::-webkit-scrollbar{display:none}
/* the dim behind a modal view: opacity only */
.rs-dim{position:absolute; inset:0; z-index:6; background:rgba(0,0,0,.32); opacity:0; visibility:hidden; pointer-events:none;
  transition:opacity 180ms linear, visibility 0s linear 180ms}
.rs-dim[data-on="1"]{opacity:1; visibility:visible; pointer-events:auto; transition:opacity 220ms linear, visibility 0s}
/* Reduce Motion: no slide; a short fade */
@keyframes rsFade{from{opacity:0}to{opacity:1}}
.rs.rs-fade{animation:rsFade 200ms ease-out both}
@keyframes rsOut{from{opacity:1}to{opacity:0}}
.rs.rs-out{animation:rsOut 160ms ease-out both}
@media (prefers-reduced-motion: reduce){
  .rs-view[data-on="1"]{transition:opacity 180ms linear, visibility 0s}
}
