/* ==========================================================
   "How it works": the process as a short deck of drawn slides (task #251). Linked only by a page that carries the section (includes/art-process.php),
   on top of art.css (the drawing language: .a .w .o .g .flow, the stage delays .s1 .s2 ...). Every rule starts with .pr or .art-process, so no other page is touched.
   Without JavaScript the slides are a numbered list, each drawing complete. art-process.js adds .pr-js (one slide at a time, the controls), .pr-anim (motion is allowed)
   and .pr-live (the deck has been seen). Over time only stroke-dashoffset, opacity and translate change; nothing loops; reduced motion = no movement at all.
   Raise ART_PROCESS_VERSION in includes/art-process.php when this file changes.
   ========================================================== */

.art .art-process { padding-top: 0; }                    /* the section before it is white as well: one gap, not two */

.pr {
  --sw: 1.5;                                             /* the line of a drawing, in the drawing's own units; it grows as the drawing shrinks (as in art.css) */
  --pr-draw: calc(300ms * var(--k));                     /* one line being drawn */
  --pr-step: calc(45ms * var(--k));                      /* shape n starts this long after shape n-1 (--n is set on every shape by art_process_svg()): about 7 move at once */
}
@media (max-width: 899px) { .pr { --sw: 1.9; } }
@media (max-width: 519px) { .pr { --sw: 2.5; } }

/* ---------- The slides: a numbered list ---------- */
.pr-slides { display: grid; gap: 20px; margin: 0; padding: 0; list-style: none; counter-reset: pr; }
.pr-slide {
  counter-increment: pr; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: center; gap: clamp(20px, 4vw, 56px);
  padding: clamp(14px, 3vw, 40px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
@media (max-width: 759px) { .pr-slide { grid-template-columns: minmax(0, 1fr); gap: 18px; } }
.pr-scene {
  display: block; width: 100%; height: auto; overflow: visible;
  fill: none; stroke: var(--art-ink); stroke-linecap: round; stroke-linejoin: round; stroke-width: var(--sw);
}
.pr-scene .k2 { stroke-width: calc(var(--sw) * 2); }     /* a plain shape drawn at the weight of an icon shown at twice its grid */
.pr-scene .r { stroke: var(--danger); }                  /* the site's red (task #256), a line only, and only where the slide's words say red: a full kind, an old kitchen ticket, a ticket refused at the gate */
.pr-words::before {                                      /* the number (without JavaScript; the counter replaces it when the deck is a deck) */
  content: counter(pr, decimal-leading-zero); display: block; margin-bottom: 14px;
  font: 500 .75rem/1.5 var(--font-mono); letter-spacing: .18em; color: var(--muted);
}
.pr-words h3 { margin-bottom: 12px; font-size: clamp(1.4rem, 2.6vw, 2.1rem); line-height: 1.12; }
.pr-words p { max-width: 34ch; font-size: clamp(1rem, 1.5vw, 1.15rem); line-height: 1.55; }

/* ---------- The deck: one slide at a time (all slides share one cell, so the card never changes height) ---------- */
.pr-js .pr-slides { gap: 0; touch-action: pan-y; }
.pr-js .pr-slide { grid-area: 1 / 1; }
.pr-js .pr-slide:not(.is-on) { visibility: hidden; }
.pr-js .pr-words::before { display: none; }

.pr-bar { display: none; }
.pr-js .pr-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; margin-top: 20px; }
.pr-count { flex: none; font: 500 .75rem/1.5 var(--font-mono); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.pr-track { flex: 1 1 96px; height: 3px; border-radius: 3px; background: var(--border); overflow: hidden; }
.pr-fill { display: block; height: 100%; background: var(--cta); transform-origin: left center; transform: scaleX(calc(var(--pr-i, 1) / var(--pr-n, 1))); }
.pr-nav { display: flex; gap: 10px; margin-left: auto; }
.pr-bar .btn { min-height: 48px; padding: 0 22px 0 18px; transition: transform var(--dur-press) var(--ease-press); }      /* only the lift of a press moves; colours change at once (as the price buttons do) */
.pr-bar .pr-next { padding: 0 18px 0 22px; }
.pr-bar .btn[aria-disabled="true"] { opacity: .45; cursor: default; }
.pr-bar .btn[aria-disabled="true"]:hover { transform: none; }
.pr-ic { display: inline-flex; flex: none; }
.pr-chev { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 519px) {
  .pr-nav { flex: 1 1 100%; margin-left: 0; }
  .pr-nav .btn { flex: 1 1 0; }
}

/* ---------- Movement: the slide that appears draws itself once ----------
   Only while the deck is armed (.pr-anim: JavaScript on, motion allowed). The slide that is on starts its animations the moment it becomes the active one,
   so a slide you come back to is drawn again. Before the deck has been seen (.pr-live is added when it scrolls into view) its first slide waits, hidden. */
@media (prefers-reduced-motion: no-preference) {
  .pr-anim:not(.pr-live) .pr-slide.is-on .l { stroke-dasharray: 1 2; stroke-dashoffset: 1; opacity: 0; }
  .pr-anim:not(.pr-live) .pr-slide.is-on :is(.o, .g, .flow, .mvr, .mvu, .pr-words) { opacity: 0; }

  .pr-live .pr-slide.is-on .l { stroke-dasharray: 1 2; animation: pr-draw var(--pr-draw) var(--ease-out) calc(var(--n, 0) * var(--pr-step)) both; }
  .pr-live .pr-slide.is-on :is(.o, .g, .flow) { animation: pr-fade var(--dur-fast) linear calc(var(--n, 0) * var(--pr-step)) both; }
  .pr-live .pr-slide.is-on .mvr { animation: pr-in-r calc(var(--pr-draw) * 2) var(--ease-out) calc(var(--n, 0) * var(--pr-step)) both; }
  .pr-live .pr-slide.is-on .mvu { animation: pr-in-u calc(var(--pr-draw) * 1.4) var(--ease-out) calc(var(--n, 0) * var(--pr-step)) both; }
  .pr-live .pr-slide.is-on .pr-words { animation: pr-rise var(--dur-calm) var(--ease-out) both; }
  .pr-fill { transition: transform var(--dur-calm) var(--ease-out); }
}
@keyframes pr-draw { 0% { stroke-dashoffset: 1; opacity: 0; } 1% { stroke-dashoffset: 1; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 1; } }
@keyframes pr-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pr-in-r { from { translate: -64px 0; opacity: 0; } to { translate: 0 0; opacity: 1; } }
@keyframes pr-in-u { from { translate: 0 18px; opacity: 0; } to { translate: 0 0; opacity: 1; } }
@keyframes pr-rise { from { translate: 0 8px; opacity: 0; } to { translate: 0 0; opacity: 1; } }

/* ---------- Windows high contrast, print (reduced motion needs no rules: the movement above exists only under no-preference) ---------- */
@media (forced-colors: active) { .pr-scene { stroke: CanvasText; } .pr-fill { background: Highlight; } }
@media print {
  .pr-js .pr-slides { gap: 20px; }
  .pr-js .pr-slide { grid-area: auto; }
  .pr-js .pr-slide:not(.is-on) { visibility: visible; }
  .pr-js .pr-bar { display: none; }
}
