/* HeartBridge donor flow (donate.php, process-payment.php, donation-success.php): "Open Hand" tokens.
   Every colour is var(--hb-*, fallback) so the pages still render if style.css has not loaded the tokens. */

.hb-donate,
.hb-pay,
.hb-thanks {
    --d-paper: var(--hb-paper, #FBF8F3);
    --d-paper-2: var(--hb-paper-2, #F3EEE6);
    --d-surface: var(--hb-surface, #FFFEFC);
    --d-line: var(--hb-line, #E7E0D5);
    --d-ink: var(--hb-ink, #1C2430);
    --d-muted: var(--hb-muted, #5A6170);
    --d-navy: var(--hb-navy, #16385C);
    --d-link: var(--hb-link, #1F5FBF);
    --d-heart: var(--hb-heart, #C8432B);
    --d-sunrise: var(--hb-sunrise, #F2B84B);
    --d-sage: var(--hb-sage, #2F7D5B);
    --d-danger: var(--hb-danger, #B3261E);
    --d-r-sm: var(--hb-r-sm, 8px);
    --d-r-md: var(--hb-r-md, 12px);
    --d-r-lg: var(--hb-r-lg, 20px);
    --d-shadow: var(--hb-shadow, 0 1px 2px rgba(28, 36, 48, .06), 0 8px 24px rgba(28, 36, 48, .08));
    --d-field-border: #8A9199; /* 3.2:1 on the surface (WCAG 1.4.11); --hb-line is decorative only */
    --d-pad: 24px;
    background: var(--d-paper);
    color: var(--d-ink);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

.hb-donate *:focus-visible,
.hb-pay *:focus-visible,
.hb-thanks *:focus-visible {
    outline: 2px solid var(--d-link);
    outline-offset: 2px;
}

/* ---------- Layout ---------- */
.hb-donate { padding: 24px 0 64px; }
.hb-donate__grid {
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "intro" "form" "trust";
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 16px;
}
.hb-donate__intro { grid-area: intro; }
.hb-donate__form  { grid-area: form; min-width: 0; }
.hb-donate__trust { grid-area: trust; }

@media (min-width: 1024px) {
    .hb-donate { padding: 48px 0 96px; }
    .hb-donate__grid {
        grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
        grid-template-areas: "intro form" "trust form";
        grid-template-rows: auto 1fr;
        gap: 32px 48px;
        padding: 0 24px;
        align-items: start;
    }
    .hb-donate__intro { position: sticky; top: 24px; }
    .hb-donate__trust { align-self: start; }
}

/* ---------- Identity panel ---------- */
.hb-intro {
    background: var(--d-navy);
    color: #fff;
    border-radius: var(--d-r-lg);
    padding: 32px 24px;
    overflow: hidden;
}
.hb-intro__logo {
    display: inline-block;
    background: #fff;
    border-radius: var(--d-r-md);
    padding: 8px 14px;
    margin-bottom: 16px;
}
.hb-intro__logo img { display: block; height: 44px; width: auto; max-width: 220px; object-fit: contain; }
.hb-intro__eyebrow {
    margin: 0 0 8px;
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #DCE4EE;
}
.hb-intro h1 {
    margin: 0 0 12px;
    font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -.02em;
    color: #fff;
}
.hb-intro__lede { margin: 0; font-size: 1.0625rem; line-height: 1.55; color: #E8EEF5; }
.hb-intro__story { margin: 16px 0 0; line-height: 1.6; color: #E8EEF5; }
.hb-intro__image {
    display: block;
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: var(--d-r-md);
    margin-bottom: 20px;
}
.hb-intro__note {
    margin: 20px 0 0;
    padding: 12px 14px;
    border-radius: var(--d-r-sm);
    background: rgba(255, 255, 255, .1);
    font-size: .875rem;
    line-height: 1.5;
    color: #E8EEF5;
}
.hb-progress { margin-top: 20px; }
.hb-progress__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.hb-progress__raised { font-size: 1.375rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.hb-progress__raised small { font-size: .875rem; font-weight: 400; color: #DCE4EE; }
.hb-progress__goal { font-size: .875rem; color: #DCE4EE; font-variant-numeric: tabular-nums; }
.hb-progress__track { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .22); overflow: hidden; }
.hb-progress__fill { height: 100%; border-radius: 999px; background: var(--d-sunrise); }

/* ---------- Trust list ---------- */
.hb-trust {
    list-style: none;
    margin: 0;
    padding: 20px 24px;
    background: var(--d-paper-2);
    border-radius: var(--d-r-lg);
    display: grid;
    gap: 14px;
    font-size: .9375rem;
    color: var(--d-ink);
}
.hb-trust li { display: flex; gap: 12px; align-items: flex-start; line-height: 1.45; }
.hb-trust i { color: var(--d-sage); margin-top: 3px; width: 18px; text-align: center; }
.hb-trust small { display: block; color: var(--d-muted); font-size: .8125rem; margin-top: 2px; }

/* ---------- Form card ---------- */
.hb-card {
    background: var(--d-surface);
    border: 1px solid var(--d-line);
    border-radius: var(--d-r-lg);
    box-shadow: var(--d-shadow);
    padding: var(--d-pad);
}
@media (min-width: 768px) { .hb-card { --d-pad: 40px; } }

.hb-sec { margin: 0 0 32px; padding: 0; border: 0; min-width: 0; }
.hb-sec:last-of-type { margin-bottom: 24px; }
.hb-sec__title,
.hb-sec > legend {
    display: block;
    float: none;
    width: 100%;
    margin: 0 0 12px;
    padding: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--d-ink);
}
.hb-req-note { margin: 0 0 20px; font-size: .875rem; color: var(--d-muted); }
.hb-star { color: var(--d-danger); font-weight: 700; }

.hb-label { display: block; margin-bottom: 6px; font-size: .9375rem; font-weight: 600; color: var(--d-ink); }
.hb-help { display: block; margin-top: 6px; font-size: .875rem; color: var(--d-muted); }

.hb-field,
.hb-select,
.hb-textarea {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    font: inherit;
    font-size: 1rem;
    color: var(--d-ink);
    background: #fff;
    border: 1px solid var(--d-field-border);
    border-radius: var(--d-r-sm);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.hb-textarea { min-height: 96px; resize: vertical; }
.hb-field::placeholder, .hb-textarea::placeholder { color: #6B7785; opacity: 1; }
.hb-field:focus, .hb-select:focus, .hb-textarea:focus {
    outline: 2px solid var(--d-link);
    outline-offset: 2px;
    border-color: var(--d-link);
}
.hb-field[aria-invalid="true"] { border-color: var(--d-danger); border-width: 2px; }

.hb-donate input,
.hb-donate select,
.hb-donate textarea,
.hb-donate button { scroll-margin-bottom: 120px; }

.hb-grid-2 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .hb-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.hb-span-2 { grid-column: 1 / -1; }

/* Money input */
.hb-money { display: flex; align-items: stretch; }
.hb-money__sym {
    display: flex; align-items: center; padding: 0 14px;
    background: var(--d-paper-2);
    border: 1px solid var(--d-field-border);
    border-right: 0;
    border-radius: var(--d-r-sm) 0 0 var(--d-r-sm);
    color: var(--d-muted);
    font-weight: 600;
}
.hb-money .hb-field { border-radius: 0 var(--d-r-sm) var(--d-r-sm) 0; font-variant-numeric: tabular-nums; }

/* ---------- Segmented control (one-time / recurring) ---------- */
.hb-seg {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    background: var(--d-paper-2);
    border: 1px solid var(--d-line);
    border-radius: var(--d-r-md);
}
.hb-seg input, .hb-tile input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.hb-seg label {
    display: flex; align-items: center; justify-content: center;
    min-height: 44px;
    border-radius: var(--d-r-sm);
    font-weight: 600;
    color: var(--d-ink);
    cursor: pointer;
    text-align: center;
    transition: background-color .15s ease, color .15s ease;
}
.hb-seg input:checked + label { background: var(--d-navy); color: #fff; }
.hb-seg input:focus-visible + label { outline: 2px solid var(--d-link); outline-offset: 2px; }
.hb-freq-more { margin-top: 12px; }

/* ---------- Amount tiles ---------- */
.hb-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (min-width: 480px) { .hb-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.hb-tile { position: relative; }
.hb-tile label {
    display: flex; align-items: center; justify-content: center;
    min-height: 52px;
    background: #fff;
    border: 1px solid var(--d-field-border);
    border-radius: var(--d-r-md);
    font-size: 1.125rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--d-ink);
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.hb-tile label:hover { border-color: var(--d-navy); }
.hb-tile input:checked + label { background: var(--d-navy); border-color: var(--d-navy); color: #fff; }
.hb-tile input:focus-visible + label { outline: 2px solid var(--d-link); outline-offset: 2px; }

/* ---------- Checkboxes and radios ---------- */
.hb-check { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; padding: 10px 0; }
.hb-check input { flex: 0 0 auto; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--d-navy); }
.hb-check label { font-size: 1rem; line-height: 1.4; cursor: pointer; }
.hb-radios { display: grid; gap: 4px 24px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .hb-radios { grid-template-columns: repeat(3, auto); justify-content: start; } }

.hb-panel {
    margin-top: 16px;
    padding: 20px;
    background: var(--d-paper-2);
    border-radius: var(--d-r-md);
}
.hb-panel[hidden] { display: none; }

/* ---------- Alerts ---------- */
.hb-alert {
    margin: 0 0 24px;
    padding: 14px 16px;
    border-radius: var(--d-r-md);
    border: 1px solid var(--d-danger);
    background: #FDEEEC;
    color: #7A1B15;
    font-weight: 500;
    line-height: 1.45;
}
.hb-alert:focus { outline: 2px solid var(--d-link); outline-offset: 2px; }
.hb-alert--ok { border-color: var(--d-sage); background: #EAF4EE; color: #1D4F39; }

/* ---------- Primary action ---------- */
.hb-btn {
    display: flex; align-items: center; justify-content: center;
    width: 100%;
    min-height: 56px;
    padding: 12px 24px;
    border: 0;
    border-radius: var(--d-r-md);
    background: var(--d-heart);
    color: #fff;
    font: inherit;
    font-size: 1.125rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: background-color .15s ease, transform .15s ease;
}
.hb-btn:hover { background: #A8361F; }
.hb-btn:disabled { opacity: .75; cursor: progress; }
.hb-btn--sage { background: var(--d-sage); }
.hb-btn--sage:hover { background: #256548; }
.hb-btn--ghost {
    background: transparent; color: var(--d-navy);
    border: 2px solid var(--d-navy);
    text-decoration: none;
}
.hb-btn--ghost:hover { background: var(--d-navy); color: #fff; }
a.hb-btn, a.hb-btn:hover, a.hb-btn:focus { text-decoration: none; color: #fff; }
a.hb-btn--ghost { color: var(--d-navy); }
a.hb-btn--ghost:hover, a.hb-btn--ghost:focus { color: #fff; }

.hb-secure { margin: 12px 0 0; text-align: center; font-size: .875rem; color: var(--d-muted); }

/* Sticky Donate button on mobile: full-bleed bar pinned to the bottom of the form while it is in view. */
.hb-submit { margin-top: 8px; }
@media (max-width: 1023.98px) {
    .hb-submit {
        position: sticky;
        bottom: 0;
        z-index: 5;
        margin: 8px calc(var(--d-pad) * -1) 0;
        padding: 12px var(--d-pad) calc(12px + env(safe-area-inset-bottom, 0px));
        background: var(--d-surface);
        border-top: 1px solid var(--d-line);
        box-shadow: 0 -8px 16px rgba(28, 36, 48, .06);
    }
}

/* ---------- Unavailable state ---------- */
.hb-unavailable { text-align: center; padding: 16px 0; }
.hb-unavailable i { color: var(--d-heart); font-size: 2.5rem; margin-bottom: 12px; }
.hb-unavailable h2 { margin: 0 0 8px; font-size: 1.375rem; }
.hb-unavailable p { margin: 0 auto 12px; max-width: 480px; color: var(--d-muted); }

/* ---------- Payment step (process-payment.php) ---------- */
.hb-pay { padding: 32px 0 64px; min-height: 100vh; }
.hb-pay__wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.hb-pay__head { text-align: center; margin-bottom: 24px; }
.hb-pay__head h1 { margin: 0 0 4px; font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2rem); font-weight: 700; letter-spacing: -.015em; }
.hb-pay__head p { margin: 0; color: var(--d-muted); }
.hb-pay__grid { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1024px) { .hb-pay__grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 32px; } }
.hb-pay .hb-card { padding: 24px; }
@media (min-width: 768px) { .hb-pay .hb-card { padding: 32px; } }
.hb-pay h2.hb-sec__title { font-size: 1.125rem; margin-bottom: 16px; }

/* The Stripe iframe sits inside a div, so :focus never fires on it. The script toggles this class instead. */
.hb-stripe-box {
    min-height: 50px;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--d-field-border);
    border-radius: var(--d-r-sm);
    transition: border-color .15s ease;
}
.hb-stripe-box--focus { outline: 2px solid var(--d-link); outline-offset: 2px; border-color: var(--d-link); }
.hb-stripe-error { min-height: 1.25rem; margin-top: 8px; color: var(--d-danger); font-weight: 500; }

.hb-summary dl { margin: 0; display: grid; gap: 10px; }
.hb-summary .hb-row { display: flex; justify-content: space-between; gap: 16px; }
.hb-summary dt { font-weight: 400; color: var(--d-muted); }
.hb-summary dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.hb-summary .hb-total { padding-top: 14px; margin-top: 4px; border-top: 1px solid var(--d-line); font-size: 1.125rem; font-weight: 700; }
.hb-summary .hb-total dt { color: var(--d-ink); font-weight: 700; }
.hb-summary .hb-total dd { color: var(--d-sage); }
.hb-pay__note { margin-top: 16px; padding: 12px 14px; background: var(--d-paper-2); border-radius: var(--d-r-sm); font-size: .875rem; color: var(--d-muted); }
.hb-pay__back { margin-top: 24px; text-align: center; }
.hb-pay__back a { color: var(--d-link); font-weight: 600; }

.hb-demo { margin-bottom: 20px; padding: 14px 16px; border-radius: var(--d-r-md); background: #FFF6E0; border: 1px solid var(--d-sunrise); color: #5C4300; line-height: 1.45; }

.hb-spinner {
    display: inline-block; width: 1rem; height: 1rem; margin-left: 10px;
    border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%;
    animation: hb-spin .7s linear infinite;
}
@keyframes hb-spin { to { transform: rotate(360deg); } }

/* ---------- Thank-you page (donation-success.php) ---------- */
.hb-thanks { padding: 32px 0 64px; }
.hb-thanks__wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.hb-thanks__grid { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1024px) { .hb-thanks__grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 32px; } }
.hb-thanks__hero { background: var(--d-sage); color: #fff; border-radius: var(--d-r-lg); padding: 32px 24px; }
.hb-thanks__hero h1 { margin: 0 0 8px; font-size: clamp(1.75rem, 1.2rem + 2vw, 2.25rem); font-weight: 700; letter-spacing: -.02em; color: #fff; }
.hb-thanks__hero p { margin: 0; line-height: 1.55; color: #fff; }
.hb-thanks__icon { font-size: 2.5rem; margin-bottom: 12px; }

@media (prefers-reduced-motion: reduce) {
    .hb-donate *, .hb-pay *, .hb-thanks * { transition: none !important; animation: none !important; }
}
