/* ==========================================================
   Sketchbook hero: the opening of the book.
   Adapted from the "Sketchbook" landing page (ThreeUI). The turning leaf is
   a chain of nested 3D strips, so the page bends the way paper bends. Rules
   are scoped to .sk-hero so nothing leaks into the rest of the site.
   ========================================================== */
@font-face{font-family:'Instrument Serif';font-style:normal;font-weight:400;font-display:block;
  src:url(fonts/instrument-serif.woff2) format('woff2')}
@font-face{font-family:'Newsreader Upright';font-style:normal;font-weight:200 600;font-display:swap;
  src:url(fonts/newsreader.woff2) format('woff2')}

.sk-hero{
  --paper:#EBE8D9;
  --ink:#171717;
  --ink-soft:rgba(23,23,23,.58);
  --display:'Instrument Serif',"New York",Georgia,'Times New Roman',serif;
  --font:var(--font-sans);
  --track-caps:.24em;
  /* room the book may use: the hero's height minus its padding and kicker */
  --sk-h:max(520px,calc(100svh - var(--topbar-h)));
  --sk-logo:clamp(64px,7vw,96px);    /* the Fable&Co logo */
  --sk-pt:24px;
  --sk-pb:76px;                       /* kept clear at the bottom for the pinned nav */
  --sk-arrow:50px;                    /* the scroll arrow, sitting just under the book */
  --sk-extra:calc(var(--sk-logo) + 10px + 56px + var(--sk-arrow)); /* wordmark + tagline above, arrow below */
  /* The book is drawn in a 1760x1240 frame with empty paper-coloured margin: the
     pages fill 85% of its width and 39.7% of its width in height. So the frame
     is sized from the space the pages themselves may use, and its empty top and
     bottom margin (15.4% of its width each) is pulled back with negative margin. */
  --sk-w:min(1450px,104vw,calc((var(--sk-h) - var(--sk-pt) - var(--sk-pb) - var(--sk-extra)) / .397));
  position:relative;display:grid;justify-items:center;align-content:center;
  /* the hero starts at the very top of the page, behind the (clear) top bar, so the sketch runs right up to the edge */
  margin-top:calc(-1 * var(--topbar-h));
  height:100svh;min-height:calc(520px + var(--topbar-h));overflow:hidden;
  padding:calc(var(--sk-pt) + var(--topbar-h)) 0 var(--sk-pb);
  color:var(--ink);
  font-family:var(--font);font-weight:400;-webkit-font-smoothing:antialiased;
  overflow-anchor:none;
}
.sk-hero,.sk-hero *{-webkit-user-select:none;-moz-user-select:none;user-select:none}
.sk-hero img{-webkit-user-drag:none;user-drag:none}
.sk-hero a{color:inherit;text-decoration:none}

/* the logo */
.sk-name{position:relative;z-index:3;display:block;margin-bottom:10px;line-height:0}
.sk-name img{display:block;width:var(--sk-logo);height:var(--sk-logo);margin-inline:auto}

.sk-kicker{
  font-family:var(--font-sub);font-size:clamp(16px,1.45vw,20px);font-weight:700;letter-spacing:.01em;line-height:1.3;text-align:center;
  color:var(--ink);margin:0 0 clamp(18px,3vh,30px);padding-inline:20px;max-width:min(34em,92vw);text-wrap:balance;
  position:relative;z-index:2;
  text-shadow:0 0 5px var(--paper),0 0 10px var(--paper),0 0 14px var(--paper);   /* a halo so the grid lines never run through the words */
}

.sk-down{
  position:relative;margin-top:14px;
  display:inline-flex;padding:10px 14px;color:var(--ink);cursor:pointer;
  -webkit-tap-highlight-color:transparent;
  animation:sk-breathe 2.6s ease-in-out infinite;z-index:3;
}
.sk-down:hover{animation:none;opacity:1}
@keyframes sk-breathe{0%,100%{opacity:.15}50%{opacity:.7}}
@media (prefers-reduced-motion:reduce){.sk-down{animation:none;opacity:.5}}

/* ---------------- the book ---------------- */
/* the floral sketch behind the hero. Landscape screens use a widened copy made by mirroring the picture side to side
   (so there is no visible join and no stretching); phones use the original tall picture. */
.sk-hero{
  background-color:#EBE8D9;   /* exactly the cream of the page and top bar */
}
/* the sketch is white with grey lines, so it is multiplied over the blue: the white turns into the blue and the lines stay */
.sk-hero::before{
  content:"";position:absolute;inset:0;z-index:0;pointer-events:none;
  background:url(images/sketchbook/hero-bg-wide.jpg) center / cover no-repeat;
  mix-blend-mode:multiply;
}
@media (max-aspect-ratio:1/1){.sk-hero::before{background-image:url(images/sketchbook/hero-bg.jpg)}}
/* the wallpaper fades out toward the bottom, into exactly the colour of the About section below, so there is no edge */
.sk-hero::after{
  content:"";position:absolute;left:0;right:0;bottom:0;height:44%;z-index:0;pointer-events:none;
  background:linear-gradient(to bottom,rgb(235 232 217 / 0) 0%,rgb(235 232 217 / .38) 35%,rgb(235 232 217 / .78) 70%,#EBE8D9 100%);
}
.sk-hero .sb-wrap{display:grid;justify-items:center;gap:20px;width:100%;position:relative;z-index:2}
.sk-hero .sb-stage{
  display:flex;align-items:center;justify-content:center;width:100%;
  position:relative;
  touch-action:pan-y;
}

/* The box is the book's own untransformed frame; only .sb-tilt leans. */
.sk-hero .sb-3d{
  position:relative;flex:none;width:var(--sk-w);
  margin-block:calc(var(--sk-w) * -0.1536);
  perspective:1750px;perspective-origin:50% 46%;
}
.sk-hero .sb-tilt{
  position:relative;
  transform-style:preserve-3d;
  transform:rotateX(var(--rx,0deg)) rotateY(var(--ry,0deg));
  will-change:transform;
}
.sk-hero .sb-book{position:relative;width:100%;aspect-ratio:1760/1240;transform-style:preserve-3d;z-index:1}

/* The book sits on a surface, so its shadow is a soft pool underneath;
   both blobs ease off while a leaf is in the air. */
.sk-hero .sb-cast{position:absolute;pointer-events:none;z-index:0}
.sk-hero .sb-cast.ambient{
  left:5%;right:5%;top:27%;bottom:2%;
  background:radial-gradient(50% 50% at 50% 58%,
    rgba(58,44,26,.34) 0%,rgba(58,44,26,.19) 40%,rgba(58,44,26,0) 74%);
  filter:blur(26px);
  opacity:calc(1 - var(--shade,0) * .42);
}
.sk-hero .sb-cast.contact{
  left:9%;right:9%;top:62%;bottom:10%;
  background:radial-gradient(50% 44% at 50% 42%,
    rgba(44,32,14,.40) 0%,rgba(44,32,14,.17) 48%,rgba(44,32,14,0) 78%);
  filter:blur(11px);
  opacity:calc(1 - var(--shade,0) * .5);
}
.sk-hero .sb-cast.hair{
  left:12%;right:12%;top:70%;bottom:17%;
  background:radial-gradient(50% 52% at 50% 40%,
    rgba(40,28,10,.34) 0%,rgba(40,28,10,0) 76%);
  filter:blur(4px);
  opacity:calc(1 - var(--shade,0) * .62);
}
.sk-hero .sb-full{position:absolute;inset:0}
.sk-hero .sb-full img{width:100%;height:auto;display:block}
.sk-hero .sb-half{position:absolute;top:0;bottom:0;width:50%;overflow-x:clip;overflow-y:visible}
.sk-hero .sb-half.left{left:0}
.sk-hero .sb-half.right{left:50%}
.sk-hero .sb-half-img{width:200%;max-width:none;height:auto;display:block}
.sk-hero .sb-half-img.right{margin-left:-100%}
/* the shadow the lifting leaf throws onto the page beneath it */
.sk-hero .gutter-shade{
  position:absolute;top:var(--pg,21.8%);bottom:var(--pg,21.8%);width:46%;
  pointer-events:none;opacity:calc(var(--shade,0) * .62);
  -webkit-mask-image:linear-gradient(180deg,transparent 0,#000 5.2%,#000 94.8%,transparent 100%);
  mask-image:linear-gradient(180deg,transparent 0,#000 5.2%,#000 94.8%,transparent 100%);
}
.sk-hero .gutter-shade.left{right:0;background:linear-gradient(270deg,rgba(52,38,20,.30),rgba(52,38,20,0) 82%)}
.sk-hero .gutter-shade.right{left:0;background:linear-gradient(90deg,rgba(52,38,20,.24),rgba(52,38,20,0) 82%)}

/* ---- the turning leaf: nested strips forming a curved surface ---- */
.sk-hero .curl{
  position:absolute;top:0;height:100%;
  width:calc(var(--bw,0px) * var(--span));
  transform-style:preserve-3d;z-index:6;
}
.sk-hero .curl.next{left:50%;transform-origin:left center;transform:rotateY(calc(-1 * var(--tt,0deg)))}
.sk-hero .curl.prev{right:50%;transform-origin:right center;transform:rotateY(var(--tt,0deg))}
.sk-hero .strip{
  position:absolute;top:0;height:100%;
  width:calc(var(--bw,0px) * var(--span) / var(--n));
  transform-style:preserve-3d;
}
.sk-hero .curl.next .strip{transform-origin:left center}
.sk-hero .curl.prev .strip{transform-origin:right center}
.sk-hero .curl.next>.strip{left:0}
.sk-hero .curl.prev>.strip{right:0;left:auto}
.sk-hero .curl.next .strip .strip{left:100%;transform:rotateY(var(--td,0deg))}
.sk-hero .curl.prev .strip .strip{right:100%;transform:rotateY(calc(-1 * var(--td,0deg)))}
.sk-hero .face{
  position:absolute;top:0;bottom:0;left:0;right:-1.1px;
  backface-visibility:hidden;-webkit-backface-visibility:hidden;
  background-repeat:no-repeat;background-size:var(--bw,0px) auto;
}
.sk-hero .face.back{transform:rotateY(180deg)}
.sk-hero .face .sh,.sk-hero .face .gl{
  -webkit-mask-image:linear-gradient(180deg,transparent 0,#000 5.2%,#000 94.8%,transparent 100%);
  mask-image:linear-gradient(180deg,transparent 0,#000 5.2%,#000 94.8%,transparent 100%);
}
.sk-hero .strip.edge .face .sh,.sk-hero .strip.edge .face .gl{
  -webkit-mask-image:linear-gradient(180deg,transparent 0,#000 9%,#000 91%,transparent 100%),var(--hf);
  mask-image:linear-gradient(180deg,transparent 0,#000 9%,#000 91%,transparent 100%),var(--hf);
  -webkit-mask-composite:source-in;mask-composite:intersect;
}
.sk-hero .curl.next .strip.edge .face.front,.sk-hero .curl.prev .strip.edge .face.back{
  --hf:linear-gradient(90deg,#000 0 22%,transparent 96%);
}
.sk-hero .curl.next .strip.edge .face.back,.sk-hero .curl.prev .strip.edge .face.front{
  --hf:linear-gradient(270deg,#000 0 22%,transparent 96%);
}
.sk-hero .face .sh{position:absolute;left:0;right:0;top:var(--pg,21.8%);bottom:var(--pg,21.8%);pointer-events:none}
.sk-hero .curl.next .face.front .sh,.sk-hero .curl.prev .face.back .sh{
  background:linear-gradient(90deg,rgba(58,43,20,var(--a1,0)),rgba(58,43,20,var(--a2,0)));
}
.sk-hero .curl.next .face.back .sh,.sk-hero .curl.prev .face.front .sh{
  background:linear-gradient(90deg,rgba(58,43,20,var(--a2,0)),rgba(58,43,20,var(--a1,0)));
}
.sk-hero .face .gl{
  position:absolute;left:0;right:0;top:var(--pg,21.8%);bottom:var(--pg,21.8%);
  pointer-events:none;background:#fffaf0;
  opacity:calc(var(--shade,0) * var(--lit,1) * var(--lit,1) * .20);
}

/* ---- the riffle: pages blur sideways as they fly past ---- */
.sk-hero .sb-wrap.intro .sb-full img,.sk-hero .sb-wrap.intro .sb-half-img{filter:url(#sb-mblur-1)}
.sk-hero .sb-wrap.intro.b2 .sb-full img,.sk-hero .sb-wrap.intro.b2 .sb-half-img{filter:url(#sb-mblur-2)}

@media (max-width:640px){
  .sk-hero{--sk-logo:60px;--sk-h:max(460px,calc(100svh - var(--topbar-h)));min-height:calc(460px + var(--topbar-h))}
  /* one line on a phone: the size follows the screen width so the whole sentence always fits */
  .sk-kicker{font-size:clamp(9.5px,3vw,15px);white-space:nowrap;max-width:none;padding-inline:0;letter-spacing:0}
  .sk-hero .sb-wrap{width:100vw;margin-inline:calc(50% - 50vw)}
}
@media (pointer:coarse),(max-width:640px){
  .sk-down{min-width:44px;min-height:44px;align-items:center;justify-content:center}
}
/* short landscape screens (phones on their side) */
@media (max-height:520px) and (orientation:landscape){
  .sk-hero{--sk-h:calc(100svh - var(--topbar-h));--sk-logo:30px;--sk-pt:8px;--sk-pb:72px;--sk-arrow:0px;--sk-extra:calc(var(--sk-logo) + 10px);min-height:0}
  .sk-kicker{display:none}
  .sk-down{display:none}
}

/* ---- About us: the same paper, wash and botanicals as the hero's bottom edge ---- */
.sk-paper{
  --ink:#171717;--paper:#EBE8D9;
  position:relative;overflow:hidden;background:var(--paper);color:var(--ink);
}
.sk-paper>.wrap{position:relative;z-index:2}
.sk-paper .label{color:rgba(23,23,23,.58)}
.sk-paper .row{border-bottom-color:rgba(23,23,23,.14)}
.sk-paper .arrow-link{border-bottom-color:rgba(23,23,23,.3)}
.sk-paper .arrow-link:hover{border-bottom-color:var(--ink)}
.sk-paper :focus-visible{outline-color:var(--ink)}

/* ---- loading screen: covers the page while the book's pages get ready ---- */
.sk-loader{
  position:fixed;inset:0;z-index:1000;display:none;flex-direction:column;align-items:center;justify-content:center;gap:22px;
  background:#EBE8D9;color:#171717;
  opacity:1;transition:opacity .45s ease;
}
.sk-loading .sk-loader{display:flex}
.sk-loader.is-done{opacity:0;pointer-events:none}
.sk-loading{overflow:hidden}
.sk-loader-text{
  position:relative;font-family:'Instrument Serif',Georgia,'Times New Roman',serif;font-size:clamp(28px,4.4vw,44px);
  letter-spacing:.005em;line-height:1;text-align:center;padding-inline:20px;
  animation:sk-loader-in .7s ease both;
}
.sk-loader-bar{position:relative;display:block;width:clamp(120px,18vw,180px);height:1px;background:rgba(23,23,23,.16);overflow:hidden}
.sk-loader-bar i{display:block;height:100%;width:100%;background:#A5282B;transform:scaleX(.04);transform-origin:left;transition:transform .35s ease}

.sk-loader-logo{display:block;width:clamp(88px,12vw,128px);height:auto;animation:sk-loader-in .7s ease both}
@keyframes sk-loader-in{from{opacity:0;transform:translateY(6px)}}
@media (prefers-reduced-motion:reduce){.sk-loader,.sk-loader-bar i{transition:none}.sk-loader-text,.sk-loader-logo{animation:none}}

/* ---- About us: its textured wash melts into the page colour below, which starts icy blue and darkens with the scroll ---- */
.home-about{--sk-fade:clamp(90px,11vw,170px);padding-bottom:var(--sk-fade)}
.home-about::after{
  content:"";position:absolute;left:0;right:0;bottom:0;height:var(--sk-fade);z-index:1;pointer-events:none;
  background:linear-gradient(to bottom,rgb(235 232 217 / 0) 0%,var(--bg) 100%);   /* var(--bg) follows the scroll effect, so the join never shows */
}
.home-about .row{border-bottom:0}

/* ---- the loupe: a real magnifier lying on the page, fixed in place at the lower right ---- */
.sk-hero .loupe{
  position:absolute;left:0;top:0;
  width:var(--lr,270px);height:var(--lr,270px);
  pointer-events:none;z-index:80;opacity:0;
  transition:opacity .25s ease;
  will-change:transform;
}
.sk-hero .loupe.on{opacity:1}
.sk-hero .loupe .ring{
  position:absolute;inset:0;border-radius:50%;
  pointer-events:none;
  padding:calc(var(--lr,270px) * .058);
  box-shadow:
    0 1px 2px rgba(58,44,26,.30),
    0 10px 18px rgba(58,44,26,.24),
    0 26px 40px rgba(58,44,26,.20),
    0 48px 66px rgba(58,44,26,.13);
}
/* the bezel is an annulus, so the glass really is see-through */
.sk-hero .loupe .ring:before{
  content:"";position:absolute;inset:0;border-radius:50%;pointer-events:none;
  background:linear-gradient(146deg,
    #fdf7e9 0%,#e6d7b4 14%,#b69d70 32%,#7d6740 50%,
    #cdbb92 66%,#f4ead3 80%,#9b8459 100%);
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,.8),
    inset 0 -2px 3px rgba(70,52,26,.5);
  -webkit-mask-image:radial-gradient(circle closest-side at 50% 50%,transparent 0 88.2%,#000 89.8% 100%);
  mask-image:radial-gradient(circle closest-side at 50% 50%,transparent 0 88.2%,#000 89.8% 100%);
}
/* the handle, drawn before the bezel so the ring covers its inner end */
.sk-hero .loupe .grip{
  position:absolute;left:50%;top:50%;
  width:calc(var(--lr,270px) * .74);height:calc(var(--lr,270px) * .125);
  transform-origin:0 50%;
  transform:rotate(40deg) translate(calc(var(--lr,270px) * .33),-50%);
  border-radius:calc(var(--lr,270px) * .06);
  pointer-events:none;
  background:
    linear-gradient(180deg,rgba(255,255,255,.46) 0 13%,rgba(255,255,255,0) 44%,
                    rgba(0,0,0,.26) 100%),
    linear-gradient(90deg,#d9bd82 0 14%,#a9884e 14% 20%,#6d4c2b 20% 62%,
                    #5a3d22 62% 92%,#7a563180 92% 100%);
  box-shadow:0 8px 15px rgba(58,44,26,.26),0 18px 26px rgba(58,44,26,.14);
}
.sk-hero .lens{
  position:relative;display:block;width:100%;height:100%;border-radius:50%;
  background-repeat:no-repeat;overflow:hidden;
  box-shadow:
    inset 0 0 0 1px rgba(52,40,22,.55),
    inset 0 4px 12px rgba(40,30,14,.28),
    inset 0 -7px 16px rgba(255,250,240,.14);
}
/* A second copy of the book, sitting beside the glass outside the tilt, and
   scaled about whichever page point the glass is currently over. */
.sk-hero .zoomwrap{
  position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:2;
  opacity:0;
}
.sk-hero .zoominner{position:absolute;inset:0;transform-origin:0 0}
.sk-hero .lens:before,.sk-hero .lens:after{content:"";position:absolute;inset:0;border-radius:50%;pointer-events:none}
.sk-hero .lens:before{z-index:1}
.sk-hero .lens:after{z-index:2}
/* the glass bends and darkens toward its rim, with a faint colour fringe */
.sk-hero .lens:before{
  background:radial-gradient(circle at 50% 50%,
    rgba(0,0,0,0) 54%,rgba(58,44,26,.10) 76%,rgba(46,34,16,.34) 100%);
  box-shadow:
    inset 0 0 0 2px rgba(130,162,196,.26),
    inset 0 0 0 4px rgba(206,158,112,.15);
}
/* the dome: one broad specular and a tight crescent opposite it */
.sk-hero .lens:after{
  background:
    radial-gradient(36% 26% at 29% 19%,rgba(255,255,255,.30),rgba(255,255,255,0) 76%),
    radial-gradient(24% 16% at 74% 86%,rgba(255,255,255,.12),rgba(255,255,255,0) 80%),
    linear-gradient(150deg,rgba(255,255,255,.06) 0 18%,rgba(255,255,255,0) 42%);
}

/* slow screens: no sideways blur on the flying pages */
.sk-hero .sb-wrap.lite.intro .sb-full img,.sk-hero .sb-wrap.lite.intro .sb-half-img{filter:none !important}
