/* sendbitcoin.gift — color scheme adopted from the Bitcoin FITS calculator
   (dark navy + signal orange), donate widget mirrors the FITS donate widget exactly. */

:root {
  --bg: #020817;
  --bg-card: #0f172a;
  --bg-elevated: #1e293b;
  --text: #f8fafc;
  --text-muted: #cbd5e1;
  --border: #334155;
  --accent: #ff8000;
  --accent-hover: #e67300;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- Single-purpose utilities ----------
   The server's CSP is `style-src 'self'` with no 'unsafe-inline', so a style=""
   attribute is dropped by the browser. These two carry values that used to be
   inline in the donate modal and in views.js. */
.donate-bolt { text-align: center; font-size: 2.5rem; }
.mt-16 { margin-top: 16px; }
/* A <fieldset> is here for the radio group's semantics, not for its default chrome. */
fieldset.radio-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
/* Secret rows: reveal control + copy button side by side (matches v2). */
.dd-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- header ---- */
.site-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 18px 28px 14px;
  border-bottom: 1px solid var(--bg-elevated);
}
.brand {
  font-size: 26px;
  letter-spacing: 0.5px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}
.brand span { color: var(--accent); }
.site-nav a {
  margin-left: 22px;
  color: var(--text-muted);
  text-decoration: none;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.site-nav a:hover { color: var(--text); }
.site-nav a.on { color: var(--accent); border-bottom: 2px solid var(--accent); padding-bottom: 2px; }
.site-nav a:focus-visible, .brand:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* ---- layout ---- */
main {
  width: min(720px, 100% - 40px);
  margin: 30px auto;
  flex: 1;
}
h1, h2 { line-height: 1.15; }
h1 { font-size: 34px; margin: 0 0 6px; }
h2 { font-size: 21px; margin-top: 0; }
.lede { color: var(--text-muted); margin-top: 0; }
a { color: var(--accent); }
.hero { padding: 28px 0 8px; }
.eyebrow { color: var(--accent); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; margin: 0 0 10px; }
.risk-note { color: var(--text-muted); font-size: 13px; margin-top: 18px; }
.geek-control { display: flex; align-items: center; gap: 12px; margin: 12px 0 28px; }
.geek-toggle { display: inline-flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 999px; padding: 10px 14px; cursor: pointer; color: var(--text-muted); min-height: 44px; }
.geek-toggle input { width: 20px; height: 20px; accent-color: var(--accent); }
.geek-toggle small { border-radius: 999px; color: var(--text-muted); font-family: ui-monospace, Menlo, Consolas, monospace; }
.geek-toggle:has(input:checked) { border-color: var(--accent); color: var(--text); background: rgba(255, 128, 0, 0.08); }
.gift-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; list-style: none; padding: 0; margin: 0 0 32px; }
.gift-steps li { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; color: var(--text-muted); font-size: 0.9rem; }
.gift-steps strong { display: block; color: var(--text); margin-bottom: 4px; }
.form-section, .technical-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 24px; margin-bottom: 24px; }
.field-help { color: var(--text-muted); font-size: 13px; margin: -1px 0 7px; }
.technical-panel { border-color: rgba(255, 128, 0, .6); }

/* ---- network toggle ---- */
.net-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 22px;
}
.net-toggle button {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 9px 18px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted);
}
.net-toggle button.on { background: var(--accent); color: #000; font-weight: 700; }
.net-toggle .warn { color: #ffb066; }

/* ---- forms ---- */
form label {
  display: block;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin: 18px 0 4px;
}
input, select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.row { display: flex; gap: 16px; }
.row > div { flex: 1; }
.hint { font-size: 13px; color: var(--text-muted); margin: 4px 0 0; }
.hint.err { color: #ff6b6b; }

/* ---- radio button row (BTC / sats / USD) ---- */
.radio-row {
  display: flex;
  gap: 4px;
  margin: 6px 0 8px;
}
.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--text-muted);
  transition: background 0.12s, border-color 0.12s;
}
.radio-label:has(input:checked) {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 700;
}
.radio-label input { display: none; }
.custom-dur-wrap label { margin-top: 0; }

/* ---- advanced section ---- */
details.advanced {
  margin-top: 22px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}
details.advanced summary {
  cursor: pointer;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  user-select: none;
}
details.advanced summary:hover { color: var(--text); }
.advanced-note { font-size: 14px; }
.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 10px;
  margin-top: 12px !important;
  cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  accent-color: var(--accent);
  cursor: pointer;
}
.checkbox-label { text-transform: none; letter-spacing: normal; font-family: Georgia, serif; font-size: 15px; color: var(--text); }

.btn {
  appearance: none;
  font: inherit;
  font-weight: 700;
  background: linear-gradient(135deg, #ff8000, #ffa040);
  color: #000;
  border: none;
  padding: 12px 26px;
  margin-top: 24px;
  cursor: pointer;
  border-radius: 50px;
  transition: transform 0.15s, filter 0.15s;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn[disabled] { opacity: 0.55; cursor: wait; transform: none; }
.btn.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* ---- ticket result card ---- */
.ticket {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  position: relative;
  padding: 28px 28px 22px;
  margin-top: 26px;
}
.ticket dl { margin: 0; }
.ticket dt {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-top: 14px;
}
.ticket dd { margin: 2px 0 0; word-break: break-all; }
.ticket dd.mono, code.mono, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; }
.ticket dd.secret { cursor: pointer; letter-spacing: 2px; user-select: none; }
.ticket dd.secret:hover { background: var(--bg-elevated); border-radius: 6px; padding: 0 6px; margin-left: -6px; }
.ticket dd.secret.revealed { letter-spacing: normal; user-select: text; background: rgba(255, 128, 0, 0.08); border-radius: 6px; padding: 0 6px; margin-left: -6px; }
.ticket .stamp {
  position: absolute;
  right: 22px; top: 20px;
  border: 2px solid var(--accent);
  color: var(--accent);
  border-radius: 6px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 12px;
  padding: 5px 11px;
  transform: rotate(4deg);
}

/* ---- P2TR badge ---- */
.addr-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  background: var(--accent);
  color: #000;
  font-weight: 700;
  margin: 0 0 6px;   /* in-flow badge above the h2 — no overlap with the giftbox */
}

/* ---- giftbox drawing (ticket top-right) ---- */
.giftbox {
  position: absolute;
  right: 26px; top: 22px;
  width: 54px; height: 52px;
  pointer-events: none;
}
.giftbox span { position: absolute; display: block; }
.giftbox .gb-box {
  left: 4px; bottom: 0;
  width: 46px; height: 32px;
  background: var(--accent);
  border-radius: 4px;
}
.giftbox .gb-lid {
  left: 0; bottom: 30px;
  width: 54px; height: 10px;
  background: var(--accent-hover);
  border-radius: 3px;
}
.giftbox .gb-bow {
  left: 50%; bottom: 38px;
  transform: translateX(-50%);
  width: 18px; height: 18px;
}
.giftbox .gb-bow::before, .giftbox .gb-bow::after {
  content: "";
  position: absolute;
  top: 2px;
  width: 14px; height: 10px;
  background: var(--accent-hover);
  border-radius: 8px 8px 0 8px;
}
.giftbox .gb-bow::before { left: -9px; transform: rotate(-35deg); }
.giftbox .gb-bow::after  { right: -9px; transform: rotate(35deg) scaleX(-1); }
/* vertical ribbon on the box */
.giftbox .gb-box::after {
  content: "";
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 7px;
  transform: translateX(-50%);
  background: #ffd9b3;
  border-radius: 2px;
}
.qr-wrap { text-align: center; margin: 18px 0 6px; }
.qr-wrap canvas, .qr-wrap img { image-rendering: pixelated; border-radius: 8px; max-width: 100%; height: auto; }

/* ---- steps / about ---- */
.steps { counter-reset: step; list-style: none; padding: 0; }
.steps li { counter-increment: step; position: relative; padding-left: 52px; margin: 22px 0; }
.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: 2px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 8px;
  color: var(--accent);
}
.callout {
  border-left: 3px solid var(--accent);
  background: var(--bg-card);
  padding: 12px 16px;
  border-radius: 0 10px 10px 0;
  margin: 20px 0;
}
.callout.warn { border-left-color: #ffd166; }
code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--bg-elevated);
  padding: 1px 5px;
  border-radius: 6px;
  word-break: break-all;
}

/* ---- recipient handout (shown on screen, becomes the print page) ---- */
.handout {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  margin-top: 26px;
}
.handout h1 { color: var(--accent); margin-bottom: 4pt; }
.handout h2 { font-size: 17px; margin: 18px 0 6px; padding-bottom: 3px; border-bottom: 1px solid var(--border); }
.handout-msg { font-style: italic; }
.handout-url { text-align: center; font-weight: bold; }

/* ---- donate FAB — mirrors the FITS reference design ---- */
.donate-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.6rem;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, #ff8000, #ffa040);
  color: #000;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255, 128, 0, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: donatePulse 2.5s ease-in-out infinite;
}
.donate-fab:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 32px rgba(255, 128, 0, 0.55);
}
.donate-fab:active { transform: translateY(-1px) scale(0.98); }
@keyframes donatePulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(255, 128, 0, 0.4); }
  50% { box-shadow: 0 8px 32px rgba(255, 128, 0, 0.6); }
}
@media (max-width: 768px) {
  main { width: min(100% - 28px, 720px); margin-top: 12px; }
  .site-head { align-items: flex-start; flex-direction: column; gap: 10px; padding: 16px 14px 12px; }
  .site-nav { display: flex; flex-wrap: wrap; gap: 12px; }
  .site-nav a { margin-left: 0; }
  h1 { font-size: 32px; }
  .gift-steps { grid-template-columns: 1fr; gap: 8px; }
  .form-section, .technical-panel { padding: 18px; }
  .geek-control { margin-bottom: 20px; }
  .geek-toggle { width: 100%; justify-content: space-between; }
  .donate-fab { bottom: 1.25rem; right: 1.25rem; padding: 0.7rem 1.2rem; font-size: 0.85rem; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

/* ---- donate modal — mirrors the FITS reference design ---- */
.modal-backdrop {
  position: fixed; inset: 0;
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  padding: 20px;
}
.modal {
  position: relative;
  width: 90%;
  max-width: 380px;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--bg-elevated);
  border-radius: 10px;
  box-shadow: 0 0 40px rgba(255, 128, 0, 0.12), 0 16px 48px rgba(0, 0, 0, 0.5);
}
.modal h2 { text-align: center; margin: 0.25rem 0 0.35rem; }
.modal > p { text-align: center; color: var(--text-muted); margin: 0 0 1.25rem; font-size: 0.9rem; }
.modal-x {
  position: absolute; top: 1rem; right: 1rem;
  background: none; border: none;
  color: var(--text-muted);
  font-size: 1.6rem; cursor: pointer; line-height: 1;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.modal-x:hover { color: var(--text); }
.modal .qr-wrap-donate {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: #020817;
  border: 1px solid var(--bg-elevated);
  border-radius: 10px;
}
.modal .qr-wrap-donate img { position: relative; z-index: 2; border-radius: 6px; }
.modal .qr-glow {
  position: absolute;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(255, 128, 0, 0.15), transparent 70%);
  z-index: 1;
}
.donate-address {
  display: block;
  margin-bottom: 0.75rem;
}
.donate-address .donate-label {
  display: block;
  text-align: left;
}
.donate-address .donate-addr-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  background: #020817;
  border: 1px solid var(--bg-elevated);
  border-radius: 10px;
  align-items: center;
}
.donate-address code { color: var(--accent); font-size: 0.85rem; }
.donate-offer { margin-bottom: 0.75rem; }
.donate-offer .donate-label { display: block; }
.donate-offer .donate-offer-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  background: #020817;
  border: 1px solid var(--bg-elevated);
  border-radius: 10px;
}
.donate-offer input {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.68rem;
}
.donate-copy-btn {
  padding: 0.6rem 1.1rem;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #000;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s;
}
.donate-copy-btn:hover { filter: brightness(1.1); }
.donate-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-style: italic;
  margin: 0.5rem 0 0;
}

/* ---- footer ---- */
.site-foot {
  border-top: 1px solid var(--bg-elevated);
  color: var(--text-muted);
  font-size: 13px;
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ---- print: only the recipient handout survives (never the gifter's keys) ---- */
@media print {
  body { background: #fff; color: #111; }
  .site-head, .site-nav, .site-foot, .donate-fab, .modal-backdrop,
  form, .net-toggle, .btn-row, .no-print, .ticket { display: none !important; }
  main { width: 100%; margin: 0; }
  .handout {
    display: block;
    max-width: 640px;
    margin: 40px auto;
    padding: 32px;
    border: 2pt solid #b3402a;
    border-radius: 12pt;
    page-break-inside: avoid;
  }
  .handout h1 { color: #b3402a; font-size: 30pt; margin-bottom: 4pt; }
  .handout h2 {
    font-family: Georgia, serif;
    font-size: 15pt;
    margin: 18pt 0 4pt;
    padding-bottom: 2pt;
    border-bottom: 0.5pt solid #ccc;
  }
  .handout-msg { font-style: italic; font-size: 13pt; }
  .handout p { font-size: 11.5pt; line-height: 1.5; }
  .handout-url { text-align: center; font-size: 13pt; font-weight: bold; margin-top: 8pt; }
  /* Printed at ~3.1in: the payload is a version-40 QR (~177 modules), so anything
     under ~0.4mm per module stops being reliably scannable by a phone camera. The
     old 220px worked out to roughly half that. */
  .handout .qr-wrap canvas, .handout .qr-wrap img { width: 300px; height: 300px; }
}

/* ---- donate modal labels ---- */
.donate-label {
  display: block;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 4px;
}


/* ---- redeem camera scanner ---- */
.camera-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cam-icon {
  display: inline-block;
  width: 20px;
  height: 16px;
  background: var(--accent);
  clip-path: polygon(0 3px, 4px 3px, 5px 0, 15px 0, 16px 3px, 20px 3px, 20px 16px, 0 16px);
}
.cam-icon::after {
  content: "";
  position: absolute;
}
.hidden { display: none !important; }
.cam-box { margin-top: 14px; }
.cam-box video {
  width: min(420px, 100%);
  border-radius: 12px;
  border: 2px solid var(--accent);
  background: #000;
}

/* ---- gifter refund panel ---- */
.refund-panel { margin-top: 18px; }
.refund-panel summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.refund-panel label { display: block; margin-top: 10px; }
.refund-panel input { margin-top: 4px; }
.refund-panel .btn { margin-top: 10px; }
