/* Header Donation Widget: the organization chooser that opens from Give. */

.mfol-hdw-panel {
  --mfol-hdw-bg: var(--color-white);
  --mfol-hdw-fg: var(--color-black);
  --mfol-hdw-card: var(--color-white);
  --mfol-hdw-card-fg: var(--color-black);
  background: var(--mfol-hdw-bg);
  border: 2px solid var(--mfol-hdw-fg);
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  box-sizing: border-box;
  color: var(--mfol-hdw-fg);
  display: flex;
  flex-direction: column;
  font-family: var(--f-body);
  gap: 8px;
  padding: 11px;
  position: absolute;
  right: 0;
  text-align: left;
  top: calc(100% + var(--donation-widget-border-width, 16px) + 10px);
  width: 260px;
  z-index: 30;
}
.mfol-hdw-panel[hidden] {
  display: none;
}
.mfol-hdw-panel--roomy {
  width: 320px;
}
/* Floating sizes: a small notch pointing up at Give */
.mfol-hdw-panel--compact::before,
.mfol-hdw-panel--roomy::before {
  background: var(--mfol-hdw-bg);
  border-left: 2px solid var(--mfol-hdw-fg);
  border-top: 2px solid var(--mfol-hdw-fg);
  content: "";
  height: 12px;
  position: absolute;
  right: 32px;
  top: -8px;
  transform: rotate(45deg);
  width: 12px;
}

/* Match the blue row: attached under the blue band, edge to edge, as part of the widget */
.mfol-hdw-panel--row {
  border: 0;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
  left: calc(-1 * var(--donation-widget-border-width, 16px));
  padding: 2px var(--donation-widget-border-width, 16px) var(--donation-widget-border-width, 16px);
  right: calc(-1 * var(--donation-widget-border-width, 16px));
  top: calc(100% + var(--donation-widget-border-width, 16px));
  width: auto;
}

/* Panel colors */
.mfol-hdw-panel--widget {
  --mfol-hdw-bg: var(--donation-widget-bg-color, var(--color-blue));
}
.mfol-hdw-panel--gray {
  --mfol-hdw-bg: var(--color-gray);
}
.mfol-hdw-panel--yellow {
  --mfol-hdw-bg: var(--color-yellow);
}
.mfol-hdw-panel--green {
  --mfol-hdw-bg: var(--color-green);
}
.mfol-hdw-panel--black {
  --mfol-hdw-bg: var(--color-black);
  --mfol-hdw-fg: var(--color-white);
  --mfol-hdw-card: var(--color-black);
  --mfol-hdw-card-fg: var(--color-white);
}

/* Slide open (only when the panel opens; off for reduced motion) */
.mfol-hdw-panel--motion {
  transition: opacity 0.14s ease, transform 0.14s ease;
}
.mfol-hdw-panel--motion:not(.is-open) {
  opacity: 0;
  transform: translateY(-6px);
}
@media (prefers-reduced-motion: reduce) {
  .mfol-hdw-panel--motion,
  .mfol-hdw-panel--motion:not(.is-open) {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* The header styles its buttons and text (monospace, centered, capitalized, black when
   focused); everything below is scoped to the panel so none of that leaks in. */
.mfol-hdw-panel,
.mfol-hdw-panel * {
  letter-spacing: normal;
  text-transform: none;
}
.site-header .mfol-hdw-panel .mfol-hdw-panel__top {
  align-items: baseline;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin: 0 0 2px;
}
.site-header .mfol-hdw-panel .mfol-hdw-panel__heading {
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.3;
  margin: 0;
  text-transform: uppercase;
}
.site-header .mfol-hdw-panel .mfol-hdw-panel__heading span {
  text-transform: inherit;
}
.site-header .mfol-hdw-panel .mfol-hdw-panel__compare {
  color: inherit;
  flex: 0 0 auto;
  font-family: var(--f-body);
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.site-header .mfol-hdw-panel .mfol-hdw-option {
  align-items: stretch;
  appearance: none;
  background: var(--mfol-hdw-card);
  border: 2px solid var(--mfol-hdw-card-fg);
  border-radius: 4px;
  box-shadow: none;
  color: var(--mfol-hdw-card-fg);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  font-family: var(--f-body);
  font-size: 1rem;
  font-weight: 400;
  gap: 3px;
  height: auto;
  justify-content: flex-start;
  line-height: 1.2;
  margin: 0;
  max-height: none;
  min-height: 0;
  padding: 9px 12px;
  position: relative;
  text-align: left;
  transition: background-color 0.12s ease;
  width: 100%;
}
.site-header .mfol-hdw-panel .mfol-hdw-option:hover,
.site-header .mfol-hdw-panel .mfol-hdw-option:focus-visible {
  background: var(--mfol-hdw-hover, var(--color-orange));
  color: var(--color-black);
}
/* Focus without a visible ring (a mouse click) gets no highlight, so neither option looks pre-chosen */
.site-header .mfol-hdw-panel .mfol-hdw-option:focus:not(:focus-visible):not(:hover) {
  background: var(--mfol-hdw-card);
  color: var(--mfol-hdw-card-fg);
}
.site-header .mfol-hdw-panel .mfol-hdw-option:focus-visible {
  outline: 3px solid var(--mfol-hdw-fg);
  outline-offset: 2px;
}
.site-header .mfol-hdw-panel .mfol-hdw-option__row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding-right: 22px; /* room for the arrow in the corner */
}
.site-header .mfol-hdw-panel .mfol-hdw-option__name {
  overflow-wrap: normal;
  white-space: nowrap;
  word-break: normal;
  font-family: var(--f-trim);
  font-size: 1.0625rem;
  font-weight: var(--f-trim-weight, 700);
  line-height: 1;
  text-transform: uppercase;
}
.site-header .mfol-hdw-panel .mfol-hdw-option__tag {
  order: 2;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  padding: 3px 7px 2px;
  text-transform: uppercase;
  white-space: nowrap;
}
.site-header .mfol-hdw-panel .mfol-hdw-option__arrow {
  font-size: 1rem;
  line-height: 1;
  position: absolute;
  right: 12px;
  top: 10px;
  transition: transform 0.12s ease;
}
.site-header .mfol-hdw-panel .mfol-hdw-option:hover .mfol-hdw-option__arrow,
.site-header .mfol-hdw-panel .mfol-hdw-option:focus-visible .mfol-hdw-option__arrow {
  transform: translateX(3px);
}
.site-header .mfol-hdw-panel .mfol-hdw-option__desc {
  font-family: var(--f-body);
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.3;
}
.site-header .mfol-hdw-panel .mfol-hdw-panel__foot {
  font-family: var(--f-body);
  font-size: 0.6875rem;
  font-weight: 400;
  line-height: 1.35;
  margin: 2px 0 0;
}

@media (prefers-reduced-motion: reduce) {
  .site-header .mfol-hdw-panel .mfol-hdw-option,
  .site-header .mfol-hdw-panel .mfol-hdw-option__arrow {
    transition: none;
  }
}

/* ===== The dropdown layout: one Donate button that opens the panel ===== */
.mfol-hdw-dd {
  align-self: center; /* just as tall as the button, so the panel opens right under it */
  position: relative;
}
.site-header .mfol-hdw-dd__toggle {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}
/* The same chevron, at the same size, as Take Action's (11 x 6) */
.mfol-hdw-dd__chevron {
  align-items: center;
  align-self: center;
  display: inline-flex;
  flex: 0 0 auto;
  width: 11px;
}
.mfol-hdw-dd__chevron svg,
.site-header .mfol-hdw-dd__toggle .mfol-hdw-dd__chevron svg {
  display: block;
  flex: 0 0 11px;
  height: 6px;
  max-width: none;
  min-width: 11px;
  width: 11px;
}
/* While the panel is open, Donate keeps its hover look, even when the panel's pointer briefly
   passes under the cursor as it slides in (that used to flash the button back to orange) */
.site-header .mfol-hdw-dd__toggle[aria-expanded="true"] {
  background-color: var(--button-bg-hover);
  border-color: var(--button-border-color-hover);
  color: var(--button-color-hover);
}
/* Flip the arrow itself, around its own center, the way Take Action's does (same timing) */
.site-header .mfol-hdw-dd__toggle .mfol-hdw-dd__chevron svg {
  transform-origin: 50% 50%;
  transition: transform 0.33s;
}
.site-header .mfol-hdw-dd__toggle[aria-expanded="true"] .mfol-hdw-dd__chevron svg {
  transform: rotate(180deg);
}
/* The chevron only means something where the panel opens (wide screens) */
@media (max-width: 1023px) {
  .mfol-hdw-dd__chevron {
    display: none;
  }
}

.site-header .mfol-hdw-dd__panel {
  left: auto;
  padding: 12px;
  right: 0;
  top: calc(100% + 12px);
  width: 340px;
}
.site-header .mfol-hdw-dd__panel.mfol-hdw-panel--compact {
  width: 300px;
}
.site-header .mfol-hdw-dd__panel.mfol-hdw-panel--roomy {
  width: 380px;
}
.site-header .mfol-hdw-dd__panel::before {
  background: var(--mfol-hdw-bg);
  border-left: 2px solid var(--mfol-hdw-fg);
  border-top: 2px solid var(--mfol-hdw-fg);
  content: "";
  height: 12px;
  position: absolute;
  right: 40px;
  top: -8px;
  transform: rotate(45deg);
  width: 12px;
}

/* Amount and One Time / Monthly */
.site-header .mfol-hdw-panel .mfol-hdw-dd__controls {
  display: flex;
  gap: 8px;
  margin: 0 0 4px;
}
.site-header .mfol-hdw-panel .mfol-hdw-dd__amount {
  align-items: center;
  background: var(--color-ui-blue, #cfe0ff);
  border: 2px solid var(--color-black);
  border-radius: 4px;
  color: var(--color-black);
  display: flex;
  flex: 0 0 auto;
  font-family: var(--f-mono);
  gap: 2px;
  height: 44px;
  padding: 0 10px;
}
.site-header .mfol-hdw-panel .mfol-hdw-dd__dollar {
  font-size: 1rem;
  font-weight: 700;
}
.site-header .mfol-hdw-panel .mfol-hdw-dd__amount input {
  -moz-appearance: textfield;
  appearance: textfield;
  background: transparent;
  border: 0;
  color: inherit;
  font-family: var(--f-mono);
  font-size: 1.0625rem;
  font-weight: 700;
  margin: 0;
  outline: none;
  padding: 0;
  width: 4.5ch;
}
.site-header .mfol-hdw-panel .mfol-hdw-dd__amount input::-webkit-outer-spin-button,
.site-header .mfol-hdw-panel .mfol-hdw-dd__amount input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.site-header .mfol-hdw-panel .mfol-hdw-dd__amount:focus-within {
  outline: 3px solid var(--mfol-hdw-fg);
  outline-offset: 2px;
}
.site-header .mfol-hdw-panel .mfol-hdw-dd__freq {
  border: 2px solid var(--color-black);
  border-radius: 4px;
  display: flex;
  flex: 1 1 auto;
  overflow: hidden;
}
.site-header .mfol-hdw-panel .mfol-hdw-dd__freq button {
  appearance: none;
  background: var(--color-white);
  border: 0;
  box-shadow: none;
  color: var(--color-black);
  cursor: pointer;
  flex: 1 1 0;
  font-family: var(--f-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  height: 40px;
  margin: 0;
  padding: 0 8px;
  white-space: nowrap;
}
.site-header .mfol-hdw-panel .mfol-hdw-dd__freq button + button {
  border-left: 2px solid var(--color-black);
}
.site-header .mfol-hdw-panel .mfol-hdw-dd__freq button[aria-pressed="true"] {
  background: var(--color-black);
  color: var(--color-white);
}
.site-header .mfol-hdw-panel .mfol-hdw-dd__freq button:focus-visible {
  outline: 3px solid var(--mfol-hdw-fg);
  outline-offset: -5px;
}

/* Give (when the organization chooser is off) */
.site-header .mfol-hdw-panel .mfol-hdw-dd__give {
  justify-content: center;
  margin-top: 4px;
  width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .site-header .mfol-hdw-dd__toggle .mfol-hdw-dd__chevron svg {
    transition: none;
  }
}

/* Screen-reader-only text. The header is on every page, so it can't rely on the block
   stylesheet that defines this elsewhere. */
.mfol-hdw-dd .mfol-sr-only {
  border: 0 !important;
  clip: rect(0, 0, 0, 0) !important;
  height: 1px !important;
  margin: -1px !important;
  overflow: hidden !important;
  padding: 0 !important;
  position: absolute !important;
  white-space: nowrap !important;
  width: 1px !important;
}

/* Give (chooser off): the standard orange button */
.site-header .mfol-hdw-panel .mfol-hdw-dd__give {
  background: var(--color-orange);
  border: 2px solid var(--color-black);
  color: var(--color-black);
}
.site-header .mfol-hdw-panel .mfol-hdw-dd__give:hover,
.site-header .mfol-hdw-panel .mfol-hdw-dd__give:focus-visible {
  background: var(--color-black);
  color: var(--color-white);
}

/* ===== Dropdown layout: a one-line header =====
   The theme sizes the desktop header for the blue quick-give row (158px tall, 128px when
   stuck, with the nav nudged up 16px to make room). Without the row, the header is shorter
   and everything sits on one line. Only with the dropdown layout (the mfol-header-dd class). */
@media (min-width: 1024px) {
  .mfol-header-dd .site-header {
    height: 88px;
  }
  .mfol-header-dd .site-header__inner {
    height: 118px;
  }
  /* The theme puts header-stuck on <html> while the header is stuck at the top */
  .header-stuck .mfol-header-dd .site-header__inner {
    height: 88px;
  }
  .mfol-header-dd .site-header__item:is(.site-header__primary-menu, .site-search-button, .site-header__secondary-menu, .mfol-hdw-dd) {
    transform: none;
  }
  .mfol-header-dd .topper {
    margin-top: -118px;
    padding-top: 118px;
  }
  .mfol-header-dd .jumplink-anchor {
    transform: translateY(-118px);
  }
}

/* Hover mode: an invisible bridge over the gap between Donate and the panel, so moving the
   pointer down into the panel doesn't close it */
.site-header .mfol-hdw-dd__panel::after {
  content: "";
  height: 14px;
  left: 0;
  position: absolute;
  right: 0;
  top: -14px;
}

/* More panel colors */
.mfol-hdw-panel--orange {
  --mfol-hdw-bg: var(--color-orange);
}
.mfol-hdw-panel--blue {
  --mfol-hdw-bg: var(--color-blue);
}
.mfol-hdw-panel--pink {
  --mfol-hdw-bg: var(--color-pink);
}
/* A black highlight gets white text */
.site-header .mfol-hdw-panel[style*="--color-black"] .mfol-hdw-option:hover,
.site-header .mfol-hdw-panel[style*="--color-black"] .mfol-hdw-option:focus-visible {
  color: var(--color-white);
}
