/* Layout concept: a lender's collateral schedule. One ruled sheet per page, tables over cards,
   footnoted definitions, and red reserved for value that gets cut. Deliberately light-only. */
:root {
  --paper: #f5f6f8;      /* cool report paper */
  --sheet: #ffffff;      /* table and chart ground */
  --ink: #14213d;        /* primary text, collateral price, rules */
  --ink-2: #55607a;      /* secondary text */
  --ink-3: #78829a;      /* spot price series, faint figures (>= 3:1 on paper for large text) */
  --rule: #d5dae3;       /* hairlines */
  --cut: #c2362c;        /* haircuts: value a lender cannot count */
  --held: #a8670b;       /* circuit breaker holding a move */
  --hatch: #b9c1cf;      /* liquidity hatching */

  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body: "Public Sans", "Helvetica Neue", Arial, sans-serif;
  --fig: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);   /* strong ease-out for UI response */
  --ease-draw: cubic-bezier(0.16, 1, 0.3, 1);   /* exponential out, for the one drawn moment */
  --press: 160ms;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 400 16px/1.6 var(--body); -webkit-font-smoothing: antialiased;
  caret-color: var(--ink); accent-color: var(--ink); scrollbar-color: var(--hatch) var(--paper); }
::selection { background: var(--ink); color: var(--paper); }
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--hatch); text-underline-offset: 3px;
  text-decoration-thickness: 1px; transition: text-decoration-color 150ms ease; }
@media (hover: hover) and (pointer: fine) { a:hover { text-decoration-color: var(--ink); } }
.skip { position: absolute; left: max(16px, env(safe-area-inset-left, 0px)); top: -100px; z-index: 20; background: var(--ink); color: var(--paper);
  padding: 10px 14px; text-decoration: none; font-weight: 600; }
.skip:focus { top: calc(env(safe-area-inset-top, 0px) + 8px); }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.fig, td, .num { font-family: var(--fig); font-variant-numeric: tabular-nums; }
.quiet { color: var(--ink-2); }
.cut { color: var(--cut); }
sup { font: 500 10px var(--fig); color: var(--ink-2); margin-left: 2px; }

/* masthead */
.masthead { border-bottom: 2px solid var(--ink); background: var(--paper); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
.masthead-in { display: flex; align-items: baseline; gap: var(--s5); padding-block: var(--s4); flex-wrap: wrap; }
.wordmark { font: 800 22px/1 var(--display); font-stretch: 125%; letter-spacing: .02em; text-transform: uppercase; text-decoration: none; }
.tagline { color: var(--ink-2); font-size: 14px; }
nav { display: flex; gap: var(--s5); margin-left: auto; }
nav a { text-decoration: none; font-weight: 500; font-size: 15px; padding-bottom: 3px; border-bottom: 2px solid transparent;
  transition: border-color 150ms ease; }
nav a.on { border-bottom-color: var(--ink); }
@media (hover: hover) and (pointer: fine) { nav a:not(.on):hover { border-bottom-color: var(--hatch); } }
.net { font: 400 13px var(--body); color: var(--ink-2); }

main { padding-block: var(--s7) var(--s8); min-height: 70vh; }
h1, h2 { font-family: var(--display); font-stretch: 112%; letter-spacing: -.01em; text-wrap: balance; color: var(--ink); }
h1 { font-weight: 700; font-size: clamp(32px, 5.2vw, 56px); line-height: 1.02; margin: 0 0 var(--s4); max-width: 16ch; }
h2 { font-weight: 600; font-size: 20px; margin: 0; }
.lede { font-size: 18px; color: var(--ink-2); max-width: 60ch; margin: 0; }
.lede b { color: var(--ink); font-weight: 600; }
section { margin-top: var(--s8); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); flex-wrap: wrap;
  border-bottom: 1px solid var(--ink); padding-bottom: var(--s2); margin-bottom: var(--s4); }
.section-head .quiet { font-size: 14px; }

/* hero figure: liquidity vs exit depth, one row per token, each row on its own scale */
.depth-fig { margin-top: var(--s7); display: grid; gap: var(--s4); }
.depth-row { display: grid; grid-template-columns: 110px 1fr 150px; gap: var(--s2) var(--s4); align-items: center; }
.depth-row .t { font: 600 15px var(--body); }
.bars { display: grid; gap: 3px; }
.bar-liq { height: 14px; background: repeating-linear-gradient(135deg, var(--hatch) 0 1.5px, transparent 1.5px 6px); border: 1px solid var(--hatch); }
.bar-exit { height: 14px; background: var(--ink); transform-origin: left center; transform: scaleX(var(--r, 0));
  transition: transform 450ms var(--ease-out); }
.draw .bar-exit { animation: draw 900ms var(--ease-draw) both; animation-delay: var(--d, 0ms); }
@keyframes draw { from { transform: scaleX(0); } }
.depth-row .v { font: 400 13px/1.35 var(--fig); color: var(--ink-2); text-align: right; }
.depth-row .v b { color: var(--ink); font-weight: 500; }
.depth-key { display: flex; gap: var(--s5); font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.depth-key i { display: inline-block; width: 22px; height: 10px; vertical-align: -1px; margin-right: var(--s2); }
.depth-key .k-liq { background: repeating-linear-gradient(135deg, var(--hatch) 0 1.5px, transparent 1.5px 6px); border: 1px solid var(--hatch); }
.depth-key .k-exit { background: var(--ink); }

/* tables */
.table-wrap { overflow-x: auto; background: var(--sheet); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--rule); }
th { font: 500 12px var(--body); color: var(--ink-2); vertical-align: bottom; }
th:first-child, td:first-child { text-align: left; }
td { font-size: 14px; }
tbody tr:last-child td { border-bottom: 0; }
td.tok { font: 600 15px var(--body); }
tr.link { cursor: pointer; }
tr.link td { transition: background-color 150ms ease; }
@media (hover: hover) and (pointer: fine) {
  tr.link:hover td { background: #eef1f6; }
  tr.link:hover td.tok a { text-decoration-color: var(--ink); }
}
td.tok a { text-decoration-color: transparent; }
.status { font: 500 12px var(--fig); white-space: nowrap; }
.status::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px; background: var(--ink); vertical-align: 0; }
.status.held::before { background: var(--held); }
.status.held { color: var(--held); }
.status.confirmed-jump::before { background: transparent; border: 1.5px solid var(--ink); }
.status.stale { color: var(--cut); }
.status.stale::before { background: var(--cut); }
.status.pending { color: var(--ink-2); }
.status.pending::before { background: transparent; border: 1.5px dashed var(--ink-3); }
.mintref { font: 400 12px var(--fig); color: var(--ink-2); }
/* messages inside tables wrap and read as text, not figures */
td.err, td.note { white-space: normal; text-align: left; font-family: var(--body); }
td.note { color: var(--ink-2); padding-block: var(--s5); }
.cell-msg { display: block; position: sticky; left: 14px; max-width: min(70ch, calc(100vw - 64px)); }
.note-block { margin: var(--s6) 0 0; padding: var(--s4) 0; border-top: 1px solid var(--ink); color: var(--ink-2); max-width: 60ch; }
.fig-note { margin: 0; font-size: 13px; color: var(--ink-2); }
.chart-empty { margin: 0; height: 100%; display: grid; place-items: center; font-size: 14px; color: var(--ink-2); }
.source { font-size: 13px; color: var(--ink-2); margin: var(--s2) 0 0; }
.notes { margin: var(--s5) 0 0; padding: 0; list-style: none; display: grid; gap: var(--s2); font-size: 14px; color: var(--ink-2); max-width: 78ch; }
.notes li { display: grid; grid-template-columns: 22px 1fr; }
.notes sup { margin: 0; font-size: 11px; line-height: 1.9; }

/* feed sheet */
.crumb { font-size: 14px; color: var(--ink-2); margin-bottom: var(--s3); }
.sheet-title { display: flex; align-items: baseline; gap: var(--s4); flex-wrap: wrap; }
.ids { display: grid; gap: 2px; font: 400 12px var(--fig); color: var(--ink-2); margin-top: var(--s2); overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--ink); margin-top: var(--s6); }
.kv div { padding: var(--s3) var(--s4) var(--s3) 0; border-bottom: 1px solid var(--rule); }
.kv dt { font-size: 13px; color: var(--ink-2); }
.kv dd { margin: 2px 0 0; font: 500 20px var(--fig); font-variant-numeric: tabular-nums; }
.kv dd small { display: block; font: 400 12px var(--body); color: var(--ink-2); margin-top: 2px; }
.chart-sheet { background: var(--sheet); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: var(--s4) var(--s4) var(--s2); }
.chart { height: 340px; }
.chart.short { height: 150px; }
.legend { display: flex; gap: var(--s5); flex-wrap: wrap; font-size: 13px; color: var(--ink-2); margin-bottom: var(--s3); }
.legend i { display: inline-block; width: 18px; height: 2px; vertical-align: middle; margin-right: var(--s2); }
.legend .k-jump { width: 0; height: 0; background: none; border: 5px solid transparent; border-top: 7px solid var(--ink); border-bottom: 0; vertical-align: 1px; }
.legend .meta { margin-left: auto; font-family: var(--fig); font-size: 12px; }
.loading { color: var(--ink-2); padding: var(--s6) 0; font-size: 14px; }
.skel { display: inline-block; height: 12px; width: 64px; background: linear-gradient(90deg, #e7eaf0 0 40%, #f0f2f6 50%, #e7eaf0 60% 100%);
  background-size: 300% 100%; animation: shimmer 1.4s linear infinite; vertical-align: middle; }
.skel.w-s { width: 40px; } .skel.w-l { width: 96px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.err { color: var(--cut); padding: var(--s4) 0; font-size: 14px; }

/* borrow: the haircut ledger */
.borrow { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: var(--s7); margin-top: var(--s7); align-items: start; }
.terms { display: grid; gap: var(--s5); position: sticky; top: 96px; }
.terms label { display: grid; gap: var(--s1); font-size: 13px; color: var(--ink-2); }
select, input { font: 500 18px var(--fig); color: var(--ink); background: var(--sheet); border: 1px solid var(--rule); border-bottom: 2px solid var(--ink);
  border-radius: 0; padding: 10px 12px; width: 100%; appearance: none; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: right 18px center, right 13px center; background-size: 5px 5px; background-repeat: no-repeat; }
.presets { display: flex; gap: var(--s2); flex-wrap: wrap; }
.presets button { font: 400 13px var(--fig); color: var(--ink); background: transparent; border: 1px solid var(--rule); padding: 6px 10px; cursor: pointer;
  min-height: 34px; transition: border-color 150ms ease, transform var(--press) var(--ease-out); }
.presets button:active { transform: scale(0.97); }
.presets button[aria-pressed="true"] { border-color: var(--ink); background: var(--sheet); }
@media (hover: hover) and (pointer: fine) { .presets button:hover { border-color: var(--ink); } }
@media (pointer: coarse) { .presets button, nav a { min-height: 44px; display: inline-flex; align-items: center; } .presets button { padding-inline: 14px; } }
select:disabled, input:disabled, .presets button:disabled { opacity: .5; cursor: not-allowed; }
.terms p { font-size: 13px; color: var(--ink-2); margin: 0; }
#out { transition: filter 200ms ease, opacity 200ms ease; }
#out.busy { filter: blur(2px); opacity: .6; }
.verdict { display: grid; grid-template-columns: 1fr 1fr; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); }
.verdict > div { padding: var(--s4) var(--s4) var(--s4) 0; }
.verdict > div + div { padding-left: var(--s4); border-left: 1px solid var(--rule); }
.verdict .k { font-size: 13px; color: var(--ink-2); }
.verdict .v { font: 700 clamp(30px, 4.2vw, 44px)/1.1 var(--display); font-stretch: 112%; font-variant-numeric: tabular-nums; margin-top: var(--s1); }
.verdict .naive .v { color: var(--ink-3); }
.verdict .s { font-size: 13px; color: var(--ink-2); margin-top: var(--s1); }
.recover { margin-top: var(--s5); }
.recover .bar-liq, .recover .bar-exit { height: 18px; }
.recover .bar-exit { margin-top: 3px; }
.recover .cap { display: flex; justify-content: space-between; font: 400 12px var(--fig); color: var(--ink-2); margin-top: var(--s1); gap: var(--s4); }
.ledger { width: 100%; margin-top: var(--s6); border-collapse: collapse; }
.ledger td { font-size: 15px; padding: 11px 0; border-bottom: 1px solid var(--rule); white-space: normal; vertical-align: top; }
/* hanging indent: the operator sits in the gutter, so wrapped labels line up with the first line */
.ledger td:first-child { font-family: var(--body); padding-right: var(--s4); padding-left: 18px; position: relative; }
.ledger td:last-child { text-align: right; white-space: nowrap; }
.ledger .op { position: absolute; left: 0; color: var(--ink-2); font-family: var(--fig); }
.ledger .why { display: block; font-size: 13px; color: var(--ink-2); }
.ledger tr.sub td { border-bottom: 1px solid var(--ink); font-weight: 600; }
.ledger tr.total td { border-bottom: 3px double var(--ink); font-weight: 600; font-size: 17px; }
.exposure { margin-top: var(--s5); padding: var(--s3) var(--s4); border: 1px solid rgb(194 54 44 / .35); background: rgb(194 54 44 / .04); font-size: 15px; max-width: 64ch; }
.exposure .tag { font: 600 12px var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--cut); margin-right: var(--s2); }

/* method */
.method { max-width: 70ch; }
.method ol { padding-left: 1.3em; margin: 0; display: grid; gap: var(--s4); }
.method li::marker { font: 500 14px var(--fig); color: var(--ink-2); }
.method li b { display: block; font-weight: 600; }
.method p { color: var(--ink-2); margin: 0 0 var(--s4); }
.params td:first-child { font-family: var(--body); font-size: 14px; }
.params td:last-child { text-align: left; font-family: var(--body); color: var(--ink-2); white-space: normal; }
code { font: 400 .9em var(--fig); background: #e9ecf1; padding: 1px 5px; }

.colophon { border-top: 1px solid var(--ink); }
.colophon-in { padding-block: var(--s5) var(--s7); display: grid; gap: var(--s1); font-size: 14px; color: var(--ink-2); }
.colophon p { margin: 0; }
.colophon b { color: var(--ink); font-weight: 600; }
.colophon .fig { font-size: 12px; }

@media (max-width: 860px) {
  nav { margin-left: 0; order: 4; flex-basis: 100%; }
  .tagline { display: none; }
  .net { margin-left: auto; }
  .borrow { grid-template-columns: minmax(0, 1fr); gap: var(--s6); }
  .terms { position: static; }
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .depth-row { grid-template-columns: 1fr auto; }
  .depth-row .bars { grid-column: 1 / -1; grid-row: 2; }
  .chart { height: 260px; }
}
@media (max-width: 480px) {
  .verdict { grid-template-columns: 1fr; }
  .verdict > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); }
}
@media (prefers-reduced-motion: reduce) {
  /* fewer and gentler: keep colour and opacity changes, drop movement */
  .draw .bar-exit, .skel { animation: none; }
  .bar-exit, .presets button { transition: none; }
  .presets button:active { transform: none; }
  #out.busy { filter: none; }
}

/* the skip link focuses the content container; it is not a control, so no ring */
main:focus { outline: none; }
