/* Line art draw · Scroll Story Kit
   Static (no JS, reduced motion): copy beside the finished, coloured illustration.
   Motion: the section pins for --sk-lineart-len of scroll; each stroke of the SVG draws on in turn
   (pathLength="1" plus stroke-dashoffset, ordered by --i), then the fills fade in under the lines.
   The three stage notes on the left follow the drawing (core steps). */
.sk-lineart {
  --sk-lineart-len: 280vh;
  --sk-lineart-gap: .05;    /* progress between one stroke starting and the next */
  --sk-lineart-dur: .16;    /* progress each stroke takes to draw */
  --sk-lineart-fill: .62;   /* progress where the fills start to fade in */
}
.sk-lineart-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
.sk-lineart-stages { display: grid; gap: 4px; margin: 32px 0 0; padding: 0; list-style: none; counter-reset: sk-lineart; }
.sk-lineart-stage { counter-increment: sk-lineart; display: grid; grid-template-columns: auto 1fr; column-gap: 14px; padding: 12px 0; border-top: 1px solid var(--sk-line); }
.sk-lineart-stage::before { content: counter(sk-lineart, decimal-leading-zero); grid-row: span 2; padding-top: 3px; font: 700 var(--sk-size-small)/1.2 var(--sk-font-mono); color: var(--sk-accent-text); }
.sk-lineart-stage strong { font-size: 1.0625rem; }
.sk-lineart-stage span { color: var(--sk-ink-2); font-size: .96875rem; }
.sk-lineart-art { margin: 0; }
.sk-lineart-art svg { display: block; width: 100%; height: auto; border-radius: var(--sk-radius); box-shadow: var(--sk-shadow); }

:root.sk-on .sk-lineart { height: var(--sk-lineart-len); padding: 0; }
:root.sk-on .sk-lineart-pin { position: sticky; top: 0; height: 100vh; height: 100svh; display: grid; align-items: center; padding: 0 var(--sk-gutter); }
:root.sk-on .sk-lineart-grid { width: 100%; }
:root.sk-on .sk-lineart-stroke {
  --t: clamp(0, (var(--sk-p) - var(--i) * var(--sk-lineart-gap)) / var(--sk-lineart-dur), 1);
  stroke-dasharray: 1 2;
  stroke-dashoffset: calc(1 - var(--t));
  opacity: clamp(0, var(--t) * 40, 1);
}
:root.sk-on .sk-lineart-fills { opacity: clamp(0, (var(--sk-p) - var(--sk-lineart-fill)) / .14, 1); }
:root.sk-on .sk-lineart-lines { stroke-width: calc(4.5px + (1 - clamp(0, (var(--sk-p) - var(--sk-lineart-fill)) / .14, 1)) * 1px); }

/* stage notes: done stages keep their colour, the current one gets the accent rule, later ones wait quietly */
:root.sk-on .sk-lineart-stage { --on: 0; position: relative; opacity: calc(.5 + .5 * var(--on)); transition: opacity var(--sk-step) var(--sk-ease); }
:root.sk-on .sk-lineart-stage::after { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: var(--sk-accent); transform-origin: 0 50%; transform: scaleX(var(--cur, 0)); transition: transform var(--sk-step) var(--sk-ease); }
:root.sk-on .sk-lineart:not([data-sk-step]) .sk-lineart-stage:nth-child(1),
:root.sk-on .sk-lineart[data-sk-step="0"] .sk-lineart-stage:nth-child(1),
:root.sk-on .sk-lineart[data-sk-step="1"] .sk-lineart-stage:nth-child(-n + 2),
:root.sk-on .sk-lineart[data-sk-step="2"] .sk-lineart-stage { --on: 1; }
:root.sk-on .sk-lineart:not([data-sk-step]) .sk-lineart-stage:nth-child(1),
:root.sk-on .sk-lineart[data-sk-step="0"] .sk-lineart-stage:nth-child(1),
:root.sk-on .sk-lineart[data-sk-step="1"] .sk-lineart-stage:nth-child(2),
:root.sk-on .sk-lineart[data-sk-step="2"] .sk-lineart-stage:nth-child(3) { --cur: 1; }

@media (max-width: 760px) {
  .sk-lineart-grid { grid-template-columns: 1fr; }
  .sk-lineart-art { grid-row: 1; }
  :root.sk-on .sk-lineart-pin { align-items: start; padding-top: 20px; }
  :root.sk-on .sk-lineart-grid { gap: 18px; }
  :root.sk-on .sk-lineart-art svg { width: auto; max-width: 100%; height: min(34svh, 72vw); margin: 0 auto; }
  :root.sk-on .sk-lineart-copy .sk-kicker { display: none; }
  :root.sk-on .sk-lineart-copy .sk-h2 { font-size: clamp(1.6rem, 1rem + 3vw, 2.2rem); }
  :root.sk-on .sk-lineart-copy .sk-lead { margin-top: 10px; font-size: 1rem; }
  :root.sk-on .sk-lineart-stages { margin-top: 14px; }
  :root.sk-on .sk-lineart-stage { padding: 8px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .sk-lineart-stage, .sk-lineart-stage::after { transition: none !important; }
}
