/* =========================================================
   Donation pages: /donate and /donate/thank-you
   Loaded only by those two pages (their front matter asks for it), on top of style.css, whose colours,
   type and components (.page-hero, .donate-box, .giftaid, .btn, .form-row, .form-status) they reuse.
   Like style.css this file is edited by hand and content-hashed by build.py, so run the build after
   changing it. Every class here starts dn-.
   ========================================================= */

.dn-page { --dn-error: #a3341f; --dn-error-bg: #fbece8; }

/* ---------- The hero, which on /donate is the whole page: the message, the charity-and-tax facts and the perks line on
   the left, the form in a white card on the right. On a phone: the message, the facts, the form, then the perks line.
   /donate/us uses the same grid, with its ways to give in the card. ---------- */
.dn-hero { padding-block: clamp(24px, 3vw, 48px) clamp(56px, 7vw, 96px); }
/* The faint logo hangs from the top of the band at a set height, so it stays put while the card beside it grows or
   shrinks (Gift Aid ticked, a message added, the thank-you filling in); on the band's bottom edge it slid up and down
   with the card. On /donate it hangs on the left below the perks line, in the empty space beside the lower half of the
   card, a little smaller than elsewhere: over the text its bars read as highlights. The left column ends about 760px
   down from 1024 wide up, and lower on narrower screens (about 970px at 861 wide), hence 1960px - 113vw. On the
   thank-you page it sits behind the short message. Stacked on a phone it goes back under the content, which moves as
   a whole. */
.dn-hero .watermark { bottom: auto; transform: none; }
.dn-hero:not(.dn-thanks) .watermark { top: max(790px, calc(1960px - 113vw)); width: min(34vw, 440px); }
.dn-hero.dn-thanks .watermark { top: 60px; }
/* style.css pulls a left-hand logo to -30vw from 900px down, meant for its 80vw phone size; at this smaller size that
   would leave only a sliver showing until the phone layout starts at 860px, so keep the desktop offset until then. */
@media (min-width: 861px) and (max-width: 900px) { .dn-hero:not(.dn-thanks) .watermark { left: -8vw; } }
@media (max-width: 860px) {
  .dn-hero:not(.dn-thanks) .watermark, .dn-hero.dn-thanks .watermark { top: auto; bottom: -6%; }
  .dn-hero:not(.dn-thanks) .watermark { width: 80vw; }   /* style.css's size on a phone */
}
.dn-hero-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 480px);
  grid-template-areas: "intro form" "why form" "perks form"; grid-template-rows: auto auto 1fr;
  column-gap: clamp(32px, 6vw, 96px); align-items: start;
}
/* On a wide screen the card is a little wider, so the declaration and the email box take fewer lines and the
   Donate button stays nearer the first screen */
@media (min-width: 1100px) { .dn-hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 520px); } }
.dn-intro { grid-area: intro; padding-top: clamp(4px, 2vw, 28px); }
.dn-intro h1 { margin-bottom: .3em; }
.dn-intro .lead { max-width: 42ch; }
.dn-hero:not(.dn-thanks) .dn-intro > :last-child { margin-bottom: 0; }   /* the thank-you page keeps its own spacing */
.dn-formcol, .dn-receipt { grid-area: form; }
.dn-formcol { min-width: 0; }

/* Being a charity, and giving tax-efficiently from the UK, the US or elsewhere: a short list in the hero's own type,
   brighter than the lead, each line marked with a small amber tick. No box. */
.dn-why { grid-area: why; list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 10px; max-width: 46ch; color: var(--white); line-height: 1.5; }
.dn-why li { position: relative; padding-left: 28px; text-wrap: pretty; }
.dn-why li::before {
  content: ""; position: absolute; left: 5px; top: .28em; width: 6px; height: 11px;
  border: solid var(--amber); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
/* What every donor gets: one quiet line */
.dn-perks { grid-area: perks; margin: 24px 0 0; max-width: 46ch; font-size: .95rem; color: var(--green-200); text-wrap: pretty; }
/* Under the card, on the hero: larger gifts, companies and trusts */
.dn-larger { margin: 16px 4px 0; font-size: .88rem; line-height: 1.5; color: var(--green-200); }

@media (max-width: 860px) {
  .dn-hero-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "intro" "why" "form" "perks"; grid-template-rows: none; }
  .dn-intro { padding-top: 0; margin-bottom: 26px; }
  .dn-why { margin: 0 0 28px; }
  .dn-formcol, .dn-receipt { width: 100%; max-width: 560px; }
  .dn-perks { margin-top: 26px; }
}
/* On a phone the lead keeps its first sentence, so the facts and the form come sooner */
@media (max-width: 600px) { .dn-lead-more { display: none; } }

/* /donate/us: Myriad USA's paragraph on the left, in the hero's own type, and the three ways to give in the card */
.dn-us-lead { max-width: 48ch; color: var(--white); line-height: 1.6; text-wrap: pretty; }
.dn-ways { grid-area: form; padding: clamp(22px, 2.6vw, 32px); }
.dn-ways-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; font-size: .95rem; line-height: 1.55; color: var(--ink-2); }
.dn-ways-list strong { display: block; margin-bottom: 2px; font-size: 1rem; color: var(--green-900); }
.dn-ways-btn { display: flex; width: fit-content; margin: 8px 0 10px; }   /* the button, then the address on its own line */
.page-hero .dn-ways a.dn-ways-btn, .page-hero .dn-ways a.dn-ways-btn:hover { color: var(--green-900); }
.dn-ways-url { overflow-wrap: anywhere; }   /* the long Every.org address breaks rather than widening the card */
.dn-us .no-lig, .dn-nowrap, .dn-ways a[href^="tel:"] { white-space: nowrap; }   /* 501(c)(3) and the phone number stay whole */
.page-hero .dn-ways a { color: var(--green-600); }
.page-hero .dn-ways a:hover { color: var(--green-800); }
@media (max-width: 860px) {
  .dn-ways { width: 100%; max-width: 560px; }
}

/* Links inside the white card: the hero's own (pale, white on hover) would vanish on white */
.page-hero .dn-form a, .page-hero .dn-receipt a { color: var(--green-600); }
.page-hero .dn-form a:hover, .page-hero .dn-receipt a:hover { color: var(--green-800); }
.page-hero .dn-receipt .btn-outline { color: var(--green-800); }
.page-hero .dn-receipt .btn-outline:hover { color: var(--white); }

/* ---------- The form ---------- */
.dn-form { display: grid; gap: 12px; padding: clamp(20px, 2vw, 26px); position: relative; }
.dn-form fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.dn-form legend { padding: 0; }
.dn-small { font-size: .82rem; line-height: 1.5; color: var(--muted); margin: 0; }
/* A field focused from an error message must not end up under the sticky header */
.dn-form input, .dn-form textarea, .dn-form summary, .dn-form button { scroll-margin-top: calc(var(--header-h) + 24px); scroll-margin-bottom: 24px; }

/* One-off / Monthly: two radios drawn as a segmented control */
.dn-form .dn-freq { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--green-050); border-radius: 999px; }
.dn-freq label, .dn-amt { position: relative; margin: 0; font-size: 1rem; }
.dn-freq input, .dn-amt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.dn-freq span { display: block; padding: 10px 12px; border-radius: 999px; text-align: center; font-weight: 700; color: var(--green-700); transition: background-color .2s, color .2s; }
.dn-freq input:not(:checked):hover + span { color: var(--green-900); background: rgba(18, 53, 36, .06); }
.dn-freq input:checked + span { background: var(--green-800); color: var(--white); }

/* Amounts: radios drawn as buttons, three to a row */
.dn-amounts legend, .dn-you legend { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 8px; }
.dn-amount-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.dn-amt span {
  display: flex; align-items: center; justify-content: center; min-height: 50px; padding: 8px 6px;
  border: 1.5px solid rgba(19, 26, 22, .16); border-radius: var(--radius-sm); background: var(--white);
  font-weight: 700; font-size: 1.08rem; color: var(--ink); font-variant-numeric: lining-nums;
  transition: background-color .2s, border-color .2s, color .2s;
}
.dn-amt input:hover + span { border-color: var(--green-500); }
.dn-amt input:checked + span { background: var(--green-800); border-color: var(--green-800); color: var(--white); }
.dn-freq input:focus-visible + span, .dn-amt input:focus-visible + span { outline: 3px solid var(--green-800); outline-offset: 2px; }

/* The "Other" amount, shown when Other is chosen (by donate.js; without it, by :has, or always) */
.dn-other { margin-top: 14px; }
.dn-money { position: relative; }
.dn-money > span { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-weight: 700; color: var(--ink-2); pointer-events: none; }
.dn-form input[type="number"] {
  width: 100%; font: inherit; padding: 10px 16px 10px 34px; border-radius: var(--radius-sm); border: 1.5px solid rgba(19, 26, 22, .18);
  background: var(--white); color: var(--ink); transition: border-color .2s, box-shadow .2s; -moz-appearance: textfield; appearance: textfield;
}
.dn-form input[type="number"]::-webkit-inner-spin-button, .dn-form input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.dn-form input[type="text"], .dn-form input[type="email"] { padding: 10px 14px; }   /* a little shorter than elsewhere, to keep the Donate button near the first screen */

/* Gift Aid: a calm panel inside the card */
.dn-ga { background: var(--green-050); border-radius: 12px; padding: 14px; }
.dn-ga legend { font-family: var(--font-head); font-weight: 500; font-size: 1.22rem; line-height: 1.25; color: var(--green-900); margin-bottom: 4px; text-wrap: balance; }
.dn-ga-calc { font-size: .95rem; color: var(--ink-2); margin: 0 0 10px; }
.dn-ga-calc strong { color: var(--green-800); white-space: nowrap; }
.dn-check { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: start; margin: 0; font-weight: 500; font-size: .88rem; line-height: 1.55; color: var(--ink); cursor: pointer; }
.dn-check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--green-800); cursor: pointer; }
.dn-check input:focus-visible { outline: 3px solid var(--green-800); outline-offset: 2px; }
/* HMRC's notes fold away under the declaration, which stays in full view */
.dn-notes { margin: 6px 0 0 34px; }
.dn-notes p { margin: 6px 0 0; font-size: .78rem; line-height: 1.5; color: var(--muted); }
.dn-ga-fields { margin-top: 14px; }
.dn-ga-why { font-size: .88rem; line-height: 1.5; color: var(--ink-2); margin: 0 0 12px; }
.dn-row { gap: 12px 14px; margin-bottom: 12px; }
@media (min-width: 600px) { .dn-row { grid-template-columns: 1fr 1fr; } }   /* first and last name, house and postcode, side by side */
.dn-row label, .dn-email label { font-size: .86rem; }
@media (max-width: 420px) { .dn-notes { margin-left: 0; } }

/* "Your details": every donor's first and last name and email, with why we ask for the email; then email updates:
   what we send, in plain small type, and the unticked box to say no */
.dn-email .dn-small { margin-top: 6px; }
.dn-optin-intro { margin: 0 0 8px; font-size: .84rem; line-height: 1.5; color: var(--ink-2); }
.dn-optin .dn-check { font-size: .84rem; line-height: 1.45; }

/* Shown and hidden: donate.js marks the form dn-js and the open parts is-on. Without it, :has does the
   same where the browser has it; where it doesn't, both stay open, which still works. */
.dn-js .dn-other:not(.is-on), .dn-js .dn-ga-fields:not(.is-on) { display: none; }
@supports selector(:has(*)) {
  .dn-form:not(.dn-js) .dn-amounts:not(:has(#dn-amt-other:checked)) .dn-other,
  .dn-form:not(.dn-js) .dn-ga:not(:has(#dn-gift-aid:checked)) .dn-ga-fields { display: none; }
}
.dn-js .dn-other.is-on, .dn-js .dn-ga-fields.is-on { animation: dn-in .35s var(--ease); }
@keyframes dn-in { from { opacity: 0; transform: translateY(-4px); } }

/* "Add a message (optional)", and the notes on the declaration */
.dn-msg summary, .dn-notes summary { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; font-weight: 700; font-size: .92rem; color: var(--green-700); border-radius: 4px; }
.dn-notes summary { gap: 8px; font-weight: 600; font-size: .82rem; }
.dn-msg summary::-webkit-details-marker, .dn-notes summary::-webkit-details-marker { display: none; }
.dn-msg summary::before, .dn-notes summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .2s var(--ease); }
.dn-msg[open] summary::before, .dn-notes[open] summary::before { transform: rotate(45deg); }
.dn-msg summary:hover, .dn-notes summary:hover { color: var(--green-900); }
.dn-msg summary:focus-visible, .dn-notes summary:focus-visible { outline: 3px solid var(--green-800); outline-offset: 3px; }
.dn-msg textarea { min-height: 96px; margin-top: 10px; padding: 12px 14px; }

/* Payments not set up yet: donate.js shows the .dn-off line in place of the form, inside the same card */
.dn-form.is-off > :not(.dn-off):not(.sr-only) { display: none; }
.dn-off { margin: 0; color: var(--ink-2); }

/* The button and what sits under it */
.dn-submit { width: 100%; justify-content: center; }
.dn-submit:focus-visible { outline: 3px solid var(--green-800); outline-offset: 3px; }
.dn-submit[disabled] { opacity: .75; cursor: progress; transform: none; box-shadow: none; }
.dn-pay { margin-top: 12px; text-align: center; }
.dn-status { margin-top: 14px; }

/* Errors, beside the field they are about */
.dn-err { margin: 6px 0 0; font-size: .85rem; font-weight: 600; line-height: 1.4; color: var(--dn-error); }
.dn-err:empty { display: none; }
.dn-form [aria-invalid="true"] { border-color: var(--dn-error); }
.dn-form [aria-invalid="true"]:focus { box-shadow: 0 0 0 4px rgba(163, 52, 31, .15); }
.dn-page .form-status.is-error { background: var(--dn-error-bg); color: var(--dn-error); }

/* ---------- Thank-you page ---------- */
.dn-next h2 { font-size: clamp(1.7rem, 2.8vw, 2.3rem); }
.dn-thanks .dn-hero-grid { grid-template-areas: "intro form"; grid-template-rows: auto; align-items: center; }
.dn-thanks .dn-hero-grid.has-keep { grid-template-areas: "intro form" "keep form"; grid-template-rows: auto 1fr; align-items: start; }
@media (max-width: 860px) {
  .dn-thanks .dn-hero-grid { grid-template-areas: "intro" "form"; }
  .dn-thanks .dn-hero-grid.has-keep { grid-template-areas: "intro" "form" "keep"; grid-template-rows: none; }
}
.dn-account-line a { font-weight: 600; }

/* Email updates: under the thanks on the left (after the card on a phone), in the hero's own type, no box. The
   supporters' list note, or one quiet line for a donor who is not on it. */
.dn-keep { grid-area: keep; margin-top: 8px; color: var(--green-100); max-width: 46ch; }
.dn-keep[hidden] { display: none; }
.dn-keep > p { margin: 0 0 14px; }
.dn-keep-t { font-size: 1.22rem; line-height: 1.25; color: var(--white); margin: 0 0 8px; }
.dn-keep .dn-keep-small { margin: 12px 0 0; color: var(--green-200); }
.dn-keep-line { margin-bottom: 0; font-size: .95rem; }
@media (max-width: 860px) { .dn-keep { margin-top: 34px; } }
.dn-receipt { padding: clamp(22px, 3.2vw, 36px); }
.dn-receipt > :last-child { margin-bottom: 0; }
.dn-receipt p { color: var(--ink-2); }
.dn-receipt.is-loading { min-height: 120px; }
.dn-r-title { font-size: clamp(1.35rem, 2.2vw, 1.7rem); color: var(--ink); }
.dn-receipt .dn-r-k { margin: 0 0 4px; font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--green-600); }
.dn-receipt .dn-r-amt { margin: 0 0 12px; font-family: var(--font-head); font-weight: 500; font-size: clamp(1.9rem, 3.2vw, 2.4rem); line-height: 1.1; color: var(--green-900); font-variant-numeric: lining-nums; }
.dn-r-ga strong { color: var(--green-800); white-space: nowrap; }
.dn-receipt .btn-row { margin: 4px 0 18px; }
.dn-decl { margin-top: 20px; padding: 16px 18px; border-radius: 12px; background: var(--bone); }
.dn-decl p { font-size: .86rem; line-height: 1.55; margin: 0 0 8px; }
.dn-decl .dn-decl-k { font-weight: 700; color: var(--ink); }
.dn-decl .dn-small { font-size: .76rem; margin: 0; color: var(--muted); }
.dn-receipt .dn-test { display: inline-block; margin-top: 16px; padding: 4px 10px; border-radius: 999px; background: var(--amber-100); color: var(--green-900); font-size: .78rem; font-weight: 700; }

/* While you're here: three next steps */
.dn-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2.4vw, 28px); margin-top: 8px; }
@media (max-width: 860px) { .dn-steps { grid-template-columns: minmax(0, 1fr); } }
.dn-step {
  display: flex; flex-direction: column; gap: 8px; padding: clamp(22px, 2.6vw, 30px); background: var(--white); border-radius: var(--radius);
  border: 1px solid rgba(19, 26, 22, .06); box-shadow: var(--shadow-sm); text-decoration: none; color: var(--ink);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.dn-step:hover { transform: translateY(-4px); box-shadow: var(--shadow); color: var(--ink); }
.dn-step:focus-visible { outline: 3px solid var(--amber); outline-offset: 4px; }
.dn-step-t { font-family: var(--font-head); font-size: 1.3rem; line-height: 1.2; color: var(--green-900); }
.dn-step-d { flex: 1; font-size: .95rem; color: var(--ink-2); }
.dn-step-go { display: inline-flex; align-items: center; gap: .45em; margin-top: 6px; font-weight: 700; font-size: .92rem; color: var(--green-600); }
.dn-step .arrow { transition: transform .25s var(--ease); }
.dn-step:hover .arrow { transform: translateX(4px); }

@media (prefers-reduced-motion: reduce) {
  .dn-js .dn-other.is-on, .dn-js .dn-ga-fields.is-on { animation: none; }
  .dn-step, .dn-step:hover, .dn-step:hover .arrow { transform: none; transition: none; }
  .dn-freq span, .dn-amt span, .dn-msg summary::before, .dn-notes summary::before { transition: none; }
}

/* Windows contrast themes replace the colours that mark the chosen amount and frequency: mark them in system colours */
@media (forced-colors: active) {
  .dn-freq span { border: 1px solid CanvasText; }
  .dn-freq input:checked + span,
  .dn-amt input:checked + span { forced-color-adjust: none; background: Highlight; color: HighlightText; border-color: Highlight; }
  .dn-freq input:focus-visible + span,
  .dn-amt input:focus-visible + span { outline-color: CanvasText; }
}
