/*
 * Reapers, part two: the pages that do something.
 *
 * style.css holds the tokens and the marketing surfaces. This holds the app
 * furniture: tier pickers, the sacrifice chooser, progress bars, forms, docs
 * and the contract footer. Same three colours, same tokens, no new palette.
 */

/* A section heading that follows body copy needs air above it, or the intro
   paragraph and the heading read as one block. */
.sec { font-size: var(--step-1); margin-bottom: 0.5rem; }
h2.sec { margin-top: 2.8rem; }
.panel h2.sec, .toc h2.sec, .sac-side h2.sec { margin-top: 0; }
.lede-sm { font-size: var(--step-1); color: var(--ink-2); max-width: 60ch; margin-top: 1.1rem; line-height: 1.5; }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 5px; padding: clamp(1.2rem, 2.5vw, 1.9rem);
}

.notice {
  margin-top: 1.8rem; padding: 0.85rem 1.1rem; border-radius: 4px;
  border: 1px solid var(--ember-dim); background: var(--ember-wash);
  font-size: var(--step--1);
}
.linkish {
  background: none; border: 0; padding: 0; font: inherit;
  color: var(--ember-hi); text-decoration: underline; cursor: pointer;
}

/* ── tiers ────────────────────────────────────────────────────────── */

.tiers { border: 0; padding: 0; margin: 1.8rem 0 0; display: grid; gap: 0.7rem; }
@media (min-width: 60rem) { .tiers { grid-template-columns: repeat(4, 1fr); } }
.tier { display: block; cursor: pointer; }
.tier input { position: absolute; opacity: 0; pointer-events: none; }
.tier-in {
  display: block; height: 100%; padding: 1.2rem 1.25rem 1.35rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 5px;
  transition: border-color 0.18s var(--out), background 0.18s var(--out);
}
.tier:hover .tier-in { border-color: var(--ink-3); }
.tier.on .tier-in { border-color: var(--ember); background: var(--ember-wash); }
.tier input:focus-visible + .tier-in { outline: 2px solid var(--ember-hi); outline-offset: 3px; }
.tier-name { display: block; font-family: var(--disp); font-size: var(--step-0); letter-spacing: -0.02em; }
.tier-cost { display: block; margin-top: 0.7rem; font-size: var(--step-1); letter-spacing: -0.04em; }
.tier-cost em { font-style: normal; font-size: var(--step--1); color: var(--ink-3); }
.tier-boost { display: block; margin-top: 0.15rem; color: var(--ember-hi); font-size: var(--step-0); }
.tier-note { display: block; margin-top: 0.8rem; font-size: var(--step--1); color: var(--ink-3); line-height: 1.45; }
.tier-top .tier-in { border-style: dashed; }

.act-bar {
  margin-top: 2rem; display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.3rem; border: 1px solid var(--line); border-radius: 5px;
}
.act-sum { font-size: var(--step-0); }
.act-sum .dim { display: block; font-size: var(--step--1); margin-top: 0.2rem; }

/* ── sacrifice ────────────────────────────────────────────────────── */

.sac { display: grid; gap: var(--gap); margin-top: 2.4rem; align-items: start; }
@media (min-width: 56rem) { .sac { grid-template-columns: 1fr auto 1fr; gap: clamp(1rem, 3vw, 2.5rem); } }
.sac-help { font-size: var(--step--1); color: var(--ink-3); margin-bottom: 0.9rem; }
.sac-warn { color: var(--ember-hi); }
.sac-arrow {
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  color: var(--ember); padding-top: 3.6rem;
}
.sac-arrow span { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-3); letter-spacing: 0.04em; }
@media (max-width: 55.999rem) { .sac-arrow { padding-top: 0; transform: rotate(90deg); } }

.pick {
  list-style: none; padding: 0; margin: 0; min-height: 5.5rem;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: 0.55rem;
}
.pick li { cursor: pointer; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: #000; }
.pick li[aria-selected="true"] { border-color: var(--ember); box-shadow: 0 0 0 1px var(--ember); }
.pick-burn li[aria-selected="true"] { border-color: var(--ember-hi); box-shadow: 0 0 0 1px var(--ember-hi); }
.pick img { width: 100%; height: auto; display: block; image-rendering: pixelated; }
.pick .id { display: block; font-family: var(--mono); font-size: 0.68rem; padding: 0.25rem 0.4rem; color: var(--ink-3); }

.sac-confirm {
  margin-top: 2.2rem; padding: 1.3rem 1.4rem; border-radius: 5px;
  border: 1px solid var(--ember-dim); background: var(--ember-wash);
}
.sac-line { font-size: var(--step-0); }
.sac-line .warn { color: var(--ember-hi); }
.check { display: flex; gap: 0.6rem; align-items: flex-start; margin: 1rem 0 1.2rem; font-size: var(--step--1); color: var(--ink-2); }
.check input { margin-top: 0.28rem; accent-color: var(--ember); width: 1rem; height: 1rem; }
.empty { margin-top: 2rem; color: var(--ink-3); font-size: var(--step--1); }
body.is-connected .empty { display: none; }

/* ── progress ─────────────────────────────────────────────────────── */

.progress-block { margin-top: 2.2rem; }
.progress { height: 0.6rem; background: var(--surface); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
/* Scaled rather than widened: animating width relayouts the bar every frame,
   and a transform is composited. --fill is the 0-1 value the client sets. */
.progress-fill {
  display: block; height: 100%; width: 100%; background: var(--ember); border-radius: 99px;
  transform: scaleX(var(--fill, 0)); transform-origin: left center;
  transition: transform 0.6s var(--out);
}
@media (prefers-reduced-motion: reduce) { .progress-fill { transition: none; } }
.bar-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: 1rem; margin: 1.2rem 0 0; }
.bar-stats dt { font-size: var(--step--1); color: var(--ink-3); }
.bar-stats dd { margin: 0.2rem 0 0; font-family: var(--mono); font-size: var(--step-1); letter-spacing: -0.03em; }

/* ── forms ────────────────────────────────────────────────────────── */

.field { margin-top: 1.4rem; }
.field label { display: block; font-size: var(--step--1); color: var(--ink-3); margin-bottom: 0.45rem; }
.field-row { display: flex; gap: 0.5rem; align-items: center; }
.field-row input {
  flex: 1 1 auto; min-width: 0; background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 4px; padding: 0.75rem 0.9rem;
  font-family: var(--mono); font-size: var(--step-1); letter-spacing: -0.03em;
}
/* Placeholder needs the same contrast as body text, so it is ink-2 and not a
   pale grey nobody can read. */
.field-row input::placeholder { color: var(--ink-3); opacity: 1; }
.field-row input:focus-visible { border-color: var(--ember); outline: none; box-shadow: 0 0 0 1px var(--ember); }
.field-note { font-size: var(--step--1); margin-top: 0.45rem; }
.btn-row { display: flex; gap: 0.6rem; margin-top: 1.4rem; flex-wrap: wrap; }
.full { width: 100%; }

.pill { font-family: var(--mono); font-size: var(--step--1); padding: 0.6rem 0.85rem; border: 1px solid var(--line); border-radius: 4px; color: var(--ink-2); }
.pill-ember { border-color: var(--ember-dim); color: var(--ember-hi); }
.flip {
  display: block; margin: 0.8rem auto -0.2rem; width: 2.4rem; height: 2.4rem;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2);
  border-radius: 99px; cursor: pointer;
}
.flip:hover { border-color: var(--ember); color: var(--ember-hi); }
.quote { margin: 1.6rem 0; display: grid; gap: 0.5rem; font-size: var(--step--1); }
.quote > div { display: flex; justify-content: space-between; gap: 1rem; }
.quote dt { color: var(--ink-3); }
.quote dd { margin: 0; }
.facts-inline { margin-top: 1.2rem; }

.seg { border: 1px solid var(--line); border-radius: 4px; padding: 0.25rem; display: flex; gap: 0.25rem; margin: 0; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 0.5rem 0.9rem; border-radius: 3px; font-size: var(--step--1); color: var(--ink-2); }
.seg input:checked + span { background: var(--ember-wash); color: var(--ink); }
.seg input:focus-visible + span { outline: 2px solid var(--ember-hi); outline-offset: 2px; }

.claim-bar {
  margin-top: 2.4rem; display: flex; flex-wrap: wrap; gap: 1.2rem;
  align-items: center; justify-content: space-between;
  padding: 1.2rem 1.3rem; border: 1px solid var(--line); border-radius: 5px;
}
.holdings { list-style: none; padding: 0; margin: 1.6rem 0 0; display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); }

.split { list-style: none; padding: 0; margin: 1.6rem 0 0; display: grid; gap: 0.9rem; }
.split li { display: grid; grid-template-columns: 3.6rem 1fr; gap: 0.9rem; align-items: baseline; font-size: var(--step--1); color: var(--ink-2); }
.split-pct { color: var(--ember-hi); font-size: var(--step-0); }

/* ── docs ─────────────────────────────────────────────────────────── */

.docs-grid { display: grid; gap: clamp(2rem, 4vw, 4rem); }
@media (min-width: 64rem) {
  .docs-grid { grid-template-columns: 15rem 1fr; align-items: start; }
  .toc { position: sticky; top: 6.5rem; }
}
.toc ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.35rem; }
.toc li { font-size: var(--step--1); }
.toc a { color: var(--ink-3); text-decoration: none; }
.toc a:hover { color: var(--ember-hi); }
.prose { max-width: 70ch; }
.prose h2 { font-size: var(--step-2); margin-top: 3.2rem; scroll-margin-top: 6rem; }
.prose h2:first-of-type { margin-top: 2.6rem; }
.prose p { color: var(--ink-2); margin-top: 1rem; }
.prose strong { color: var(--ink); font-weight: 600; }
.list { margin: 1.1rem 0 0; padding-left: 1.15rem; color: var(--ink-2); display: grid; gap: 0.5rem; }
.list li::marker { color: var(--ember-dim); }
.callout {
  margin-top: 1.4rem; padding: 1rem 1.2rem; border-radius: 4px;
  border: 1px solid var(--line); background: var(--surface); font-size: var(--step--1);
}

/* ── footer ───────────────────────────────────────────────────────── */

.foot-bar .wrap { display: grid; gap: 2.2rem; }
.foot-top { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; align-items: baseline; }
.foot-mark { font-family: var(--disp); letter-spacing: -0.02em; font-size: var(--step-0); }
.contracts h2 { font-size: var(--step-0); font-family: var(--body); font-weight: 600; letter-spacing: 0; }
.contracts p { font-size: var(--step--1); margin-top: 0.3rem; }
.contracts dl {
  display: grid; gap: 1px; margin: 1.1rem 0 0; background: var(--line-soft);
  border: 1px solid var(--line-soft); border-radius: 4px; overflow: hidden;
}
@media (min-width: 50rem) { .contracts dl { grid-template-columns: repeat(2, 1fr); } }
.contracts dl > div {
  background: var(--bg); padding: 0.75rem 1rem; display: flex; flex-wrap: wrap;
  gap: 0.2rem 0.8rem; justify-content: space-between; align-items: baseline;
}
.contracts dt { font-size: var(--step--1); color: var(--ink-2); }
.contracts dd { margin: 0; font-size: 0.76rem; word-break: break-all; }
.pending { color: var(--ink-3); font-family: var(--body); }
.foot-end { font-size: var(--step--1); }

/* ── toast ────────────────────────────────────────────────────────── */

.toast {
  position: fixed; inset: auto 1rem 1rem auto; z-index: var(--z-toast);
  max-width: min(26rem, calc(100vw - 2rem));
  background: var(--surface); border: 1px solid var(--ember-dim); color: var(--ink);
  padding: 0.85rem 1.1rem; border-radius: 5px; font-size: var(--step--1);
  box-shadow: 0 10px 30px oklch(0 0 0 / 0.45);
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity 0.24s var(--out), transform 0.24s var(--out);
}
.toast.on { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* Payout asset picker. Matches the segmented control next to it rather than
   inheriting the browser default, which on Windows is a white box that punches
   a hole in a dark page. */
.picker {
  appearance: none;
  background: var(--panel, #17120f);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 2px;
  padding: .6rem .9rem;
  font: inherit;
  min-width: 16ch;
}
.picker:focus-visible { outline: 2px solid var(--accent, #f36f21); outline-offset: 2px; }
.picker option { background: #17120f; color: #eee; }

/* Payout calculator. Inputs on the left, the answer beside them on a wide
   screen, stacked on a narrow one - the point is watching the number move as
   you change an input, so they have to be visible together. */
.calc { border: 1px solid rgba(255,255,255,.10); border-radius: 3px; padding: 1.4rem; }
.calc-in { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.calc-in label { display: grid; gap: .4rem; }
.calc-in span { font-size: .82rem; opacity: .72; }
.calc-in input, .calc-in select {
  appearance: none;
  background: #17120f;
  color: inherit;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 2px;
  padding: .6rem .8rem;
  font: inherit;
  width: 100%;
}
.calc-in input:focus-visible, .calc-in select:focus-visible {
  outline: 2px solid var(--accent, #f36f21); outline-offset: 2px;
}
.calc-in option { background: #17120f; color: #eee; }
.calc-out { margin-top: 1.4rem; }
.calc [data-c-note] { margin: 1rem 0 0; max-width: 62ch; }
