/* Bonsai — /donate, the public donation page.
 *
 * Loaded ON TOP of document.css, which carries the paper, the rail, the type
 * scale and the footer that every public page shares. Only what that file has
 * no reason to know about lives here: an amount picker, a money field, and the
 * card that states the split.
 *
 * A separate file rather than a <style> block because the page's CSP is
 * `style-src 'self'` with no 'unsafe-inline' — the same rule the app and the
 * landing page are held to. It is content-hashed by scripts/stamp-assets.mjs
 * like every other file in this directory.
 *
 * The equivalent controls inside the app are styled in styles.css (search
 * ".donate-amounts"). They are deliberately NOT shared: the app is a soft-UI
 * panel on a dark-capable surface, this is ink on paper, and one rule set
 * bending to cover both would serve neither. What must stay identical is the
 * WORDING of the split, and that is enforced by neither file — see the note
 * above DONATION_ENVIRONMENT_SHARE_BPS in lib/billing.mjs. */

/* ═══ THE PANEL ══════════════════════════════════════════════════════════════ */
.give {
  margin-top: 2rem; padding: clamp(1.35rem, 3vw, 1.9rem);
  background: var(--paper-panel);
  border: 1px solid var(--line-strong); border-radius: 4px;
  box-shadow: var(--lip), var(--lift-2);
  max-width: var(--col);
}
.give-label {
  display: block; margin-bottom: .7rem;
  font-family: var(--mono);
  font-size: var(--t-tag); font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint);
}
.give-label + .give-label { margin-top: 1.6rem; }

/* ═══ AMOUNT ═════════════════════════════════════════════════════════════════ */
.amounts { display: flex; flex-wrap: wrap; gap: .6rem; }
.amount {
  flex: 1 1 auto; min-width: 5rem;
  cursor: pointer; font-family: inherit;
  font-size: 1rem; font-weight: 600; color: var(--ink);
  padding: .8rem 1rem;
  background: linear-gradient(180deg, var(--paper-lit), var(--paper));
  border: 1px solid var(--line-strong); border-radius: 3px;
  box-shadow: var(--lip-soft), var(--lift-1);
  transition: background-color .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease);
}
.amount:hover { border-color: var(--ink-ghost); }
.amount:active { transform: translateY(1px); }
.amount:focus-visible { outline: 2px solid var(--forest-deep); outline-offset: 2px; }
/* Selection is never carried by colour alone: aria-pressed states it outright
   for assistive tech, and the border darkens along with the fill for anyone who
   cannot separate the two greens from the paper. */
.amount[aria-pressed="true"] {
  color: #f5f0e3; background: linear-gradient(180deg, #3d5c43 0%, #34503a 45%, #294633 100%);
  border-color: var(--forest-dark);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), var(--lift-1);
}

/* ═══ CUSTOM AMOUNT ══════════════════════════════════════════════════════════ */
.give-field { position: relative; display: flex; }
/* Inside the field, not beside it, so the value reads back as one "$12.50".
   aria-hidden — the input's own <label> says what the number is. */
.give-currency {
  position: absolute; left: .95rem; top: 50%; transform: translateY(-50%);
  font-size: 1rem; font-weight: 600; color: var(--ink-ghost); pointer-events: none;
}
.give-input {
  width: 100%; font-family: inherit; font-size: 1rem; color: var(--ink);
  padding: .8rem 1rem .8rem 2rem;
  background: var(--paper-lit);
  border: 1px solid var(--line-strong); border-radius: 3px;
  box-shadow: inset 0 1px 3px rgba(43,38,24,.10);
}
.give-input:focus { outline: 2px solid var(--forest-deep); outline-offset: 1px; }
.give-input::placeholder { color: var(--ink-ghost); }

/* ═══ THE SPLIT ══════════════════════════════════════════════════════════════ */
/* Deliberately above the button, not below it and not in a footnote: it is the
   single most important thing on the page, because "donate" ordinarily implies
   the money goes to the cause and here four fifths of it does not. */
.split { margin-top: 1.6rem; padding: 1.1rem 1.25rem; border-radius: 3px;
  background: linear-gradient(180deg, rgba(244,246,238,.92), rgba(233,238,224,.75));
  border: 1px solid var(--line); border-left: 3px solid var(--forest);
}
.split-head {
  display: block; margin-bottom: .8rem;
  font-family: var(--mono);
  font-size: var(--t-tag); font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--leaf);
}
.split-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.split-list li {
  position: relative; padding-left: 1.5rem; max-width: none;
  font-size: .9375rem; line-height: 1.5; color: var(--ink-soft);
}
.split-list li::before {
  content: ""; position: absolute; left: .3rem; top: .55em;
  width: .4rem; height: .4rem; border-radius: 50%; background: var(--leaf);
  box-shadow: 0 0 0 3px rgba(76,107,70,.16);
}
.split-list b { color: var(--forest-deep); font-weight: 700; }
/* The chosen amount, in dollars, split in front of the donor. Filled in by
   donate-page.js; empty and hidden until an amount is valid. */
.split-sum {
  margin: .9rem 0 0; padding-top: .75rem;
  font-size: .9375rem; line-height: 1.5; color: var(--ink);
  border-top: 1px solid rgba(76,107,70,.2);
}
.split-sum[hidden] { display: none; }
.split-sum b { color: var(--forest-deep); font-weight: 700; }
.split-fine {
  margin: .9rem 0 0; padding-top: .75rem;
  font-size: .8125rem; line-height: 1.55; color: var(--ink-faint);
  border-top: 1px solid rgba(76,107,70,.2);
}

/* ═══ SUBMIT ═════════════════════════════════════════════════════════════════ */
.give-go { margin-top: 1.6rem; display: flex; flex-wrap: wrap; align-items: center; gap: .85rem 1.25rem; }
.give-go .btn { min-width: 12rem; justify-content: center; }
.give-go .btn[disabled] { opacity: .65; cursor: default; }
/* Loading, while Stripe Checkout is being opened. The button used to swap its
   text for the word "Starting…"; these are the same three bouncing dots the app
   shows on every other button that waits.

   Restated here rather than imported: this page deliberately loads only
   document.css and donate.css, not styles.css, so .dot-loader is not in scope.
   Nothing can check the two copies against each other — keep them in step by
   eye, and note the two places this one differs on purpose.

   The dots take currentColor instead of var(--forest). This is the dark filled
   button, and forest-on-forest is invisible; styles.css needs a second rule
   (.profile-feedback-send .dot-loader span) to say the same thing for its own
   filled button, which currentColor gets right on both.

   The label is hidden with `visibility` rather than the hidden attribute, so it
   keeps its box and the button holds its exact size. `hidden` takes it out of
   flow, and the button would then shrink to the height of a 0.42rem dot —
   .give-go .btn pins the width at 12rem, but nothing was pinning the height. */
#give-btn { position: relative; }
#give-btn.is-loading #give-btn-label { visibility: hidden; }
#give-btn .dot-loader { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.dot-loader { display: inline-flex; align-items: center; gap: .3rem; }
.dot-loader[hidden] { display: none; }
.dot-loader span {
  width: .42rem; height: .42rem; border-radius: 50%;
  background: currentColor; opacity: .3;
  animation: dot-bounce 1s infinite ease-in-out;
}
.dot-loader span:nth-child(2) { animation-delay: .16s; }
.dot-loader span:nth-child(3) { animation-delay: .32s; }
@keyframes dot-bounce {
  0%, 80%, 100% { opacity: .3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-.2rem); }
}
@media (prefers-reduced-motion: reduce) {
  .dot-loader span { animation: none; opacity: .6; }
}
.give-status { font-size: .9375rem; line-height: 1.5; color: var(--seal-deep); }
.give-status[hidden] { display: none; }

/* ═══ RETURNING FROM STRIPE ══════════════════════════════════════════════════ */
.give-back { margin-top: 2rem; }
.give-back[hidden] { display: none; }
.give-back .lbl { color: var(--leaf); }
.give-back.is-cancel { border-left-color: var(--line-strong); }
.give-back.is-cancel .lbl { color: var(--ink-faint); }

@media (max-width: 560px) {
  .amount { min-width: 0; flex-basis: calc(50% - .3rem); }
  .give-go { flex-direction: column; align-items: stretch; }
  .give-go .btn { width: 100%; }
}
