/* ==========================================================================
   receipt.css — public receipt page (r.html) · v2 "Lights Out". Loads after nett.css.
   The receipt post's permalink, in X post-detail grammar, inside the app shell
   (sidebar with Receipts current, top bar, tab bar on phones): one 600px column with
   hairlines on both sides, a column head (seal · "Receipt" · ID), the post
   (author, big amount, line, facts), then a Details card and a Timeline card,
   the actions and the fine print. Reads var(--nt-*) only. Page prefix: r-
   ========================================================================== */

/* ---------- Column --------------------------------------------------------- */
:root { --r-fs-text: 17px; }            /* X post-detail text size: the line under the amount, card titles */
.nt-page.r-page { display: flex; max-width: none; padding: 0; }
.r-col {
  width: 100%;
  max-width: 600px;
  min-height: calc(100vh - var(--nt-banner-h) - var(--nt-top-h));
  margin-inline: auto;
}
@media (min-width: 640px) {
  .r-col { border-left: var(--nt-rule-hair); border-right: var(--nt-rule-hair); }
}
.r-footer { margin-top: 0; }

/* ---------- Right rail (>= 1280px): X post detail keeps a side column ------ */
.r-rail { display: none; }
@media (min-width: 1280px) {
  .nt-page.r-page { justify-content: center; gap: 24px; padding-right: var(--nt-gutter); }
  .r-page > .r-col { margin-inline: 0; }
  .r-rail { display: block; flex: 0 0 300px; padding-top: 16px; }
  .r-railcard {
    position: sticky;
    top: calc(var(--nt-banner-h) + var(--nt-top-h) + 16px);
    padding: 16px 16px 18px;
    border: var(--nt-rule-hair);
    border-radius: var(--nt-r-card);
    background: var(--nt-surface);
  }
  .r-railcard__title { font-size: var(--nt-fs-title); line-height: var(--nt-lh-title); letter-spacing: var(--nt-ls-title); font-weight: var(--nt-w-bold); color: var(--nt-text-strong); }
  .r-railcard__text { margin-top: 8px; font-size: var(--nt-fs-ui); line-height: 1.45; color: var(--nt-muted); text-wrap: pretty; }
  .r-railcard__steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; margin: 14px 0 0; padding: 12px 0 0; list-style: none; border-top: var(--nt-rule-hair); font-size: var(--nt-fs-small); font-weight: var(--nt-w-medium); color: var(--nt-text); }
  .r-railcard__steps .nt-label { margin-right: 8px; }
  .r-railcard__link { margin-top: 14px; font-size: var(--nt-fs-small); }
}

/* ---------- Column head: seal (home) · Receipt / NT-9F3A…C21 (X "Post" header) --- */
.r-top {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 16px 0 5px;            /* the n's stem lines up with the avatar and the amount */
}
.r-top__home {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: var(--nt-r-pill);
  color: var(--nt-text-strong);
  transition: background-color var(--nt-d-hover) var(--nt-ease);
}
.r-top__home:hover { background: var(--nt-surface-2); }
.r-top__home .nt-mark { width: 24px; height: 24px; }
/* No JS: the static fallback is the settled canonical receipt, so its seal is solid. */
html:not(.r-js) .r-top__home .nt-mark__fill { transform: none; }
.r-top__title { display: flex; flex-direction: column; min-width: 0; }
.r-top__h {
  font-size: var(--nt-fs-title);
  line-height: 24px;
  letter-spacing: var(--nt-ls-title);
  font-weight: var(--nt-w-bold);
  color: var(--nt-text-strong);
}
.r-top__sub {
  font-family: var(--nt-font-mono);
  font-size: var(--nt-fs-micro);
  line-height: 16px;
  color: var(--nt-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* JS on + query params: hide the static fallback until the requested receipt is drawn. */
.r-hold :is(#receipt, #r-top-sub) { visibility: hidden; }
#receipt:focus { outline: none; }            /* skip-link target, not a control */
/* Without JS the copy controls cannot work: do not offer them. */
html:not(.r-js) :is(.r-copylink, .nt-copy) { display: none; }

/* ---------- The post -------------------------------------------------------- */
.r-post {
  container-type: inline-size;
  padding: 12px 16px 20px;
  border-bottom: var(--nt-rule-hair);
}
/* X "social context" slot above the author row, aligned to the name column. */
.r-context { padding-left: 60px; margin-bottom: 6px; }

.r-author { display: flex; align-items: center; gap: 12px; min-width: 0; }
.r-author__who { display: flex; flex-direction: column; min-width: 0; font-size: var(--nt-fs-ui); line-height: 20px; }
.r-author__name,
.r-author__handle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-author__name { font-weight: var(--nt-w-bold); color: var(--nt-text-strong); }
.r-author__handle { color: var(--nt-muted); }
.r-author__status { display: inline-flex; flex: none; margin-left: auto; }
.r-author__status .nt-chip { height: 28px; padding: 0 12px; gap: 7px; font-size: var(--nt-fs-small); }

.r-h { display: flex; flex-direction: column; margin-top: 20px; font-weight: var(--nt-w-regular); }
/* 64px on desktop (48 at 360), and never wider than the column: the size also answers
   to the amount's length (--r-chars, set by receipt.js), so $1,000,000.00 fits at 360. */
.r-amount {
  font-size: min(clamp(48px, 14vw, 64px), calc(100cqi / (var(--r-chars, 7) * 0.6)));
  line-height: 1;
  letter-spacing: -0.03em;
  font-weight: var(--nt-w-bold);
  color: var(--nt-text-strong);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.r-amount s {
  color: var(--nt-muted);
  text-decoration-thickness: 0.06em;
  text-decoration-color: var(--nt-muted);
}
.r-line {
  margin-top: 12px;
  font-size: var(--r-fs-text);
  line-height: 24px;
  color: var(--nt-text);
  text-wrap: pretty;
}
.r-line .nt-at { font-weight: var(--nt-w-bold); color: var(--nt-text-strong); }
.r-by { margin-top: 2px; font-size: var(--nt-fs-ui); line-height: 20px; color: var(--nt-muted); text-wrap: pretty; }
.r-by .nt-at { font-weight: var(--nt-w-medium); color: var(--nt-text); }
.r-meta {
  margin-top: 16px;
  font-family: var(--nt-font-mono);
  font-size: var(--nt-fs-data);
  line-height: 20px;
  color: var(--nt-muted);
  font-variant-numeric: tabular-nums;
}

/* Money just landed (pending receipt settling on screen): one Signal-tint flash + one blink.
   The tint holds for the first third, then fades (same curve as nett's card flash). */
.r-post.is-landed { animation: r-land var(--nt-d-tint) var(--nt-ease) both; }
@keyframes r-land { 0%, 35% { background-color: var(--nt-signal-tint); } 100% { background-color: transparent; } }
.r-post.is-landed .r-author__status .nt-marker { animation: nt-blink var(--nt-d-blink) var(--nt-ease) 1; }

/* ---------- Details + Timeline cards ---------------------------------------- */
.r-rest { padding: 16px 16px 56px; }
.r-card {
  padding: 16px 20px 4px;
  border: var(--nt-rule-hair);
  border-radius: var(--nt-r-card);
  background: var(--nt-surface);
}
.r-card + .r-card { margin-top: 12px; }
.r-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; }
.r-card__title {
  font-size: var(--r-fs-text);
  line-height: 24px;
  letter-spacing: -0.01em;
  font-weight: var(--nt-w-bold);
  color: var(--nt-text-strong);
}
.r-card__aside { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-group { margin-top: 20px; padding-bottom: 2px; }
.r-card__head + .r-group { margin-top: 12px; }

.r-kv .nt-kv__row { min-height: 40px; }
/* Words in a value cell read in Inter (nett.css .nt-word / .nt-stone), a size up on the permalink. */
.r-kv .nt-kv__row > dd :is(.nt-word, .nt-stone) { font-size: var(--nt-fs-table); }
.r-kv .nt-kv__row > dd.r-hashcell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  overflow: visible;                  /* the Copy pill's focus ring */
}
.r-hash { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-hash__full { display: none; }
/* Amount: the accounting double rule is drawn only once the payout is closed. */
.nt-double.is-open,
.nt-double.is-open::after { border-bottom-color: transparent; }
.r-kv .nt-kv__row--total > dd .nt-refunded { color: var(--nt-muted); }

.r-card--timeline .nt-timeline { margin-top: 16px; padding-bottom: 12px; }

/* ---------- Actions + fine print -------------------------------------------- */
.r-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 12px;
  margin-top: 24px;
}
.r-copylink { min-width: 128px; }           /* "Copy link" -> "Copied": no width change */
.r-share > svg { width: 16px; height: 16px; margin-right: -4px; }
.r-verify { flex-basis: 100%; margin-top: 4px; font-size: var(--nt-fs-ui); line-height: 20px; }
.r-verify > .nt-link { border-radius: 4px; }        /* the focus ring follows a soft corner */
.r-fine {
  margin-top: 28px;
  padding-top: 16px;
  border-top: var(--nt-rule-hair);
  font-size: var(--nt-fs-micro);
  line-height: 1.55;
  color: var(--nt-muted);
  text-wrap: pretty;
}
.r-fine__demo { color: var(--nt-text); }
.r-print { display: none; }

/* ---------- Not found ------------------------------------------------------- */
.r-missing { padding: 24px 16px 56px; }
.r-missing__title { margin-top: 12px; }
.r-missing__error { margin-top: 20px; overflow-wrap: anywhere; }
.r-missing__id { font-family: var(--nt-font-mono); font-weight: var(--nt-w-regular); }
.r-missing__text { max-width: 52ch; margin-top: 8px; font-size: var(--nt-fs-ui); color: var(--nt-muted); text-wrap: pretty; }
.r-missing__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* ---------- Phone ----------------------------------------------------------- */
@media (max-width: 767px) {
  .r-top { top: 0; height: 53px; padding: 0 12px 0 5px; gap: 8px; }
}
@media (max-width: 479px) {
  .r-post { padding-bottom: 16px; }
  .r-card { padding-inline: 16px; }
  .r-actions > .nt-btn { flex: 1 1 100%; }
  .r-verify { margin: 4px 0 0; }
  .r-missing__actions > .nt-btn { flex: 1 1 100%; }
}

/* ---------- Motion ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .r-post.is-landed { animation: nt-tint-hold var(--nt-d-tint-reduced) linear both; }
  .r-post.is-landed .r-author__status .nt-marker { animation: none; }
}

/* ---------- Print: a statement prints as a statement (light) --------------- */
@media print {
  @page { margin: 14mm 16mm; }
  html, body { background: #fff !important; }
  .nt-skip, .r-actions, .nt-copy, .nt-footer, .r-rail { display: none !important; }
  .nt-shell { display: block; min-height: 0; }
  .nt-shell::before { content: none; }
  .nt-page.r-page { display: block; }
  .r-col { max-width: none; min-height: 0; border: 0; }
  .r-col, .r-col * { color: #000 !important; }
  .r-top { position: static; height: auto; padding: 0 0 4px; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .r-top__home { width: auto; height: auto; justify-content: start; }
  .r-main { zoom: 0.8; }                  /* one page on Letter or A4 */
  .r-post { padding: 8px 0 12px; border-color: #bbb; }
  .r-context { padding-left: 0; }
  .r-rest { padding: 12px 0 0; }
  .r-fine { margin-top: 14px; padding-top: 10px; border-color: #bbb; }
  .r-h { margin-top: 12px; }
  .r-amount { font-size: min(52px, calc(100cqi / (var(--r-chars, 7) * 0.6))); }
  .r-line { margin-top: 8px; }
  .r-meta { margin-top: 10px; }
  .r-card + .r-card { margin-top: 8px; }
  .r-card { padding-top: 12px; }
  .r-group { margin-top: 14px; }
  .r-card { background: #fff; border-color: #bbb; break-inside: avoid; }
  .r-author__status .nt-chip, .nt-avatar { background: #fff !important; border-color: #bbb !important; box-shadow: inset 0 0 0 1px #bbb; }
  .r-top__sub, .r-author__handle, .r-by, .r-meta, .nt-label, .nt-stone, .r-kv dt, .nt-tl__time, .nt-tl__delta, .r-fine { color: #555 !important; }
  .nt-kv__row { border-color: #ddd; }
  .nt-double, .nt-double::after { border-color: #000; }
  .nt-tl.is-done + .nt-tl.is-done::before { background: #999; }
  .r-post.is-landed { animation: none; }
  /* Full hashes on paper: a printed receipt must be verifiable without the page. */
  .r-kv .nt-kv__row { align-items: flex-start; min-height: 0; padding-block: 6px; }
  .r-kv .nt-kv__row--total { padding-block: 10px 12px; }
  .r-card--timeline .nt-timeline { margin-top: 10px; }
  .r-card--timeline .nt-tl { height: 42px; }
  .r-card--timeline .nt-tl:last-child { height: 36px; }
  .r-card--timeline .nt-tl + .nt-tl::before { top: -26px; height: 28px; }
  .r-kv .nt-kv__row > dd { white-space: normal; }
  .r-kv .nt-kv__row > dd.r-hashcell { display: block; min-width: 0; }
  .r-hash { overflow: visible; white-space: normal; overflow-wrap: anywhere; }
  .r-hash__short { display: none; }
  .r-hash__full { display: inline; }
  .r-print {
    display: block;
    margin-top: 6px;
    font-family: var(--nt-font-mono);
    font-size: var(--nt-fs-micro);
    overflow-wrap: anywhere;
  }
}
