/* The Support page (support.qmd), its Welcome page line, and the line at the
   end of each chapter (filters/support-note.lua).
   Readers reach the page from the footer, the Resources menu, the Welcome
   page, and the end of each chapter. It is listed in the book so that Quarto
   renders it; the first rule keeps it out of the sidebar and out of the
   next-page link on the page before it.
   The page takes its accent from _variables.yml (the handbook's link color)
   and uses it once, for the Give button and the chosen amount. White on either
   accent passes WCAG AA (#2761e3 5.3:1, #15803d 5.0:1). Identical in all four
   handbooks. Stylesheets are cached as immutable on three of the sites, so
   change this by adding a -v3 file, not by editing it. */

.sidebar-item:has(> .sidebar-item-container > a[href$="support.html"]),
.nav-page-next:has(> a[href$="support.html"]) {
  display: none;
}

/* The page carries its own title, so Quarto's title block is hidden here. */
body:has(.support-page) #title-block-header {
  display: none;
}

.support-page {
  --support-accent: #2761e3;
  --support-ink: #1a2332;
  --support-text: #4a5565;
  --support-muted: #6b7280;
  --support-line: #dfe3e8;
  --support-face: #ffffff;
  --support-track: #f2f4f6;
  --support-tint: #eef3fd;
  --support-mark: var(--support-ink);
  max-width: 33rem;
  margin: 3rem auto 4rem;
  text-align: center;
}

.quarto-dark .support-page,
[data-bs-theme="dark"] .support-page {
  --support-ink: #eef1f5;
  --support-text: #c5ccd6;
  --support-muted: #9aa4b1;
  --support-line: #3a3f47;
  --support-face: #22262c;
  --support-track: #1b1e23;
  --support-tint: #262f3e;
}

@supports (color: color-mix(in srgb, red 50%, white)) {
  .support-page {
    --support-tint: color-mix(in srgb, var(--support-accent) 8%, #ffffff);
  }

  .quarto-dark .support-page,
  [data-bs-theme="dark"] .support-page {
    --support-tint: color-mix(in srgb, var(--support-accent) 22%, #22262c);
  }
}

.support-page .support-title {
  margin: 0 0 1rem;
  border: 0;
  color: var(--support-ink);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
}

.support-lead {
  margin: 0 0 0.9rem;
  color: var(--support-text);
  font-size: 1.08rem;
  line-height: 1.65;
}

/* One line under the lead that points to the Changelog. */
.support-record {
  margin: 0 0 2.25rem;
  color: var(--support-muted);
  font-size: 0.95rem;
}

.support-record a {
  color: var(--support-accent);
  text-underline-offset: 0.18em;
}

.quarto-dark .support-record a,
[data-bs-theme="dark"] .support-record a {
  color: var(--support-ink);
}

.support-options {
  text-align: left;
}

.support-panel + .support-panel {
  margin-top: 1.5rem;
}

.support-panel[hidden] {
  display: none;
}

.support-panel-label {
  margin: 0 0 0.6rem;
  color: var(--support-muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.support-amounts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

#support-monthly .support-amounts {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.support-page .support-amount {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0.4rem;
  border: 1px solid var(--support-line);
  border-radius: 8px;
  background-color: var(--support-face);
  color: var(--support-ink);
  font-size: 1.08rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}

.support-page .support-amount:hover {
  border-color: var(--support-accent);
  color: var(--support-ink);
  text-decoration: none;
}

.support-page .support-amount[aria-checked="true"] {
  border: 2px solid var(--support-accent);
  background-color: var(--support-tint);
}

/* The script turns the two panels into a choice: frequency, then amount,
   then one Give button. Without it, each amount is its own checkout link. */
.support-options.is-enhanced .support-panel + .support-panel {
  margin-top: 0;
}

.support-frequency {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 1rem;
  padding: 4px;
  border-radius: 10px;
  background-color: var(--support-track);
}

.support-frequency button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--support-muted);
  font: inherit;
  font-size: 0.97rem;
  font-weight: 500;
  cursor: pointer;
}

.support-frequency button[aria-checked="true"] {
  background-color: var(--support-face);
  color: var(--support-ink);
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12);
}

.support-page .support-give {
  display: block;
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  background-color: var(--support-accent);
  color: #ffffff;
  font-size: 1.08rem;
  font-weight: 650;
  text-align: center;
  text-decoration: none;
}

.support-page .support-give[hidden] {
  display: none;
}

.support-page .support-give:hover {
  color: #ffffff;
  filter: brightness(0.94);
}

.support-page .support-amount:focus-visible,
.support-frequency button:focus-visible,
.support-page .support-give:focus-visible,
.support-fine a:focus-visible {
  outline: 3px solid var(--support-mark);
  outline-offset: 2px;
}

.support-fine {
  margin: 0.85rem 0 0;
  color: var(--support-muted);
  font-size: 0.85rem;
  text-align: center;
}

.support-fine svg {
  margin-right: 0.3rem;
  vertical-align: -2px;
}

.support-fine a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

@media (max-width: 575.98px) {
  .support-page {
    margin-top: 1.5rem;
  }

  .support-page .support-title {
    font-size: 1.65rem;
  }

  .support-amounts {
    gap: 0.45rem;
  }

  .support-page .support-amount {
    font-size: 1rem;
  }
}

/* One plain line at the bottom of the Welcome page, under the license note. */
.home-support {
  margin: 0.6rem 0 0.5rem;
  color: #5b6b7f;
}

.quarto-dark .home-support,
[data-bs-theme="dark"] .home-support {
  color: #9aa7b6;
}

/* One plain line at the end of each chapter. It sits under a chapter's
   closing italic line when there is one, and is left out of print. */
.support-note {
  margin: 2.5rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid #e3e6ea;
  color: #5b6b7f;
  font-size: 0.95rem;
  line-height: 1.6;
}

.support-note.support-note-closing {
  margin-top: -0.4rem;
  padding-top: 0;
  border-top: 0;
}

.support-note p {
  margin: 0;
  color: inherit;
}

.support-note a {
  font-weight: 600;
  text-underline-offset: 0.18em;
}

.quarto-dark .support-note,
[data-bs-theme="dark"] .support-note {
  border-color: #3a3f47;
  color: #9aa7b6;
}

@media print {
  .support-note {
    display: none;
  }
}
