/* Smooth page changes, shared by the chooser and every chapter.
   1. Browsers with cross-document view transitions (Chrome, Edge, Safari 18.2+) crossfade between pages.
   2. Everywhere else, a curtain in the colour of the page you just chose lifts to reveal the new page,
      so there is never a flash of white. transition.js sets the colour; the chooser stores it on click. */
@view-transition{ navigation:auto; }
::view-transition-old(root){ animation: .6s cubic-bezier(.4,0,.2,1) both vtOut; }
::view-transition-new(root){ animation: .9s cubic-bezier(.22,1,.36,1) both vtIn; }
@keyframes vtOut{ to{ opacity:0; filter:blur(8px); transform:scale(1.025); } }
@keyframes vtIn{ from{ opacity:0; filter:blur(10px); transform:scale(.98); } }

html::after{
  content:''; position:fixed; inset:0; z-index:2147483647; pointer-events:none;
  background: var(--curtain, #1a0a14);
  animation: curtainOut 1.1s cubic-bezier(.22,1,.36,1) .05s both;
}
@keyframes curtainOut{ from{ opacity:1; visibility:visible; } to{ opacity:0; visibility:hidden; } }

@media (prefers-reduced-motion: reduce){
  html::after{ display:none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*){ animation-duration:.01s !important; }
}
