/* Visual kit (Task #1896): takeaway, steps, side-by-side, live stat, figure,
   annotated figure. Markup comes from src/_lib/visual-kit.js, motion from
   js/visual-kit.js. Only these blocks ever animate, never body text.
   Motion is transform + opacity only, so it cannot shift layout (CLS). */

/* ---- Scroll reveal --------------------------------------------------------
   Chrome and Safari 26 do this with no JavaScript (a view() timeline). Other
   browsers get the same effect from js/visual-kit.js, which only hides blocks
   that start below the fold. With reduced motion, or no JS, blocks just show. */
@keyframes vk-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    [data-vk-reveal] { animation: vk-rise linear both; animation-timeline: view(); animation-range: entry 4% entry 38%; }
  }
  .vk-io [data-vk-reveal]:not(.is-in) { opacity: 0; transform: translateY(14px); }
  .vk-io [data-vk-reveal] { transition: opacity .5s ease, transform .5s ease; }
  .vk-io [data-vk-reveal].is-in { opacity: 1; transform: none; }
}
@media print { [data-vk-reveal] { opacity: 1 !important; transform: none !important; animation: none !important; } }

.vk-eyebrow, .vk-takeaway-label, .vk-stats-label {
  margin: 0; font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
}
.vk-takeaway-label { color: var(--accent-text); }

/* ---- Key takeaway ---------------------------------------------------------- */
.vk-takeaway {
  margin: 32px 0; padding: 18px 22px 18px 24px; max-width: 40em;
  border-radius: 18px; border: 1px solid color-mix(in oklch, var(--accent) 22%, transparent);
  border-left: 5px solid var(--accent);
  background: color-mix(in oklch, var(--accent) 8%, var(--bg));
}
.vk-takeaway-label { margin-bottom: 6px; }
.vk-takeaway-body p { margin: 0; font-family: var(--serif); font-size: 19px; line-height: 1.5; color: var(--ink); font-weight: 500; }
.vk-takeaway-body p + p { margin-top: 10px; }

/* ---- Step sequence --------------------------------------------------------- */
.vk-steps { list-style: none; counter-reset: vk; margin: 32px 0; padding: 0; display: flex; flex-direction: column; gap: 0; max-width: 40em; }
.vk-step {
  counter-increment: vk; position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px;
  padding: 0 0 28px 52px; min-width: 0;
}
.vk-step::before {
  content: counter(vk); position: absolute; left: 0; top: 0; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--sans); font-weight: 800; font-size: 16px;
  color: #fff; background: var(--accent);
}
.vk-step::after { content: ""; position: absolute; left: 17px; top: 44px; bottom: 6px; width: 2px; background: var(--hairline); }
.vk-step:last-child { padding-bottom: 0; }
.vk-step:last-child::after { display: none; }
.vk-step-media { width: clamp(160px, 42vw, 240px); }
.vk-step-title { margin: 6px 0 4px; font-family: var(--sans); font-weight: 700; font-size: 17px; color: var(--ink); }
.vk-step-text p { margin: 0; font-family: var(--serif); font-size: 17px; line-height: 1.55; color: var(--ink); }
.vk-step-text p + p { margin-top: 8px; }
@media (min-width: 640px) {
  .vk-step:has(.vk-step-media) { grid-template-columns: 200px minmax(0, 1fr); gap: 8px 22px; align-items: center; }
  .vk-step-media { width: 200px; }
}

/* ---- Illustration figure --------------------------------------------------- */
.vk-art { display: block; height: auto; max-width: 100%; border-radius: 18px; background: #f4f1fd; }
.vk-art--persona { width: 100%; max-width: 256px; }
.vk-art--card { width: 100%; max-width: 320px; }
.vk-art--wide { width: 100%; max-width: 600px; }
.vk-figure { margin: 32px 0; max-width: 40em; }
.vk-figure figcaption { margin-top: 10px; font-size: 14px; line-height: 1.45; color: var(--muted); max-width: 600px; }
.vk-ph {
  display: grid; place-items: center; aspect-ratio: 3 / 2; width: 100%; max-width: 320px; border-radius: 18px;
  border: 2px dashed var(--hairline); color: var(--faint); font-size: 14px;
}

/* ---- Side by side ---------------------------------------------------------- */
.vk-sbs { margin: 32px 0; max-width: 40em; }
.vk-sbs > .vk-eyebrow { margin-bottom: 10px; }
.vk-sbs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; position: relative; }
.vk-side { padding: 20px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.vk-side-art { max-width: 160px; margin-bottom: 4px; }
.vk-side-name { margin: 0; font-family: var(--sans); font-weight: 700; font-size: 16px; color: var(--ink); }
.vk-side-fig { margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.vk-side-big { font-family: var(--sans); font-weight: 800; font-size: 34px; letter-spacing: -.03em; line-height: 1.05; color: var(--ink); overflow-wrap: anywhere; }
.vk-side-cap { font-size: 14px; color: var(--muted); }
.vk-side-body p { margin: 0; font-family: var(--serif); font-size: 16px; line-height: 1.5; color: var(--ink); }
.vk-side-body p + p { margin-top: 8px; }
@media (max-width: 559px) { .vk-sbs-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---- Live stat ------------------------------------------------------------- */
.vk-stats { margin: 32px 0; padding: 18px 20px; max-width: 40em; display: flex; flex-direction: column; gap: 12px; }
.vk-stats-row { display: flex; flex-wrap: wrap; gap: 14px 32px; }
.vk-stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vk-stat-v { font-family: var(--sans); font-weight: 800; font-size: 30px; letter-spacing: -.03em; line-height: 1.05; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.vk-stat-l { font-size: 13.5px; color: var(--muted); }
.vk-num { display: inline-block; font-variant-numeric: tabular-nums; }
.vk-stats-link { font-size: 15px; font-weight: 600; color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; align-self: flex-start; }

/* ---- Annotated figure ------------------------------------------------------ */
.vk-annot { max-width: 600px; }
.vk-annot-stage { position: relative; container-type: inline-size; }
.vk-pins { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: pin; }
.vk-pin {
  counter-increment: pin; font-size: 15px; line-height: 1.4; color: var(--ink);
  padding-left: 30px; position: relative;
}
.vk-pin::before {
  content: counter(pin); position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--accent);
}
@container (min-width: 520px) {
  .vk-pins { position: absolute; inset: 0; margin: 0; display: block; pointer-events: none; }
  .vk-pin {
    position: absolute; padding: 4px 10px; font-size: 13px; font-weight: 600; white-space: nowrap; border-radius: 999px;
    background: rgba(255, 255, 255, .92); border: 1px solid color-mix(in oklch, var(--accent) 35%, transparent);
    color: #211D33; box-shadow: 0 2px 8px rgba(109, 90, 230, .15);
  }
  .vk-pin::before { display: none; }
  .vk-pin[data-align="start"] { left: 1.5%; }
  .vk-pin[data-align="end"] { right: 1.5%; }
  .vk-pin[data-side="above"] { bottom: calc((100 - var(--y)) * 1% + 18px); }
  .vk-pin[data-side="below"] { top: calc(var(--y) * 1% + 18px); }
}
