/*
 * The faucet's own layer, on top of shared-ui. Three things, in the order a
 * visitor meets them:
 *
 *   1. The tape: the chain's mini-block height as a ruler that prints at a
 *      mint needle and runs left (drawn by app.js on a canvas).
 *   2. The ticket, fed out from under the tape: the claim's value first, $0,
 *      the two coins, the address and Claim; past a perforation, the stub,
 *      which is the treasury - how many claims it can still pay.
 *   3. The receipt a claim prints, and where to spend the coins.
 *
 * One orchestrated moment: a claim sweeps the ticket's edge while it is out,
 * stamps it when the receipt lands, and pins the transaction on the tape. The
 * rest of the page is still. Every animation sits behind
 * prefers-reduced-motion: no-preference, and nothing hidden depends on one.
 */

.ex-wrap.app.fc {
  width: min(100%, 70rem);
  padding-top: var(--pickle-space-7);
}

.fc-h { font-size: var(--pickle-text-display); }

.fc .ex-lede { max-width: 38rem; }

/* ===================================================================== tape */

.fc-tape {
  margin: var(--pickle-space-6) 0 0;
  background: var(--pickle-bg-deep);
  border: 1px solid var(--pickle-line);
  border-radius: var(--pickle-radius) var(--pickle-radius) 0 0;
}

.fc-tape-read {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pickle-space-2) var(--pickle-space-5);
  align-items: baseline;
  justify-content: space-between;
  padding: var(--pickle-space-4) var(--pickle-space-5) 0;
}

.fc-tape-read p { margin: 0; }

.fc-tape-n {
  display: flex;
  gap: var(--pickle-space-3);
  align-items: baseline;
}

.fc-tape-n span,
.fc-tape-meta {
  color: var(--pickle-subtle);
  font-family: var(--pickle-font-mono);
  font-size: var(--pickle-text-2xs);
  letter-spacing: .16em;
  text-transform: uppercase;
}

.fc-tape-n b {
  color: var(--pickle-text);
  font-family: var(--pickle-font-mono);
  font-size: var(--pickle-text-2xl);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
}

.fc-tape-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pickle-space-1) var(--pickle-space-5);
}

.fc-tape-meta b {
  color: var(--pickle-muted);
  font-weight: 400;
  letter-spacing: 0;
}

.fc-tape-canvas {
  display: block;
  width: 100%;
  height: 4.75rem;
  opacity: .25;
  transition: opacity var(--pickle-slow) var(--pickle-ease);
}

.fc-tape-canvas.on { opacity: 1; }

/* =================================================================== ticket */

.fc-ticket {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 19rem;
  background: var(--pickle-surface-1);
  border: 1px solid var(--pickle-line);
  border-top: 2px solid var(--pickle-mint);
  border-radius: 0 0 var(--pickle-radius) var(--pickle-radius);
  transition: border-color var(--pickle-slow) var(--pickle-ease);
}

.fc-ticket.waiting { border-top-color: var(--pickle-amber); }

/* A claim in flight: a brighter band runs along the ticket's edge. */
.fc-ticket::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--pickle-mint-hi);
  opacity: 0;
  transform-origin: 0 50%;
  pointer-events: none;
}

.fc-ticket.sending::before { opacity: 1; }

.fc-main {
  min-width: 0;
  padding: var(--pickle-space-6);
}

.fc-head {
  display: flex;
  gap: var(--pickle-space-1) var(--pickle-space-4);
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 var(--pickle-space-4);
  color: var(--pickle-subtle);
  font-family: var(--pickle-font-mono);
  font-size: var(--pickle-text-2xs);
  letter-spacing: .16em;
  text-transform: uppercase;
}

.fc-worth {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--pickle-space-3) var(--pickle-space-6);
  align-items: center;
  margin: 0 0 var(--pickle-space-5);
}

.fc-worth-n {
  color: var(--pickle-accent-text);
  font-family: var(--pickle-font-mono);
  font-size: clamp(4.5rem, 9vw, 7rem);
  font-weight: 500;
  letter-spacing: -.07em;
  line-height: .82;
}

.fc-worth-for {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--pickle-muted);
  font-size: var(--pickle-text-sm);
  line-height: 1.5;
}

/* The stamp a landed claim leaves on the ticket, over the coins it paid. */
.fc-stamp {
  position: absolute;
  top: -.6rem;
  right: .6rem;
  padding: .3rem .75rem;
  color: var(--pickle-accent-text);
  font-family: var(--pickle-font-mono);
  font-size: var(--pickle-text-md);
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  background: rgb(20 20 22 / 90%);
  border: 2px solid var(--pickle-mint);
  border-radius: var(--pickle-radius);
  opacity: 0;
  transform: rotate(-9deg);
  pointer-events: none;
}

.fc-ticket.claimed .fc-stamp { opacity: 1; }

.fc-amounts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--pickle-line);
  border: 1px solid var(--pickle-line);
  border-radius: var(--pickle-radius);
  overflow: clip;
}

.fc-amount {
  display: flex;
  flex-direction: column;
  gap: var(--pickle-space-2);
  margin: 0;
  padding: var(--pickle-space-4);
  background: var(--pickle-bg);
}

.fc-amount b {
  color: var(--pickle-text);
  font-family: var(--pickle-font-mono);
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.04em;
  line-height: 1;
}

.fc-amount span {
  color: var(--pickle-accent-text);
  font-family: var(--pickle-font-mono);
  font-size: var(--pickle-text-2xs);
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------------- form */

.fc-form { margin: 0; }

.fc-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--pickle-space-3);
}

.fc-form .fc-row input {
  min-height: 3.25rem;
  font-size: var(--pickle-text-md);
}

.fc-claim {
  min-width: 9.5rem;
  min-height: 3.25rem;
  padding-inline: var(--pickle-space-6);
  font-size: var(--pickle-text-md);
}

/* In its cooldown the button carries the wait, in amber, instead of a dimmed
   Claim that looks broken. */
.fc-ticket.waiting .fc-claim:disabled {
  color: var(--pickle-amber);
  background: var(--pickle-amber-soft);
  border-color: var(--pickle-amber-line);
  opacity: 1;
  cursor: default;
}

.fc-claim[aria-busy="true"] { cursor: progress; }

.fc-form .fc-hint {
  margin: var(--pickle-space-2) 0 0;
  color: var(--pickle-subtle);
  font-size: var(--pickle-text-xs);
  line-height: 1.6;
}

/* The gauge, notched once per hour of the 24. */
.fc-gauge { margin: var(--pickle-space-5) 0 var(--pickle-space-4); }

.fc-gauge .ex-gauge {
  position: relative;
  height: 12px;
}

.fc-gauge .ex-gauge::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to right,
    transparent 0,
    transparent calc(100% / 24 - 2px),
    var(--pickle-surface-1) calc(100% / 24 - 2px),
    var(--pickle-surface-1) calc(100% / 24)
  );
  pointer-events: none;
}

.fc-gauge .ex-gauge > i { transition: width var(--pickle-slow) var(--pickle-ease); }

/* ------------------------------------------------------------------- stub */

.fc-stub {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: var(--pickle-space-6) var(--pickle-space-5);
  border-left: 1px dashed rgb(255 255 255 / 22%);
}

/* The two notches the perforation runs between. */
.fc-stub::before,
.fc-stub::after {
  content: "";
  position: absolute;
  left: -11px;
  width: 20px;
  height: 20px;
  background: var(--pickle-bg);
  border: 1px solid var(--pickle-line);
  border-radius: 50%;
}

.fc-stub::before { top: -12px; border-top-color: transparent; border-left-color: transparent; transform: rotate(-45deg); }
.fc-stub::after { bottom: -11px; border-bottom-color: transparent; border-right-color: transparent; transform: rotate(-45deg); }

.fc-stub p { margin: 0; }

.fc-stub-k {
  color: var(--pickle-subtle);
  font-family: var(--pickle-font-mono);
  font-size: var(--pickle-text-2xs);
  letter-spacing: .16em;
  text-transform: uppercase;
}

.fc-stub .fc-left {
  margin: var(--pickle-space-3) 0 var(--pickle-space-2);
  overflow-wrap: anywhere;
}

.fc-left b {
  color: var(--pickle-text);
  font-family: var(--pickle-font-mono);
  font-size: clamp(2.4rem, 4.6vw, 3.4rem);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.05em;
  line-height: 1;
}

.fc-stub-for {
  color: var(--pickle-muted);
  font-size: var(--pickle-text-sm);
  line-height: 1.5;
}

.fc-kv {
  margin: auto 0 0;
  padding-top: var(--pickle-space-5);
}

.fc-kv div {
  display: flex;
  gap: var(--pickle-space-3);
  align-items: baseline;
  justify-content: space-between;
  padding: .55rem 0;
  border-top: 1px solid var(--pickle-line);
}

.fc-kv dt {
  flex: none;
  color: var(--pickle-subtle);
  font-family: var(--pickle-font-mono);
  font-size: var(--pickle-text-2xs);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.fc-kv dd {
  min-width: 0;
  margin: 0;
  color: var(--pickle-text);
  font-family: var(--pickle-font-mono);
  font-size: var(--pickle-text-xs);
  font-variant-numeric: tabular-nums;
  text-align: right;
  overflow-wrap: anywhere;
}

/* ================================================================== receipt */

.fc-receipt {
  margin-top: var(--pickle-space-4);
  padding: var(--pickle-space-5) var(--pickle-space-6);
  background: var(--pickle-mint-soft);
  border: 1px solid var(--pickle-mint-line);
  border-radius: var(--pickle-radius);
}

.fc-receipt[hidden],
.fc-next[hidden],
.fc-apps li[hidden] { display: none; }

.fc-receipt-h {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pickle-space-1) var(--pickle-space-3);
  align-items: baseline;
  margin: 0 0 var(--pickle-space-4);
  font-family: var(--pickle-font-display);
  font-size: var(--pickle-text-2xl);
  font-weight: 600;
  letter-spacing: var(--pickle-tracking-display);
  line-height: 1.1;
}

.fc-receipt-h b {
  color: var(--pickle-accent-text);
  font-family: var(--pickle-font-mono);
  font-weight: 500;
  letter-spacing: -.03em;
}

.fc-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: var(--pickle-space-4) var(--pickle-space-5);
  margin: 0;
}

.fc-facts dt {
  margin-bottom: var(--pickle-space-1);
  color: var(--pickle-subtle);
  font-family: var(--pickle-font-mono);
  font-size: var(--pickle-text-2xs);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.fc-facts dd {
  margin: 0;
  color: var(--pickle-text);
  font-family: var(--pickle-font-mono);
  font-size: var(--pickle-text-sm);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.fc-facts a[href] {
  color: var(--pickle-accent-text);
  text-decoration: underline;
  text-underline-offset: .2em;
}

/* ===================================================================== next */

.fc-next { margin-top: var(--pickle-space-7); }

.fc-next-h {
  margin: 0 0 var(--pickle-space-4);
  font-family: var(--pickle-font-display);
  font-size: var(--pickle-text-xl);
  font-weight: 600;
  letter-spacing: var(--pickle-tracking-tight);
}

.fc-apps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--pickle-line);
  border: 1px solid var(--pickle-line);
  border-radius: var(--pickle-radius);
  overflow: clip;
}

.fc-apps li { background: var(--pickle-bg); }

.fc-apps a {
  display: flex;
  flex-direction: column;
  gap: var(--pickle-space-2);
  height: 100%;
  padding: var(--pickle-space-5);
  color: var(--pickle-text);
  text-decoration: none;
  transition: background var(--pickle-fast) var(--pickle-ease);
}

.fc-apps a:hover { background: var(--pickle-mint-soft); }
.fc-apps a:focus-visible { outline-offset: -2px; }

.fc-apps b {
  font-size: var(--pickle-text-lg);
  font-weight: 600;
  letter-spacing: var(--pickle-tracking-tight);
}

.fc-apps a:hover b { color: var(--pickle-accent-text); }

.fc-apps span {
  color: var(--pickle-muted);
  font-size: var(--pickle-text-sm);
  line-height: 1.45;
}

/* =================================================================== narrow */

@media (max-width: 760px) {
  .fc-ticket { grid-template-columns: minmax(0, 1fr); }
  .fc-main { padding: var(--pickle-space-5); }
  .fc-stub {
    padding: var(--pickle-space-5);
    border-top: 1px dashed rgb(255 255 255 / 22%);
    border-left: 0;
  }
  .fc-stub::before { top: -11px; left: -11px; transform: rotate(45deg); }
  .fc-stub::after { top: -11px; right: -11px; bottom: auto; left: auto; transform: rotate(-135deg); }
  .fc-left b { font-size: 2.6rem; }
  .fc-receipt { padding: var(--pickle-space-5); }
}

@media (max-width: 520px) {
  .fc-tape-read { padding: var(--pickle-space-3) var(--pickle-space-4) 0; }
  .fc-tape-n b { font-size: var(--pickle-text-xl); }
  .fc-tape-canvas { height: 4.5rem; }
  .fc-worth { grid-template-columns: minmax(0, 1fr); gap: var(--pickle-space-4); }
  .fc-head span + span { display: none; }
  .fc-row { grid-template-columns: minmax(0, 1fr); }
  .fc-claim { width: 100%; }
  .fc-amount { padding: var(--pickle-space-3); }
  .fc-stamp { top: .6rem; right: 0; }
}

/* The claim's checks: Turnstile's slot, and the proof-of-work gauge. Both
   hidden until app.js has a reason to show them; `hidden` has to win over the
   gauge row's own display. */
.fc-captcha { margin-top: var(--pickle-space-3); min-height: 65px; }
.fc-captcha[hidden],
.fc-proof[hidden] { display: none; }
.fc-proof { margin-top: var(--pickle-space-3); }
.fc-proof .ex-gauge > i { background: var(--pickle-mint); }

/* =================================================================== motion */

@media (prefers-reduced-motion: no-preference) {
  /* The instrument arrives after the headline, in one beat. */
  .fc-tape,
  .fc-ticket { animation: ex-in-sm 620ms var(--pickle-ease) both; }
  .fc-tape { animation-delay: 300ms; }
  .fc-ticket { animation-delay: 380ms; }

  .fc-ticket.sending::before { animation: fc-sweep 900ms var(--pickle-ease) infinite; }

  .fc-proof .ex-gauge > i { transition: width 240ms linear; }

  .fc-ticket.claimed .fc-stamp { animation: fc-stamp 460ms cubic-bezier(.2, 1.4, .4, 1) both; }

  .fc-receipt:not([hidden]) { animation: ex-in 520ms var(--pickle-ease) both; }
}

@keyframes fc-sweep {
  from { transform: scaleX(0); opacity: 1; }
  70% { transform: scaleX(1); opacity: 1; }
  to { transform: scaleX(1); opacity: 0; }
}

@keyframes fc-stamp {
  from { opacity: 0; transform: rotate(-16deg) scale(1.9); }
  to { opacity: 1; transform: rotate(-9deg) scale(1); }
}
