/* ==========================================================================
   Alpha ERP product page — page-scoped styles
   --------------------------------------------------------------------------
   Loaded only by alpha-erp.html, after styles.css. It adds the document
   chain (FIG.01), the extra marks and step legend of the procurement figure
   (FIG.02), and the three-up card grids. Shared classes are only placed or
   scoped here, never restyled. Tokens all come from styles.css :root.
   ========================================================================== */

/* ---- FIG.01 · document chain ---------------------------------------------
   Plain HTML and complete without JS: every record is a node on a rail,
   drawn at rest. Only the sequenced reveal is animated, gated on
   .hero-booted, with the static end state restored for reduced motion. */
.erp-chain {
  list-style: none;
  margin: 0;
  padding: 0.1rem 0.15rem 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums lining-nums;
}

.erp-doc {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "id   value"
    "line state";
  gap: 0.3rem 1rem;
  align-items: baseline;
  padding-block: 0.7rem;
  padding-inline-start: 1.6rem;
}
.erp-doc + .erp-doc { border-top: 1px dashed var(--border-strong); }

/* the rail: a node per record, and a link down to the next one */
.erp-doc::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: calc(0.7rem + 5px);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  background: var(--bg);
  box-shadow: 0 0 0 3px var(--blue-50);
}
.erp-doc:not(:last-child)::after {
  content: "";
  position: absolute;
  inset-inline-start: 4px;
  top: calc(0.7rem + 14px);
  bottom: calc(-0.7rem - 6px);
  width: 1px;
  background: linear-gradient(180deg, var(--blue-500), var(--border-strong));
  transform-origin: top;
}
.erp-doc--entry::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--blue-50), 0 0 10px var(--accent-glow);
}

.erp-doc__id {
  grid-area: id;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.1rem 0.6rem;
  line-height: 1.45;
}
.erp-doc__type {
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.erp-doc__ref {
  font-size: 0.8125rem;
  color: var(--text);
}
.erp-doc__value {
  grid-area: value;
  justify-self: end;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text);
  white-space: nowrap;
}
.erp-doc__line {
  grid-area: line;
  font-size: 0.71875rem;
  line-height: 1.5;
  color: var(--text-dim);
}
.erp-doc__state {
  grid-area: state;
  justify-self: end;
}
.erp-doc__state .pill-mini,
.erp-entry .pill-mini {
  display: inline-block;
  margin-inline-start: 0;
}
.erp-entry tfoot .pill-mini { margin-inline-start: 0.4rem; }

/* wider frames: value and status share the first line, so the detail line
   runs the full width */
@media (min-width: 480px) {
  .erp-doc {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "id   value state"
      "line line  line";
    column-gap: 0.75rem;
  }
}

/* the balanced entry the delivery ends in */
.erp-entry {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 0.5rem;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  font-size: 0.75rem;
}
.erp-entry caption {
  caption-side: top;
  text-align: start;
  padding-bottom: 0.4rem;
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-deep);
}
.erp-entry th,
.erp-entry td {
  padding: 0.42rem 0.65rem;
  text-align: end;
  font-weight: 400;
  white-space: nowrap;
  color: var(--text);
}
.erp-entry thead th {
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
}
.erp-entry thead th:first-child,
.erp-entry th[scope="row"] {
  text-align: start;
  white-space: normal;
}
.erp-entry tbody tr + tr > * { border-top: 1px solid var(--border); }
/* credits indent under the debit, as they do in a journal */
.erp-entry tbody tr + tr th { padding-inline-start: 1.2rem; }
.erp-entry tfoot > tr > * {
  border-top: 1px solid var(--border-strong);
  font-weight: 500;
}
.erp-entry tfoot th { color: var(--text-faint); }
.erp-entry__side {
  color: var(--accent);
  margin-inline-end: 0.3rem;
}
.erp-entry__name {
  margin-inline-start: 0.35rem;
  font-size: 0.6875rem;
  color: var(--text-faint);
}

/* narrow frames: the account name drops under its code, then goes, so the
   amounts never squeeze */
@media (max-width: 559px) {
  .erp-entry th,
  .erp-entry td { padding: 0.4rem 0.45rem; }
  .erp-entry tbody tr + tr th { padding-inline-start: 0.9rem; }
  .erp-entry__name {
    display: block;
    margin-inline-start: 0;
    font-size: 0.625rem;
  }
}
@media (max-width: 399px) {
  .erp-doc {
    column-gap: 0.6rem;
    padding-inline-start: 1.35rem;
  }
  .erp-entry { font-size: 0.6875rem; }
  .erp-entry th,
  .erp-entry td { padding: 0.38rem 0.35rem; }
  .erp-entry tbody tr + tr th { padding-inline-start: 0.6rem; }
}
@media (max-width: 359px) {
  .erp-entry__name { display: none; }
}

.erp-note {
  margin-top: var(--space-2xs);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

/* sequenced reveal: each record rises in, then its link draws down to the
   next; the journal lines post last, the balanced totals after them */
.hero-booted .erp-doc {
  animation: erp-rise 0.42s var(--ease-out) both;
  animation-delay: calc(0.8s + var(--i, 0) * 0.15s);
}
.hero-booted .erp-doc:not(:last-child)::after {
  animation: erp-link 0.3s var(--ease) both;
  animation-delay: calc(0.98s + var(--i, 0) * 0.15s);
}
.hero-booted .erp-entry tbody tr,
.hero-booted .erp-entry tfoot tr {
  animation: erp-fade 0.34s var(--ease-out) both;
}
.hero-booted .erp-entry tbody tr:nth-child(1) { animation-delay: 1.62s; }
.hero-booted .erp-entry tbody tr:nth-child(2) { animation-delay: 1.74s; }
.hero-booted .erp-entry tbody tr:nth-child(3) { animation-delay: 1.86s; }
.hero-booted .erp-entry tfoot tr { animation-delay: 2s; }
@keyframes erp-rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes erp-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes erp-link {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

/* ---- FIG.02 · procurement -------------------------------------------------
   The .archmap wires and nodes come from styles.css and are visible without
   JS. Added here: the dashed control chips, the dotted ties to them, the
   four role tags, and one long pulse path that follows a purchase from
   request to payment. */
.erp-proc {
  display: grid;
  gap: var(--space-lg);
  align-items: center;
}
.erp-proc .pipeline { margin: 0; }

.erp-flow .pulse {
  fill: none;
  stroke-dasharray: 0.05 0.95;
  animation-duration: 10s;
}
.erp-ties line {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 2 4;
}
.erp-chip rect {
  fill: var(--bg-2);
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}
.erp-chip text {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--text-faint);
  text-anchor: middle;
  dominant-baseline: middle;
}
.erp-roles text {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  fill: var(--accent-deep);
  text-anchor: middle;
  dominant-baseline: middle;
}

/* the legend carries each step in words the figure has no room for */
.erp-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}
.erp-steps li {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  column-gap: var(--space-xs);
  padding-block: 0.8rem;
  border-bottom: 1px solid var(--border);
}
.erp-steps__num {
  grid-row: span 2;
  padding-top: 0.2rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.erp-steps h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
}
.erp-steps p {
  margin-top: 0.2rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-dim);
}

/* ---- Three-up grids: editions and field cards ---------------------------- */
@media (min-width: 640px) and (max-width: 999px) {
  .erp-editions > :last-child,
  .erp-field > :last-child { grid-column: 1 / -1; }
}
@media (min-width: 1000px) {
  .erp-proc {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: var(--space-xl);
  }
  .erp-editions,
  .erp-field { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---- Reduced motion ------------------------------------------------------
   styles.css already stops the shared hero, wire and pulse motion, but only
   shortens durations, so a delayed reveal would still sit hidden first.
   These selectors match the animated ones exactly: every record, link and
   journal line is drawn from the start. */
@media (prefers-reduced-motion: reduce) {
  .hero-booted .erp-doc,
  .hero-booted .erp-doc:not(:last-child)::after,
  .hero-booted .erp-entry tbody tr,
  .hero-booted .erp-entry tfoot tr {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
