/* Openhand design tokens.
   Theme lock: dark only, one accent, one radius rule.
   Radius rule: surfaces 16px, controls 10px, pills full. No exceptions.
   Color rule: one accent (signal green). Amber appears only as the semantic
   encoding for money leaving the wallet, never as decoration. */

@font-face { font-family: 'InterVar'; src: local('SF Pro Display'), local('Inter'); }

:root {
  --bg:        #0a0c0e;
  --bg-raise:  #111417;
  --bg-sink:   #07090a;
  --line:      #1e242a;
  --line-soft: #171c21;

  --ink:       #edf1f4;
  --ink-2:     #a3aeb8;
  --ink-3:     #6c7883;

  --accent:    #4ade9b;
  --accent-dk: #0f2b21;
  --out:       #e0a45c;

  --r-surface: 16px;
  --r-control: 10px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --shell: 1180px;

  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.shell { max-width: var(--shell); margin: 0 auto; padding: 0 28px; }
@media (max-width: 700px) { .shell { padding: 0 18px; } }

.mono {
  font-family: 'SF Mono', ui-monospace, 'JetBrains Mono', Menlo, monospace;
  font-feature-settings: 'tnum' 1;
}
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- type scale ---------- */
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.028em; line-height: 1.06; }
h1 { font-size: clamp(38px, 5.4vw, 62px); }
h2 { font-size: clamp(28px, 3.6vw, 40px); letter-spacing: -0.026em; line-height: 1.1; }
h3 { font-size: 18px; letter-spacing: -0.012em; line-height: 1.3; }
p  { margin: 0; }
.lede { font-size: 18px; color: var(--ink-2); max-width: 56ch; }
.body { font-size: 15.5px; color: var(--ink-2); max-width: 62ch; }
.small { font-size: 13.5px; color: var(--ink-3); }

.eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--ink-3); font-weight: 500;
}

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 40; height: 68px;
  display: flex; align-items: center;
  background: rgba(10, 12, 14, 0.82);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}
.nav.stuck { border-bottom-color: var(--line-soft); }
.nav .shell { display: flex; align-items: center; gap: 30px; width: 100%; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; letter-spacing: -0.02em; font-size: 16.5px; }
.brand-mark { width: 17px; height: 17px; border-radius: 999px; border: 2px solid var(--accent); position: relative; }
.brand-mark::after { content: ''; position: absolute; inset: 3.5px; border-radius: 999px; background: var(--accent); }
.nav-links { display: flex; gap: 26px; margin-left: auto; font-size: 14.5px; color: var(--ink-2); white-space: nowrap; }
.nav-links a:hover { color: var(--ink); }
@media (max-width: 780px) { .nav-links { display: none; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: var(--r-control);
  font-size: 14.5px; font-weight: 550; white-space: nowrap;
  border: 1px solid var(--line); background: var(--bg-raise); color: var(--ink);
  cursor: pointer; font-family: inherit;
  transition: transform 0.16s var(--ease), border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.btn:hover { border-color: #2c343c; background: #161a1e; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn-primary { background: var(--accent); color: #04140d; border-color: transparent; font-weight: 600; }
.btn-primary:hover { background: #62e7ab; border-color: transparent; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- surfaces ---------- */
.card {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--r-surface);
}
.pad { padding: 24px 26px; }

/* ---------- sections ---------- */
section { padding: clamp(56px, 7vw, 92px) 0; }
.rule { border-top: 1px solid var(--line-soft); }

/* ---------- reveal ----------
   Content is visible by default. The hidden state is applied only once the
   observer is confirmed working, so a failed or unsupported observer can never
   leave the page blank. */
.js-reveal .rv { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.js-reveal .rv.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js-reveal .rv { opacity: 1; transform: none; transition: none; }
}

/* ---------- ledger ---------- */
.ledger { width: 100%; border-collapse: collapse; }
.ledger th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.13em;
  color: var(--ink-3); font-weight: 500; padding: 0 12px 11px 0;
}
.ledger td { padding: 11px 12px 11px 0; border-top: 1px solid var(--line-soft); font-size: 14px; vertical-align: baseline; }
.ledger tr:hover td { background: rgba(255,255,255,0.014); }
.dir { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; }
.dir.in  { color: var(--accent); }
.dir.out { color: var(--out); }
.sig { color: var(--ink-3); font-size: 12.5px; border-bottom: 1px solid var(--line); }
.sig:hover { color: var(--accent); border-bottom-color: var(--accent); }
.muted { color: var(--ink-3); }

/* ---------- stats ---------- */
.stat-num { font-size: clamp(30px, 4vw, 40px); font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.stat-lab { font-size: 11px; text-transform: uppercase; letter-spacing: 0.13em; color: var(--ink-3); margin-bottom: 14px; }
.meter { height: 5px; border-radius: 999px; background: #1a1f24; overflow: hidden; margin-top: 16px; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.9s var(--ease); }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px;
  border-radius: 999px; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.1em; font-weight: 600; border: 1px solid var(--line); color: var(--ink-3);
}
.badge.live { color: var(--accent); border-color: #1d4536; background: var(--accent-dk); }
.badge.fb { color: var(--out); border-color: #3d3021; background: #241c11; }

details > summary { cursor: pointer; color: var(--ink-3); font-size: 13px; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary:hover { color: var(--ink-2); }
pre {
  margin: 12px 0 0; overflow-x: auto; background: var(--bg-sink);
  border: 1px solid var(--line-soft); border-radius: var(--r-control);
  padding: 15px 17px; font-size: 12px; line-height: 1.65; color: #93a2ae;
  font-family: 'SF Mono', ui-monospace, Menlo, monospace;
}

/* ---------- landing layouts ---------- */
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(32px, 5vw, 68px);
  align-items: center;
}

.logowall {
  border-top: 1px solid var(--line-soft);
  padding: 26px 0;
  display: flex; align-items: center;
  gap: clamp(26px, 6vw, 62px);
  flex-wrap: wrap;
  opacity: 0.6;
}

.problem-grid {
  display: grid;
  grid-template-columns: 1fr 0.7fr;
  gap: clamp(32px, 6vw, 76px);
  align-items: center;
}

.bento {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
  margin-top: 44px;
}
.bento .cell { display: flex; flex-direction: column; justify-content: space-between; gap: 24px; }

/* Every multi-column layout collapses explicitly, never by assumption. */
@media (max-width: 900px) {
  .hero-grid, .problem-grid, .bento { grid-template-columns: 1fr; }
  .problem-grid img { aspect-ratio: 16 / 10; }
  .bento { margin-top: 32px; }
}

/* ---------- full-bleed photograph ----------
   The scrim is what keeps the overlaid copy above WCAG AA on a photograph
   whose brightness is not under our control. */
.cause-shot { position: relative; margin: 0; isolation: isolate; }
.cause-shot img {
  width: 100%; height: clamp(430px, 62vh, 620px);
  object-fit: cover; object-position: center 42%;
  filter: saturate(0.82) brightness(0.82);
}
.cause-shot::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(7,9,10,0.95) 0%, rgba(7,9,10,0.82) 38%, rgba(7,9,10,0.28) 72%, rgba(7,9,10,0.5) 100%);
}
.cause-shot figcaption {
  position: absolute; inset: 0; z-index: 1;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  max-width: var(--shell); margin: 0 auto; padding: 0 28px;
}
.cause-shot figcaption > * { max-width: 46ch; }
@media (max-width: 700px) {
  .cause-shot img { height: 560px; }
  .cause-shot::after {
    background: linear-gradient(180deg, rgba(7,9,10,0.5) 0%, rgba(7,9,10,0.9) 45%, rgba(7,9,10,0.95) 100%);
  }
  .cause-shot figcaption { padding: 0 18px; justify-content: flex-end; padding-bottom: 40px; }
}

/* ---------- app shell ---------- */
.stat-row {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 16px;
}
.stage {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 18px 0; border-top: 1px solid var(--line-soft);
}
.stage:first-child { border-top: 0; padding-top: 0; }
.app-split {
  display: grid;
  grid-template-columns: 1fr 0.82fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .stat-row, .app-split { grid-template-columns: 1fr; }
}

audio { width: 100%; margin-top: 16px; height: 38px; }
audio::-webkit-media-controls-panel { background: var(--bg-sink); }

/* ---------- skeletons ----------
   Shaped like the content they replace, so nothing reflows on arrival. */
.sk { position: relative; overflow: hidden; background: #161b20; border-radius: 6px; }
.sk::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.045), transparent);
  animation: sweep 1.4s var(--ease) infinite;
}
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .sk::after { animation: none; } }
.sk-line { height: 11px; margin: 9px 0; }
.sk-num { height: 34px; width: 62%; }

/* ---------- trace ----------
   The core interaction. A figure opens into the rows that produce it, and the
   rows are summed in front of the reader so the total can be checked. */
.traceable {
  display: inline-flex; align-items: center; gap: 10px;
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; color: inherit; cursor: pointer; text-align: left;
}
.traceable .chev {
  width: 20px; height: 20px; flex: none; border-radius: 999px;
  border: 1px solid var(--line); display: grid; place-items: center;
  font-size: 10px; color: var(--ink-3);
  transition: transform 0.3s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.traceable:hover .chev { border-color: var(--accent); color: var(--accent); }
.traceable[aria-expanded='true'] .chev { transform: rotate(90deg); border-color: var(--accent); color: var(--accent); }
.traceable:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }

.trace {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 0.42s var(--ease);
}
.trace[data-open='true'] { grid-template-rows: 1fr; }
.trace > div { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .trace { transition: none; } }

.trace-inner { padding-top: 18px; margin-top: 18px; border-top: 1px dashed var(--line); }
.trace-row {
  display: grid; grid-template-columns: 1fr auto; gap: 12px;
  padding: 7px 0; font-size: 13px; align-items: baseline;
}
.trace-row + .trace-row { border-top: 1px solid var(--line-soft); }
.trace-sum {
  display: grid; grid-template-columns: 1fr auto; gap: 12px;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 13px; font-weight: 600;
}
.trace-check { font-size: 12px; margin-top: 10px; color: var(--accent); }
.trace-check.bad { color: var(--out); }

/* ---------- ledger controls ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  height: 30px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--ink-2);
  font: inherit; font-size: 13px; cursor: pointer;
  transition: border-color 0.16s var(--ease), color 0.16s var(--ease), background 0.16s var(--ease);
}
.chip:hover { color: var(--ink); border-color: #2c343c; }
.chip[aria-pressed='true'] { background: var(--accent-dk); border-color: #1d4536; color: var(--accent); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ledger tr.expandable { cursor: pointer; }
.ledger tr.expandable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.detail td { padding: 0 12px 0 0; border-top: 0; }
.detail-inner {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px; padding: 16px 0 20px;
}
.detail-k { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); }
.detail-v { font-size: 13px; margin-top: 5px; word-break: break-all; }

.copy {
  border: 0; background: none; padding: 0; margin-left: 8px; cursor: pointer;
  color: var(--ink-3); font: inherit; font-size: 12px; border-bottom: 1px solid var(--line);
}
.copy:hover { color: var(--accent); border-color: var(--accent); }

.empty { padding: 34px 0; text-align: center; }
.empty-title { font-size: 15px; font-weight: 600; }
.empty-body { font-size: 13.5px; color: var(--ink-3); margin-top: 7px; }

/* ---------- skip link ---------- */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 60;
  background: var(--accent); color: #04140d; padding: 11px 18px;
  border-radius: 0 0 var(--r-control) 0; font-size: 14px; font-weight: 600;
}
.skip:focus { left: 0; }

/* Evidence flow: use the existing tokens and keep long signatures contained. */
[hidden] { display: none !important; }
.table-wrap { overflow-x: auto; }
.journey-row + .journey-row { border-top: 1px solid var(--line-soft); margin-top: 20px; padding-top: 20px; }
.journey-row p { margin: 10px 0; line-height: 1.8; }
.journey-row a { overflow-wrap: anywhere; }
.evidence-list { padding-left: 20px; margin: 18px 0; }
.evidence-list li { margin: 12px 0; line-height: 1.65; }
.receipt-actions { display:flex; flex-wrap:wrap; gap:10px; margin:18px 0; }
#walletLine, #readStatus, #reconciliation, #claimResult { overflow-wrap:anywhere; }
#reconciliation { padding:26px; }
#journey .sig { display:inline-block; margin:4px 8px 4px 0; }
:root { --ink-3: #9ba7b2; }
@media (max-width:650px) { .table-wrap { padding:12px !important; } .ledger { min-width:600px; } .nav-links { display:none; } }
