/* ==========================================================================
   rill — vouch staking: the curator board (/curators → curators/index.html,
   js/board.js) and the vouch block on a curator's page (/c/<pubkey>,
   js/curator.js). loaded after styles.css (tokens, font, buttons, tags,
   circles, toast) and trail.css (top bar, kicker, footer, ca button, the
   curator page's .cp- layout). every rule here is scoped to body.boardpage,
   a .bd- class, or the curator page's .cp-vouch block.
   ========================================================================== */

.bd { width: 100%; }
.bd-view {
  flex: 1 0 auto; width: 100%; max-width: var(--maxw); margin: 0 auto;
  padding: 0 var(--gutter) clamp(56px, 8vw, 104px);
}
.bd-muted, .bd-none { color: var(--ink-2); }
.bd-nw { white-space: nowrap; }
.bd-sep { color: var(--ink-3); white-space: pre; }
.bd-link {
  display: inline-flex; gap: 8px; align-items: baseline;
  font-size: 12.5px; letter-spacing: .06em; color: var(--ink);
  border-bottom: 1px solid var(--ink); padding-bottom: 1px;
  transition: color .15s, border-color .15s;
}
.bd-link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.bd-dot {
  display: inline-block; width: 6px; height: 6px; margin-right: 9px; border-radius: 50%;
  background: var(--accent); vertical-align: .12em;
}
@media (prefers-reduced-motion: no-preference) { .bd-dot { animation: bd-blink 1.1s ease-in-out infinite; } }
@keyframes bd-blink { 50% { opacity: .25; } }

/* ---------- header ---------- */
.bd-head { padding: clamp(36px, 6vw, 72px) 0 clamp(30px, 4vw, 48px); }
.bd-title {
  margin-top: 14px;
  font-size: clamp(38px, 5.6vw, 72px); font-weight: 300; line-height: 1.02; letter-spacing: .01em;
}
.bd-lede {
  margin-top: 20px; max-width: 64ch;
  font-size: clamp(14px, 1.15vw, 16px); line-height: 1.7; letter-spacing: .02em; color: var(--ink);
  text-wrap: pretty;
}
.bd-noscript { margin-top: 16px; font-size: 13px; line-height: 1.6; }
.bd-noscript a { border-bottom: 1px solid var(--ink); }

/* ---------- totals: three figures, one size (--len: the longest, set by js/board.js) ---------- */
.bd-totals { border-top: 1px solid var(--ink); }
.bd-totals[hidden] { display: none; }
.bd-sums {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0;
  container-type: inline-size; --cell: calc(33.33cqi - 48px);
}
.bd-sum { min-width: 0; padding: 22px 24px 24px 0; }
.bd-sum + .bd-sum { padding-left: 24px; border-left: 1px solid var(--hair); }
.bd-sum dt { font-size: var(--t-xs); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.bd-sum dd {
  --n: clamp(30px, 3.6vw, 52px);
  display: flex; align-items: flex-end; margin: 14px 0 0; min-width: 0; min-height: calc(var(--n) * 1.05);
}
.bd-sum__n {
  font-size: var(--n); font-weight: 300; line-height: 1.05; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
@supports (width: 1cqi) {
  .bd-sum__n { font-size: min(var(--n), var(--cell) / (.64 * var(--len, 6))); }
}
.bd-sum.is-none .bd-sum__n { color: var(--ink-2); }
.bd-totals__note {
  padding: 12px 0 0; border-top: 1px solid var(--hair);
  font-size: 11.5px; line-height: 1.6; letter-spacing: .04em; color: var(--ink-2); font-variant-numeric: tabular-nums;
}

/* ---------- your vouch (a connected wallet): a labelled row like the ledger's treasury ---------- */
.bd-you {
  display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 10px 24px; align-items: baseline;
  margin-top: clamp(32px, 4vw, 48px); padding: 18px 0 20px;
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--hair);
}
.bd-you[hidden] { display: none; }
.bd-you__label { justify-self: start; font-size: var(--t-xs); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); font-weight: 400; }   /* start: its focus ring hugs the words */
.bd-you__main { min-width: 0; }
.bd-you__body {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px;
}
.bd-you__line { min-width: 0; flex: 1 1 32ch; font-size: 14px; line-height: 1.6; letter-spacing: .03em; font-variant-numeric: tabular-nums; }
.bd-you__sub { flex-basis: 100%; order: 3; margin-top: -6px; font-size: 11.5px; line-height: 1.6; letter-spacing: .04em; color: var(--ink-2); }
.bd-you__key { color: var(--ink); border-bottom: 1px solid var(--ink); padding-bottom: 1px; transition: color .15s, border-color .15s; }
.bd-you__key:hover { color: var(--accent); border-bottom-color: var(--accent); }
.bd-you__w { color: var(--accent); }
.bd-you__acts { display: flex; flex-wrap: wrap; gap: 8px; }
.bd-you__acts .btn { min-width: 96px; }
.bd-you__acts .btn[aria-busy="true"] { opacity: .6; cursor: progress; }
.bd-you__un:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.bd-you__status { margin-top: 10px; font-size: 12px; line-height: 1.6; letter-spacing: .04em; color: var(--ink); }
.bd-you__status:empty { display: none; }
.bd-you__status.is-error { color: var(--accent); }

/* ---------- storage off ---------- */
.bd-off {
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  padding: clamp(44px, 6vw, 72px) 16px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--hair);
}
.bd-off[hidden] { display: none; }
.bd-off .empty__mark { width: 11px; height: 11px; }
.bd-off__line { font-size: clamp(17px, 1.6vw, 21px); letter-spacing: .03em; }
.bd-off__sub { max-width: 52ch; font-size: 13px; line-height: 1.7; letter-spacing: .03em; color: var(--ink-2); text-wrap: balance; }

/* ---------- the board ---------- */
.bd-board { margin-top: clamp(44px, 5.5vw, 72px); min-width: 0; }
.bd-board[hidden] { display: none; }
.bd-board__head { padding-bottom: 6px; }
.bd-board__head h2:focus, .bd-you__label:focus { outline: none; }
.bd-board__head h2:focus-visible, .bd-you__label:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }
.bd-board__meta { font-variant-numeric: tabular-nums; }
.bd-board__meta:empty { display: none; }

.bd-loading, .bd-error {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 28px 0;
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--hair);
  font-size: 12.5px; letter-spacing: .06em; color: var(--ink-2);
}
.bd-loading[hidden], .bd-error[hidden] { display: none; }
.bd-error { color: var(--ink); }
.bd-error .btn[aria-busy="true"] { opacity: .6; cursor: progress; }

.bd-empty {
  display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
  padding: clamp(40px, 6vw, 64px) 16px clamp(42px, 6vw, 66px);
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--hair);
}
.bd-empty[hidden] { display: none; }
.bd-empty .empty__mark { width: 11px; height: 11px; }
.bd-empty__line { max-width: 50ch; font-size: 13.5px; line-height: 1.7; letter-spacing: .03em; color: var(--ink-2); text-wrap: balance; }

.bd-fine { margin-top: 14px; max-width: 80ch; font-size: 11.5px; line-height: 1.6; letter-spacing: .04em; color: var(--ink-2); }
.bd-view[data-state="loading"] .bd-fine, .bd-view[data-state="error"] .bd-fine { display: none; }

/* the table (desktop) */
.bd-table { width: 100%; border-collapse: collapse; font-size: 13px; letter-spacing: .03em; border-top: 1px solid var(--ink); }
.bd-table[hidden] { display: none; }
.bd-table th {
  padding: 11px 12px 9px; border-bottom: 1px solid var(--hair); text-align: left; white-space: nowrap;
  font-weight: 400; font-size: var(--t-xs); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2);
}
.bd-table td { padding: 14px 12px; border-bottom: 1px solid var(--hair); vertical-align: middle; font-variant-numeric: tabular-nums; }
.bd-table th:first-child, .bd-table td:first-child { padding-left: 0; }
.bd-table th:last-child, .bd-table td:last-child { padding-right: 0; }
.bd-table .bd-c-rank { width: 56px; }
.bd-table .bd-c-num { text-align: right; white-space: nowrap; width: 9%; }
.bd-table .bd-c-weight { width: 26%; }
.bd-table .bd-c-rew { text-align: right; }
.bd-row { transition: background-color .15s; }
.bd-row:hover { background: #fafaf8; }

.bd-rank { font-weight: 400; }
.bd-row:first-child .bd-rank { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.bd-row.is-yours .bd-rank { border-color: var(--accent); color: var(--accent); background: var(--paper); }
.bd-row.is-yours:first-child .bd-rank { background: var(--accent); color: #fff; }

.bd-c-key { white-space: nowrap; }
.bd-key { font-size: 14px; letter-spacing: .04em; color: var(--ink); border-bottom: 1px solid var(--ink); padding-bottom: 1px; transition: color .15s, border-color .15s; }
.bd-key:hover { color: var(--accent); border-bottom-color: var(--accent); }
.bd-key__go { color: var(--ink-2); }
.bd-key:hover .bd-key__go { color: inherit; }
.bd-yours { margin-left: 12px; vertical-align: .1em; }

/* the weight, with a hairline bar: its share of the heaviest curator's */
.bd-weight { display: block; white-space: nowrap; }
.bd-weight__n { font-size: 15px; letter-spacing: .02em; }
.bd-unit { font-size: 11.5px; color: var(--ink-2); }
.bd-bar {
  position: relative; display: block; height: 1px; margin-top: 8px; max-width: 280px;
  background: var(--hair);
}
.bd-bar::before {
  content: ""; position: absolute; left: 0; top: -1px; height: 3px; width: var(--w, 0%);
  background: var(--ink);
}
.bd-row.is-yours .bd-bar::before { background: var(--accent); }

.bd-rew { color: var(--ink); border-bottom: 1px solid var(--hair); padding-bottom: 1px; transition: color .15s, border-color .15s; }
.bd-rew:hover { color: var(--accent); border-bottom-color: var(--accent); }
.bd-rew__part { white-space: nowrap; }

/* ---------- how vouching works + how rewards work ---------- */
.bd-how { margin-top: clamp(56px, 7vw, 96px); }
.bd-how .tp-route__head { padding-bottom: 14px; }
.bd-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--hair); }
.bd-step { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 16px; align-items: start; padding: 20px 24px 24px 0; min-width: 0; }
.bd-step + .bd-step { padding-left: 24px; border-left: 1px solid var(--hair); }
.bd-step p { padding-top: 4px; font-size: 13px; line-height: 1.7; letter-spacing: .02em; color: var(--ink-2); max-width: 42ch; }
.bd-step strong { color: var(--ink); font-weight: 500; }

.bd-rewards {
  display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 10px 24px; align-items: baseline;
  margin-top: clamp(28px, 3.5vw, 44px); padding: 18px 0 22px;
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--hair);
}
.bd-rewards__label { font-size: var(--t-xs); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); font-weight: 400; }
.bd-rewards__body { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px 32px; min-width: 0; }
.bd-rewards__text { max-width: 72ch; font-size: 14px; line-height: 1.7; letter-spacing: .02em; color: var(--ink); text-wrap: pretty; }

/* without javascript: the header, the noscript line and the explainers */
html:not(.js) .bd-totals, html:not(.js) .bd-board { display: none; }

/* ---------- tablets: the board keeps its columns, a little tighter ---------- */
@media (max-width: 1100px) {
  .bd-table td, .bd-table th { padding-left: 8px; padding-right: 8px; }
  .bd-table .bd-c-weight { width: 22%; }
  /* the "your vouch" tag moves under the key: the row is never marked by colour alone */
  .bd-c-key .bd-yours { display: block; width: max-content; margin: 4px 0 0; }
}

/* ---------- below 900px: every curator is a card ---------- */
@media (max-width: 899px) {
  .bd-table, .bd-table tbody, .bd-table tr, .bd-table td { display: block; }
  .bd-table thead {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0;
  }
  .bd-table tr {
    display: grid; grid-template-columns: 42px repeat(4, minmax(0, 1fr)); column-gap: 12px; row-gap: 12px;
    grid-template-areas:
      "rank key key weight weight"
      "rank vouchers followers trails views"
      "rank rew rew rew rew";
    padding: 18px 0 18px; border-bottom: 1px solid var(--hair);
  }
  .bd-row:hover { background: none; }
  .bd-table td, .bd-table td:first-child, .bd-table td:last-child,
  .bd-table .bd-c-rank, .bd-table .bd-c-weight, .bd-table .bd-c-num { padding: 0; border: 0; min-width: 0; width: auto; }
  .bd-table .bd-c-rank { grid-area: rank; align-self: start; }
  .bd-table .bd-c-key { grid-area: key; }
  .bd-table .bd-c-weight { grid-area: weight; text-align: right; align-self: start; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
  /* the unit moves into a label above the figure, like the counts below it */
  .bd-table .bd-c-weight::before {
    content: attr(data-label); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap;
  }
  .bd-table .bd-c-weight .bd-unit { display: none; }
  .bd-table .bd-c-key { align-self: start; padding-top: 14px; }
  .bd-table .bd-c-num { text-align: left; display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
  .bd-table .bd-c-num:nth-child(4) { grid-area: vouchers; }
  .bd-table .bd-c-num:nth-child(5) { grid-area: followers; }
  .bd-table .bd-c-num:nth-child(6) { grid-area: trails; }
  .bd-table .bd-c-num:nth-child(7) { grid-area: views; }
  .bd-table .bd-c-num::before, .bd-table .bd-c-rew::before {
    content: attr(data-label); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap;
  }
  .bd-table .bd-c-rew {
    grid-area: rew; text-align: left; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px;
  }
  .bd-table .bd-c-rew > * { margin-left: auto; font-size: 13px; }
  .bd-weight__n { font-size: 17px; }
  .bd-bar { width: 100%; max-width: 160px; margin-top: 6px; }
  .bd-yours { display: inline-block; margin: 6px 0 0; }
  .bd-c-key .bd-yours { display: block; width: max-content; margin-left: 0; }
}

/* ---------- phones ---------- */
@media (max-width: 720px) {
  .bd-head { padding-top: 26px; padding-bottom: 26px; }
  .bd-lede { margin-top: 14px; font-size: 14px; }
  .bd-sums { grid-template-columns: repeat(3, minmax(0, 1fr)); --cell: calc(33.33cqi - 20px); }
  .bd-sum { padding: 16px 10px 18px 0; }
  .bd-sum + .bd-sum { padding-left: 12px; }
  .bd-sum dd { --n: clamp(22px, 6.4vw, 30px); margin-top: 10px; }
  .bd-sum dt { min-height: 2.6em; font-size: 10px; letter-spacing: .1em; }
  .bd-you, .bd-rewards { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .bd-you__acts { width: 100%; }
  .bd-you__acts .btn { flex: 1 1 0; }
  .bd-steps { grid-template-columns: minmax(0, 1fr); }
  .bd-step, .bd-step + .bd-step { padding: 18px 0 20px; border-left: 0; }
  .bd-step + .bd-step { border-top: 1px solid var(--hair); }
  /* the table's own top line is the rule here */
  .bd-board__head .tp-route__rule { display: none; }
  .bd-board__meta { margin-left: auto; }
  .bd-you__line { order: 1; }
  .bd-you__sub { order: 2; margin-top: -4px; }
  .bd-you__acts { order: 3; }
}
@media (max-width: 389px) {
  .bd-table tr { grid-template-columns: 36px repeat(4, minmax(0, 1fr)); column-gap: 8px; }
  .bd-table .bd-c-rank .circ { width: 28px; height: 28px; font-size: 10.5px; }
  .bd-table .bd-c-num { font-size: 13px; }
  .bd-table .bd-c-num::before { font-size: 9px; letter-spacing: .06em; }
}

/* ---------- touch: 44px targets ---------- */
@media (pointer: coarse) {
  .bd-key, .bd-link, .bd-you__key, .bd-rew { position: relative; }
  .bd-key::after, .bd-link::after, .bd-you__key::after, .bd-rew::after {
    content: ""; position: absolute; left: -6px; right: -6px; top: 50%; height: 44px; transform: translateY(-50%);
  }
}
@media (hover: none) {
  .bd-key:hover, .bd-you__key:hover { color: var(--ink); border-bottom-color: var(--ink); }
  .bd-link:hover { color: var(--ink); border-bottom-color: var(--ink); }
}

/* ==========================================================================
   the curator page (/c/<pubkey>): vouched $RILL, vouchers, rank + vouch
   ========================================================================== */
.cp-vouch {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px 40px;
  margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--hair);
}
.cp-vouch[hidden] { display: none; }
.cp-vouch .cp-counts dt { color: var(--ink-2); }
.cp-vouch__kicker { color: var(--accent); }
.cp-vouch__act { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; max-width: 46ch; }
.cp-vouch__act .btn { min-width: 220px; min-height: 42px; }
/* an outlined button (follow above is the filled one); accent once the vouch is yours */
.cp-vouch__act .btn.is-on { border-color: var(--accent); color: var(--accent); background: var(--paper); }
.cp-vouch__act .btn.is-on:hover { background: var(--accent); color: #fff; }
.cp-vouch__act .btn[aria-busy="true"] { opacity: .6; cursor: progress; }
.cp-vouch__note {
  font-size: 11.5px; line-height: 1.6; letter-spacing: .04em; color: var(--ink-2); text-align: right; text-wrap: pretty;
}
.cp-vouch__note:empty { display: none; }
.cp-vouch__note.is-on { color: var(--accent); }
.cp-vouch__note.is-error { color: var(--accent); }
.cp-vouch__note a { color: var(--ink); border-bottom: 1px solid var(--ink); transition: color .15s, border-color .15s; white-space: nowrap; }
.cp-vouch__note a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.cp-vouch__note .bd-dot { margin-right: 7px; }
.cp-rank-of {
  margin-left: 12px; font-size: 12px; letter-spacing: .06em; color: var(--ink-2); vertical-align: .35em;
  border-bottom: 1px solid var(--hair); transition: color .15s, border-color .15s; white-space: nowrap;
}
.cp-rank-of:hover { color: var(--accent); border-bottom-color: var(--accent); }
@media (max-width: 720px) {
  .cp-vouch { align-items: stretch; }
  /* three figures on one row (the board link goes under the rank); a figure too
     long for that (1,000,000,000 at 360px) moves the next ones to a second row
     instead of running into them */
  .cp-vouch .cp-counts { display: flex; flex-wrap: wrap; justify-content: flex-start; column-gap: 28px; row-gap: 16px; }
  .cp-vouch .cp-counts > div { min-width: auto; }
  .cp-vouch .cp-counts dd { font-size: 24px; }
  .cp-rank-of { display: block; width: max-content; margin: 8px 0 0; vertical-align: 0; font-size: 11px; }
  .cp-rank-of__on { display: none; }
  .cp-vouch__act { align-items: stretch; width: 100%; max-width: none; }
  .cp-vouch__act .btn { width: 100%; }
  .cp-vouch__note { text-align: left; }
}

/* ==========================================================================
   /curators: the boosted strip (js/utility.js renderBoosted; .bst- rules in styles.css)
   ========================================================================== */
.bd-boosted { margin-top: clamp(36px, 4.5vw, 56px); }
.bd-boosted[hidden] { display: none; }
.bd-boosted .tp-route__head { padding-bottom: 12px; }
@media (max-width: 720px) {
  /* the title, and the tag on a line of its own under it (the strip's accent line is the rule) */
  .bd-boosted .tp-route__head { flex-wrap: wrap; row-gap: 2px; }
  .bd-boosted .tp-route__head .tp-route__rule { display: none; }
  .bd-boosted .tp-route__head .tag { flex-basis: 100%; }
}
.bd-key__short { white-space: nowrap; }
