/* ---------------------------------------------------------------
   Adeia — Proof and Policy

   Two sections on the white ground. Proof stages the live ledger as
   a large panel with a --mist verdict card overlapping its lower
   right; Policy lays the four seed figures out as mono numerals
   separated by hairlines.

   Everything is scoped under .proof or .policy. Tokens and the shared
   classes (.label, .mono, .h2, .plus-link, .quiet) come from
   tokens.css and base.css and are not restated here.

   Outcome states never rely on hue to be told apart: executed is
   quiet and unmarked, held carries a solid edge marker, a fill, and
   the heaviest weight in the section, denied is struck through.
   --------------------------------------------------------------- */

/* =====================================================================
   Section A — Proof
   ===================================================================== */

.proof {
  /* Panel padding is hoisted so the rows can bleed back out to the
     panel edge with a negative margin of exactly the same size. */
  --proof-pad: clamp(1.25rem, 2.4vw, 2.5rem);
  --proof-verdict-w: 26rem;
  /* Room under the panel for the share of the card that hangs past it. */
  --proof-verdict-drop: 8.5rem;
}

/* ---------- head ---------- */

.proof__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  column-gap: var(--gap);
  row-gap: clamp(1rem, 2vw, 1.75rem);
  padding-bottom: clamp(2rem, 4.5vw, 3.5rem);
}

.proof__eyebrow {
  grid-column: 1 / -1;
  color: var(--quiet);
}

.proof__title {
  grid-column: 1;
  max-width: 17ch;
}

.proof__link {
  grid-column: 2;
  justify-self: end;
  white-space: nowrap;
}

/* ---------- stage: panel plus the overlapping verdict card ---------- */

.proof__stage {
  position: relative;
}

.proof__panel {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: var(--proof-pad);
  padding-bottom: clamp(2rem, 4vw, 3.25rem);
}

.proof__panelhead {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: clamp(1rem, 2vw, 2rem);
  padding-bottom: clamp(1rem, 2vw, 1.75rem);
}

.proof__panellabel {
  color: var(--quiet);
}

.proof__policyset {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem clamp(1.25rem, 3vw, 3rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.proof__policyitem {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.proof__policyval {
  font-size: var(--t-lead);
  font-weight: 500;
  line-height: 1;
}

.proof__policyval--live {
  font-weight: 700;
}

/* ---------- rows ---------- */

.proof__rows {
  list-style: none;
  margin: 0 calc(-1 * var(--proof-pad));
  padding: 0;
  border-top: 1px solid var(--rule);
}

.proof__row {
  position: relative;
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr) auto 12.5rem;
  grid-template-areas: "time who amt state";
  align-items: baseline;
  column-gap: clamp(0.75rem, 1.8vw, 2rem);
  padding: clamp(0.9rem, 1.6vw, 1.35rem) var(--proof-pad);
  border-bottom: 1px solid var(--rule);
  opacity: 0;
  transform: translateY(0.75rem);
  transition:
    opacity var(--d-reveal) var(--ease-out),
    transform var(--d-reveal) var(--ease-out),
    background-color var(--d-reveal) var(--ease-out);
}

.proof__row.is-in {
  opacity: 1;
  transform: none;
}

/* The edge marker. Transparent for a quiet row, solid for a held one —
   position and presence, not colour, is what distinguishes it. */
.proof__row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 3px;
  background: transparent;
  transition: background-color var(--d-reveal) var(--ease-out);
}

.proof__time {
  grid-area: time;
  font-size: var(--t-small);
  font-weight: 500;
  color: var(--quiet);
}

.proof__who {
  grid-area: who;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.5rem;
  min-width: 0;
}

.proof__acct {
  font-size: var(--t-body);
  font-weight: 500;
}

.proof__memo {
  font-size: var(--t-body);
  color: var(--quiet);
}

.proof__memo::before {
  content: "·";
  margin-right: 0.5rem;
}

.proof__amt {
  grid-area: amt;
  justify-self: end;
  text-align: right;
  font-size: var(--t-body);
  font-weight: 400;
  color: var(--quiet);
}

.proof__state {
  grid-area: state;
  justify-self: end;
  text-align: right;
  color: var(--quiet);
}

/* --- outcome: executed. The quiet baseline; no marker, no fill. --- */

/* --- outcome: held. The loudest thing in the section. --- */
.proof__row[data-outcome="held"] {
  background: var(--mist);
}

.proof__row[data-outcome="held"]::before {
  background: var(--on-paper);
}

.proof__row[data-outcome="held"] .proof__time,
.proof__row[data-outcome="held"] .proof__memo {
  color: var(--on-paper);
}

.proof__row[data-outcome="held"] .proof__acct,
.proof__row[data-outcome="held"] .proof__memo {
  font-weight: 500;
}

.proof__row[data-outcome="held"] .proof__amt {
  font-size: var(--t-lead);
  font-weight: 700;
  color: var(--on-paper);
}

.proof__row[data-outcome="held"] .proof__state {
  color: var(--on-paper);
  font-weight: 700;
}

/* --- outcome: approved. Keeps the marker and the weight, loses the
       fill — the row has stopped asking for anything. --- */
.proof__row[data-outcome="approved"]::before {
  background: var(--quiet);
}

.proof__row[data-outcome="approved"] .proof__amt {
  font-size: var(--t-lead);
  font-weight: 500;
  color: var(--on-paper);
}

.proof__row[data-outcome="approved"] .proof__state {
  color: var(--on-paper);
  font-weight: 600;
}

/* --- outcome: denied. --- */
.proof__row[data-outcome="denied"] .proof__amt {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-underline-offset: 0;
}

/* ---------- tail: status line and the outcome key ---------- */

.proof__tail {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: clamp(1rem, 2vw, 1.75rem);
  padding-top: clamp(1.25rem, 2.4vw, 2rem);
}

.proof__foot {
  margin: 0;
  max-width: 44ch;
  font-size: var(--t-small);
  font-weight: 600;
  line-height: 1.5;
}

.proof__key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem clamp(1rem, 2vw, 1.75rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.proof__keyitem {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: var(--t-small);
  line-height: 1.5;
  color: var(--quiet);
}

.proof__keyamt {
  font-size: var(--t-small);
}

.proof__keyitem[data-outcome="held"] {
  color: var(--on-paper);
  font-weight: 600;
}

.proof__keyitem[data-outcome="held"] .proof__keyamt {
  font-weight: 700;
}

.proof__keyitem[data-outcome="denied"] .proof__keyamt {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

/* ---------- verdict card ---------- */

.proof__verdict {
  position: relative;
  z-index: 1;
  background: var(--mist);
  border: 1px solid var(--rule);
  color: var(--on-paper);
  padding: clamp(1.25rem, 2.2vw, 2rem);
  /* Stacked layout still overlaps the panel, and still sits off-axis. */
  margin: -1.75rem 0 0 clamp(0rem, 5vw, 4rem);
}

.proof__verdictlabel {
  color: var(--on-paper);
}

.proof__verdictamt {
  margin: 0.85rem 0 0;
  min-height: 1.05em;
  font-size: var(--t-h3);
  font-weight: 500;
  line-height: 1.05;
  opacity: 0;
  transform: translateY(0.5rem);
  transition:
    opacity var(--d-reveal) var(--ease-out),
    transform var(--d-reveal) var(--ease-out);
}

.proof__verdict:not([data-state="idle"]) .proof__verdictamt {
  opacity: 1;
  transform: none;
}

.proof__verdictrule {
  margin: 0.75rem 0 0;
  font-size: var(--t-body);
  line-height: 1.5;
}

.proof__verdictreason {
  margin: 0.65rem 0 0;
  font-size: var(--t-small);
  line-height: 1.5;
  color: var(--quiet);
  overflow-wrap: anywhere;
}

.proof__verdictwho {
  margin: 0.65rem 0 0;
  font-size: var(--t-body);
  font-weight: 600;
  line-height: 1.5;
}

.proof__verdictreason:empty,
.proof__verdictwho:empty {
  display: none;
}

.proof__verdictnote {
  margin: 1.1rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
  font-size: var(--t-small);
  line-height: 1.5;
  color: var(--quiet);
}

/* ---------- proof: wide layout, where the card overlaps ---------- */

@media (min-width: 64rem) {
  .proof__stage {
    padding-bottom: var(--proof-verdict-drop);
  }

  /* The card overlaps the panel's lower corner and hangs past its edge,
     rather than sitting inside it. Anchored to the bottom and pushed down
     by a share of its own height, so it stays put whatever the copy runs to. */
  .proof__verdict {
    position: absolute;
    right: -1.5rem;
    bottom: 0;
    transform: translateY(34%);
    width: var(--proof-verdict-w);
    margin: 0;
  }

  /* Everything the card can reach keeps a lane clear of it. Without this the
     rows' amount and state columns are cropped by the overlap. */
  .proof__row,
  .proof__tail,
  .proof__panelhead {
    padding-right: calc(var(--proof-verdict-w) - 1.5rem + 2rem);
  }
}

/* ---------- proof: narrow ---------- */

@media (max-width: 48rem) {
  .proof__head {
    grid-template-columns: minmax(0, 1fr);
  }

  .proof__title {
    grid-column: 1;
    max-width: none;
  }

  .proof__link {
    grid-column: 1;
    justify-self: start;
  }

  .proof__row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "time  amt"
      "who   amt"
      "state state";
    align-items: start;
    row-gap: 0.35rem;
  }

  .proof__amt {
    align-self: center;
  }

  .proof__state {
    justify-self: start;
    text-align: left;
    padding-top: 0.25rem;
  }
}

/* =====================================================================
   Section B — Policy
   ===================================================================== */

.policy__head {
  padding-bottom: clamp(2rem, 4.5vw, 3.25rem);
}

.policy__eyebrow {
  color: var(--quiet);
  margin-bottom: clamp(0.75rem, 1.5vw, 1.25rem);
}

.policy__title {
  max-width: 20ch;
}

/* One-pixel grid gaps over a rule-coloured ground give hairlines that
   survive every reflow: a cross at two columns, stripes at one. */
.policy__figures {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  list-style: none;
  margin: 0;
  padding: 0;
}

.policy__fig {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: var(--paper);
  padding: clamp(1.5rem, 2.8vw, 2.5rem) clamp(1rem, 2vw, 1.75rem);
}

.policy__num {
  margin: 0;
  font-size: var(--t-h2);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: normal;
  font-variant-numeric: tabular-nums;
}

.policy__num--word {
  color: var(--quiet);
  text-transform: lowercase;
}

.policy__figlabel {
  margin: 0;
}

.policy__gloss {
  margin: 0.15rem 0 0;
  max-width: 26ch;
  font-size: var(--t-small);
  line-height: 1.45;
}

.policy__note {
  max-width: 64ch;
  margin-top: clamp(2rem, 4vw, 3.25rem);
}

.policy__code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--bone);
  padding: 0.12em 0.4em;
  overflow-wrap: anywhere;
}

@media (max-width: 48rem) {
  .policy__figures {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 30rem) {
  .policy__figures {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* =====================================================================
   Reduced motion — the finished state, immediately. ledger.js skips
   the sequence entirely; this makes sure no transition survives it.
   ===================================================================== */

@media (prefers-reduced-motion: reduce) {
  .proof__row,
  .proof__row::before,
  .proof__verdictamt {
    transition: none;
  }

  .proof__row,
  .proof__verdictamt {
    opacity: 1;
    transform: none;
  }
}
