/* The preview stays beside the reading column on desktop and becomes a dock on phones. */
.peek{position:absolute;left:62px;top:450px;width:330px;display:block;color:#efe6d2;text-decoration:none;z-index:2;cursor:pointer;-webkit-tap-highlight-color:transparent}
html.fit .hint{display:none}
html.ready .peek{animation:pk-in .9s cubic-bezier(.22,.68,0,1) .25s both}
/* The side column spans the catalog: only its preview follows the reader. */
#side{position:relative;z-index:10}
html.fit #side{position:relative;top:auto;align-self:stretch}
html.fit #side .peek{position:sticky;inset:auto;top:var(--peek-stick-top,28px);width:100%;margin-top:32px}
@keyframes pk-in{from{opacity:0;transform:translateY(16px)}}
html.leaving .peek{animation:none;transition:opacity .35s ease;opacity:0}
.pk-deck{position:relative;aspect-ratio:16/10;transform-style:preserve-3d}
.pk-f,.pk-ghost{position:absolute;inset:0;margin:0;border-radius:12px;overflow:hidden;background:#232a3d}
.pk-f{inset:auto 0 0 0;height:100%;opacity:0;transform:translateY(-10px) scale(1.02);transition:opacity .3s ease,transform .55s cubic-bezier(.22,.68,0,1),box-shadow .3s ease;
  box-shadow:0 0 0 1px rgba(255,255,255,.1),0 2px 6px rgba(0,0,0,.35),0 30px 50px -20px rgba(0,0,0,.75)}
.pk-f.on{opacity:1;transform:none;z-index:1}
.pk-f img{width:100%;height:100%;object-fit:cover;object-position:50% 0;display:block}
.pk-ghost{inset:auto 0 0 0;height:var(--fh,100%);background-position:50% 0;background-size:cover;filter:saturate(.6) brightness(.7);box-shadow:0 0 0 1px rgba(255,255,255,.08),0 20px 40px -20px rgba(0,0,0,.7);
  transform:translate(12px,-12px) rotate(2.5deg) scale(.95);opacity:.55;transition:transform .6s cubic-bezier(.22,.68,0,1),opacity .4s ease,height .5s cubic-bezier(.22,.68,0,1)}
.pk-ghost.g1{transform:translate(22px,-22px) rotate(5deg) scale(.9);opacity:.3}
.peek:not(.rest) .pk-ghost{transform:translate(6px,-7px) rotate(1deg) scale(.97);opacity:.32}
.peek:not(.rest) .pk-ghost.g1{transform:translate(11px,-13px) rotate(2deg) scale(.94);opacity:.16}
.pk-f::after{content:'';position:absolute;inset:0;pointer-events:none;background:radial-gradient(circle at var(--sx,50%) var(--sy,30%),rgba(255,255,255,.22),transparent 60%);mix-blend-mode:soft-light}
.peek:hover .pk-f.on{box-shadow:0 0 0 1px rgba(255,255,255,.22),0 2px 6px rgba(0,0,0,.35),0 36px 60px -20px rgba(0,0,0,.8)}
.pk-cap{margin-top:16px}
.pk-cap.in{animation:pk-cap .4s ease both}
@keyframes pk-cap{from{opacity:0;transform:translateY(5px)}}
.pk-o{margin:0;display:flex;gap:8px;align-items:center;font-size:15px;letter-spacing:.02em;opacity:.9}
.pk-dot{flex:none;width:7px;height:7px;border-radius:50%;box-shadow:0 0 0 3px rgba(255,255,255,.07)}
.pk-h{margin:6px 0 0;font-size:17.5px;line-height:1.3;letter-spacing:-.005em;text-wrap:balance}
.peek.rest .pk-h{font-size:16px;opacity:.9}
.pk-f .pk-s{position:absolute;inset:0;opacity:0;transition:opacity .5s ease}
.pk-f .pk-s.on{opacity:1}
/* the step list under the headline: the step being played is lit, with a thin bar that fills for as long as it holds */
.peek .pk-t{list-style:none;margin:11px 0 0;padding:0;display:grid;gap:7px;font:14px/1.45 ui-sans-serif,system-ui,sans-serif}
.peek .pk-t li{position:relative;min-height:0;padding:0;white-space:normal;font:inherit;align-items:start;display:grid;grid-template-columns:16px minmax(0,1fr);gap:6px;opacity:.8;transition:opacity .3s ease}
.pk-t li span{white-space:normal;overflow-wrap:anywhere}
.pk-t li b{font-weight:600;font-variant-numeric:tabular-nums;opacity:.7}
.pk-t li.now{opacity:1}
.pk-t li.was{opacity:.72}
.pk-t li i{position:absolute;left:22px;right:0;bottom:-3px;height:1.5px;border-radius:2px;background:currentColor;opacity:.5;transform:scaleX(0);transform-origin:0 50%}
.pk-t li.now i{animation:pk-bar var(--beat,1.9s) linear both}
@keyframes pk-bar{to{transform:none}}
.peek.rest .pk-t{display:none}
/* Selection animates the preview; every entry keeps readable contrast for comparison. */
.pk-dim :is(li > a, a.row, #spare){opacity:1}
@media (prefers-reduced-motion:reduce){ .pk-f,.pk-ghost,.pk-cap.in,html.ready .peek,.pk-s,#book li > a:is(.pk-on,.pk-hint)::after{transition:none;animation:none} .pk-t li{opacity:.75} }
@media (prefers-reduced-motion:no-preference){
  @view-transition{navigation:auto}
  /* coming home from a page: the same flight in reverse (see v2.css) */
  ::view-transition-group(demo),::view-transition-group(title),::view-transition-group(over){animation-duration:.65s;animation-timing-function:cubic-bezier(.22,.68,0,1)}
  ::view-transition-old(root){animation:vt-recede .55s cubic-bezier(.22,.68,0,1) both}
  ::view-transition-new(root){animation:vt-arrive .42s ease .14s both}
  @keyframes vt-recede{to{opacity:0;filter:blur(10px) brightness(.85);transform:scale(.97)}}
  @keyframes vt-arrive{from{opacity:0}}
}
#book li > a.pk-on::after{content:'→' / '';display:inline-block;margin-left:8px;color:#a2492f;animation:pk-arrow .35s cubic-bezier(.22,.68,0,1) both}
@keyframes pk-arrow{from{opacity:0;transform:translateX(-6px)}}
#book li > a.pk-hint::after{content:'←' / '';display:inline-block;margin-left:8px;color:#a2492f;opacity:.55;animation:pk-arrow .35s cubic-bezier(.22,.68,0,1) both}
#folder a.row.pk-hint{background:rgba(162,73,47,.06)}
#folder a.row{transition:background .4s ease}

/* phones: the card becomes a frosted dock at the bottom, rising while a line is in focus (see dock() in peek.js) */
html:not(.fit) .peek{display:grid;position:fixed;z-index:20;left:10px;right:10px;top:auto;bottom:calc(10px + env(safe-area-inset-bottom));width:auto;
  grid-template-columns:108px minmax(0,1fr);gap:12px;align-items:center;padding:10px 14px 10px 10px;border-radius:16px;
  background:rgba(20,25,38,.88);-webkit-backdrop-filter:blur(14px) saturate(1.2);backdrop-filter:blur(14px) saturate(1.2);
  box-shadow:0 0 0 1px rgba(255,255,255,.09),0 18px 40px -12px rgba(0,0,0,.65);
  transform:translateY(calc(100% + 30px));transition:transform .5s cubic-bezier(.22,.68,0,1);animation:none}
html:not(.fit) .peek.up{transform:none}
html:not(.fit) .pk-ghost{display:none}
html:not(.fit) .pk-f{border-radius:8px}
html:not(.fit) .pk-cap{margin:0;min-width:0}
html:not(.fit) .pk-cap.in{animation:none}
html:not(.fit) .pk-o{font-size:12px;gap:6px}
html:not(.fit) .pk-o span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
html:not(.fit) .pk-h{font-size:15px;line-height:1.4;margin-top:3px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
html:not(.fit) .pk-t{display:flex;gap:4px;margin-top:8px}
html:not(.fit) .peek .pk-t li{display:block;flex:1;height:2px;min-height:0;padding:0;opacity:1;background:rgba(239,230,210,.2);border-radius:2px;overflow:hidden}
html:not(.fit) .pk-t li b,html:not(.fit) .pk-t li span{display:none}
html:not(.fit) .pk-t li i{left:0;right:0;top:0;bottom:0;height:auto;opacity:.9}
html:not(.fit) .pk-t li.was i{animation:none;transform:none}
html:not(.fit) body{padding-bottom:110px}   /* room for the dock under the last line */

/* empty space around the index goes back to the desk (peek.js): the cursor says "step back", and the way-back link leans toward it */
html.fit,html.fit body,html.fit #stage,html.fit #side{cursor:zoom-out}
html.fit :is(#catalog,#book,#folder,.peek,#side > *){cursor:auto}
#home{display:inline-block;transition:transform .35s cubic-bezier(.22,.68,0,1),opacity .3s ease}
#home.pk-back{transform:translateX(-6px)}
html:not(.fit) #book li > a:is(.pk-on,.pk-hint)::after{display:none}   /* phones: the dock marks the line */
@media (prefers-reduced-motion:no-preference){ ::view-transition-old(title),::view-transition-old(over){animation:vt-out .18s ease both} }
@keyframes vt-out{to{opacity:0}}
