/* ===== First-visit loader: a pencil test on a pegbar ===== */
html.kb-loading{overflow:hidden}
html.kb-loading body > :not(.kb-loader){opacity:0}
html.kb-revealing body > :not(.kb-loader){opacity:1;transition:opacity .7s ease .25s}

.kb-loader{position:fixed;inset:0;z-index:1000;perspective:1800px;perspective-origin:50% 0;cursor:pointer;
  --lp:#f3ecdf;--li:#1d1b26;--lr:#e2453c;--lb:#2f6fe4;color:var(--li);font-family:"Bricolage Grotesque",system-ui,sans-serif}

/* the paper stack */
.kb-sheet{position:absolute;inset:0;transform-origin:50% 0;background:
  repeating-linear-gradient(0deg,transparent 0 31px,#2f6fe414 31px 32px),var(--lp);
  box-shadow:0 1px 0 #0000000d,0 18px 40px -20px #0006;backface-visibility:hidden}
.kb-sheet.s3{transform:translateY(10px) rotate(-.5deg);filter:brightness(.94)}
.kb-sheet.s2{transform:translateY(5px) rotate(.4deg);filter:brightness(.97)}
.kb-sheet::after{content:"";position:absolute;inset:0;background:linear-gradient(180deg,#0000 30%,#0004);opacity:0;pointer-events:none}

/* registration crosses in the corners */
.kb-reg{position:absolute;width:22px;height:22px;opacity:.35}
.kb-reg::before,.kb-reg::after{content:"";position:absolute;background:var(--li)}
.kb-reg::before{left:10px;top:0;width:2px;height:22px}
.kb-reg::after{top:10px;left:0;height:2px;width:22px}
.kb-reg.tl{left:28px;top:56px}.kb-reg.tr{right:28px;top:56px}.kb-reg.bl{left:28px;bottom:28px}.kb-reg.br{right:28px;bottom:28px}

/* centre stage */
.kb-stage{position:absolute;inset:0;display:grid;place-content:center;justify-items:center;gap:18px;padding:0 16px;text-align:center}
/* name → kb: the name appears, collapses to K + B, which hand over to the drawn mark */
.ld-wrap{position:relative;display:flex;justify-content:center}
.kb-name{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);white-space:nowrap;font-family:"Bricolage Grotesque",system-ui,sans-serif;font-weight:800;font-size:clamp(40px,7.4vw,104px);letter-spacing:-.04em;line-height:1;color:var(--li);pointer-events:none}
/* the name in the logo's own lettering: same monoline stroke, round caps, ink + red b */
.kb-name2{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);pointer-events:none}
.kb-glyph{position:absolute;overflow:visible;backface-visibility:hidden}
.kb-glyph path{fill:none;stroke:var(--li);stroke-width:10;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1;stroke-dashoffset:1;opacity:0}
.kb-glyph.keyb path{stroke:var(--lr)}
.kb-glyph.key{will-change:transform}  /* own GPU layer: the glide never waits on the main thread */
/* all motion is driven by loader.js (Web Animations) so the write-on, dissolve and glide share one clock */
.kb-name .ch{display:inline-block;transform-origin:50% 60%;will-change:transform,opacity,filter}
.kb-name .sp{display:inline-block;width:.28em}
.kb-name .b{color:var(--lr)}
.kb-stage .ld-mark{display:block;height:clamp(110px,24vh,210px);--kb-ink:var(--li);--kb-b:var(--lr)}
.kb-ground{width:clamp(140px,22vw,240px);height:3px;border-radius:3px;background:var(--li);opacity:.85;margin-top:-6px}
.kb-cap{font-family:"Gochi Hand",cursive;font-size:clamp(20px,2.4vw,26px);color:var(--lr);min-height:1.4em;transition:opacity .2s}
.kb-cap.swap{opacity:0}
.kb-cap.action{font-size:clamp(30px,4vw,44px);color:var(--li)}

/* dope-sheet progress strip */
.kb-strip{display:flex;gap:4px;align-items:flex-end;height:22px}
.kb-strip i{width:6px;height:10px;border-radius:2px;background:#1d1b2626;transition:background .2s,height .2s}
.kb-strip i:nth-child(6n+1){height:16px}
.kb-strip i.on{background:var(--li)}
.kb-strip i.head{background:var(--lr);height:20px}
.kb-count{font-family:"Bricolage Grotesque",system-ui,sans-serif;font-size:12px;letter-spacing:.08em;text-transform:uppercase;opacity:.75}
.kb-count b{color:var(--lr);font-weight:600}

.kb-foot{position:absolute;left:62px;right:62px;bottom:24px;display:flex;justify-content:space-between;gap:16px;font-family:"Bricolage Grotesque",system-ui,sans-serif;font-size:11px;letter-spacing:.1em;text-transform:uppercase;opacity:.6}
.kb-skip{position:absolute;right:62px;top:52px;font-family:"Bricolage Grotesque",system-ui,sans-serif;font-size:11px;letter-spacing:.08em;text-transform:uppercase;opacity:.45;background:none;border:0;color:inherit;cursor:pointer;padding:6px}
.kb-skip:hover{opacity:1}

/* exit: the b glides to the top-left logo spot; the paper dissolves into the site */
html.kb-loading .top .logo{visibility:hidden} /* the real logo appears exactly when the flying one lands */
.kb-loader.out{pointer-events:none;cursor:default}
.kb-loader.out .kb-sheet{transition:opacity .75s ease .15s;opacity:0}
.kb-loader.out .kb-stage>*:not(.ld-mark),.kb-loader.out .kb-foot,.kb-loader.out .kb-skip,.kb-loader.out .kb-reg{transition:opacity .3s ease;opacity:0}
.kb-fly{position:fixed;z-index:2;transform-origin:0 0;transition:transform .95s cubic-bezier(.65,0,.25,1);will-change:transform}
.kb-fly svg{display:block;height:100%;width:auto}
.kb-fly .kb-mark *{transition:stroke .9s ease,fill .9s ease}

@media (max-width:600px){
  .kb-foot{left:20px;right:20px;flex-direction:column;align-items:center;gap:4px}
  .kb-skip{right:12px;top:40px}
  .kb-reg{display:none}
  .kb-strip{gap:3px}.kb-strip i{width:5px}
}
