/* =====================================================================
   AltGent_ page loader — the logo gets "printed"
   - full intro on first arrival (from outside the site)
   - shorter version when moving between our own pages
   Markup + behaviour: loader.js (included right after <body>).
   Only shows when loader.js adds .ldOn to <html>, so without JS
   or with reduced motion the page is never covered.
   ===================================================================== */
.loader{display:none}
.ldOn .loader{position:fixed;inset:0;z-index:9999;display:grid;place-items:center;
  background:var(--paper,#f4f1ea);clip-path:inset(0 0 0 0);pointer-events:auto}
.ldOn .loader.done{display:none}

/* faint grid, like the HUD panels */
.loader::before{content:"";position:absolute;inset:0;opacity:.5;pointer-events:none;
  background-image:linear-gradient(var(--line,#dcd8cd) 1px,transparent 1px),linear-gradient(90deg,var(--line,#dcd8cd) 1px,transparent 1px);
  background-size:48px 48px;
  -webkit-mask:radial-gradient(ellipse at center,#000 0,transparent 70%);mask:radial-gradient(ellipse at center,#000 0,transparent 70%)}

/* HUD corners + labels */
.ldCorner{position:absolute;width:14px;height:14px;border:solid var(--green-deep,#5f7e3f)}
.ldCorner.tl{top:28px;left:28px;border-width:1.5px 0 0 1.5px}
.ldCorner.tr{top:28px;right:28px;border-width:1.5px 1.5px 0 0}
.ldCorner.bl{bottom:28px;left:28px;border-width:0 0 1.5px 1.5px}
.ldCorner.br{bottom:28px;right:28px;border-width:0 1.5px 1.5px 0}
.ldHud{position:absolute;font-family:"Space Mono",monospace;font-size:10px;letter-spacing:.16em;text-transform:uppercase;color:var(--mist,#8d8a80);white-space:nowrap}
.ldHud.tl{top:36px;left:52px;color:var(--green-deep,#5f7e3f)}
.ldHud.tr{top:36px;right:52px}
.ldHud.bl{bottom:36px;left:52px}
.ldHud.br{bottom:36px;right:52px;color:var(--ink,#211f1b);font-variant-numeric:tabular-nums}

/* logo stage: outline (toolpath) + fill printed bottom→top in layers */
.ldLogo{position:relative;width:min(52vw,340px);aspect-ratio:780.35/237.81}
.ldLogo svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}
.ldOutline *{fill:none;stroke:var(--ink,#211f1b);stroke-width:3.2;stroke-linejoin:miter}
.ldFillWrap{position:absolute;inset:0;clip-path:inset(100% 0 0 0)}
.ldFill *{fill:var(--ink,#211f1b)}
.ldBar{position:absolute;left:0;right:0;bottom:-26px;height:1px;background:var(--line,#dcd8cd);overflow:hidden}
.ldBar i{position:absolute;inset:0;background:var(--green-deep,#5f7e3f);transform-origin:left;transform:scaleX(0)}

/* ---------- FULL intro (first arrival) ---------- */
.loader.full.run .ldOutline > *{animation:ldDraw .95s cubic-bezier(.6,.05,.3,1) forwards;animation-delay:calc(var(--i) * .09s)}
.loader.full.run .ldFillWrap{animation:ldPrint .85s steps(14,end) 1.05s forwards}
.loader.full.run .ldBar i{animation:ldBar 1.9s cubic-bezier(.4,0,.2,1) forwards}
.loader.full.run .ldOutline{animation:ldFade .3s ease 1.8s forwards}
.loader.full.run .ldLogo{animation:ldGlitch .38s steps(1,end) 1.95s 1}

/* ---------- FAST (between our own pages) — outline + 7 layers ---------- */
.loader.fast.run .ldOutline > *{animation:ldDraw .45s cubic-bezier(.6,.05,.3,1) forwards;animation-delay:calc(.05s + var(--i) * .045s)}
.loader.fast.run .ldFillWrap{animation:ldPrint .3s steps(7,end) .6s forwards}
.loader.fast.run .ldBar i{animation:ldBar .9s cubic-bezier(.4,0,.2,1) forwards}
.loader.fast.run .ldOutline{animation:ldFade .15s ease .85s forwards}

/* reveal the page (wipe upward) */
.ldOn .loader.out{animation:ldOut .6s cubic-bezier(.7,0,.2,1) forwards;pointer-events:none}
.ldOn .loader.fast.out{animation-duration:.45s}

/* cover the page when leaving via an internal link (the next page draws the logo) */
.ldOn .loader.cover{animation:ldIn .32s cubic-bezier(.7,0,.2,1) forwards}
.loader.cover .ldLogo{visibility:hidden}

@keyframes ldDraw{to{stroke-dashoffset:0}}
@keyframes ldPrint{to{clip-path:inset(0 0 0 0)}}
@keyframes ldBar{to{transform:scaleX(1)}}
@keyframes ldFade{to{opacity:0}}
@keyframes ldIn{from{clip-path:inset(100% 0 0 0)}to{clip-path:inset(0 0 0 0)}}
@keyframes ldOut{from{clip-path:inset(0 0 0 0)}to{clip-path:inset(0 0 100% 0)}}
@keyframes ldGlitch{
  0%{transform:translate(0,0) skewX(0);filter:none}
  12%{transform:translate(-2px,1px) skewX(-2deg);filter:drop-shadow(2px 0 0 #e0483d) drop-shadow(-2px 0 0 var(--green,#7fa05a))}
  28%{transform:translate(2px,-1px) skewX(2deg);filter:drop-shadow(-3px 0 0 #e0483d) drop-shadow(3px 0 0 var(--green,#7fa05a))}
  44%{transform:translate(-1px,0) skewX(0);filter:drop-shadow(2px 0 0 #e0483d) drop-shadow(-2px 0 0 var(--green,#7fa05a))}
  60%{transform:translate(1px,-1px) skewX(-1deg);filter:drop-shadow(-1px 0 0 #e0483d) drop-shadow(2px 0 0 var(--green,#7fa05a))}
  78%{transform:translate(0,1px) skewX(0);filter:drop-shadow(1px 0 0 #e0483d) drop-shadow(-1px 0 0 var(--green,#7fa05a))}
  100%{transform:translate(0,0) skewX(0);filter:none}
}

/* small screens: tighter HUD, drop the two secondary labels */
@media(max-width:600px){
  .ldCorner.tl,.ldCorner.tr{top:18px}.ldCorner.bl,.ldCorner.br{bottom:18px}
  .ldCorner.tl,.ldCorner.bl{left:18px}.ldCorner.tr,.ldCorner.br{right:18px}
  .ldHud.tl{top:25px;left:40px}.ldHud.br{bottom:25px;right:40px}
  .ldHud.tr,.ldHud.bl{display:none}
  .ldLogo{width:min(62vw,260px)}
}
