/* =========================================================
   The donor account (/account) and the unsubscribe page (/unsubscribe).
   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, .btn, .form-status) they reuse, laid out like the donation page: the message
   on the left, a white card on the right. 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 ac-.
   ========================================================= */

.ac-page { --ac-error: #a3341f; --ac-error-bg: #fbece8; }
.ac-page [hidden] { display: none !important; }   /* account.js shows and hides the panels with the hidden attribute */

/* ---------- The hero: the message on the left, the card on the right; on a phone, one under the other ---------- */
.ac-hero { padding-block: clamp(32px, 4vw, 56px) clamp(56px, 7vw, 96px); min-height: min(620px, 72vh); }   /* a short card doesn't leave the footer halfway up */
.ac-hero:has(.is-in) { min-height: 0; }
/* The faint logo hangs from the top of the band, so it stays put when the card changes size (signing in, the
   dashboard loading); stacked on a phone it sits under the content, which moves as a whole */
.ac-hero .watermark { top: -80px; bottom: auto; transform: none; }
@media (max-width: 860px) { .ac-hero .watermark { top: auto; bottom: -6%; } }
.ac-hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 460px); column-gap: clamp(32px, 6vw, 96px); align-items: start; }
.ac-hero-grid.is-in { grid-template-columns: minmax(0, 1fr); }   /* signed in: the card steps aside */
.ac-intro { padding-top: clamp(4px, 2vw, 24px); }
.ac-intro h1 { font-size: clamp(2.2rem, 4.5vw, 3.4rem); max-width: 18ch; margin-bottom: .35em; }
.ac-intro .lead { max-width: 40ch; }
@media (max-width: 860px) {
  .ac-hero-grid { grid-template-columns: minmax(0, 1fr); }
  .ac-intro { padding-top: 0; margin-bottom: 26px; }
  .ac-card { max-width: 560px; }
}

/* Signed in as ... Sign out */
.ac-who { margin: 0; color: var(--green-100); overflow-wrap: anywhere; }
.ac-who strong { color: var(--white); font-weight: 700; margin-right: 10px; }
.ac-who-status.is-visible { margin-top: 14px; max-width: 46ch; }

/* ---------- The card ---------- */
.ac-card { padding: clamp(22px, 3vw, 32px); }
.ac-panel { display: grid; gap: 14px; justify-items: start; }
.ac-panel > *, .ac-panel > div { width: 100%; }
.ac-panel > .btn, .ac-panel > .ac-link { width: auto; }
.ac-panel p { margin: 0; color: var(--ink-2); }
.ac-card-t { font-size: clamp(1.3rem, 2.2vw, 1.55rem); line-height: 1.25; margin: 0; color: var(--ink); text-wrap: balance; }
.ac-card-t:focus { outline: none; }   /* focused only so a screen reader reads the new panel */
.ac-card input[type="email"] { padding: 12px 14px; }
.ac-loading { margin: 0; color: var(--muted); }
.ac-loading:empty { display: none; }
.page-hero .ac-card a { color: var(--green-600); }
.page-hero .ac-card a:hover { color: var(--green-800); }

.ac-small { font-size: .85rem; line-height: 1.5; color: var(--muted); margin: 0; }
.ac-panel .ac-small { color: var(--muted); }
.ac-err { margin: 6px 0 0; font-size: .85rem; font-weight: 600; line-height: 1.4; color: var(--ac-error); }
.ac-err:empty { display: none; }
.ac-page [aria-invalid="true"] { border-color: var(--ac-error); }
.ac-page .form-status { font-size: .95rem; }
.ac-page .form-status.is-error { background: var(--ac-error-bg); color: var(--ac-error); }

/* Buttons: the site's own, with a visible focus ring and a calm busy state */
.ac-page .btn:focus-visible { outline: 3px solid var(--green-800); outline-offset: 3px; }
.page-hero .ac-intro .btn:focus-visible, .page-hero .ac-who .ac-link:focus-visible { outline-color: var(--amber); }
.ac-page .btn[disabled], .ac-page .ac-link[disabled] { opacity: .65; cursor: progress; transform: none; box-shadow: none; }

/* Text buttons: Sign out, Use a different email address */
.ac-link { appearance: none; background: none; border: 0; padding: 4px 0; font: inherit; font-weight: 600; color: var(--green-600);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; cursor: pointer; border-radius: 4px; }
.ac-link:hover { color: var(--green-800); text-decoration-thickness: 2px; }
.ac-link:focus-visible { outline: 3px solid var(--green-800); outline-offset: 3px; }
.page-hero .ac-who .ac-link { color: var(--green-200); }
.page-hero .ac-who .ac-link:hover { color: var(--white); }

/* ---------- Signed in: the donations, the monthly gifts and the email-updates switch ---------- */
.ac-section { padding-block: clamp(40px, 6vw, 72px) 0; }
.ac-section:last-child { padding-bottom: clamp(56px, 8vw, 96px); }
.ac-section h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin-bottom: .6em; }
.ac-note { color: var(--ink-2); max-width: 62ch; }
.ac-warning { font-weight: 600; color: var(--green-700); }
.ac-after { margin-top: 14px; max-width: 70ch; }
.ac-more { margin-top: 18px; }
#ac-more-status { margin-top: 14px; max-width: 70ch; }
#ac-more-status:focus { outline: none; }

/* The donations: a plain table on the page's own background */
.ac-table-wrap { overflow-x: auto; }
.ac-table { width: 100%; border-collapse: collapse; font-size: .97rem; line-height: 1.45; }
.ac-table th { text-align: left; font-size: .8rem; font-weight: 700; letter-spacing: .04em; color: var(--muted); padding: 8px 16px 8px 0; white-space: nowrap; }
.ac-table td { padding: 12px 16px 12px 0; vertical-align: top; border-top: 1px solid rgba(19, 26, 22, .09); }
.ac-table .num, .ac-table td[data-label="Amount"] { text-align: right; font-variant-numeric: tabular-nums lining-nums; }
.ac-table td[data-label="Date"] { white-space: nowrap; }
.ac-table td:last-child { text-align: right; padding-right: 0; }
.ac-table a { font-weight: 600; white-space: nowrap; }
.ac-table a:focus-visible { outline: 3px solid var(--green-800); outline-offset: 2px; border-radius: 3px; }
.ac-refund { display: block; font-size: .85rem; color: var(--muted); }
.ac-state--wait { color: var(--green-700); font-weight: 600; }
.ac-state--off { color: var(--muted); }

/* Monthly gifts: one row each, the amount and its details, and the button */
.ac-subs { list-style: none; margin: 0; padding: 0; }
.ac-sub { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; align-items: center; padding: 16px 0; border-top: 1px solid rgba(19, 26, 22, .09); }
.ac-sub-amt { margin: 0; font-family: var(--font-head); font-size: 1.3rem; line-height: 1.25; color: var(--green-900); font-variant-numeric: lining-nums; }
.ac-sub-meta { margin: 2px 0 0; color: var(--ink-2); font-size: .95rem; }
.ac-sub .form-status { grid-column: 1 / -1; margin: 0; }
@media (max-width: 600px) { .ac-sub { grid-template-columns: minmax(0, 1fr); } .ac-sub .btn { justify-self: start; } }

/* Gift Aid for your tax return: one row per tax year. The list of each payment, and the line naming the charity and
   the donor, are only for the printed summary. */
.ac-aid-table td[data-label="Gift Aid payments"], .ac-aid-table td[data-label="Of which one-off"] { text-align: right; font-variant-numeric: tabular-nums lining-nums; }
.ac-aid-table td:last-child { padding-right: 0; }
.ac-aid-actions { margin: 18px 0 0; }
.ac-aid-print-head, .ac-aid-detail { display: none; }

/* Printing the Gift Aid summary ("Print or save as PDF" sets body.ac-print-aid): only that section, with each payment */
@media print {
  body.ac-print-aid .skip-link, body.ac-print-aid .site-header, body.ac-print-aid .site-footer, body.ac-print-aid .ac-hero,
  body.ac-print-aid .ac-dash > .ac-section:not(#ac-aid-wrap), body.ac-print-aid .ac-aid-actions, body.ac-print-aid #ac-aid-more { display: none !important; }
  body.ac-print-aid { background: #fff; }
  body.ac-print-aid #ac-aid-wrap { padding: 0; }
  body.ac-print-aid .ac-aid-print-head { display: block; margin: 0 0 18px; font-size: .9rem; color: #333; }
  body.ac-print-aid .ac-aid-detail { display: block; }
  body.ac-print-aid .ac-aid-detail h3 { margin: 24px 0 6px; font-size: 1.05rem; }
  body.ac-print-aid .ac-aid-detail table { break-inside: auto; table-layout: fixed; }
  body.ac-print-aid .ac-aid-detail tr { break-inside: avoid; }
  body.ac-print-aid .ac-aid-total td { font-weight: 700; }
  body.ac-print-aid .ac-table thead { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  body.ac-print-aid .ac-table, body.ac-print-aid .ac-table tbody { display: table; width: 100%; }
  body.ac-print-aid .ac-table tbody { display: table-row-group; }
  body.ac-print-aid .ac-table thead { display: table-header-group; }
  body.ac-print-aid .ac-table tr { display: table-row; }
  body.ac-print-aid .ac-table td { display: table-cell; padding: 6px 16px 6px 0; }
  body.ac-print-aid .ac-table td::before { display: none; }
  body.ac-print-aid .ac-table .num, body.ac-print-aid .ac-table td[data-label="Amount"], body.ac-print-aid .ac-aid-table td[data-label="Gift Aid payments"],
  body.ac-print-aid .ac-aid-table td[data-label="Of which one-off"] { text-align: right !important; }
  body.ac-print-aid a { color: inherit; }
}

/* Email updates: a line on why most donors find it on, then the switch (a checkbox) and where they stand */
.ac-updates { max-width: 66ch; }
.ac-updates-intro { margin: 0 0 14px; max-width: 66ch; color: var(--ink-2); }
.ac-check { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: start; margin: 0; font-weight: 500; font-size: 1rem; line-height: 1.55; color: var(--ink); cursor: pointer; }
.ac-check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--green-800); cursor: pointer; }
.ac-check input:focus-visible { outline: 3px solid var(--green-800); outline-offset: 2px; }
.ac-check input[disabled] { cursor: progress; }
.ac-updates-small { margin: 6px 0 0 34px; }
.ac-updates-state { margin: 14px 0 0; font-weight: 600; color: var(--green-700); }
.ac-updates-state:empty { display: none; }
.ac-updates-state.is-error { color: var(--ac-error); }

/* Delete my details: two paragraphs, a quiet button, and the question it opens */
.ac-erase { max-width: 66ch; }
.ac-erase p { margin: 0 0 14px; color: var(--ink-2); }
.ac-erase-confirm p:focus { outline: none; }   /* focused only so a screen reader reads the question */
.ac-erase-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; }
.ac-erase .form-status { margin: 0; }

/* Phones: each donation becomes a short labelled list */
@media (max-width: 640px) {
  .ac-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .ac-table, .ac-table tbody, .ac-table tr, .ac-table td { display: block; width: 100%; }
  .ac-table tr { padding: 12px 0; border-top: 1px solid rgba(19, 26, 22, .12); }
  .ac-table td { display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: 10px; padding: 3px 0; border: 0; text-align: left !important; }
  .ac-table td::before { content: attr(data-label); font-size: .8rem; font-weight: 700; color: var(--muted); padding-top: 2px; }
  .ac-table td[data-label=""] { grid-template-columns: minmax(0, 1fr); padding-top: 6px; }
  .ac-table td[data-label=""]::before { display: none; }
  .ac-updates-small { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ac-page .btn, .ac-page .btn:hover { transition: none; transform: none; }
}

/* Windows contrast themes: keep the focus rings and the checkbox visible */
@media (forced-colors: active) {
  .ac-page .btn:focus-visible, .ac-link:focus-visible, .ac-check input:focus-visible { outline-color: CanvasText; }
}
