/* --------------------------------------------------------------------------
   Load-in curtain (Nov 2026, Christian): a light copper page over the site
   while it loads. The flat H in the middle fills from the bottom with the
   real loading progress (js/curtain.js), then the copper fades away and the
   flat H hands over to the spinning 3D H in exactly the same place.

   Only shown when the inline script in <head> adds html.curtain-on, so no-JS
   visitors and ?noanim never see it. aria-hidden; the page underneath is
   never hidden from screen readers.
   -------------------------------------------------------------------------- */

.curtain { display: none; }

html.curtain-on .curtain {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 100;                       /* above the top bar (40) and the mark (41) */
}
html.curtain-lift .curtain { pointer-events: none; }

/* The light end of the brand copper gradient (assets/logos/hexagon-icon-copper.svg,
   favicon.svg: #b2713d -> #cca280) */
.curtain-bg {
  position: absolute;
  inset: 0;
  height: 100vh;
  height: 100lvh;                     /* reach under iOS Safari's toolbar */
  background: #cca280;
  transition: opacity .9s cubic-bezier(.4, 0, .2, 1);
}
html.curtain-lift .curtain-bg { opacity: 0; }

/* Same box as .hero-mark.has-3d (css/v2.css) so the handoff lines up. The
   viewBox is 580 wide, not 576: the 3D H's silhouette at rest fills 79.4%
   of its canvas (camera fov 32 at 1050, js/logo3d.js), the brand polygon
   79.4% of 580. */
.curtain-mark {
  position: fixed;
  left: 50%;
  top: 50%;
  width: clamp(72px, 9vw, 120px);
  height: clamp(72px, 9vw, 120px);
  transform: translate(-50%, -50%);
  display: block;
  overflow: visible;
  transition: opacity .6s ease;
}
.curtain-h-empty { fill: #b2713d; }   /* brand copper: the empty vessel */
.curtain-h-full { fill: #f3f1ea; }    /* paper, the white of the 3D H */

/* No 3D handoff (no WebGL, reduced motion, page already scrolled): the flat
   H simply fades out with the copper */
html.curtain-lift .curtain-mark { opacity: 0; }
/* 3D handoff: the spinning H fades up UNDER the identical flat H first,
   then the flat one goes, so the swap is invisible */
html.curtain-morph .curtain-mark { transition: opacity .35s ease .5s; }
html.curtain-on .hero-mark { transition: opacity .45s ease; }

/* While it is up the page can't scroll (at most ~6s, js/curtain.js). The
   gutter is kept so the scrollbar arriving afterwards doesn't shift the
   centred H; it shows the copper meanwhile. */
html.curtain-on:not(.curtain-lift),
html.curtain-on:not(.curtain-lift) body { overflow: hidden; }
html.curtain-on {
  scrollbar-gutter: stable;
  background-color: #cca280 !important;   /* setTone() writes an inline colour */
}

/* Reduced motion: no rising fill and no morph, just a short fade */
@media (prefers-reduced-motion: reduce) {
  .curtain-h-full { clip-path: none; }
  .curtain-bg, .curtain-mark,
  html.curtain-morph .curtain-mark { transition: opacity .4s ease; }
}
