/*
 * The public verify page (BRIEF v2, ADR-0038). Served from /brand/verify with a
 * content-hashed name, so the 30-day cache in front of /brand never serves a
 * stale sheet. Tokens shared with the dossier PDF; light theme only.
 */
:root {
  --ink: #101d16;
  --paper: #f6f7f4;
  --card: #ffffff;
  --line: #e2e6df;
  --muted: #5b675e;
  --verified: #1e7a4e;
  --verified-bg: #eaf4ee;
  --unmeasured: #7d5615;
  --unmeasured-bg: #f8f1e2;
  --failed: #a4392f;
  --failed-bg: #f9e9e6;
  --brand: #1A2942;
  --radius: 14px;
  --mono: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Roboto Flex", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Roboto Serif", Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--sans); background: var(--paper); color: var(--ink);
  font-size: 15.5px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
/* Scripts reveal their controls by clearing hidden: no class display may win over it. */
[hidden] { display: none !important; }
a:focus-visible, button:focus-visible, summary:focus-visible, video:focus-visible {
  outline: 2px solid var(--verified); outline-offset: 2px; border-radius: 6px;
}
.wrap { max-width: 680px; margin: 0 auto; padding: 0 16px 56px; }

/* header */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--line); margin-bottom: 16px;
}
.lockup-link { display: inline-flex; text-decoration: none; }
.lockup-link .seal { width: 30px; height: 30px; }
.lang { display: flex; gap: 2px; font-size: 13px; }
.lang a {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; border-radius: 8px; text-decoration: none; color: var(--muted);
}
.lang a[aria-current] { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }

.refline {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin-bottom: 12px;
}
.chip-btn {
  font-family: var(--sans); font-size: 12.5px; border: 1px solid var(--line); background: var(--card);
  border-radius: 8px; padding: 0 12px; min-height: 36px; cursor: pointer; color: var(--ink);
}
.chip-btn:hover { border-color: var(--muted); }

/* verdict card */
.verdict {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 20px 16px; box-shadow: 0 1px 2px rgba(16, 29, 22, .05);
}
.tone-verified { --tone: var(--verified); --tone-bg: var(--verified-bg); }
.tone-ink { --tone: var(--ink); --tone-bg: var(--paper); }
.tone-failed { --tone: var(--failed); --tone-bg: var(--failed-bg); }
.tone-amber { --tone: var(--unmeasured); --tone-bg: var(--unmeasured-bg); }
.verdict-top { display: flex; gap: 16px; align-items: center; }
.verdict-seal { flex: 0 0 76px; width: 76px; height: 76px; }
.verdict-seal svg { width: 100%; height: 100%; display: block; }
.verdict-seal .ring { fill: none; stroke: var(--tone); stroke-width: 3; stroke-dasharray: 245; stroke-dashoffset: 245; animation: draw 1s ease-out .1s forwards; }
.verdict-seal .ring-in { fill: none; stroke: var(--tone); stroke-width: 1; opacity: .4; }
.verdict-seal .mark { fill: none; stroke: var(--tone); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .45s ease-out .95s forwards; }
.verdict-seal text { fill: var(--tone); font-family: var(--serif); font-weight: 600; font-size: 40px; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.verdict h1 { font-family: var(--serif); font-weight: 600; font-size: 25px; line-height: 1.18; text-wrap: balance; }
.verdict.tone-failed h1 { color: var(--failed); }
.fact { margin-top: 6px; font-size: 14.5px; color: var(--muted); line-height: 1.45; }
.facts {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line);
}
.facts dt { font-size: 12.5px; color: var(--muted); }
.facts dd { font-size: 14px; font-weight: 500; line-height: 1.35; }
.facts dd small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.rubric-custom {
  margin-top: 12px; padding: 9px 11px; font-size: 12.5px; color: var(--muted);
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
}
.rubric-custom strong { color: var(--ink); font-weight: 600; }
.signals { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.signals-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0 12px; font-size: 13.5px; }
.signals-head strong { font-weight: 600; }
.signals-note { font-size: 12.5px; color: var(--muted); }
.text-link {
  display: inline-flex; align-items: center; min-height: 44px; font-size: 13px;
  color: var(--verified); font-weight: 500; text-decoration: none;
}
.text-link:hover { text-decoration: underline; }
.scope-line {
  margin-top: 6px; font-size: 13px; color: var(--muted); background: var(--paper);
  border-radius: 10px; padding: 9px 11px;
}
.scope-line a { color: var(--ink); text-underline-offset: 3px; }

/* sections */
.section { margin-top: 30px; }
.section > h2 {
  font-family: var(--serif); font-weight: 600; font-size: 18px; line-height: 1.25; margin-bottom: 10px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.section > h2 .count { font-family: var(--sans); font-size: 13px; font-weight: 500; color: var(--muted); }
.section-lede { font-size: 13.5px; color: var(--muted); margin-bottom: 10px; }
.banner {
  font-size: 12.5px; line-height: 1.4; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-left: 3px solid var(--tone, var(--muted)); border-radius: 8px;
  padding: 8px 10px; margin-bottom: 10px;
}

/* files */
.files { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.file { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
/* The badges are positioned against this container, so a video and an
   unpreviewable format carry them as a photograph does. */
.media { position: relative; }
.thumb { position: relative; display: block; }
.thumb img, .file video { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; background: var(--ink); }
.file video { object-fit: contain; }
.thumb-badge {
  position: absolute; left: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 5px;
  background: rgba(16, 29, 22, .84); color: #fff; font-size: 11.5px; border-radius: 999px; padding: 3px 9px;
}
.thumb-badge.warn { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.thumb-badge svg { width: 11px; height: 11px; }
.media-unavailable { font-size: 13px; color: var(--muted); padding: 18px 14px; border-bottom: 1px dashed var(--line); }
.file-body { padding: 10px 12px 12px; font-size: 13px; }
.file-name { font-weight: 600; }
.hash { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 4px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.copy-hash { font-family: var(--sans); font-size: 12px; border: none; background: none; color: var(--verified); cursor: pointer; min-height: 32px; }
/* A complementary analysis wears no state colour: it neither passes nor fails. */
.analysis {
  margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--paper);
  border: 1px solid var(--line); font-size: 12.5px; line-height: 1.45; color: var(--muted);
}
.analysis-label { display: block; color: var(--ink); font-weight: 500; }
.more-files { margin-top: 12px; }
.more-files > summary { list-style: none; cursor: pointer; min-height: 44px; display: flex; align-items: center; font-size: 13.5px; font-weight: 500; color: var(--verified); }
.more-files > summary::-webkit-details-marker { display: none; }
.more-files[open] > summary { margin-bottom: 8px; }
.media-empty { font-size: 13.5px; color: var(--muted); }
/* compare a received file (BRIEF v2 §5.2). CONTRACT with file-compare.js: it
   reveals .compare-pick, writes « compare-result ok|no|computing », and toggles
   .drag on #file-compare. */
.compare { margin-top: 12px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 0 16px; }
.compare > summary {
  list-style: none; cursor: pointer; min-height: 52px; display: flex; align-items: center;
  justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 600;
}
.compare > summary::-webkit-details-marker { display: none; }
.compare.drag { border-color: var(--verified); background: var(--verified-bg); }
.compare-body { padding: 0 0 14px; font-size: 13px; color: var(--muted); }
.compare-pick { align-items: center; }
.compare-pick:has(input:focus-visible) label { outline: 2px solid var(--verified); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.compare-result { margin-top: 10px; font-size: 13.5px; line-height: 1.45; color: var(--ink); }
.compare-result:empty { display: none; }
.compare-result.ok { color: var(--verified); font-weight: 500; }
.compare-list-title { margin-top: 12px; color: var(--ink); font-weight: 500; }
.compare-list { list-style: none; display: grid; gap: 6px; margin: 4px 0 8px; }
.compare-list li { display: grid; gap: 2px; }
.compare-list code { font-family: var(--mono); font-size: 11.5px; word-break: break-all; }

/* controls */
.controls { list-style: none; display: grid; gap: 10px; }
.control { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 4px; }
.control-row { display: grid; grid-template-columns: 28px 1fr auto; gap: 2px 12px; align-items: start; }
.state-icon { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--s-bg); color: var(--s); }
.state-icon svg { width: 15px; height: 15px; }
.control h3 { font-size: 15px; font-weight: 600; line-height: 1.3; padding-top: 3px; }
.state-label { font-size: 12.5px; font-weight: 600; color: var(--s); white-space: nowrap; padding-top: 5px; }
.control-result { grid-column: 2 / 4; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.control-subline { grid-column: 2 / 4; font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-top: 2px; }
.control-signer { grid-column: 2 / 4; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.s-verified { --s: var(--verified); --s-bg: var(--verified-bg); }
.s-not_measured { --s: var(--muted); --s-bg: var(--paper); }
.s-failed { --s: var(--failed); --s-bg: var(--failed-bg); }
.s-in_progress { --s: var(--unmeasured); --s-bg: var(--unmeasured-bg); }
/* Coherence pill, heading the sealing-time drawer. CONTRACT with merkle-check.js:
   it overwrites className with « check ok|fail|error », so the base look lives on .check. */
.check {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
  font-size: 12.5px; font-weight: 500; color: var(--muted); background: var(--paper);
  border-radius: 8px; padding: 5px 10px;
}
.check.ok { color: var(--verified); background: var(--verified-bg); }
.check.fail { color: var(--failed); background: var(--failed-bg); }
.check.error { color: var(--muted); background: var(--paper); }
/* Bitcoin check on click. CONTRACT with bitcoin-check.js: it reveals #bitcoin-check
   and writes « bitcoin-check-result ok|inconclusive|checking ». */
.bitcoin-check { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.bitcoin-check .btn { margin: 4px 0 2px; }
.bitcoin-check-result { margin-top: 6px; font-size: 13px; line-height: 1.45; color: var(--ink); }
.bitcoin-check-result:empty { display: none; }
.bitcoin-check-result.ok { color: var(--verified); font-weight: 500; }
.bitcoin-check-result.inconclusive { color: var(--unmeasured); }
.yourself { grid-column: 1 / 4; margin-top: 8px; border-top: 1px solid var(--line); }
.yourself > summary {
  list-style: none; cursor: pointer; min-height: 44px; display: flex; align-items: center;
  justify-content: space-between; font-size: 13.5px; font-weight: 500; color: var(--verified);
}
.yourself > summary::-webkit-details-marker { display: none; }
.chev { transition: transform .2s; color: var(--muted); }
details[open] > summary .chev { transform: rotate(90deg); }
.yourself-body { padding: 2px 0 12px; font-size: 13.5px; color: var(--muted); }
.yourself-body h4 { font-size: 13.5px; color: var(--ink); font-weight: 600; margin: 12px 0 3px; }
.yourself-body h4:first-child { margin-top: 2px; }
.yourself-body p { margin-bottom: 8px; }
.howto { font-size: 12.5px; word-break: break-word; }
/* printed procedure (BRIEF v2 R4). CONTRACT with the golden pages job: see fragments/verify-procedure. */
.procedure { margin: 6px 0 10px; }
.procedure .procedure-label { font-size: 12px; color: var(--muted); margin: 6px 0 3px; }
.cmd {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.5; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; overflow-x: auto; white-space: pre;
}
.cmd-expected { color: var(--muted); }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 13px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--paper); color: var(--ink); font-size: 13px; font-weight: 500;
  text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }

/* keep */
.keep-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.keep-card p { font-size: 13px; color: var(--muted); }
.keep-card .btnrow { margin-top: 0; }
.keep-card .when { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12.5px; }

/* technical details */
.technical { margin-top: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.technical > summary {
  list-style: none; cursor: pointer; min-height: 52px; padding: 0 16px; display: flex; align-items: center;
  justify-content: space-between; font-weight: 600; font-size: 15px;
}
.technical > summary::-webkit-details-marker { display: none; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; padding: 4px 16px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { color: var(--ink); min-width: 0; }
.kv .mono { font-family: var(--mono); font-size: 11.5px; word-break: break-all; }
.kv a { color: var(--verified); display: inline-flex; min-height: 32px; align-items: center; margin-right: 12px; }
.kv .media-heading { font-weight: 600; color: var(--ink); }
.verify-map { position: relative; display: block; margin: 10px 0 0; }
.verify-map img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); }
/* Symbolic zone ring drawn over the tile — dashed to read as approximate, never
   a precise fix. Its 42% width is a deliberate, out-of-scale visual balance, not
   a measured radius; the real "~11 km" precision lives in the label beside it. */
.verify-map__zone { position: absolute; top: 50%; left: 50%; width: 42%; aspect-ratio: 1; transform: translate(-50%, -50%); border: 2px dashed var(--muted); border-radius: 50%; background: color-mix(in srgb, var(--ink) 6%, transparent); pointer-events: none; }
.verify-map__zone::after { content: ""; position: absolute; top: 50%; left: 50%; width: 6px; height: 6px; transform: translate(-50%, -50%); border-radius: 50%; background: var(--ink, #101d16); }
.attention { color: var(--failed); font-weight: 600; }
.freshness { padding: 0 16px 14px; font-size: 12px; color: var(--muted); }

/* scope */
.scope-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.scope-grid > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.scope-grid h3 { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.scope-grid ul { list-style: none; display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.scope-grid li { padding-left: 16px; position: relative; }
.scope-grid li::before { content: "–"; position: absolute; left: 0; color: var(--muted); }
.scope-grid .establishes li::before { content: "✓"; color: var(--verified); }
.scope-limit { margin-top: 10px; font-size: 13px; color: var(--muted); }
.scope-limit strong { color: var(--ink); font-weight: 600; }

/* store + about */
.store {
  margin-top: 26px; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--card);
}
.store p { font-size: 13px; color: var(--muted); }
.store strong { display: block; color: var(--ink); font-size: 14px; }
.badge-store {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 13px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--paper); color: var(--ink); font-size: 13px; font-weight: 500; text-decoration: none;
}
.store-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.store-badge { display: inline-block; line-height: 0; border-radius: 8px; }
.store-badge img { height: 40px; width: auto; display: block; }
.store-badge:focus-visible { outline: 2px solid var(--verified); outline-offset: 3px; }
.about { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); display: grid; gap: 8px; }
.about .official { color: var(--ink); font-size: 13px; }
.about .links { display: flex; gap: 4px 14px; flex-wrap: wrap; }
.about .links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); text-underline-offset: 3px; }

@media (max-width: 540px) {
  .verdict h1 { font-size: 22px; }
  .verdict-seal { flex-basis: 64px; width: 64px; height: 64px; }
  .facts { gap: 8px 10px; }
  .facts dd { font-size: 13px; }
  .scope-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dt { margin-top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .verdict-seal .ring, .verdict-seal .mark { animation: none; stroke-dashoffset: 0; }
  * { transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  body { background: #fff; }
  .wrap { max-width: none; padding: 16px; }
  /* Paper has no scrollbar: a command that overflows is a command the reader
     cannot retype, fingerprint included (BRIEF v2 R4). */
  .cmd { white-space: pre-wrap; word-break: break-all; overflow-x: visible; }
  /* Drawers are opened for printing by verify-page.js; without JavaScript
     nothing would open them, and the paper would carry none of the procedure,
     the sealed fingerprints or the technical details. */
  details > *:not(summary) { display: block !important; }
  .lang, .chip-btn, .copy-hash, .store, #evidiq-print, .compare-pick, .compare-result, .bitcoin-check { display: none !important; }
  .verdict-seal .ring, .verdict-seal .mark { animation: none; stroke-dashoffset: 0; }
  .about a[href^="http"]::after { content: " (" attr(href) ")"; }
}
