/*
 * Pramaan — the public certificate (/verify).
 * Consumes canonical tokens from /app/brand.css and the performance primitives
 * from /app/ceremony.css. Law: docs/brand-system.md.
 *
 * Grounds: the scan happens on ink (the record's material); the certificate
 * opens on paper (the stranger's material). Blue is the issuer and carries
 * focus and the primary action. Green appears only where a verdict is stated.
 *
 * The one geometry, at three scales:
 *   the mark      — datum L + clock track, 12u canvas, the tick inside it
 *   the reticle   — the same corners at viewfinder scale, closing on a code
 *   the certificate — the same corners at page scale: a perforated clock-track
 *                     head it was issued from, a clock-track right edge, and a
 *                     solid datum down the left and along the foot. Everything
 *                     Pramaan attests sits inside that frame (§2.2).
 */

* { box-sizing: border-box; }

html { background: var(--ink); }

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--paper-ink-text);
  font-family: var(--font-sans);
  font-size: var(--text-m);
  line-height: 1.5;
  background:
    linear-gradient(var(--hairline-dark) 1px, transparent 1px),
    linear-gradient(90deg, var(--hairline-dark) 1px, transparent 1px),
    var(--ink);
  background-size: 56px 56px, 56px 56px, auto;
}

#proof-field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.65;
}

/* Announced, never drawn — one complete statement to assistive tech (§9.12). */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---- Page chrome ------------------------------------------------------- */

.public-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1160px;
  margin: auto;
  padding: 24px 28px;
  border-bottom: 1px solid var(--hairline-dark);
}

.public-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.public-brand span { display: flex; flex-direction: column; }

.public-brand strong {
  font-size: var(--text-l);
  font-weight: 600;
  line-height: 1.2;
}

.lockup-deva { font-weight: 400; }

.eyebrow,
.public-brand small {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--muted-ink);
}

.public-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mute-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--hairline-dark);
  background: transparent;
  color: var(--muted-ink);
  cursor: pointer;
  border-radius: 0;
}

.mute-btn:hover { color: var(--paper-ink-text); }
.mute-btn[aria-pressed='true'] { color: var(--paper-ink-text); }
.mute-btn .icon-sound-off { display: none; }
.mute-btn[aria-pressed='false'] .icon-sound-on { display: none; }
.mute-btn[aria-pressed='false'] .icon-sound-off { display: block; }

/*
 * The header carries no operator entrance. This page belongs to the stranger;
 * the way into the office is one quiet line in the page footer.
 */

/* ---- Layout ------------------------------------------------------------ */

main {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: auto;
  padding: clamp(58px, 9vw, 120px) 28px;
  display: grid;
  grid-template-columns: minmax(250px, 0.72fr) minmax(440px, 1fr);
  gap: clamp(48px, 9vw, 120px);
  align-items: start;
}

.proof-intro { position: sticky; top: 48px; }

.proof-intro h1 {
  font-size: var(--text-display);
  font-weight: 400;
  line-height: 0.95;
  margin: 20px 0 28px;
}

.proof-intro > p {
  font-size: var(--text-m);
  line-height: 1.75;
  color: var(--muted-ink);
  max-width: 34rem;
}

.trust-line {
  margin-top: 36px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted-ink);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
}

.trust-line span {
  width: 7px;
  height: 7px;
  background: var(--blue-lit);
}

/*
 * When the certificate has issued, it takes the room. The desk has done its
 * work; leaving it on screen next to the answer is the composition of a form,
 * not of a document — and a screenshot of this page must be the certificate.
 */
body[data-state='issued'] .proof-intro,
body[data-state='issued'] .verification-desk { display: none; }

body[data-state='issued'] main {
  grid-template-columns: minmax(0, 720px);
  justify-content: center;
}

/* ---- Verification desk (ink ground) ------------------------------------ */

.verification-desk {
  background: var(--ink-raised);
  border: 1px solid var(--hairline-dark);
  padding: clamp(22px, 4vw, 42px);
  box-shadow: 0 32px 90px var(--shadow-firm);
}

.desk-header { margin-bottom: 28px; }

.desk-header h2 {
  font-size: var(--text-xl);
  font-weight: 400;
  line-height: 1.2;
  margin: 0;
  text-align: right;
}

.scan-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--hairline-dark);
  margin-bottom: 24px;
}

.scan-tab {
  border: 0;
  background: transparent;
  color: var(--muted-ink);
  padding: 14px 8px;
  font-family: var(--font-sans);
  font-size: var(--text-s);
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.scan-tab.active {
  color: var(--paper-ink-text);
  border-color: var(--blue-lit);
}

.scan-tab:focus-visible,
.verify-action:focus-visible,
.mute-btn:focus-visible,
input:focus-visible {
  outline: 2px solid var(--blue-lit);
  outline-offset: 4px;
}

/* ---- No script --------------------------------------------------------- */

/*
 * Rendered only when scripting is off. The desk is withdrawn (that rule lives
 * inside the <noscript> block itself); this says what happened and what to do
 * instead — a form that silently answers nothing is a dead end (§9.9).
 */
.no-script {
  background: var(--ink-raised);
  border: 1px solid var(--hairline-dark);
  border-top: 3px solid var(--blue-lit);
  padding: clamp(22px, 4vw, 42px);
  color: var(--paper-ink-text);
  box-shadow: 0 32px 90px var(--shadow-firm);
}

.no-script h2 {
  font-size: var(--text-xl);
  font-weight: 400;
  line-height: 1.25;
  margin: 12px 0 16px;
}

.no-script p {
  color: var(--muted-ink);
  font-size: var(--text-s);
  line-height: 1.7;
  margin: 0 0 12px;
}

.no-script p:last-child { margin-bottom: 0; }

.no-script strong {
  color: var(--paper-ink-text);
  font-family: var(--font-mono);
  font-weight: 500;
}

/* ---- Camera + the lens ------------------------------------------------- */

.camera-frame {
  position: relative;
  overflow: hidden;
  min-height: 260px;
  background: var(--ink);
  border: 1px solid var(--hairline-dark);
}

.camera-frame video {
  display: block;
  width: 100%;
  height: 300px;
  object-fit: cover;
}

/*
 * The reticle IS the mark's corners, exact to the geometry: module `u`, a
 * solid datum L one module thick down the left and along the bottom, and
 * clock-track modules — square, one module wide, at two-module pitch —
 * along the top (starting 2u from the corner, as the mark does) and down
 * the right (starting 1u down, as the mark does).
 */
.scan-reticle {
  --u: 6px;
  position: absolute;
  inset: 18% 22%;
  color: var(--paper-ink-text);
  box-shadow: 0 0 0 999px var(--shadow-firm);
}

.scan-reticle::before {
  /* Datum L — the fixed reference: solid left column + bottom row. */
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(currentColor, currentColor) left top / var(--u) 100% no-repeat,
    linear-gradient(currentColor, currentColor) left bottom / 100% var(--u) no-repeat;
}

.scan-reticle::after {
  /* Clock track — the measure: square modules, top and right. */
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, currentColor 0 var(--u), transparent var(--u) calc(var(--u) * 2))
      left calc(var(--u) * 2) top 0 / calc(100% - var(--u) * 2) var(--u) no-repeat,
    repeating-linear-gradient(180deg, currentColor 0 var(--u), transparent var(--u) calc(var(--u) * 2))
      right 0 top var(--u) / var(--u) calc(100% - var(--u)) no-repeat;
}

.scan-reticle span {
  /* The sweep — issuer-blue focus, never a verdict colour */
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 2px;
  background: var(--blue-lit);
  animation: sweep 2.8s ease-in-out infinite;
}

/*
 * Captured. The frame closes on the specimen, the sweep stops — there is
 * nothing left to look for — and the corners take the issuer's blue.
 */
.scan-reticle[data-captured='true'] { color: var(--blue-lit); }
.scan-reticle[data-captured='true'] span { opacity: 0; animation: none; }

/*
 * The camera is opened by the stranger, not to them: permission is never
 * requested before this is pressed (docs/brand-system.md §9.15).
 */
.camera-start {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  min-height: 44px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--blue-lit);
  background: var(--ink);
  color: var(--paper-ink-text);
  font-family: var(--font-sans);
  font-size: var(--text-s);
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  border-radius: 0;
}

.camera-start:hover { background: var(--ink-raised); }
.camera-start:focus-visible { outline: 2px solid var(--blue-lit); outline-offset: 3px; }
.camera-start[hidden] { display: none; }

.camera-status {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  text-align: center;
  font-size: var(--text-xs);
  color: var(--paper-ink-text);
}

/* The promise, made before the permission is asked for — not after. */
.camera-promise {
  margin: 14px 0 0;
  color: var(--muted-ink);
  font-size: var(--text-xs);
  line-height: 1.6;
}

.camera-denied,
.form-message {
  color: var(--muted-ink);
  font-size: var(--text-s);
  line-height: 1.5;
}

.form-message:empty { display: none; }

/* ---- Manual entry ------------------------------------------------------ */

.proof-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.proof-field > span:first-child {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--muted-ink);
}

.proof-field small {
  text-transform: none;
  letter-spacing: 0;
  color: var(--blue-lit);
}

/* The datum corners acknowledge the specimen when the field takes focus. */
.datum-field { display: block; }

.proof-field input {
  width: 100%;
  display: block;
  border: 1px solid var(--hairline-dark);
  background: var(--ink);
  color: var(--paper-ink-text);
  min-height: 50px;
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: var(--text-s);
  font-weight: 400;
  line-height: 1.4;
  border-radius: 0;
}

.identifier-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.identifier-grid label:last-child { grid-column: 1 / -1; }

.field-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted-ink);
  font-size: var(--text-xs);
}

.field-divider::before,
.field-divider::after {
  content: '';
  height: 1px;
  flex: 1;
  background: var(--hairline-dark);
}

/* ---- Primary action — the issuer's blue -------------------------------- */

.verify-action {
  width: 100%;
  margin-top: 24px;
  min-height: 60px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  background: var(--blue);
  color: var(--paper-bright);
  font-family: var(--font-sans);
  font-size: var(--text-s);
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
  box-shadow: 0 8px 28px var(--shadow-soft);
}

.verify-action:hover { box-shadow: 0 14px 36px var(--shadow-firm); }
.verify-action[hidden] { display: none; }

/* ---- The wait ----------------------------------------------------------- */

/*
 * The question is with the registry. Where the button was, the measure ticks:
 * ten modules of the mark's own clock track, filling in sequence. One primary
 * thing per state (§9.2.8) — and no spinner exists in this product.
 */
.registry-wait {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: var(--blue-lit);
}

.registry-wait[hidden] { display: none; }

.wait-line {
  margin: 0;
  color: var(--paper-ink-text);
  font-size: var(--text-s);
  line-height: 1.5;
}

/* ---- Trouble — never a verdict ------------------------------------------ */

/*
 * Network, registry and connection failures are reported as themselves. They
 * borrow no verdict colour, no verdict sound and no verdict language (§9.10);
 * amber is the cautionary note, and the sentence says outright that nothing
 * has been decided about the pack.
 */
.trouble {
  margin-top: 26px;
  padding: 18px 20px;
  background: var(--ink);
  border: 1px solid var(--hairline-dark);
  border-left: 3px solid var(--amber-lit);
}

.trouble[hidden] { display: none; }
.trouble .eyebrow { display: block; color: var(--amber-lit); }

.trouble-message {
  margin: 10px 0 0;
  color: var(--paper-ink-text);
  font-size: var(--text-s);
  line-height: 1.6;
}

.trouble-steps {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted-ink);
  font-size: var(--text-s);
  line-height: 1.7;
}

.trouble-steps[hidden] { display: none; }

/* ============================================================
   THE CERTIFICATE — the one geometry at page scale
   ============================================================ */

.certificate {
  --cert-u: 6px;
  --cert-inset: 16px;
  grid-column: 2;
  position: relative;
  overflow: hidden;
  background: var(--paper);
  color: var(--graphite);
  border: 0;
  box-shadow: 0 30px 100px var(--shadow-firm);
}

body[data-state='issued'] .certificate { grid-column: auto; }

/* The perforated head — the edge the certificate was fed from. */
.cert-edge {
  position: relative;
  z-index: 1;
  height: var(--cert-u);
  color: var(--graphite);
}

/*
 * The frame is PRINTED on the sheet, inset from its edges the way a rule is
 * printed inside a document's trim — the datum L solid down the left and along
 * the foot, the clock track measuring down the right. At the sheet's own edge
 * it would be ink on ink and read as nothing; here it reads as ink on paper.
 */
.certificate::after {
  content: '';
  position: absolute;
  inset: calc(var(--cert-u) + var(--cert-inset)) var(--cert-inset) var(--cert-inset);
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(var(--graphite), var(--graphite)) left top / var(--cert-u) 100% no-repeat,
    linear-gradient(var(--graphite), var(--graphite)) left bottom / 100% var(--cert-u) no-repeat,
    repeating-linear-gradient(
        180deg,
        color-mix(in srgb, var(--graphite) 40%, transparent) 0 var(--cert-u),
        transparent var(--cert-u) calc(var(--cert-u) * 2)
      )
      right top var(--cert-u) / var(--cert-u) 100% no-repeat;
}

.cert-body {
  position: relative;
  z-index: 1;
  --cert-gutter: clamp(22px, 3.4vw, 38px);
  padding: var(--cert-gutter) calc(var(--cert-gutter) + var(--cert-inset));
  padding-left: calc(var(--cert-gutter) + var(--cert-inset) + var(--cert-u));
  padding-bottom: calc(var(--cert-gutter) + var(--cert-inset) + var(--cert-u));
}

.certificate .eyebrow { color: var(--muted-paper); }

/* ---- Head: what this document is, its number, its moment ---------------- */

.cert-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--hairline-light);
}

.cert-head .eyebrow { display: block; }

.cert-dateline {
  margin: 7px 0 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.4;
  color: var(--muted-paper);
}

.cert-number {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  text-align: right;
}

.cert-number[hidden] { display: none; }

.cert-number span:last-child {
  font-family: var(--font-mono);
  font-size: var(--text-s);
  font-weight: 600;
  line-height: 1.2;
  color: var(--graphite);
}

/* ---- The verdict -------------------------------------------------------- */

.cert-verdict { margin: clamp(28px, 4vw, 40px) 0 clamp(26px, 4vw, 38px); }

.cert-mark { margin-bottom: 22px; }
.cert-mark svg { display: block; }

/*
 * The frame arrives with the certificate — it is the office's mark, not the
 * verdict. Only the tick is performed, and only once the server has answered
 * (§9.1.3). ceremony.css leaves the datum and the modules undrawn for the
 * assembly ceremony; this certificate does not assemble, it issues.
 */
.cert-mark .mark-datum { stroke-dashoffset: 0; }
.cert-mark .mark-module { opacity: 1; transform: none; }

.certificate h2 {
  margin: 0;
  font-size: var(--text-display);
  font-weight: 600;
  line-height: 0.96;
  color: var(--graphite);
  max-width: 14ch;
}

/*
 * Green is earned here and nowhere else in the product: the one moment a
 * server-established PASS is stated. Every other outcome keeps its own ink.
 */
.certificate[data-outcome='genuine'] h2 { color: var(--green); }

.certificate[data-outcome='recalled'] h2,
.certificate[data-outcome='expired'] h2,
.certificate[data-outcome='decommissioned'] h2 { color: var(--red); }

.verdict-supporting {
  margin: 18px 0 0;
  color: var(--muted-paper);
  font-size: var(--text-m);
  line-height: 1.65;
  max-width: 42ch;
}

/* ---- The attestation, inside the lens ----------------------------------- */

/*
 * The lens rule (§2.2): what Pramaan attests appears inside the frame. The
 * panel's corners are the mark's own — the solid datum corner bottom-left,
 * the clock-track corner top-right.
 */
.attestation {
  position: relative;
  padding: clamp(22px, 3vw, 30px);
  /*
   * Security paper, ruled to the mark's own grid (Order 32a).
   *
   * The module is 12 units on a 144 canvas, so the paper is ruled at 12px —
   * the same measure the mark is cut on, which is what makes this the
   * product's paper rather than a texture. It is laid at 2% of ink: found by
   * someone who leans in, gone at reading distance, and far too faint to
   * trouble the type above it. The corners stay the frame; this is underneath
   * everything, as paper is.
   */
  background-color: var(--paper-bright);
  background-image:
    linear-gradient(90deg, color-mix(in srgb, var(--graphite) 2%, transparent) 1px, transparent 1px),
    linear-gradient(0deg, color-mix(in srgb, var(--graphite) 2%, transparent) 1px, transparent 1px);
  background-size: 12px 12px;
  /* No box. The mark's two corners ARE the frame — a rectangle with corner
     decorations reads as damage; a datum and a clock track read as a lens. */
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--graphite) 7%, transparent);
}

.attestation::before {
  content: '';
  position: absolute;
  left: -1px;
  bottom: -1px;
  width: 68px;
  height: 68px;
  border-left: 2px solid var(--graphite);
  border-bottom: 2px solid var(--graphite);
  pointer-events: none;
}

.attestation::after {
  content: '';
  position: absolute;
  right: -1px;
  top: -1px;
  width: 68px;
  height: 68px;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg, var(--graphite) 0 6px, transparent 6px 12px) right top / 68px 2px no-repeat,
    repeating-linear-gradient(180deg, var(--graphite) 0 6px, transparent 6px 12px) right top / 2px 68px no-repeat;
}

.attestation > .eyebrow { display: block; }

/* The identifiers echoed back in the standard the pack is printed in (§13). */
.hri-block { margin: 16px 0 0; }
.hri-block[hidden] { display: none; }

.hri-label {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--muted-paper);
}

.hri {
  margin: 8px 0 0;
  font-family: var(--font-mono);
  font-size: var(--text-m);
  font-weight: 500;
  line-height: 1.7;
  color: var(--graphite);
  overflow-wrap: anywhere;
}

.hri .hri-ai { color: var(--muted-paper); }
.hri .hri-pair { margin-right: 1.1em; white-space: nowrap; }

.certificate-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 22px 0 0;
  border-top: 1px solid var(--hairline-light);
}

/* `display: grid` would otherwise win over the UA's [hidden] rule. */
.certificate-fields[hidden] { display: none; }

.certificate-fields div {
  padding: 13px 0;
  border-bottom: 1px solid var(--hairline-light);
}

.certificate-fields div:nth-child(odd) { padding-right: 20px; }

.certificate-fields div:nth-child(even) {
  padding-left: 20px;
  border-left: 1px solid var(--hairline-light);
}

/* An odd number of attested facts must not leave the record hanging. */
.certificate-fields div:nth-child(odd):last-child {
  grid-column: 1 / -1;
  padding-right: 0;
}

.certificate-fields dt {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--muted-paper);
}

.certificate-fields dd {
  margin: 6px 0 0;
  font-family: var(--font-mono);
  font-size: var(--text-s);
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* ---- The signatory ------------------------------------------------------ */

/*
 * Venus is named (§9.17). Not another grey row: the issuer signs, in the
 * issuer's own blue, over a signature rule, with the scope of the attestation
 * written beneath it — who attests this, and exactly what they attest.
 */
.signatory { margin: clamp(26px, 3.4vw, 34px) 0 0; }

.signatory .eyebrow { display: block; }

.signatory-name {
  margin: 10px 0 0;
  font-family: var(--font-serif);
  font-optical-sizing: auto;
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: 1.15;
  color: var(--blue);
}

.signatory-rule {
  height: 2px;
  width: min(300px, 62%);
  margin: 12px 0 12px;
  background: var(--blue);
}

.signatory-scope {
  margin: 0;
  font-size: var(--text-s);
  line-height: 1.65;
  color: var(--muted-paper);
  max-width: 46ch;
}

/* ---- What to do next ---------------------------------------------------- */

.next-steps {
  margin: clamp(24px, 3vw, 30px) 0 0;
  padding: 0;
  list-style: none;
}

.next-steps[hidden] { display: none; }

.next-steps li {
  position: relative;
  padding-left: 22px;
  margin-top: 11px;
  font-size: var(--text-s);
  line-height: 1.6;
  color: var(--graphite);
}

.next-steps li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 8px;
  height: 8px;
  background: var(--blue);
}

.certificate[data-outcome='recalled'] .next-steps li::before,
.certificate[data-outcome='expired'] .next-steps li::before,
.certificate[data-outcome='decommissioned'] .next-steps li::before { background: var(--red); }

/* ---- The foot ----------------------------------------------------------- */

.cert-foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-top: clamp(28px, 3.6vw, 36px);
  padding-top: 16px;
  border-top: 1px solid var(--hairline-light);
}

.cert-attests {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: 1.7;
  color: var(--muted-paper);
  max-width: 48ch;
}

.cert-foot button {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px; /* the target floor — a thumb, not a cursor */
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 500;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  text-decoration: underline;
  cursor: pointer;
}

.cert-foot button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

/* Printed only when there is nothing to print (see @media print). */
.print-nothing { display: none; }

/* ---- Page footer ------------------------------------------------------- */

.public-footer {
  position: relative;
  z-index: 1;
  max-width: 1160px;
  margin: auto;
  border-top: 1px solid var(--hairline-dark);
  padding: 24px 28px 50px;
  display: flex;
  justify-content: space-between;
  color: var(--muted-ink);
  font-size: var(--text-xs);
}

.public-footer nav { display: flex; gap: 22px; }

.public-footer a { color: var(--paper-ink-text); }

/* ---- Motion ------------------------------------------------------------ */

@keyframes sweep {
  0%, 100% { transform: translateY(-65px); opacity: 0.3; }
  50% { transform: translateY(65px); opacity: 1; }
}

/* ---- Responsive -------------------------------------------------------- */

@media (max-width: 760px) {
  .public-header { padding: 16px 18px; }

  main { display: block; padding: 48px 16px; }

  body[data-state='issued'] main { display: block; }

  .proof-intro { position: static; }

  .proof-intro > p { font-size: var(--text-s); }

  .trust-line { margin-bottom: 44px; }

  .verification-desk { padding: 22px 18px; }

  .camera-frame,
  .camera-frame video { min-height: 230px; height: 230px; }

  .certificate { margin-top: 24px; }

  .cert-head { flex-direction: column; gap: 14px; }

  .cert-number { align-items: flex-start; text-align: left; }

  .certificate h2 { max-width: none; }

  .certificate-fields { grid-template-columns: 1fr; }

  .certificate-fields div:nth-child(odd) { padding-right: 0; }

  .certificate-fields div:nth-child(even) { padding-left: 0; border-left: 0; }

  .cert-foot { flex-direction: column; align-items: flex-start; gap: 8px; }

  .public-footer { display: block; padding: 24px 18px 38px; }

  .public-footer nav { margin-top: 18px; flex-direction: column; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }

  #proof-field { display: none; }
}

/* ---- Paper ------------------------------------------------------------- */

/*
 * The certificate is portable: it must survive a slow phone, a printer, a
 * screenshot and a shared link (§9.16, §14.2). On paper the interface is not
 * the artifact — the record is. Everything that asks something of the reader
 * is withdrawn; what remains is the document's anatomy: the issue edge, the
 * number, the dateline, the mark, the verdict, the attested facts inside the
 * lens, and the signature of the office that issued it.
 */
@media print {
  @page {
    size: A4;
    margin: 15mm;
  }

  html,
  body {
    background: var(--paper-bright);
    color: var(--graphite);
    font-size: 10.5pt;
  }

  /* Interface chrome does not print: the desk, the camera, the sound control,
     the sign-in links, the ambient field, the way back to another check. */
  #proof-field,
  .public-header,
  .proof-intro,
  .verification-desk,
  .no-script,
  .public-footer,
  .cert-foot button {
    display: none !important;
  }

  main {
    display: block;
    max-width: none;
    margin: 0;
    padding: 0;
    gap: 0;
  }

  .certificate {
    grid-column: auto;
    margin: 0;
    border: 0;
    box-shadow: none;
    overflow: visible;
    background: var(--paper-bright);
    color: var(--graphite);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* The frame survives the printer: the datum down the left and along the
     foot, the clock track down the right, the perforation as the head rule.
     The inset frame is inherited unchanged — it is the document's own rule. */
  .cert-body {
    --cert-gutter: 8mm;
  }

  .cert-verdict { margin: 8mm 0 7mm; }

  .cert-mark svg { width: 22mm; height: 22mm; }

  .certificate h2 { font-size: 26pt; max-width: 20ch; }

  .verdict-supporting { font-size: 11pt; }

  .attestation {
    background: transparent;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .signatory,
  .next-steps,
  .cert-foot {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .signatory-name { font-size: 15pt; }

  /* A page break may not separate an attested fact from its label. */
  .certificate-fields,
  .certificate-fields div {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .cert-foot { margin-top: 8mm; }

  /* Nothing has been checked: print that sentence, not a blank sheet. */
  .certificate[hidden] ~ .print-nothing {
    display: block;
    font-family: var(--font-mono);
    font-size: 10.5pt;
    line-height: 1.6;
    color: var(--graphite);
  }
}
