/* Behind the Memoir: motion layer.
   Plain-CSS ports of 21st.dev components (see js/fx.js for credits).
   Everything here is switched off for visitors who ask for reduced motion. */
:root{--fx-ease:cubic-bezier(.19,1,.22,1);--fx-ease2:cubic-bezier(.23,1,.32,1)}

/* Hero entrance (runs while the page boots) */
html.mb-loading .h1sec .hcopy>*,html.mb-loading .h1sec .hart{opacity:0}
.fx .h1sec .hcopy>.sub,.fx .h1sec .hcopy>.cta,.fx .h1sec .hcopy>.hq{animation:fxUp 1s var(--fx-ease) both}
.fx .h1sec .hcopy>.sub{animation-delay:.45s}.fx .h1sec .hcopy>.cta{animation-delay:.6s}.fx .h1sec .hcopy>.hq{animation-delay:.8s}
.fx .h1sec .hart{animation:fxFade 1.4s ease-out .15s both}
.fx .h1sec .snap.s1,.fx .h1sec .hn1{animation:fxDrop 1.1s var(--fx-ease) .7s both}
.fx .h1sec .snap.s2,.fx .h1sec .hn2{animation:fxDrop 1.1s var(--fx-ease) .9s both}

html.fx:not(.fx-rm) .h1sec h1:not([data-fx]){opacity:0}
/* 1. Text Reveal (Mask): headings slide up line by line from behind a mask */
.fx-split .fx-l{display:block;overflow:hidden;padding-bottom:.08em;margin-bottom:-.08em}
.fx-split .fx-i{display:block;transform:translate3d(0,110%,0);transition:transform .9s var(--fx-ease);transition-delay:var(--fx-d,0s);will-change:transform;backface-visibility:hidden}
.fx-split.fx-on .fx-i{transform:none}

/* 2. Scroll Reveal: cards and blocks rise into view */
.fx-r{opacity:0}
.fx-r.fx-on{animation:fxUp .95s var(--fx-ease) var(--fx-d,0s) both}

/* 3. Optimized Tilt Card: 3D tilt with a warm light sheen that follows the pointer */
.fx-tilt{transform:perspective(1000px) rotateX(var(--fx-rx,0deg)) rotateY(var(--fx-ry,0deg)) scale(var(--fx-sc,1));transition:transform .35s var(--fx-ease2);will-change:transform}
.fx-sheen{position:absolute;inset:0;z-index:5;pointer-events:none;opacity:0;transition:opacity .3s;mix-blend-mode:overlay;background:radial-gradient(circle at var(--fx-px,50%) var(--fx-py,50%),rgba(255,236,196,.55) 0%,transparent 75%)}
.fx-sheen::after{content:"";position:absolute;inset:0;background:radial-gradient(circle 90px at var(--fx-px,50%) var(--fx-py,50%),rgba(255,244,222,.12),transparent 70%)}
.fx-tilt:hover .fx-sheen,.fx-tilt.fx-touch .fx-sheen{opacity:1}

/* 4. Book: covers become real 3D books that turn on hover */
.fx-bk{perspective:900px}
.fx-book{display:block;position:relative;transform-style:preserve-3d;transition:transform .5s ease-out;--fx-dp:12px}
.fx-book>.cover{position:relative;z-index:1}
.fx-pages{position:absolute;right:0;top:3px;bottom:3px;width:calc(var(--fx-dp) - 2px);background:repeating-linear-gradient(90deg,#fbf6ec 0 1px,#e6dcc8 1px 2px);transform:translateX(calc(var(--fx-dp)/2)) rotateY(90deg) translateX(calc(var(--fx-dp)/2))}
.fx-back{position:absolute;inset:0;background:#2e1a16;border-radius:2px 4px 4px 2px;transform:translateZ(calc(-1*var(--fx-dp)))}
.fx-bk:hover .fx-book,.fx-bk:focus-visible .fx-book{transform:rotateY(-20deg) scale(1.066) translateX(-8px)}
.fx .bk:hover .cover{transform:none}
.fx .bk:hover .fx-book .cover{box-shadow:18px 22px 34px rgba(20,10,6,.35)}
.fx .stc:hover{transform:none}
.fx .stc .fx-book{--fx-dp:8px}

/* 5. Parallax Floating: hero photos and notes drift with the cursor (uses the translate property) */
.fx-float{will-change:translate}

/* 6. Reading Progress: thin bar at the top + time-left readout */
#fxrp{position:fixed;left:0;right:0;top:0;height:3px;z-index:60;pointer-events:none;background:rgba(90,20,36,.12);opacity:0;transition:opacity .3s}
#fxrp.on{opacity:1}
#fxrp i{display:block;height:100%;background:linear-gradient(90deg,var(--ox,#5a1424),#9c3a3f 70%,var(--gold,#c9a45f));transform-origin:left;transform:scaleX(var(--fx-p,0));transition:transform .45s var(--fx-ease2)}
#fxrt{position:fixed;right:14px;bottom:14px;z-index:60;font:500 11.5px/1 var(--sans,Jost,sans-serif);letter-spacing:.12em;text-transform:uppercase;color:#f6efe2;background:rgba(46,11,19,.92);padding:9px 13px;border-radius:999px;box-shadow:0 6px 18px rgba(20,8,6,.25);display:flex;align-items:center;gap:7px;opacity:0;transform:translateY(8px);transition:opacity .3s,transform .4s var(--fx-ease2);pointer-events:none}
#fxrt.on{opacity:1;transform:none}
#fxrt svg{width:12px;height:12px;display:none}
#fxrt.done svg{display:block}
#fxrt.done polyline{stroke-dasharray:240;stroke-dashoffset:240;animation:fxDraw .35s var(--fx-ease2) .08s forwards}

/* 7. Shining Button: a soft light sweeps across buttons on hover */
.btn{position:relative;overflow:hidden;isolation:isolate}
.btn::before{content:"";position:absolute;top:-60%;left:-3rem;width:.45rem;height:220%;background:rgba(255,246,228,.75);filter:blur(8px);transform:skewX(-12deg);transition:left .8s ease;pointer-events:none;z-index:-1}
.btn.ghost::before,.btn.ghost-l::before,.btn.ghost-g::before{background:rgba(90,20,36,.25)}
.btn.ghost:hover::before,.btn.ghost-l:hover::before,.btn.ghost-g:hover::before{background:rgba(255,246,228,.55)}
.btn:hover::before{left:calc(100% + 3rem)}

/* 8. Animated Link: the underline wipes in from the left, the arrow nudges forward */
.more,.fnav a,.tchips a,.wcard em,.ritem b{background-image:linear-gradient(currentColor,currentColor);background-repeat:no-repeat;background-position:100% 100%;background-size:0 1px;transition:background-size .3s cubic-bezier(.4,0,.2,1),color .2s;text-decoration:none!important}
.more:hover,.fnav a:hover,.tchips a:hover,.wcard:hover em,.ritem:hover b{background-position:0 100%;background-size:100% 1px}
.more i{display:inline-block;transition:transform .3s var(--fx-ease2)}
.more:hover i{transform:translateX(4px)}
.tchips a{background-position:100% calc(100% - 4px)}
.tchips a:hover{background-position:0 calc(100% - 4px);background-size:calc(100% - 28px) 1px}

/* 9. Scroll Reveal Image: big pictures settle from a slow zoom, bands open out as they arrive */
.fx-zoom{isolation:isolate}
.fx-bg{position:absolute;inset:0;z-index:-1;background:var(--bg) center/cover;transform:scale(var(--fx-s,1));transform-origin:50% 50%;will-change:transform}
.fx-zoom.fx-hasbg{background-image:none!important}
.tcard.fx-zoom,.rbig.fx-zoom{overflow:hidden}
.fx-zimg{transform:scale(var(--fx-s,1));will-change:transform}
.fx-open{clip-path:inset(0 var(--fx-x,0%) round var(--fx-rad,0px))}

/* Page change: new pages fade up gently */
#page.fx-enter>*{animation:fxPage .55s var(--fx-ease) both}

@keyframes fxUp{from{opacity:0;translate:0 26px}to{opacity:1;translate:0 0}}
@keyframes fxFade{from{opacity:0}to{opacity:1}}
@keyframes fxDrop{from{opacity:0;translate:0 -18px}to{opacity:1;translate:0 0}}
@keyframes fxPage{from{opacity:0;translate:0 12px}to{opacity:1;translate:0 0}}
@keyframes fxDraw{to{stroke-dashoffset:0}}

@media (max-width:760px){.fx-pages,.fx-back{display:none}.fx-bk:hover .fx-book{transform:none}}
@media (prefers-reduced-motion:reduce){
  .fx-r,.fx-split .fx-i{opacity:1!important;transform:none!important;animation:none!important}
  .fx .h1sec *,.fx .h1sec .hart,#page.fx-enter>*{animation:none!important}
  .btn::before{display:none}
  .fx-tilt{transform:none!important}
}
