/* "Field to report" process animation (CC-WEB-032). Token colours only; Archivo per CC-WEB-031.
   Two layouts from one DOM:
   - STAGE (default when motion is allowed): the five scenes are stacked in one grid cell; the active one shows.
     The stage size is reserved by aspect-ratio, so nothing moves when the script starts (CLS 0).
   - STATIC (prefers-reduced-motion, or no JS via noscript.css): five captioned panels in a list.
   Each scene lays itself out from its own width (container queries): portrait 4:5 below 560px, landscape 16:10 above. */

.pa { --pa-ink: var(--ink); max-width: 960px; margin: 0 auto; }
.pa__scenes { list-style: none; margin: 0; padding: 0; display: grid; }
.pa__visual { container-type: inline-size; }
.pa__visual > * { aspect-ratio: 4 / 5; }
@container (min-width: 560px) { .pa__visual > * { aspect-ratio: 16 / 10; } }
.pa__visual > * { position: relative; overflow: hidden; border-radius: var(--r-md); background: var(--navy-deep); color: var(--on-navy); padding: 16px; font-size: 14px; line-height: 1.3; isolation: isolate; }
.pa__visual > *::before { content: ""; position: absolute; inset: 0; z-index: -1; background: url("/assets/img/contours.svg?v=323dd2029c") center / cover; opacity: .08; }
@container (min-width: 560px) { .pa__visual > * { padding: 24px; font-size: 15px; } }

.pa__cap { margin: 14px 0 0; font-size: 1.0625rem; color: var(--ink); display: flex; gap: 12px; align-items: baseline; }
.pa__num { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--gold); color: var(--navy); font: 700 .875rem/28px var(--font-display); text-align: center; transform: translateY(-1px); }
.pa__label { margin: 6px 0 0; font-size: 14px; color: var(--on-navy-2); }

/* ---- Stage mode ---- */
.pa__scene { grid-area: 1 / 1; min-width: 0; }
.pa__scene:not(.is-active) .pa__visual { opacity: 0; visibility: hidden; }
.pa__scene:not(.is-active) .pa__cap { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pa__controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 18px; }
.pa__controls[hidden] { display: none; }
.pa__btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: var(--r-pill); border: 1px solid var(--navy); background: var(--surface); color: var(--navy); font: 600 .9375rem/1 var(--font); cursor: pointer; }
.pa__btn:hover { background: var(--paper); }
.pa__icon { width: 12px; height: 12px; display: inline-block; border-left: 4px solid currentColor; border-right: 4px solid currentColor; }
.pa.is-paused .pa__icon { border-left: 0; border-right: 0; border-style: solid; border-width: 6px 0 6px 11px; border-color: transparent transparent transparent currentColor; width: 0; height: 0; }
.pa__dots { display: flex; gap: 6px; }
.pa__dot { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--ink-2); background: var(--surface); color: var(--navy); font: 600 .8125rem/1 var(--font); cursor: pointer; padding: 0; }
.pa__dot[aria-current="step"] { background: var(--navy); color: var(--on-navy); border-color: var(--navy); }
.pa__end { margin-left: auto; }
@media (max-width: 559px) { .pa__end { margin-left: 0; width: 100%; } }

/* ---- Static mode (reduced motion; noscript.css repeats these rules for no-JS) ----
   Not in the hero (.pa--hero): there the stage stays one frame and the scene buttons step through it without motion. */
@media (prefers-reduced-motion: reduce) {
  .pa:not(.pa--hero) { max-width: none; }
  .pa:not(.pa--hero) .pa__scenes { grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 40px 32px; counter-reset: none; }
  .pa:not(.pa--hero) .pa__scene { grid-area: auto; }
  .pa:not(.pa--hero) .pa__scene:not(.is-active) .pa__visual { opacity: 1; visibility: visible; }
  .pa:not(.pa--hero) .pa__scene:not(.is-active) .pa__cap { position: static; width: auto; height: auto; margin: 14px 0 0; overflow: visible; clip: auto; white-space: normal; }
  .pa:not(.pa--hero) .pa__controls { display: none; }
}

/* ---- Hero (CC-WEB-034): the stage sits on contour navy beside the H1 ---- */
.pa--hero { max-width: none; margin: 0; }
.pa--hero .pa__visual > * { background: var(--navy-2); box-shadow: var(--shadow-float); }
.pa--hero .pa__cap { color: var(--on-navy); }
.pa--hero .pa__btn { border-color: rgba(255, 255, 255, .5); }
.pa--hero .pa__dot { border-color: rgba(255, 255, 255, .5); }
.pa--hero .pa__dot[aria-current="step"] { background: var(--gold); color: var(--navy); border-color: var(--gold); }
.pa--hero :focus-visible { outline-color: var(--gold); }

/* ---- Shared scene parts ---- */
.m { font-family: var(--font-mono); font-size: 13.5px; }
.n { text-align: right; font-variant-numeric: tabular-nums; }
.pa-t { border-collapse: collapse; width: 100%; color: var(--ink); font-variant-numeric: tabular-nums; }
.pa-t td { padding: 4px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; position: relative; }
.pa-t tr:last-child td { border-bottom: 0; }
.pa-t .h td { color: var(--ink-2); font-weight: 600; font-size: 13.5px; }
.pa-flag { display: inline-block; width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 11px solid var(--gold); margin-right: 6px; vertical-align: -1px; flex: none; }
.pa-sheet, .pa-file, .pa-exc, .pa-report { background: var(--surface); color: var(--ink); border-radius: 8px; box-shadow: var(--shadow-float); }

/* 1. Sources */
.pa1 { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr; gap: 14px; }
.pa1__sources { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pa1__src { background: var(--surface); color: var(--ink); border-radius: 8px; box-shadow: var(--shadow-float); padding: 10px; display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; line-height: 1.2; }
.pa1__ext { align-self: flex-start; font-family: var(--font-mono); font-weight: 400; font-size: 12px; color: var(--navy); background: #E8EFF8; border-radius: 4px; padding: 2px 6px; }
.pa1__facts { list-style: none; margin: 0; padding: 0 0 0 4px; display: flex; flex-direction: column; justify-content: center; gap: 6px; color: var(--on-navy-2); font-size: 1.1em; }
.pa1__facts b { font-family: var(--font-display); font-size: 1.6em; color: var(--on-navy); margin-right: 6px; }
.pa1__lab { position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.pa1__doc { width: 34px; margin-bottom: 6px; }
.pa1__doc .sheet { fill: var(--surface); stroke: var(--on-navy); stroke-width: 1.5; } .pa1__doc .fold { fill: none; stroke: var(--navy); stroke-width: 1.5; } .pa1__doc .lines { stroke: var(--gold); stroke-width: 2; stroke-linecap: round; }
.pa1__tray { width: 100%; max-width: 200px; border: 2px solid var(--on-navy-2); border-top: 0; border-radius: 0 0 10px 10px; height: 44px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; font-weight: 600; color: var(--on-navy); }
@container (min-width: 560px) { .pa1__src { font-size: 15px; padding: 14px; } .pa1__ext { font-size: 13px; } }

/* 2. Messy files */
.pa2 { display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.pa-file { padding: 8px 10px; }
.pa-file__name { margin: 0 0 4px; font-family: var(--font-mono); font-size: 13.5px; color: var(--ink-2); }
.pa-file--a { transform: rotate(-1.5deg); } .pa-file--b { transform: rotate(1.2deg) translateX(8px); } .pa-file--c { transform: rotate(-.8deg); }
@container (min-width: 560px) {
  .pa2 { display: grid; grid-template-columns: 1fr 1fr; align-content: center; gap: 18px; }
  .pa-file--b { transform: rotate(2deg) translateY(18px); }
  .pa-file--c { grid-column: 1 / -1; width: 62%; justify-self: center; transform: rotate(-1.5deg); }
}
@container (min-width: 840px) {
  .pa2 { grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
  .pa-file--a { transform: rotate(-3deg) translateY(-14px); } .pa-file--b { transform: rotate(2.5deg) translateY(24px); } .pa-file--c { grid-column: auto; width: auto; transform: rotate(-1.5deg) translateY(-4px); }
}

/* 3. Cleaned */
.pa3 { display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.pa-sheet { padding: 10px 12px; }
.pa-sheet__title { margin: 0 0 4px; font-weight: 600; color: var(--navy); display: flex; justify-content: space-between; gap: 8px; }
.pa-sheet__title span { color: var(--ink-2); font-weight: 400; }
.pa-t--clean td .o { position: absolute; left: 6px; top: 4px; opacity: 0; white-space: nowrap; }
.pa-t--clean td.n .o { left: auto; right: 6px; }
.pa-exc { padding: 10px 12px; background: var(--flag-bg); }
.pa-exc__title { margin: 0 0 6px; font-weight: 600; color: var(--navy); }
.pa-exc__title span { color: var(--gold-ink); }
.pa-exc ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pa-exc li { display: flex; align-items: baseline; gap: 2px; }
.pa-exc b { font-weight: 600; margin-right: 4px; }
@container (min-width: 560px) { .pa3 { display: grid; grid-template-columns: 7fr 5fr; align-items: center; gap: 20px; } }

/* 4. Checked */
.pa4 { display: flex; align-items: center; justify-content: center; }
.pa4 .pa-sheet { width: 100%; max-width: 520px; }
.pa-limit-key { color: var(--gold-ink) !important; font-weight: 600 !important; }
.pa4__table { position: relative; }
.pa4__band { position: absolute; top: 0; bottom: 0; left: 36%; width: 24%; background: var(--gold); opacity: .18; border-radius: 4px; transform-origin: top; }
.pa-t--check { position: relative; }
.pa-t--check td { padding: 6px 8px; }
.pa-t--check .st { color: var(--ink-2); }
.pa-t--check tr.x td { background: rgba(200, 151, 58, .10); }
.pa-t--check tr.x .st { color: var(--gold-ink); font-weight: 600; }

/* 5. Report */
.pa5 { display: flex; align-items: center; justify-content: center; }
.pa-report { width: 100%; max-width: 520px; padding: 0; overflow: hidden; }
.pa-report__tabs { display: flex; gap: 2px; background: var(--paper); border-bottom: 1px solid var(--line); padding: 6px 8px 0; }
.pa-report__tabs > span { padding: 6px 10px; border-radius: 6px 6px 0 0; color: var(--ink-2); display: inline-flex; align-items: center; }
.pa-report__tabs .on { background: var(--surface); color: var(--navy); font-weight: 600; }
.pa-report__exc { color: var(--gold-ink) !important; font-weight: 600; }
.pa-report__page { padding: 12px 14px 14px; }
.pa-report__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pa-report__title { margin: 0; font-family: var(--font-display); font-weight: 700; color: var(--navy); letter-spacing: -0.01em; }
.pa-report__month { margin: 0; color: var(--ink-2); perspective: 400px; }
.pa-report__month span { display: inline-block; }
.pa-report__chart { position: relative; margin: 10px 0; }
.pa5__svg { width: 100%; height: 96px; }
.pa5__svg .band { fill: var(--gold); opacity: .10; } .pa5__svg .lim { stroke: var(--gold-ink); stroke-dasharray: 5 4; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.pa5__svg .ln { fill: none; stroke: var(--navy); stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; } .pa5__svg .ex { fill: var(--gold); stroke: var(--navy); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.pa-report__wipe { position: absolute; inset: 0; background: var(--surface); transform-origin: right; transform: scaleX(0); }
.pa-t--report tr.x td { background: rgba(200, 151, 58, .10); }

/* Scene 4: fixed columns so the limit band sits exactly behind Result */
.pa-t--check { table-layout: fixed; }
.pa-t--check td:nth-child(1) { width: 34%; } .pa-t--check td:nth-child(2) { width: 24%; } .pa-t--check td:nth-child(3) { width: 42%; }
.pa4__band { left: 34%; width: 24%; }

/* Wide stages: larger type and sheets so the scenes fill the frame */
@container (min-width: 840px) {
  .pa__visual > * { font-size: 17px; padding: 40px; }
  .m, .pa-t .h td, .pa-file__name { font-size: 15.5px; }
  .pa-t td { padding: 6px 10px; }
  .pa3 { gap: 32px; }
  .pa4 .pa-sheet { max-width: 640px; padding: 16px 20px; }
  .pa-report { max-width: 640px; }
  .pa5__svg { height: 150px; }
  .pa-report__page { padding: 18px 22px 22px; }
  .pa-flag { border-left-width: 7px; border-right-width: 7px; border-bottom-width: 13px; }
}
