/* ==========================================================================
   Give — the giving panel, opened by Donate Now buttons.

   Self-contained on purpose: this loads on every page, including ones whose
   own stylesheet knows nothing about it, so it inherits the palette from
   styles.css custom properties but owns every selector under .cg-give.
   ========================================================================== */


/* ---------- Panel ---------- */

.cg-give-scrim {
  position: fixed;
  inset: 0;
  z-index: 950;
  background: rgba(45, 36, 53, 0.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 200ms ease;
}
.cg-give-scrim.is-open { opacity: 1; }

.cg-give {
  position: fixed;
  z-index: 960;
  right: clamp(0.5rem, 3vw, 2rem);
  bottom: clamp(0.5rem, 3vw, 2rem);
  width: min(420px, calc(100vw - 1rem));
  max-height: min(720px, calc(100vh - 2rem));

  display: flex;
  flex-direction: column;
  overflow: hidden;

  font-family: var(--font-stack, sans-serif);
  color: var(--color-text-dark, #2D2435);
  background: var(--color-bg-white, #fff);
  border-radius: var(--radius-xl, 16px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);

  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
}
.cg-give.is-open { transform: none; opacity: 1; }

/* On a phone the panel is the page. A 420px card floating over a 390px
   viewport is a card with nowhere to go. */
@media (max-width: 560px) {
  .cg-give {
    right: 0; bottom: 0; left: 0;
    width: 100%;
    max-height: 92vh;
    border-radius: var(--radius-xl, 16px) var(--radius-xl, 16px) 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cg-give, .cg-give-scrim { transition: none; }
  .cg-give { transform: none; }
}

/* ---------- Header ---------- */

.cg-give__head {
  position: relative;
  padding: 1.4rem 3rem 1.2rem 1.4rem;
  color: #fff;
  background: linear-gradient(135deg, var(--color-primary, #541d66), var(--color-primary-light, #6e2d85));
}

.cg-give__eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
}

.cg-give__title { margin: 0; font-size: 1.25rem; line-height: 1.25; font-weight: 700; color: #fff; }
.cg-give__sub { margin: 0.45rem 0 0; font-size: 0.85rem; line-height: 1.45; opacity: 0.85; }

.cg-give__close {
  position: absolute;
  top: 0.9rem; right: 0.9rem;
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.cg-give__close:hover { background: rgba(255, 255, 255, 0.28); }
.cg-give__close svg { width: 16px; height: 16px; }

/* ---------- Body ---------- */

.cg-give__body { padding: 1.2rem 1.4rem 1.4rem; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.cg-give__label {
  display: block;
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted, #6B6175);
}

.cg-give__section + .cg-give__section { margin-top: 1.25rem; }

/* -- Designation chips -- */

.cg-give__targets { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.cg-give__target {
  padding: 0.5rem 0.85rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-dark, #2D2435);
  background: var(--color-bg-light, #F4F0F6);
  border: 2px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}
.cg-give__target:hover { background: #e9e0ee; }
.cg-give__target.is-active {
  color: var(--color-primary, #541d66);
  background: #fff;
  border-color: var(--color-primary, #541d66);
}

/* -- Amounts -- */

.cg-give__amounts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }

.cg-give__amount {
  padding: 0.7rem 0.25rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-dark, #2D2435);
  background: var(--color-bg-light, #F4F0F6);
  border: 2px solid transparent;
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
}
.cg-give__amount.is-active {
  color: #fff;
  background: var(--color-primary, #541d66);
  border-color: var(--color-primary, #541d66);
}

.cg-give__custom { position: relative; margin-top: 0.5rem; }
.cg-give__custom .cg-give__cur {
  position: absolute;
  z-index: 1;
  top: 50%; left: calc(34px + 0.6rem);   /* past the StratusUI stepper's minus button */
  transform: translateY(-50%);
  font-weight: 700;
  color: var(--color-text-muted, #6B6175);
  pointer-events: none;
}

.cg-give input[type="text"],
.cg-give input[type="email"],
.cg-give input[type="number"] {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font: inherit;
  font-size: 1rem;
  color: var(--color-text-dark, #2D2435);
  background: #fff;
  border: 2px solid var(--color-border, #DDD);
  border-radius: var(--radius-md, 8px);
}
.cg-give__custom input { padding-left: 1.9rem; font-weight: 700; }

/* The StratusUI stepper (data-sui-number) wears the panel's input look: the
   wrapper carries the border, the input inside it is bare. */
.cg-give__custom .sui-num {
  background: #fff;
  border: 2px solid var(--color-border, #DDD);
  border-radius: var(--radius-md, 8px);
}
.cg-give__custom .sui-num:focus-within { border-color: var(--color-primary, #541d66); box-shadow: none; }
.cg-give__custom .sui-num-btn { width: 34px; color: var(--color-text-muted, #6B6175); }
.cg-give__custom .sui-num-btn:hover { background: var(--color-bg-alt, #f4f0f6); color: var(--color-primary, #541d66); }
.cg-give .cg-give__custom input.sui-num-input {
  border: 0; border-radius: 0; background: transparent;
  padding: 0.7rem 0.4rem 0.7rem 1.6rem; text-align: left;
  font-size: 1rem; font-weight: 700; color: var(--color-text-dark, #2D2435);
}

.cg-give input:focus {
  outline: 0;
  border-color: var(--color-primary, #541d66);
}

.cg-give__fields { display: grid; gap: 0.6rem; }

/* -- Frequency -- */

.cg-give__freq {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 3px;
  background: var(--color-bg-light, #F4F0F6);
  border-radius: 999px;
}
.cg-give__freq button {
  padding: 0.5rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text-muted, #6B6175);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.cg-give__freq button.is-active {
  color: var(--color-primary, #541d66);
  background: #fff;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,.08));
}

/* -- Checkbox rows -- */

.cg-give__check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--color-text-muted, #6B6175);
  cursor: pointer;
}
.cg-give__check input { margin-top: 0.15rem; accent-color: var(--color-primary, #541d66); }

/* -- Recipient preview -- */

.cg-give__split {
  padding: 0.85rem 1rem;
  font-size: 0.8rem;
  line-height: 1.5;
  background: var(--color-bg-light, #F4F0F6);
  border-radius: var(--radius-md, 8px);
}
.cg-give__split b { display: block; margin-bottom: 0.4rem; color: var(--color-text-dark, #2D2435); }
.cg-give__split ul { margin: 0; padding: 0; list-style: none; }
.cg-give__split li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.2rem 0;
  color: var(--color-text-muted, #6B6175);
}
.cg-give__split li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cg-give__split li span:last-child { flex: 0 0 auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.cg-give__split em {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-style: normal;
  color: var(--color-text-muted, #6B6175);
}

/* -- Footer -- */

.cg-give__foot {
  padding: 1rem 1.4rem 1.2rem;
  border-top: 1px solid var(--color-border-light, #EEE);
  background: #fff;
}

.cg-give__submit {
  width: 100%;
  padding: 0.95rem 1rem;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  background: var(--color-accent, #ff7f40);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background 150ms ease;
}
.cg-give__submit:hover:not(:disabled) { background: var(--color-accent-dark, #e06020); }
.cg-give__submit:disabled { opacity: 0.55; cursor: not-allowed; }

.cg-give__fine {
  margin: 0.7rem 0 0;
  font-size: 0.72rem;
  line-height: 1.45;
  text-align: center;
  color: var(--color-text-muted, #6B6175);
}

.cg-give__note {
  margin: 0 0 0.9rem;
  padding: 0.7rem 0.85rem;
  font-size: 0.8rem;
  line-height: 1.45;
  border-radius: var(--radius-md, 8px);
}
.cg-give__note--warn { color: #7a4a10; background: #fdf1de; }
.cg-give__note--error { color: #8a2b20; background: #fbe6e3; }
.cg-give__note--ok { color: #1c6b41; background: #e4f5ec; }
.cg-give__note[hidden] { display: none; }

.cg-give__spinner {
  display: inline-block;
  width: 14px; height: 14px;
  margin-right: 0.5rem;
  vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: cg-give-spin 700ms linear infinite;
}
@keyframes cg-give-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cg-give__spinner { animation: none; } }

/* ==========================================================================
   /give/ — the full giving page
   ========================================================================== */

.give-page__modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.give-mode {
  padding: 1.1rem 1rem;
  text-align: left;
  font: inherit;
  color: var(--color-text-dark, #2D2435);
  background: #fff;
  border: 2px solid var(--color-border, #DDD);
  border-radius: var(--radius-lg, 12px);
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}
.give-mode:hover { transform: translateY(-2px); box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,.1)); }
.give-mode.is-active { border-color: var(--color-primary, #541d66); box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,.1)); }
.give-mode b { display: block; margin-bottom: 0.25rem; font-size: 1rem; }
.give-mode span { font-size: 0.8rem; line-height: 1.4; color: var(--color-text-muted, #6B6175); }

.give-panel { display: none; }
.give-panel.is-active { display: block; }

.give-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.75rem;
}

.give-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem;
  text-align: left;
  font: inherit;
  background: #fff;
  border: 2px solid var(--color-border, #DDD);
  border-radius: var(--radius-lg, 12px);
  cursor: pointer;
  transition: border-color 150ms ease, transform 150ms ease;
}
.give-card:hover { transform: translateY(-2px); border-color: var(--color-primary-light, #6e2d85); }
.give-card.is-active { border-color: var(--color-primary, #541d66); background: #faf7fb; }
.give-card b { font-size: 0.95rem; line-height: 1.3; color: var(--color-text-dark, #2D2435); }
.give-card span { font-size: 0.78rem; line-height: 1.4; color: var(--color-text-muted, #6B6175); }

.give-card__tag {
  align-self: flex-start;
  margin-top: 0.2rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
}
.give-card__tag--curated { color: #1c6b41; background: #e4f5ec; }
.give-card__tag--derived { color: #6B6175; background: #F4F0F6; }

.give-search { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.give-search input {
  flex: 1;
  padding: 0.8rem 1rem;
  font: inherit;
  border: 2px solid var(--color-border, #DDD);
  border-radius: var(--radius-md, 8px);
}
.give-search input:focus { outline: 0; border-color: var(--color-primary, #541d66); }

.give-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--color-text-muted, #6B6175);
}

/* ---------- Directory card Give button ----------
   Lives here rather than in styles.css so the directory keeps working
   unchanged if Give is ever pulled from a page. */

.dir-card__give {
  padding: 0.35rem 0.9rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  background: var(--color-accent, #ff7f40);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background 150ms ease;
}
.dir-card__give:hover { background: var(--color-accent-dark, #e06020); }
.dir-card__give:focus-visible {
  outline: 3px solid var(--color-secondary, #54c8e8);
  outline-offset: 2px;
}

/* Direct-only giving: the nonprofit's own page, when we can't take the gift. */
.cg-give__fallback { display: inline-block; margin-top: 0.5rem; font-weight: 600; color: var(--color-primary, #541d66); }
