/* Every block carries its proof.
   Component styles for #proof. Every selector is prefixed .proof-; the page provides .wrap,
   .section and .section-heading, which are reused here and never redefined.
   Pixel glyphs are inline SVG on an integer grid (1 art pixel = 2 CSS px, crispEdges).
   Wires are 2px HTML lines: Ramp 2 at rest, Ramp 5 when lit. Planned parts stay Ramp 2.
   Two paths reach Ethereum: the attesters' "final header only" line on the main axis, and the
   relayer's "transaction + Merkle proof" lane, which bypasses the attesters (bottom on wide
   screens, right edge on narrow ones). */

.proof-section { background: var(--paper); }
.proof-section code { font-family: var(--font-mono); font-size: .875em; letter-spacing: 0; overflow-wrap: anywhere; }
.proof-nowrap { white-space: nowrap; }
.proof-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---------------------------------------------------------------- figure, shared */
.proof-figure { margin: 0; }
.proof-flow { list-style: none; margin: 0; padding: 0; }
.proof-stage { position: relative; min-width: 0; }
.proof-art { position: relative; min-width: 0; }
.proof-name { margin: 0; color: var(--ink); font-size: 16px; line-height: 24px; font-weight: 600; letter-spacing: -.01em; }
.proof-role { margin: 4px 0 0; color: var(--muted); font-size: 14px; line-height: 20px; text-wrap: balance; }
.proof-status { margin: 8px 0 0; color: var(--ink); font-size: 14px; line-height: 20px; text-wrap: balance; }
.proof-glyph { display: block; flex: none; max-width: none; overflow: visible; }
/* explicit sizes (2 CSS px per art pixel) so a page-wide svg { width: 24px } rule cannot rescale them */
.proof-glyph-block { width: 48px; height: 48px; }
.proof-glyph-chip { width: 40px; height: 40px; }
.proof-glyph-diamond { width: 34px; height: 56px; }
.proof-glyph-coin { width: 44px; height: 44px; }
.proof-glyph-quorum { width: 102px; height: 26px; }
.proof-glyph-doc { width: 14px; height: 18px; }
.proof-glyph-sign { width: 22px; height: 16px; }
.proof-glyph-arrow { width: 8px; height: 14px; }

.proof-wire { position: relative; }
.proof-seg { position: absolute; display: block; background: var(--ramp-2); --proof-sx: 0; --proof-sy: 1; --proof-origin: 0 50%; }
.proof-seg::after { content: ''; position: absolute; inset: 0; background: var(--ramp-5); transform-origin: var(--proof-origin); }
.proof-seg-planned::after { display: none; }
.proof-out { position: relative; display: block; flex: 1 1 auto; align-self: center; min-width: 16px; height: 2px; }
.proof-out .proof-seg { inset: 0; }
.proof-tip { position: absolute; display: block; line-height: 0; }
.proof-wire-label { position: absolute; color: var(--muted); font-size: 14px; line-height: 20px; white-space: nowrap; }

/* Pearl blocks: three blocks on one chain, each with its certificate */
.proof-chain { display: flex; align-items: flex-start; flex: none; }
.proof-chain-link { display: block; flex: none; width: 14px; height: 2px; margin: 16px 0 0 -6px; background: var(--ink); }

/* TEE enclaves: notched pixel frame drawn with four offset shadows (no blur).
   Live: Ink frame. Planned: Mineral frame, pale chip, pending certificates, no motion. */
.proof-enclaves { list-style: none; margin: 0; padding: 0; }
.proof-enclave-row { position: relative; display: flex; align-items: center; min-width: 0; }
.proof-enclave { position: relative; display: flex; align-items: center; background: var(--paper);
  box-shadow: 0 -2px 0 var(--ink), 0 2px 0 var(--ink), -2px 0 0 var(--ink), 2px 0 0 var(--ink); }
.proof-planned .proof-enclave { box-shadow: 0 -2px 0 var(--ramp-3), 0 2px 0 var(--ramp-3), -2px 0 0 var(--ramp-3), 2px 0 0 var(--ramp-3); }
.proof-enclave-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.proof-vendor { margin: 0; color: var(--ink); font-size: 16px; line-height: 24px; font-weight: 600; white-space: nowrap; }
.proof-vendor-status { margin-left: 4px; color: var(--muted); font-size: 14px; line-height: 20px; font-weight: 400; }
.proof-planned .proof-vendor { color: var(--muted); }
.proof-checks { display: flex; align-items: flex-end; gap: 4px; }
.proof-checks .proof-glyph-sign { margin-left: 8px; }

/* Ethereum: the two contracts, in a Ramp 5 frame */
.proof-chain-frame { position: relative; display: flex; align-items: center; gap: 16px; flex: none; padding: 16px; background: var(--paper);
  box-shadow: 0 -2px 0 var(--ramp-5), 0 2px 0 var(--ramp-5), -2px 0 0 var(--ramp-5), 2px 0 0 var(--ramp-5); }
.proof-contracts { display: grid; gap: 24px; margin: 0; text-align: left; }
.proof-contracts dt { color: var(--ink); font-size: 14px; line-height: 20px; }
.proof-contracts dt code { font-size: 14px; }
.proof-contracts dd { margin: 0; color: var(--muted); font-size: 14px; line-height: 20px; white-space: nowrap; }

.proof-lane-label { color: var(--ink); }

/* ---------------------------------------------------------------- figure, wide: left to right */
/* Columns are whole even pixels so every wire and glyph lands on the pixel grid; the quorum
   column takes the slack. Main axis at y 136; the relayer lane at y 304, under the enclaves. */
@media (min-width: 1360px) {
  .proof-flow { display: grid; grid-template-columns: 176px 336px minmax(208px, 1fr) 352px 160px; }
  .proof-stage { display: grid; grid-template-columns: var(--proof-wire-w, 0px) minmax(0, 1fr); grid-template-rows: 312px auto; row-gap: 24px; }
  .proof-wire { grid-column: 1; grid-row: 1; }
  .proof-art { grid-column: 2; grid-row: 1; display: flex; align-items: center; align-self: start; height: 272px; }
  .proof-text { grid-column: 2; grid-row: 2; padding-right: 16px; }
  .proof-stage-attest { --proof-wire-w: 80px; }
  .proof-stage-quorum { --proof-wire-w: 48px; }
  .proof-stage-eth { --proof-wire-w: 96px; }
  .proof-stage-mint { --proof-wire-w: 40px; }
  .proof-wire-join-m, .proof-lane-n { display: none; }

  /* three enclave rows, 80px tall, 16px apart: centres at 40, 136 and 232 */
  .proof-stage-attest .proof-art { align-items: stretch; flex-direction: column; justify-content: center; }
  .proof-enclaves { display: grid; grid-template-rows: repeat(3, 80px); row-gap: 16px; }
  .proof-enclave { flex: none; width: 232px; height: 76px; margin: 2px; gap: 16px; padding: 0 16px; }

  /* fan out: trunk, spine, three branches with arrows */
  .proof-wire-fan .proof-seg-trunk { left: 0; top: 135px; width: 56px; height: 2px; }
  .proof-wire-fan .proof-seg-spine { left: 55px; top: 39px; width: 2px; height: 194px; --proof-sx: 1; --proof-sy: 0; --proof-origin: 50% 50%; }
  .proof-wire-fan .proof-seg-branch { left: 56px; width: 16px; height: 2px; }
  .proof-wire .proof-seg-b1 { top: 39px; }
  .proof-wire .proof-seg-b2 { top: 135px; }
  .proof-wire .proof-seg-b3 { top: 231px; }
  .proof-wire-fan .proof-tip { left: 72px; }
  .proof-tip-b1 { top: 33px; }
  .proof-tip-b2 { top: 129px; }
  .proof-tip-b3 { top: 225px; }
  .proof-label-headers { right: 32px; top: 108px; }

  /* join: three branches into a spine, one trunk to the quorum */
  .proof-wire-join .proof-seg-branch { left: 0; width: 16px; height: 2px; }
  .proof-wire-join .proof-seg-spine { left: 15px; top: 39px; width: 2px; height: 194px; --proof-sx: 1; --proof-sy: 0; --proof-origin: 50% 50%; }
  .proof-wire-join .proof-seg-trunk { left: 16px; top: 135px; width: 24px; height: 2px; }
  .proof-wire-join .proof-tip-trunk { left: 40px; top: 129px; }
  /* sits on the line that leaves the TDX enclave */
  .proof-label-signatures { left: -16px; top: 12px; }

  /* single lines into Ethereum and into the coin */
  .proof-wire-line .proof-seg-trunk { left: 0; top: 135px; width: calc(100% - 8px); height: 2px; }
  .proof-wire-line .proof-tip-trunk { right: 0; top: 129px; }
  .proof-label-final { right: 12px; top: 108px; }

  /* Ethereum: the frame sits so PearlCheckpoints meets the main axis (136) and PearlBridge
     meets the relayer lane (200); the coin leaves on the main axis */
  .proof-stage-eth .proof-art { align-items: flex-start; }
  .proof-chain-frame { margin: 110px 2px 0; }
  .proof-stage-eth .proof-out { align-self: flex-start; margin-top: 135px; }

  /* the relayer lane: drops from the headers trunk, runs under the enclaves and the quorum,
     rises into PearlBridge */
  .proof-lane-drop { left: 15px; top: 137px; width: 2px; height: 168px; --proof-sx: 1; --proof-sy: 0; --proof-origin: 50% 0; }
  .proof-lane-run { top: 303px; height: 2px; left: 0; right: 0; }
  .proof-stage-attest .proof-lane-run { left: 15px; }
  .proof-stage-eth .proof-lane-run { right: auto; width: 66px; }
  .proof-lane-rise { left: 64px; top: 199px; width: 2px; height: 106px; --proof-sx: 1; --proof-sy: 0; --proof-origin: 50% 100%; }
  .proof-lane-in { left: 64px; top: 199px; width: 24px; height: 2px; }
  .proof-tip-lane { left: 88px; top: 193px; }
  .proof-lane-label-w { left: 0; top: 256px; }
}

/* ---------------------------------------------------------------- figure, narrow: top to bottom */
/* The lane runs down the right edge (x = 100% - 3px); everything else keeps 24px clear of it. */
@media (max-width: 1359.98px) {
  .proof-flow { display: flex; flex-direction: column; max-width: 560px; margin-inline: auto; }
  .proof-stage { display: flex; flex-direction: column; align-items: center; text-align: center; }
  .proof-art { display: flex; flex-direction: column; align-items: center; width: 100%; }
  .proof-out, .proof-lane-w { display: none; }
  .proof-text { max-width: min(320px, calc(100% - 48px)); margin-top: 16px; }
  .proof-wire { width: 100%; flex: none; }
  .proof-wire-label { right: calc(50% + 12px); top: 12px; }

  /* arrows point down: the right pointing grid turned a quarter, centred on its line */
  .proof-tip .proof-glyph-arrow { transform: rotate(90deg); }

  /* simple arrows between stages */
  .proof-wire-line, .proof-wire-join { height: 56px; margin: 16px 0 8px; }
  .proof-wire-line .proof-seg-trunk, .proof-wire-join .proof-seg-trunk { left: calc(50% - 1px); top: 0; width: 2px; height: 46px; --proof-sx: 1; --proof-sy: 0; --proof-origin: 50% 0; }
  .proof-wire-line .proof-tip-trunk, .proof-wire-join .proof-tip-trunk { left: calc(50% - 4px); top: 43px; }
  .proof-wire-join .proof-seg-branch, .proof-wire-join .proof-seg-spine { display: none; }

  /* fan out above the enclaves: a long trunk (the lane branches off it at 64), spine, three drops.
     Enclave centres sit at 24px + (100% - 48px) x 1/6, 1/2, 5/6. */
  .proof-wire-fan { height: 120px; margin: 24px 0 8px; }
  .proof-wire-fan .proof-seg-trunk { left: calc(50% - 1px); top: 0; width: 2px; height: 88px; --proof-sx: 1; --proof-sy: 0; --proof-origin: 50% 0; }
  .proof-wire-fan .proof-seg-spine { left: calc(24px + (100% - 48px) / 6 - 1px); top: 88px; width: calc((100% - 48px) * 2 / 3 + 2px); height: 2px; --proof-origin: 50% 50%; }
  .proof-wire-fan .proof-seg-branch { top: 90px; width: 2px; height: 22px; --proof-sx: 1; --proof-sy: 0; --proof-origin: 50% 0; }
  .proof-wire .proof-seg-b1 { left: calc(24px + (100% - 48px) / 6 - 1px); }
  .proof-wire .proof-seg-b2 { left: calc(50% - 1px); }
  .proof-wire .proof-seg-b3 { left: calc(24px + (100% - 48px) * 5 / 6 - 1px); }
  .proof-wire-fan .proof-tip { top: 109px; }
  .proof-tip-b1 { left: calc(24px + (100% - 48px) / 6 - 4px); }
  .proof-tip-b2 { left: calc(50% - 4px); }
  .proof-tip-b3 { left: calc(24px + (100% - 48px) * 5 / 6 - 4px); }
  .proof-label-headers { top: 64px; }

  /* the relayer lane: branches right off the headers trunk, then runs down the right edge */
  .proof-lane-branch { left: 50%; right: 2px; top: 88px; height: 2px; }
  .proof-lane-down { right: 2px; top: 0; bottom: 0; width: 2px; --proof-sx: 1; --proof-sy: 0; --proof-origin: 50% 0; }
  .proof-stage-attest .proof-lane-down { top: 88px; }
  .proof-lane-label-n { left: auto; right: 12px; top: 24px; text-align: right; }

  /* three enclaves side by side; equal columns keep the centres at 1/6, 1/2, 5/6 */
  .proof-enclaves { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: calc(100% - 48px); }
  .proof-enclave-row { justify-content: center; }
  .proof-enclave { flex: 1 1 auto; flex-direction: column; gap: 8px; margin: 2px 6px; padding: 16px 4px; min-width: 0; }
  .proof-enclave-body { align-items: center; }
  .proof-vendor { display: flex; flex-direction: column; align-items: center; }
  .proof-vendor-status { margin-left: 0; }
  .proof-checks .proof-glyph-doc:nth-child(4) { display: none; }
  .proof-checks .proof-glyph-sign { margin-left: 4px; }

  /* join below the enclaves */
  .proof-wire-join-m { height: 48px; margin-top: 2px; }
  .proof-wire-join-m .proof-seg-rise { top: 0; width: 2px; height: 22px; --proof-sx: 1; --proof-sy: 0; --proof-origin: 50% 0; }
  .proof-wire-join-m .proof-seg-spine { left: calc(24px + (100% - 48px) / 6 - 1px); top: 22px; width: calc((100% - 48px) * 2 / 3 + 2px); height: 2px; --proof-origin: 50% 50%; }
  .proof-wire-join-m .proof-seg-trunk { left: calc(50% - 1px); top: 24px; width: 2px; height: 24px; --proof-sx: 1; --proof-sy: 0; --proof-origin: 50% 0; }
  .proof-stage-attest .proof-text { margin-top: 12px; }

  /* Ethereum: full width less the lane gutters. Its wire block is 80px, so PearlBridge's name
     line is centred at 80 + 2 + 16 + 40 + 24 + 10 = 172; the lane turns in there. */
  .proof-chain-frame { align-self: stretch; justify-content: space-between; margin: 2px 24px 0; padding: 16px 12px 16px 16px; }
  .proof-stage-eth .proof-lane-down { bottom: auto; height: 173px; }
  .proof-lane-turn { left: calc(100% - 14px); right: 2px; top: 171px; height: 2px; --proof-origin: 100% 50%; }
  .proof-tip-lane { left: calc(100% - 22px); top: 165px; }
  .proof-tip-lane .proof-glyph-arrow { transform: rotate(180deg); }

  /* motion: each stage plays on its own as it scrolls in, so its delays start from its first part */
  .proof-stage-attest { --proof-shift: 560ms; }
  .proof-stage-quorum { --proof-shift: 1760ms; }
  .proof-stage-eth { --proof-shift: 2280ms; }
  .proof-stage-mint { --proof-shift: 3240ms; }
}
@media (max-width: 400px) {
  .proof-enclave { margin-inline: 4px; padding-inline: 2px; }
  .proof-vendor { font-size: 14px; line-height: 20px; }
  .proof-checks .proof-glyph-doc:nth-child(3) { display: none; }
}

/* ---------------------------------------------------------------- motion: one pass on reveal */
/* proof.js adds .proof-armed to the figure (lit layers wait), then .proof-play to each stage:
   all at once on wide screens, one by one as they scroll in on narrow ones. Without the
   script, or under reduced motion, every element is shown lit and still. */
.proof-lit-2 { --proof-delay: var(--proof-delay-2); }
.proof-armed .proof-lit { opacity: 0; }
.proof-armed .proof-seg::after { transform: scale(var(--proof-sx), var(--proof-sy)); }
.proof-armed .proof-play .proof-lit { animation: proof-fade 400ms var(--ease) calc(var(--proof-delay, 0ms) - var(--proof-shift, 0ms)) both; }
.proof-armed .proof-play .proof-seg::after { animation: proof-grow 520ms var(--ease) calc(var(--proof-delay, 0ms) - var(--proof-shift, 0ms)) both; }
@keyframes proof-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes proof-grow { from { transform: scale(var(--proof-sx), var(--proof-sy)); } to { transform: scale(1, 1); } }
@media (prefers-reduced-motion: reduce) {
  .proof-armed .proof-lit { opacity: 1; animation: none !important; }
  .proof-armed .proof-seg::after { transform: none; animation: none !important; }
}

/* ---------------------------------------------------------------- stations and ledger */
.proof-stations { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 48px; margin: 80px 0 0; padding: 0; }
.proof-stations li { padding-top: 24px; border-top: 1px solid var(--line); }
.proof-stations h3, .proof-row h3 { margin: 0; color: var(--ink); font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -.02em; text-wrap: balance; }
.proof-stations p { margin: 8px 0 0; color: var(--muted); font-size: 16px; line-height: 24px; text-wrap: pretty; }

.proof-ledger { margin-top: 80px; border-top: 1px solid var(--line); }
.proof-row { display: grid; grid-template-columns: 1fr 1.2fr; gap: 80px; padding: 32px 0; border-bottom: 1px solid var(--line); }
.proof-row-body p { margin: 0; color: var(--muted); font-size: 16px; line-height: 24px; text-wrap: pretty; }
.proof-row-body p + p { margin-top: 12px; }

/* between the wide diagram and the stacked one: the vertical figure beside the stations */
@media (min-width: 901px) and (max-width: 1359.98px) {
  .proof-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); column-gap: 80px; align-items: start; }
  .proof-flow { max-width: none; }
  .proof-stations { grid-template-columns: 1fr; gap: 32px; margin-top: 0; }
}
@media (max-width: 1000px) {
  .proof-layout { column-gap: 40px; }
  .proof-row { gap: 40px; }
  .proof-stations { column-gap: 40px; }
}
@media (max-width: 900px) {
  .proof-stations { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 32px; margin-top: 64px; }
  .proof-ledger { margin-top: 64px; }
  .proof-row { grid-template-columns: 1fr; gap: 8px; padding: 24px 0; }
  .proof-stations h3, .proof-row h3 { font-size: 16px; line-height: 24px; }
}
@media (max-width: 600px) {
  .proof-stations { grid-template-columns: 1fr; gap: 32px; }
  .proof-stations li { padding-top: 16px; }
}
