/* ---- Intro curtain (every page, once per visit) ----
   A black sheet over the page while it loads: "Jan Zugic" is lettered in the
   middle, a steel hairline along the bottom fills with real loading, then the sheet fades away
   and the page rises in. Shown only while <html> has .intro-on, which
   intro-head.js sets in each page's <head> (once per visit, never under
   reduced motion), then .intro-leaving while it fades. Without JS the
   classes never appear and nothing blocks. */

.intro { display: none; }

/* Scroll stays locked through the exit fade too. */
html.intro-on,
html.intro-on body,
html.intro-leaving,
html.intro-leaving body { overflow: hidden; }
html.intro-on .intro,
html.intro-leaving .intro { display: grid; }
.intro {
  position: fixed;
  inset: 0;
  z-index: 1000;
  place-items: center;
  background: var(--paper);
  color: var(--ink);
  transition: opacity 0.9s ease-in-out;
}
/* The sheet's lower edge: one steel hairline that fills with loading. */
.intro::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(var(--intro-p, 0));
  transform-origin: left;
}

/* Hold the hero's own entrance until the sheet lifts. */
html.intro-on .hero > * { animation-play-state: paused; }
/* Sections already on screen rise in during the fade, not unseen behind the sheet. */
html.intro-on .reveal.in { opacity: 0; transform: translateY(18px); }

/* Opened in a background tab: hold everything until it is looked at. */
html.intro-wait .intro * { animation-play-state: paused; }

.intro-drawing {
  width: min(84vw, 1100px);
  height: auto;
  overflow: visible;
}

/* Every line is drawn by a hot steel pen and cools to ink once it lands,
   like the hero blueprint. --d staggers the strokes in drafting order. */
.intro .ln {
  fill: none;
  stroke: var(--accent);
  stroke-width: 0.2;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  animation:
    intro-draw 0.9s cubic-bezier(0.6, 0, 0.3, 1) var(--d) forwards,
    intro-cool 0.9s ease calc(var(--d) + 0.6s) forwards;
}
/* Drawing strokes are in viewBox units; intro.js sets --sw and --sw-pen so
   they stay about 1.5 px and 2 px wide whatever size the drawing is. */
.intro-drawing .ln { stroke-width: var(--sw, 0.2); }
.intro .ln--axis { --ink-to: var(--ink-soft); opacity: 0.55; }
/* The lettering: each pen stroke at constant pen speed (--t from its length). */
.intro .ln--engrave {
  stroke-width: var(--sw-pen, 0.26);
  stroke-linecap: round;
  stroke-linejoin: round;
  animation:
    intro-draw var(--t) linear var(--d) forwards,
    intro-cool 0.9s ease calc(var(--d) + var(--t) + 0.2s) forwards;
}
@keyframes intro-draw { to { stroke-dashoffset: 0; } }
@keyframes intro-cool { to { stroke: var(--ink-to, var(--ink)); } }
@keyframes intro-fade { to { opacity: 1; } }

/* Sheet frame and corner tags, as on a drawing. */
.intro-frame {
  position: absolute;
  inset: clamp(10px, 2vw, 22px);
  width: calc(100% - 2 * clamp(10px, 2vw, 22px));
  height: calc(100% - 2 * clamp(10px, 2vw, 22px));
  overflow: visible;
  opacity: 0.35;
}
.intro-frame .ln { stroke-width: 1; animation-duration: 1.4s, 0.9s; }
.intro-tag {
  position: absolute;
  top: clamp(24px, 4vw, 48px);
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-soft);
  opacity: 0;
  animation: intro-fade 0.6s ease 0.5s forwards;
}
.intro-tag--tl { left: clamp(28px, 4.5vw, 52px); }
.intro-tag--tr { right: clamp(28px, 4.5vw, 52px); }

.intro-meta {
  position: absolute;
  left: clamp(28px, 4.5vw, 52px);
  right: clamp(28px, 4.5vw, 52px);
  bottom: clamp(24px, 4vw, 44px);
}
.intro-label {
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-soft);
}

/* The page waits hidden under the sheet, so the exit can crossfade. */
html.intro-on body > :not(.intro),
html.intro-on body::before { opacity: 0; }

/* Exit, a crossfade: the sheet drops its paper (the page behind is the
   same colour and still hidden, so nothing changes yet), then the
   drawing fades out while the page fades in on the same curve; halfway,
   both show at half strength. */
html.intro-leaving .intro { opacity: 0; background: transparent; }
html.intro-leaving body > :not(.intro),
html.intro-leaving body::before { transition: opacity 0.9s ease-in-out; }
