:root {
  --navy: var(--agapay-giving-primary, #071a2a);
  --navy-soft: #102d42;
  --gold: var(--agapay-giving-accent, #c8a24a);
  --gold-deep: var(--agapay-giving-accent-text, #987224);
  --gold-pale: var(--agapay-giving-accent, #ead49b);
  --ivory: var(--agapay-giving-primary-text, #f4efe4);
  --paper: var(--agapay-giving-background, #fffdf8);
  --ink: var(--agapay-giving-text, #152534);
  --muted: var(--agapay-giving-muted, #6f786f);
  --line: var(--agapay-giving-border, #e1d7c6);
  --success: var(--agapay-giving-success, #2f7650);
  --danger: var(--agapay-giving-danger, #a13e36);
  --serif: var(--agapay-giving-heading-font, "Cormorant Garamond", Georgia, serif);
  --sans: var(--agapay-giving-font, "DM Sans", system-ui, sans-serif);
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 300px; background: transparent; }
body {
  min-width: 300px;
  min-height: 100vh;
  margin: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
[hidden] { display: none !important; }

.giving-frame { width: 100%; padding: 6px; }
.giving-box {
  position: relative;
  width: min(100%, 540px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 18px 52px rgba(7, 26, 42, 0.14), 0 3px 9px rgba(7, 26, 42, 0.06);
}
.giving-box::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  z-index: 4;
  background: linear-gradient(90deg, var(--navy), var(--gold) 42%, var(--gold-pale) 50%, var(--gold) 58%, var(--navy));
}
.step-ribbon {
  display: flex;
  align-items: center;
  padding: 13px 28px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--agapay-giving-surface, #f6f1e7);
}
.step-ribbon__item {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}
.step-ribbon__item i {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  font-style: normal;
  font-size: 9px;
}
.step-ribbon__item.is-active { color: var(--gold-deep); }
.step-ribbon__item.is-active i { border-color: var(--gold); background: var(--gold); color: var(--navy); }
.step-ribbon__item.is-complete { color: var(--success); }
.step-ribbon__item.is-complete i { border-color: var(--success); background: var(--success); color: var(--ivory); }
.step-ribbon__line { flex: 1; min-width: 12px; height: 1px; margin: 0 9px; background: var(--line); }

.giving-status { margin: 13px 28px 0; border: 1px solid rgba(161, 62, 54, 0.22); border-radius: 9px; padding: 8px 10px; background: rgba(161, 62, 54, 0.06); color: var(--danger); font-size: 11px; line-height: 1.4; }
.giving-status.is-success { border-color: rgba(47, 118, 80, 0.25); background: rgba(47, 118, 80, 0.07); color: var(--success); }

.giving-step { padding: 20px 28px 24px; animation: step-in 0.32s ease both; }
@keyframes step-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.section-heading { margin-bottom: 14px; }
.section-heading--gift { margin-bottom: 10px; }
.section-kicker, .field-label {
  display: block;
  color: var(--gold-deep);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.section-heading h2, .completion-state h2, .unavailable-state h2 {
  margin: 3px 0 0;
  color: var(--navy);
  font: 600 clamp(23px, 5vw, 28px)/1.08 var(--serif);
  letter-spacing: -0.015em;
}
.section-heading p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }

.giving-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 22px 28px 16px;
  border-bottom: 1px solid var(--line);
}
.giving-app-link {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--agapay-giving-surface, #f6f1e7);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}
.giving-app-link img { display: block; border-radius: 7px; }
.giving-app-link:hover { border-color: var(--gold); text-decoration: underline; }
.giving-app-link:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

.frequency-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; border-radius: 10px; padding: 3px; background: var(--agapay-giving-surface, #eee8dc); }
.frequency-tabs button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  transition: 0.18s ease;
}
.frequency-tabs button:hover { color: var(--navy); }
.frequency-tabs button.is-active { border-color: var(--gold); background: var(--paper); color: var(--navy); box-shadow: 0 3px 10px rgba(7, 26, 42, 0.08); }
.frequency-note { min-height: 16px; margin: 5px 2px 13px; color: var(--muted); font: italic 500 12px var(--serif); text-align: center; }

.amount-block { margin-bottom: 13px; }
.amount-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.amount-grid button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--agapay-giving-surface, white);
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
  transition: 0.16s ease;
}
.amount-grid button:hover { transform: translateY(-1px); border-color: var(--gold); box-shadow: 0 5px 15px rgba(7, 26, 42, 0.07); }
.amount-grid button.is-active { border-color: var(--navy); background: var(--navy); color: var(--ivory); box-shadow: 0 6px 16px rgba(7, 26, 42, 0.18); }
.other-amount { position: relative; display: flex; align-items: center; margin-top: 6px; }
.other-amount > span { position: absolute; left: 15px; color: var(--gold-deep); font-weight: 700; }
.other-amount input { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 9px; padding: 0 58px 0 31px; background: var(--agapay-giving-surface, white); color: var(--navy); font-size: 14px; font-weight: 600; outline: none; }
.other-amount small { position: absolute; right: 14px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; }
.other-amount input:focus, .input-field input:focus, .reveal-field input:focus, .reveal-field textarea:focus, .select-field select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 20%, transparent); }

.select-field, .input-field, .reveal-field { position: relative; display: grid; gap: 6px; margin: 12px 0; }
.select-field select, .input-field input, .reveal-field input, .reveal-field textarea {
  width: 100%;
  min-height: 43px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 14px;
  background: var(--agapay-giving-surface, white);
  color: var(--ink);
  outline: none;
}
.select-field select { appearance: none; padding-right: 40px; }
.select-chevron { position: absolute; right: 15px; bottom: 14px; color: var(--gold-deep); pointer-events: none; }
.reveal-field textarea { min-height: 82px; padding-block: 12px; resize: vertical; line-height: 1.5; }
.tribute-fields { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 10px; }
.tribute-fields > * { margin-top: 2px; }

.optional-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 13px; }
.option-card { display: grid; grid-template-columns: 19px 1fr; gap: 8px; align-items: start; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--agapay-giving-surface, rgba(255, 255, 255, 0.75)); cursor: pointer; transition: 0.16s ease; }
.option-card:hover { border-color: var(--gold); }
.option-card:has(input:checked) { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, var(--paper)); }
.option-card input { position: absolute; opacity: 0; }
.custom-check { width: 18px; height: 18px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 5px; background: var(--agapay-giving-surface, white); }
.option-card input:checked + .custom-check { border-color: var(--navy); background: var(--navy); }
.option-card input:checked + .custom-check::after { content: "✓"; color: var(--ivory); font-size: 12px; font-weight: 800; }
.option-card strong { display: block; color: var(--navy); font-size: 11px; }
.option-card small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.45; }

.fee-card { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: start; margin: 14px 0; border: 1px solid var(--gold); border-radius: 11px; padding: 11px; background: var(--agapay-giving-surface, #f5f0e6); cursor: pointer; }
.fee-switch { position: relative; width: 38px; height: 22px; margin-top: 1px; }
.fee-switch input { position: absolute; opacity: 0; }
.fee-switch i { position: absolute; inset: 0; border-radius: 99px; background: #c9c3b8; transition: 0.18s ease; }
.fee-switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--agapay-giving-surface, white); box-shadow: 0 1px 4px rgba(7, 26, 42, 0.28); transition: 0.18s ease; }
.fee-switch input:checked + i { background: var(--success); }
.fee-switch input:checked + i::after { transform: translateX(16px); }
.fee-card strong { display: block; color: var(--navy); font-size: 11px; }
.fee-card small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.5; }

.primary-action, .secondary-action {
  width: 100%;
  min-height: 49px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 0;
  border-radius: 10px;
  background: var(--gold);
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(152, 114, 36, 0.22);
  transition: 0.18s ease;
}
.primary-action:hover { transform: translateY(-1px); filter: saturate(1.08); box-shadow: 0 12px 28px rgba(152, 114, 36, 0.29); }
.primary-action:disabled { cursor: wait; opacity: 0.68; transform: none; }
.primary-action svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.primary-action strong { font-size: inherit; }
.primary-action--checkout { margin-top: 14px; }

.back-button { margin: -4px 0 13px; border: 0; padding: 0; background: none; color: var(--gold-deep); font-size: 11px; font-weight: 700; }
.gift-summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 0 15px; border-left: 3px solid var(--gold); border-radius: 0 10px 10px 0; padding: 10px 13px; background: var(--agapay-giving-surface, #f5f0e6); }
.gift-summary div { min-width: 0; }
.gift-summary div span { display: block; color: var(--gold-deep); font-size: 9px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; }
.gift-summary div strong { display: block; overflow: hidden; margin-top: 3px; color: var(--navy); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.gift-summary > strong { flex: 0 0 auto; color: var(--navy); font: 600 24px var(--serif); }
.name-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.name-grid .input-field { margin-top: 0; }
.turnstile-wrap { display: flex; justify-content: center; overflow: hidden; margin-top: 10px; }
.secure-note { margin: 10px 0 0; color: var(--muted); font-size: 9px; line-height: 1.45; text-align: center; }
.secure-note span { color: var(--gold-deep); }

.completion-state, .unavailable-state { padding: 38px 28px 34px; text-align: center; animation: step-in 0.32s ease both; }
.completion-icon { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 17px; border-radius: 50%; background: var(--success); color: var(--ivory); font-size: 25px; box-shadow: 0 0 0 8px rgba(47, 118, 80, 0.08); }
.completion-icon--quiet { background: var(--navy); color: var(--gold-pale); box-shadow: 0 0 0 8px rgba(7, 26, 42, 0.06); }
.completion-state p, .unavailable-state p { max-width: 440px; margin: 10px auto 22px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.secondary-action { width: auto; min-height: 44px; display: inline-flex; padding: 0 22px; background: var(--navy); color: var(--ivory); box-shadow: none; }

.giving-footer { display: flex; align-items: center; justify-content: center; gap: 10px; border-top: 1px solid var(--line); padding: 11px 16px; background: var(--agapay-giving-surface, #f5f0e6); color: var(--muted); font-size: 8px; letter-spacing: 0.04em; }
.giving-footer a { display: inline-flex; align-items: center; gap: 6px; color: var(--navy); text-decoration: none; }
.giving-footer img { width: 19px; height: 19px; object-fit: contain; }
.giving-footer strong { font-family: var(--serif); font-size: 12px; letter-spacing: 0.08em; }
.footer-divider { width: 1px; height: 16px; background: var(--line); }

@media (max-width: 560px) {
  .giving-frame { padding: 4px; }
  .giving-box { border-radius: 16px; }
  .giving-header { padding-inline: 18px; }
  .step-ribbon { padding: 13px 18px 10px; }
  .step-ribbon__item { font-size: 8px; letter-spacing: 0.04em; }
  .step-ribbon__item i { width: 19px; height: 19px; }
  .giving-step { padding: 18px 18px 22px; }
  .giving-status { margin-inline: 18px; }
  .frequency-tabs { grid-template-columns: repeat(2, 1fr); }
  .amount-grid { grid-template-columns: repeat(3, 1fr); }
  .optional-grid, .tribute-fields { grid-template-columns: 1fr; }
  .option-card { min-height: 56px; }
  .name-grid { grid-template-columns: 1fr; gap: 0; }
  .completion-state, .unavailable-state { padding: 34px 19px 31px; }
  .giving-footer { flex-wrap: wrap; gap: 8px; }
}

@media (max-width: 390px) {
  .giving-app-link span { max-width: 68px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

.option-card:focus-within, .fee-card:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
