/* The vignettes of "Kies uw vak." on /bouwsector/ (D-249, D-250): the pencil drawing, the take that develops out of it and melts into
   the paper, the motion of a trade without film. On paper; the ground is painted inside the vignette too, so the take can multiply with it
   and its sky goes into the paper, as lip.fr's photos do. Without a script, and with reduced motion, every drawing stands complete and
   every take in colour on its poster: the states below that hide something are all under .js. The lab's original is
   mockups/stroom-v4-lab/schets/vignet.css. */
.vg {
  --potlood: #3F4247; --grond: #F5F3EE;
  --shot-grijs: grayscale(1) brightness(1.32) contrast(.86); --shot-kleur: brightness(1.1) contrast(1.08) saturate(.9);
  --was: #86C6CF; --golf: #3B8C9F; --licht: #F2C66B; --stroom: #D99A2B;
  margin: 0;
}
.vg-doek { position: relative; aspect-ratio: 1000 / 600; isolation: isolate; background: var(--grond); }
.vg-schets { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; color: var(--potlood); mix-blend-mode: multiply; }
/* until the pen has hidden the strokes it will draw, the drawing waits out of sight; if the script never comes, it shows drawn */
.js .vg:not(.vg-klaar) .vg-schets { visibility: hidden; animation: vg-toon 0s 2.5s forwards; }
@keyframes vg-toon { to { visibility: visible; } }

/* the take: grey and small inside the drawing first, then it opens up and takes its colour */
.vg-shot {
  position: absolute; mix-blend-mode: multiply;
  -webkit-mask-image: var(--verf); mask-image: var(--verf); -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center; -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  transition: opacity .9s ease, -webkit-mask-size 2.2s cubic-bezier(.2, .7, .2, 1), mask-size 2.2s cubic-bezier(.2, .7, .2, 1);
}
.vg-shot video { display: block; width: 100%; height: 100%; object-fit: cover; filter: var(--shot-kleur); transition: filter 2.6s ease .3s; }
.js .vg:not(.is-shot) .vg-shot { opacity: 0; -webkit-mask-size: 56% 56%; mask-size: 56% 56%; }
.js .vg:not(.is-shot) .vg-shot video { filter: var(--shot-grijs); }

/* the heat pump: the fan behind its grille, the air it blows */
.vg-waaier path, .vg-waaier circle { fill: none; stroke: currentColor; stroke-width: 1.1; stroke-opacity: .5; vector-effect: non-scaling-stroke; }
.vg-lucht { fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linecap: round; opacity: 0; }
.vg.is-los .vg-lucht { animation: vg-lucht 2.4s ease-in-out calc(var(--i) * .8s) infinite; }
@keyframes vg-lucht { 0% { opacity: 0; transform: none; } 30% { opacity: .55; } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)); } }
/* the pool: the water's wash and its light */
.vg-was { fill: var(--was); mix-blend-mode: multiply; opacity: .62; transition: opacity 1.8s ease; }
.vg-golven polyline { fill: none; stroke: var(--golf); stroke-width: 1.3; stroke-linecap: round; stroke-dasharray: 46 34 12 58; opacity: .6; transition: opacity 1.2s ease .6s; }
.js .vg:not(.is-shot) :is(.vg-was, .vg-golven polyline) { opacity: 0; }
.vg.is-los .vg-golven polyline { animation: vg-golf calc(7s + var(--i) * 1.3s) linear infinite; }
.vg.is-los .vg-golven polyline:nth-child(even) { animation-direction: reverse; }
@keyframes vg-golf { to { stroke-dashoffset: -150; } }
/* the electrician: the lamp's light, and the current running from the board along each cable */
.vg-gloed { fill: var(--licht); mix-blend-mode: multiply; opacity: .26; transition: opacity 1.4s ease; }
.js .vg:not(.is-shot) .vg-gloed { opacity: 0; }
.vg.is-los .vg-gloed { animation: vg-gloed 2.8s ease-in-out infinite; }
@keyframes vg-gloed { 0%, 100% { opacity: .26; } 55% { opacity: .4; } }
.vg-stroom polyline { fill: none; stroke: var(--stroom); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: .05 2; stroke-dashoffset: .05; opacity: 0; }
.vg.is-los .vg-stroom polyline { opacity: 1; animation: vg-stroom 2.8s cubic-bezier(.4, 0, .6, 1) calc(var(--i) * .45s) infinite; }
@keyframes vg-stroom { 0% { stroke-dashoffset: .05; } 70%, 100% { stroke-dashoffset: -1; } }
/* the joiner's sash and the kitchen's drawer: a clean line, carried by one matrix per sample of its cycle */
.vg-vlak { transform-box: view-box; transform-origin: 0 0; }
.vg-vlak path { fill: none; stroke: currentColor; stroke-width: 1.3; stroke-opacity: .8; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.vg-vlak .fijn { stroke-width: .8; stroke-opacity: .5; }
.vg-vlak .teken { stroke-width: .8; stroke-opacity: .35; }
.vg-vlak .dik { stroke-width: 2.4; }

/* the credit, a slate's line: the record dot blinks while the take runs; a trade without film has an empty ring */
.vg-krediet { display: flex; align-items: center; gap: 9px; margin-top: 12px; font: 500 11px/1.2 var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--potlood); opacity: .62; }
.vg-krediet i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--rood); opacity: .3; }
.vg.is-los .vg-krediet i { opacity: 1; animation: vg-rec 1.6s steps(1) infinite; }
.vg:not(:has(.vg-shot)) .vg-krediet i { background: transparent; box-shadow: inset 0 0 0 1.4px currentColor; }
@keyframes vg-rec { 50% { opacity: .2; } }

/* on the phone the drawing is a third of its desktop size, so the pencil goes heavier to read the same */
@media (max-width: 760px) {
  .vg .lp-lijn { stroke-width: 2.6; }
  .vg .lp-detail { stroke-width: 2; }
  .vg .lp-fijn { stroke-width: 1.5; }
  .vg .lp-hulp { stroke-width: 1.4; }
  .vg .lp-accent { stroke-width: 3.2; }
  .vg-stroom polyline { stroke-width: 5; }
}
