/* Roosterke, de illustraties van de openbare site (Infrastructure/Site/SiteArt.cs).
   Gedeeld door de homepagina (landing.css-tokens) en de Blazor-pagina's (app.css-tokens):
   beide hebben --surface, --surface-2, --line, --ink, --ink-3, --accent en --accent-soft.

   De markup is de eindstand. landing/art.js zet .is-in op [data-art] zodra het in beeld
   komt; pas dan speelt de opbouw, één keer. De beginstand (verborgen, nog niet getekend)
   geldt alleen met JavaScript (.motion op de homepagina, .rk-js in Blazor) en zonder
   "minder beweging". Alleen transform, opacity en stroke-dashoffset bewegen.
   Vertraging: --d per onderdeel, --art-base per plaatje, --art-skip (negatief) als Blazor
   het plaatje halverwege vervangt, zodat het gewoon doorloopt. */

[data-art] {
  --art-surface: var(--surface);
  --art-sunk: var(--surface-2);
  --art-line: var(--line);
  --art-soft: color-mix(in srgb, var(--ink) 9%, transparent);
  --art-strong: color-mix(in srgb, var(--ink) 19%, transparent);
  --art-ink: var(--ink);
  --art-ink-3: var(--ink-3);
  --art-accent: var(--accent);
  --art-accent-soft: color-mix(in srgb, var(--accent) 14%, var(--surface));
  --art-ok: #1F7A4D;
  --art-ok-soft: #E6F2EB;
  --art-ok-text: #1A6440;
  --art-tile: #16181D;
  --art-ease: cubic-bezier(.2, .7, .2, 1);
  --art-spring: cubic-bezier(.3, 1.5, .5, 1);
}
:root[data-theme="donker"] [data-art] {
  --art-accent-soft: color-mix(in srgb, var(--accent) 24%, var(--surface));
  --art-ok: #4CB782;
  --art-ok-soft: #12291D;
  --art-ok-text: #7FD1A6;
  --art-tile: #0B0C0F;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="licht"]) [data-art] {
    --art-accent-soft: color-mix(in srgb, var(--accent) 24%, var(--surface));
    --art-ok: #4CB782;
    --art-ok-soft: #12291D;
    --art-ok-text: #7FD1A6;
    --art-tile: #0B0C0F;
  }
}

.art { display: block; width: 100%; height: auto; overflow: visible; font-family: inherit; }
.art text { font-family: inherit; }

/* Vlakken en lijnen */
.art-panel { fill: var(--art-surface); stroke: var(--art-line); }
.art-sunk { fill: var(--art-sunk); }
.art-rule { fill: none; stroke: var(--art-line); stroke-width: 1.5; }
.art-rule--soft { stroke-width: 1; }
.art-label { fill: var(--art-ink-3); font-size: 13px; font-weight: 650; }
.art-bar { fill: var(--art-soft); }
.art-person { fill: var(--art-strong); }
.art-person-face { fill: var(--art-surface); stroke: none; }
path.art-person-face { fill: none; stroke: var(--art-surface); stroke-width: 2.6; stroke-linecap: round; }
.art-shift { fill: var(--art-accent-soft); stroke: color-mix(in srgb, var(--art-accent) 30%, transparent); }
.art-shift--alt { fill: var(--art-sunk); stroke: var(--art-line); }
.art-shift-bar { fill: var(--art-accent); }
.art-shift-bar--alt { fill: var(--art-strong); }
.art-open { fill: none; stroke: var(--art-accent); stroke-width: 1.5; stroke-dasharray: 5 4; }
.art-dot { fill: var(--art-accent); }
.art-ring { fill: none; stroke: var(--art-accent); stroke-width: 1.5; }
.art-arrow { fill: none; stroke: var(--art-ink-3); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.art-shield { fill: var(--art-ok-soft); stroke: var(--art-ok); stroke-width: 1.4; stroke-linejoin: round; }
.art-check-line { fill: none; stroke: var(--art-ok); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.art-ok { fill: var(--art-ok); }
.art-ok-check { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.art-ok-soft { fill: var(--art-ok-soft); }
.art-ok-text { fill: var(--art-ok-text); font-size: 13px; font-weight: 700; }
.art-accent { fill: var(--art-accent); }
.art-on-accent { fill: #fff; font-size: 13px; font-weight: 700; }
.art-badge { fill: var(--art-surface); stroke: var(--art-accent); stroke-width: 1.4; }
.art-cross { fill: none; stroke: var(--art-accent); stroke-width: 1.8; stroke-linecap: round; }
.art-wire { fill: none; stroke: var(--art-strong); stroke-width: 1.5; }
.art-joint { fill: var(--art-strong); }
.art-travel { fill: none; stroke: var(--art-accent); stroke-width: 2.4; stroke-linecap: round; }
.art-node { fill: var(--art-surface); stroke: var(--art-line); }
.art-node-text { fill: var(--art-ink); font-size: 14px; font-weight: 650; }
.art-tile { fill: var(--art-tile); stroke: var(--art-line); }
.art-tile-text { fill: #F6F4F0; font-weight: 750; letter-spacing: -.01em; }

/* Koppelingen: breed naast elkaar, op de telefoon onder elkaar. */
.art-hub__narrow { display: none; }
@media (max-width: 640px) {
  .art-hub__wide { display: none; }
  .art-hub__narrow { display: block; max-width: 420px; margin-inline: auto; }
}

/* Draaiende onderdelen schalen en schuiven vanuit hun eigen midden. */
[data-art] :is(.a-pop, .a-slide, .a-rise, .a-move, .a-swap-up, .a-swap-down) { transform-box: fill-box; transform-origin: center; }
[data-art] .a-grow { transform-box: fill-box; transform-origin: left center; }
[data-art] .a-draw { stroke-dasharray: 100; }

@media (prefers-reduced-motion: no-preference) {
  /* Beginstand, tot het plaatje in beeld komt. */
  :is(.motion, .rk-js) [data-art]:not(.is-in):not(.is-done) :is(.a-pop, .a-fade, .a-rise, .a-slide) { opacity: 0; }
  :is(.motion, .rk-js) [data-art]:not(.is-in):not(.is-done) .a-grow { transform: scaleX(0); }
  :is(.motion, .rk-js) [data-art]:not(.is-in):not(.is-done) .a-draw { stroke-dashoffset: 100; }
  :is(.motion, .rk-js) [data-art]:not(.is-in):not(.is-done) :is(.a-out, .a-dim) { opacity: 1; }
  :is(.motion, .rk-js) [data-art]:not(.is-in):not(.is-done) .a-move { transform: translate(var(--fx, 0px), var(--fy, 0px)); }
  :is(.motion, .rk-js) [data-art]:not(.is-in):not(.is-done) :is(.a-swap-up, .a-swap-down) { transform: translateX(var(--fx, 0px)); }

  /* De opbouw. */
  [data-art].is-in :is(.a-pop, .a-fade, .a-rise, .a-slide, .a-grow, .a-draw, .a-out, .a-dim, .a-ping, .a-travel, .a-move, .a-swap-up, .a-swap-down, .a-refill, .a-unfill) {
    animation-duration: var(--t, .6s);
    animation-timing-function: var(--art-ease);
    animation-fill-mode: both;
    animation-delay: calc(var(--art-base, .2s) + var(--d, 0s) + var(--art-skip, 0s));
  }
  [data-art].is-in .a-pop { animation-name: art-pop; animation-timing-function: var(--art-spring); --t: .5s; }
  [data-art].is-in .a-fade { animation-name: art-fade; --t: .5s; }
  [data-art].is-in .a-rise { animation-name: art-rise; }
  [data-art].is-in .a-slide { animation-name: art-slide; --t: .55s; }
  [data-art].is-in .a-grow { animation-name: art-grow; --t: .7s; }
  [data-art].is-in .a-draw { animation-name: art-draw; --t: .7s; }
  [data-art].is-in .a-out { animation-name: art-out; --t: .35s; }
  [data-art].is-in .a-dim { animation-name: art-dim; --t: .5s; }
  [data-art].is-in .a-ping { animation-name: art-ping; animation-timing-function: ease-out; animation-iteration-count: 2; animation-fill-mode: none; --t: 1.1s; }
  [data-art].is-in .a-travel { animation-name: art-travel; animation-timing-function: cubic-bezier(.45, 0, .55, 1); animation-fill-mode: none; --t: .9s; }
  [data-art].is-in .a-move { animation-name: art-move; animation-timing-function: cubic-bezier(.6, 0, .25, 1); --t: .75s; }
  [data-art].is-in .a-swap-up { animation-name: art-swap-up; animation-timing-function: cubic-bezier(.6, 0, .3, 1); --t: .8s; }
  [data-art].is-in .a-swap-down { animation-name: art-swap-down; animation-timing-function: cubic-bezier(.6, 0, .3, 1); --t: .8s; }
  /* Invallen: de dienst wordt open (gestippeld), schuift naar een collega en vult zich weer. */
  [data-art].is-in .a-refill { animation-name: art-refill; animation-timing-function: linear; --t: 1.6s; }
  [data-art].is-in .a-unfill { animation-name: art-unfill; animation-timing-function: linear; --t: 1.6s; }
}

@keyframes art-pop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
@keyframes art-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes art-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes art-slide { from { opacity: 0; transform: translate(var(--fx, 0px), var(--fy, -10px)); } to { opacity: 1; transform: none; } }
@keyframes art-grow { from { transform: scaleX(0); } to { transform: none; } }
@keyframes art-draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes art-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes art-dim { from { opacity: 1; } to { opacity: .4; } }
@keyframes art-ping { from { opacity: .7; transform: scale(.6); } to { opacity: 0; transform: scale(1.9); } }
@keyframes art-travel { from { stroke-dashoffset: 10; } to { stroke-dashoffset: -100; } }
@keyframes art-move { from { transform: translate(var(--fx, 0px), var(--fy, 0px)); } to { transform: none; } }
@keyframes art-swap-up { 0% { transform: translateX(var(--fx, 0px)); } 50% { transform: translate(calc(var(--fx, 0px) / 2), -14px); } 100% { transform: none; } }
@keyframes art-swap-down { 0% { transform: translateX(var(--fx, 0px)); } 50% { transform: translate(calc(var(--fx, 0px) / 2), 14px); } 100% { transform: none; } }
@keyframes art-refill { 0% { opacity: 1; } 18%, 82% { opacity: 0; } 100% { opacity: 1; } }
@keyframes art-unfill { 0% { opacity: 0; } 18%, 82% { opacity: 1; } 100% { opacity: 0; } }

/* Ping vanuit het eigen midden. */
[data-art] .a-ping { transform-box: fill-box; transform-origin: center; }

@media (prefers-reduced-motion: reduce) {
  [data-art] * { animation: none !important; }
}

@media print {
  [data-art] * { animation: none !important; }
  [data-art] :is(.a-pop, .a-fade, .a-rise, .a-slide) { opacity: 1 !important; }
  [data-art] :is(.a-grow, .a-move, .a-swap-up, .a-swap-down) { transform: none !important; }
  [data-art] .a-draw { stroke-dashoffset: 0 !important; }
}
