@font-face {
  font-family: "Familjen Grotesk";
  src: url("/fonts/familjen-grotesk-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/*
  Colour carries meaning here:
  testnet green (Bitcoin Core's testnet icon hue) = testnet5 coins and the brand,
  bitcoin orange = the real sats you pay.
*/
:root {
  --forest: #123f26;
  --forest-deep: #0c2c1a;
  --on-forest: #eef5ea;
  --on-forest-2: rgba(238, 245, 234, 0.76);
  --on-forest-line: rgba(238, 245, 234, 0.16);
  --lime: #5fe928;
  --lime-hover: #7af04c;
  --orange: #f7931a;
  --orange-ink: #9a5200;

  --paper: #ffffff;
  --paper-2: #f2f6f0;
  --ink: #15211a;
  --ink-2: #33433a;
  --muted: #5b6a61;
  --line: #dde5de;
  --field: #c3cfc6;
  --green: #18803e;
  --green-wash: #e9f6ec;
  --bad: #c4321f;
  --bad-wash: #fcefec;
  --link: #18803e;
  --focus: #18803e;
  --panel-shadow: 0 30px 60px -30px rgba(3, 20, 10, 0.55);

  --sans: "Familjen Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --forest: #103522;
    --paper: #0b1510;
    --paper-2: #122019;
    --ink: #e7efe9;
    --ink-2: #c5d2c9;
    --muted: #97a89d;
    --line: #20332a;
    --field: #34493d;
    --green: #5fd47f;
    --green-wash: #10291a;
    --bad: #ff8a78;
    --bad-wash: #2c1512;
    --link: #7be08f;
    --focus: #5fe928;
    --orange-ink: #ffb357;
    --panel-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.8);
  }
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  background: var(--paper);
  scroll-behavior: smooth;
  scroll-padding-top: 1.5rem;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-feature-settings: "kern", "calt";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, p, dl, dd, ol, ul { margin: 0; }

::selection { color: var(--forest-deep); background: var(--lime); }

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover { text-decoration-thickness: 2px; }

.mono {
  font-family: var(--mono);
  font-size: 0.85em;
}

.wrap {
  width: 100%;
  max-width: 74rem;
  margin: 0 auto;
  padding-inline: 2rem;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Band: header and hero on testnet green */

.band {
  --focus: var(--lime);
  --link: var(--on-forest);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh; /* the small viewport, so phone toolbars don't push the white up */
  color: var(--on-forest);
  background: var(--forest);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: 4.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--on-forest);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand { padding-block: 0.5rem; }

.mark {
  width: 1.875rem;
  height: 1.875rem;
}

.mark circle { fill: var(--lime); }
.mark path { fill: var(--forest-deep); }

.nav {
  display: flex;
  gap: 2rem;
  font-size: 0.9375rem;
}

.nav a {
  padding-block: 0.75rem;
  color: var(--on-forest-2);
  text-decoration: none;
}

.nav a:hover { color: var(--on-forest); }

.nav a[aria-current="page"] {
  color: var(--on-forest);
  text-decoration: underline 2px var(--lime);
  text-underline-offset: 0.45em;
}

/* Spare height is split above the heading and above the status strip,
   so the hero sits in the middle and the strip sits at the bottom of the screen. */
.hero {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding-top: clamp(2.5rem, 7vw, 5.5rem);
  text-align: center;
}

.hero h1 { margin-top: auto; }

h1 {
  font-size: clamp(2.75rem, 6.6vw, 5.5rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: clamp(2rem, 4vw, 2.75rem);
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  margin-bottom: clamp(3rem, 7vw, 5rem);
}

.lead {
  max-width: 38rem;
  color: var(--on-forest-2);
  font-size: 1.25rem;
  line-height: 1.5;
}

.lead p { text-wrap: balance; }

.lead p + p { margin-top: 1rem; }

/* The form, order card and node connect panel: a centred column, contents left-aligned. */
.claim,
.connect {
  width: 100%;
  max-width: 38rem;
  text-align: left;
}

.lead a {
  color: var(--on-forest);
  text-decoration-color: var(--lime);
}

/* Same colour meaning as the order tracker: green = testnet5 coins, orange = real sats. */
.amount {
  font-weight: 700;
  white-space: nowrap;
}

.amount-get { color: var(--lime); }
.amount-fee { color: var(--orange); }

/* Claim form */

.notice {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 0.875rem 1.125rem;
  border-radius: 10px;
  color: var(--on-forest-2);
  background: var(--forest-deep);
  box-shadow: inset 0 0 0 1px rgba(247, 147, 26, 0.55);
}

.notice-dot {
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--orange);
  transform: translateY(-0.1em);
}

.notice strong {
  color: #ffffff;
  font-weight: 700;
}

form { display: grid; }

label {
  margin-bottom: 0.625rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.field {
  display: flex;
  gap: 0.375rem;
  padding: 0.375rem;
  border-radius: 14px;
  background: #ffffff;
  transition: box-shadow 120ms ease;
}

.field:focus-within { box-shadow: 0 0 0 3px var(--lime); }

input {
  flex: 1;
  min-width: 0;
  height: 3.25rem;
  margin: 0;
  padding: 0 0.875rem;
  border: 0;
  border-radius: 9px;
  color: #15211a;
  background: transparent;
  font-size: 1rem;
}

/* 16px or more, or iOS Safari zooms the page when the field is focused. */
input.mono { font-size: 1rem; }

input:focus { outline: none; }

input::placeholder { color: #75837a; }

input:disabled { cursor: not-allowed; }

.field:has(input:disabled) { background: rgba(238, 245, 234, 0.12); }
.field:has(input:disabled) input::placeholder { color: var(--on-forest-2); opacity: 0.6; }

input[aria-invalid="true"] { color: #a32616; }

.field:has(input[aria-invalid="true"]) { box-shadow: 0 0 0 3px #ff9c8a; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  border: 0;
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.btn-go {
  flex: none;
  height: 3.25rem;
  padding: 0 1.5rem;
  border-radius: 9px;
  color: var(--forest-deep);
  background: var(--lime);
  font-size: 1rem;
}

.btn-go:hover { background: var(--lime-hover); }

.btn-go:focus-visible { outline-color: var(--forest); outline-offset: -5px; }

.btn-go:disabled {
  color: var(--on-forest-2);
  background: rgba(238, 245, 234, 0.12);
  cursor: not-allowed;
}

.field-error {
  margin-top: 0.75rem;
  color: #ffc2b8;
  font-weight: 600;
}

.field-error:empty { display: none; }

.hint {
  margin-top: 0.875rem;
  color: var(--on-forest-2);
  font-size: 0.9375rem;
}

/* Order panel */

.order {
  padding: clamp(1.25rem, 3vw, 2rem);
  border-radius: 18px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--panel-shadow);
  animation: rise 280ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.order { --link: var(--green); --focus: var(--green); }
.order a { color: var(--link); }

.progress {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 600;
}

.progress li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.progress li + li { flex: 1; }

.progress li + li::before {
  content: "";
  flex: 1;
  min-width: 0.75rem;
  height: 2px;
  margin-right: 0.125rem;
  border-radius: 1px;
  background: var(--line);
}

.progress li[data-state="done"] + li::before { background: var(--green); }

.progress-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border: 1.5px solid var(--field);
  border-radius: 50%;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1;
}

.progress li[data-state="active"] { color: var(--ink); }

.progress li[data-state="active"] .progress-mark {
  border-color: var(--green);
  color: #ffffff;
  background: var(--green);
}

/* Paying is the one step in real bitcoin, so it is orange. */
#p-payment[data-state="active"] .progress-mark {
  border-color: var(--orange);
  color: #2b1600;
  background: var(--orange);
}

.progress li[data-state="done"] { color: var(--ink-2); }

.progress li[data-state="done"] .progress-mark {
  border-color: var(--green);
  color: transparent;
  background: var(--green);
}

.progress li[data-state="done"] .progress-mark::after {
  content: "";
  position: absolute;
  top: 0.26rem;
  left: 0.47rem;
  width: 0.3rem;
  height: 0.58rem;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.progress li[data-state="bad"] { color: var(--bad); }

.progress li[data-state="bad"] .progress-mark {
  border-color: var(--bad);
  color: var(--bad);
  background: var(--bad-wash);
}

.pay {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.pay-copy {
  flex: 1;
  min-width: 0;
}

.qr {
  flex: none;
  width: 10.5rem;
  padding: 0.5rem;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.qr svg {
  display: block;
  width: 100%;
  height: auto;
}

/* The server draws the QR with its own colours; normalise them. */
.qr svg path:first-child { fill: #ffffff; }
.qr svg path[stroke] { stroke: #0c2c1a; }

.pay-title {
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.pay-hint {
  margin-top: 0.375rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

.copy-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.3125rem 0.3125rem 0.3125rem 0.75rem;
  border-radius: 10px;
  background: var(--paper-2);
}

.copy-field code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 0.8125rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.btn-quiet {
  flex: none;
  height: 2rem;
  padding: 0 0.875rem;
  border-radius: 7px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--field);
  font-size: 0.875rem;
}

.btn-quiet:hover { box-shadow: inset 0 0 0 1px var(--ink-2); }

.status {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding: 0.875rem 1rem;
  border-radius: 10px;
  background: var(--paper-2);
}

.status-icon {
  position: relative;
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.125rem;
  border-radius: 50%;
}

.status[data-tone="wait"],
.status[data-tone="send"] { --pulse: var(--orange); }
.status[data-tone="send"] { --pulse: var(--green); }

.status[data-tone="wait"] .status-icon::before,
.status[data-tone="send"] .status-icon::before {
  content: "";
  position: absolute;
  inset: 0.3rem;
  border-radius: 50%;
  background: var(--pulse);
  animation: pulse 1.6s ease-in-out infinite;
}

.status[data-tone="wait"] .status-icon::after,
.status[data-tone="send"] .status-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--pulse);
  opacity: 0.2;
}

.status[data-tone="ok"] { background: var(--green-wash); }

.status[data-tone="ok"] .status-icon { background: var(--green); }

.status[data-tone="ok"] .status-icon::after {
  content: "";
  position: absolute;
  top: 0.22rem;
  left: 0.43rem;
  width: 0.3rem;
  height: 0.6rem;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.status[data-tone="bad"] { background: var(--bad-wash); }

.status[data-tone="bad"] .status-icon { background: var(--bad); }

.status[data-tone="bad"] .status-icon::before,
.status[data-tone="bad"] .status-icon::after {
  content: "";
  position: absolute;
  top: 0.56rem;
  left: 0.3rem;
  width: 0.65rem;
  height: 2px;
  border-radius: 1px;
  background: #ffffff;
  transform: rotate(45deg);
}

.status[data-tone="bad"] .status-icon::after { transform: rotate(-45deg); }

.status[data-tone="idle"] .status-icon { box-shadow: inset 0 0 0 2px var(--field); }

.status-title {
  font-weight: 700;
  line-height: 1.45;
}

.status-text {
  margin-top: 0.125rem;
  color: var(--muted);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

.status-text:empty { display: none; }

.order-meta {
  margin-top: 1.25rem;
  font-size: 0.9375rem;
}

.order-meta > div {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 1rem;
  padding-block: 0.625rem;
  border-top: 1px solid var(--line);
}

.order-meta dt { color: var(--muted); }

.order-meta dd {
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.txid-cell {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.txid-cell .mono { flex: 1; min-width: 0; }

.btn-line {
  height: 2.75rem;
  margin-top: 1.25rem;
  padding: 0 1.25rem;
  border-radius: 10px;
  color: var(--ink);
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--ink);
}

.btn-line:hover {
  color: var(--paper);
  background: var(--ink);
}

/* Live facts along the bottom of the band */

.facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 2.75rem;
  margin-top: auto;
  padding: 1.25rem 0 1.5rem;
  border-top: 1px solid var(--on-forest-line);
  color: var(--on-forest-2);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  list-style: none;
}

.facts li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dot {
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--on-forest-line);
}

.dot[data-tone="ok"] {
  background: var(--lime);
  box-shadow: 0 0 0 3px rgba(95, 233, 40, 0.22);
}

.dot[data-tone="warn"] { background: var(--orange); }
.dot[data-tone="bad"] {
  background: #ff3b30;
  box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.25);
}

/* Questions */

.questions {
  max-width: 58rem;
  padding-block: clamp(3rem, 7vw, 5.5rem);
}

.questions h2 {
  margin-bottom: clamp(1.75rem, 3.5vw, 2.5rem);
  text-align: center;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.025em;
}

.qa > div {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 0.375rem 2.5rem;
  padding-block: 1.375rem;
  border-top: 1px solid var(--line);
}

.qa > div:last-child { border-bottom: 1px solid var(--line); }

.qa dt {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.35;
}

.qa dd {
  max-width: 52ch;
  color: var(--ink-2);
}

/* Footer */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 2rem;
  padding-block: 2rem 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
  font-size: 0.9375rem;
}

/* Motion */

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
}

@keyframes pulse {
  50% { opacity: 0.35; }
}

/* Node page */

.connect-label {
  margin-bottom: 0.625rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.field + .connect-label { margin-top: 1.5rem; }

.field-code code {
  display: flex;
  flex: 1;
  align-items: center;
  min-width: 0;
  min-height: 3.25rem;
  padding: 0.625rem 0.875rem;
  color: #15211a;
  font-size: 0.9375rem;
  line-height: 1.4;
  overflow-wrap: break-word;
}

.field-code .btn-go { align-self: center; }

.hash { font-size: 0.875em; }

/* Responsive */

@media (max-width: 960px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .qa > div { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .wrap { padding-inline: 1.25rem; }
  .site-header { height: 4rem; }
  .nav { gap: 1.25rem; }
  .nav a[href$="#questions"] { display: none; }
  .field-code code { font-size: 0.8125rem; }
  .lead { font-size: 1.125rem; }
  .field { flex-direction: column; }
  .field input { flex: none; }
  .btn-go { width: 100%; }
  .order { padding: 1.125rem; }
  .progress { gap: 0.5rem; font-size: 0.875rem; }
  .pay { flex-direction: column; align-items: stretch; }
  .qr { width: min(14rem, 100%); margin-inline: auto; }
  .facts { gap: 0.5rem 1.75rem; }
}

@media (max-width: 380px) {
  .nav a:last-child { display: none; }
  .progress {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.25rem;
  }
  .progress li { flex-direction: column; gap: 0.375rem; }
  .progress li + li::before { display: none; }
}

/* Bigger copy buttons for fingers. */
@media (pointer: coarse) {
  .btn-quiet { height: 2.5rem; padding: 0 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
