/* Ingress, "What does your roof need?" panel: the drawing layer in the result card, 21 November 2026.
   Loaded after ingress-which.css. Existing tokens only: ink for the roof and the fix, the accent for the problem marks.
   Code orchestrates the sequence by toggling classes; the CSS does the drawing. */

/* Drawing area: top of the result card, full card width */
.rd-area { position: relative; height: 220px; margin: calc(-1 * var(--space-4)) calc(-1 * var(--space-4)) var(--space-3); padding: 0 var(--space-2); border-bottom: 1px solid var(--grey-rule); }
.rd-area svg { display: block; width: 100%; height: 100%; }
.rd-area .rd-note { position: absolute; left: var(--space-3); top: var(--space-2); margin: 0; }   /* "First, a look" (F7), caption style */

.rd path { fill: none; stroke-linejoin: miter; stroke-linecap: butt; }
.rd-section path { stroke: var(--ink); stroke-width: 2; }                       /* existing roof, purlin, fixings */
.rd-fix path { stroke: var(--accent); stroke-width: 2.5; }                       /* new work */
.rd-fix path.rd-ex, .rd-fix[data-fix="f4a"] path { stroke: var(--ink); stroke-width: 2; }   /* an existing part drawn inside a fix group */
.rd-marks path { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.rd-fix[data-fix="f4a"] path { stroke-dasharray: 6 5; }        /* the old sheet lifting away */

/* Card states around the drawing (data-state on .wk-result): empty and counting show only the drawing area and the count line */
.rn-count { margin: 0; color: var(--grey-caption); }
.wk-result[data-state="empty"] .rd-area svg { visibility: hidden; }
.wk-result.rn { min-height: 0; padding: var(--space-4); background: var(--paper); display: block; }

/* ---------- Motion. Each path draws in turn: duration = group time / n, delay = i x that. ---------- */
.rd .is-in path { stroke-dasharray: 1; }
.rd-fix[data-fix="f4a"].is-in path { stroke-dasharray: 6 5; }
@media (prefers-reduced-motion: no-preference) {
  .rd-section.is-in path { animation: rd-draw calc(900ms / var(--n)) linear both; animation-delay: calc(var(--i) * 900ms / var(--n)); }
  .rd-marks.is-in path   { animation: rd-draw calc(500ms / var(--n)) linear both; animation-delay: calc(var(--i) * 500ms / var(--n)); }
  .rd-fix.is-in path     { animation: rd-draw calc(1200ms / var(--n)) linear both; animation-delay: calc(200ms + var(--i) * 1200ms / var(--n)); }
  .rd-fix[data-fix="f4a"].is-in { animation: rd-fade 600ms ease-out both; }   /* the lift is a fade and move; F4b then draws */
  .rd-section, .rd-marks { transition: opacity 200ms ease-out; }
}
.rd .is-out { opacity: 0; }
.rd .rd-ghost { opacity: 0.25; }   /* the empty-card ghost: a section drawn once at 25 per cent (23 Nov 2026) */
@keyframes rd-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes rd-fade { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 639px) {
  .rd-area { height: 160px; margin: calc(-1 * var(--space-4)) calc(-1 * var(--margin)) var(--space-3); padding: 0 var(--space-1); }
}
@media (max-width: 639px) { .wk-result.rn { padding: var(--space-4) var(--margin); } }
