/* ==========================================================================
   NACS Foundation donation form and confirmation
   --------------------------------------------------------------------------
   Built from the existing ConvenienceCares design language rather than a new
   one: Gotham, the site blue (#004C97), the pill form controls and pill
   buttons the other Foundation forms already use, and the site's own
   breakpoints. The accent colour is supplied per widget instance as the
   --nfd-accent custom property, so a fund can carry its own program colour.
   ========================================================================== */

.nfd,
.nfdc {
    --nfd-accent: #004C97;
    --nfd-bg: #FFFFFF;
    --nfd-ink: #425563;
    --nfd-ink-strong: #1B2A36;
    --nfd-muted: #7C878E;
    --nfd-field: #E9EDF7;
    --nfd-line: #D3DBEA;
    --nfd-error: #C4271B;
    --nfd-radius: 12px;
    --nfd-radius-pill: 50px;
    --nfd-gap: 20px;
    --nfd-font: "Gotham SSm A", "Gotham SSm B", Gotham, Arial, sans-serif;

    background: var(--nfd-bg);
    font-family: var(--nfd-font);
    color: var(--nfd-ink);
    display: block;
    position: relative;
    width: 100%;
    padding: 48px 20px;
    box-sizing: border-box;
}

/* The reset in ConvenienceCares.css gives these elements a display value, which
   would otherwise beat the hidden attribute the scripts rely on. */
.nfd [hidden],
.nfdc [hidden] {
    display: none !important;
}

.nfd__container,
.nfdc__container {
    max-width: 780px;
    margin: 0 auto;
    width: 100%;
}

.nfd__heading {
    font-size: 36px;
    line-height: 1.15;
    font-weight: 700;
    color: var(--nfd-accent);
    margin: 0 0 16px;
}

.nfd__intro {
    margin-bottom: 32px;
}

.nfd__intro p:last-child {
    margin-bottom: 0;
}

.nfd__editor-note {
    background: #FFF7E5;
    border-left: 4px solid #ED8B00;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 20px;
    color: var(--nfd-ink-strong);
    margin-bottom: 24px;
}

/* ------------------------------------------------------------------ steps */

.nfd__step {
    border: 0;
    padding: 0;
    margin: 0 0 36px;
}

.nfd__legend {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    line-height: 1.3;
    font-weight: 700;
    color: var(--nfd-ink-strong);
    padding: 0;
    margin-bottom: 16px;
    width: 100%;
}

.nfd__legend--minor {
    font-size: 18px;
}

.nfd__step-number {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--nfd-accent);
    color: #FFFFFF;
    font-size: 15px;
    line-height: 30px;
    text-align: center;
    font-weight: 700;
}

/* Visually hidden but still focusable and still the accessible control: the
   labels are only skins over real radios and checkboxes, so keyboard
   navigation and screen-reader semantics work without any ARIA. */
.nfd__native {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    margin: 0;
    padding: 0;
    pointer-events: none;
}

/* ------------------------------------------------------------------ funds */

/* 300px so the four launch funds land as a tidy 2x2 with room for their descriptions, rather than
   3 + 1 with a gap; it still collapses to a single column on a phone. */
.nfd__cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px;
}

.nfd__card {
    position: relative;
    display: flex;
}

.nfd__card-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 18px 18px 18px 50px;
    border: 2px solid var(--nfd-line);
    border-radius: var(--nfd-radius);
    background: #FFFFFF;
    cursor: pointer;
    transition: border-color .15s ease-in-out, background-color .15s ease-in-out;
}

/* The selection marker is a shape as well as a colour, so the chosen fund is
   still obvious without colour perception. */
.nfd__card-label::before {
    content: "";
    position: absolute;
    left: 18px;
    top: 20px;
    width: 20px;
    height: 20px;
    border: 2px solid var(--nfd-muted);
    border-radius: 50%;
    background: #FFFFFF;
    box-sizing: border-box;
}

.nfd__card-label:hover {
    border-color: var(--nfd-card-accent, var(--nfd-accent));
}

.nfd__native:checked + .nfd__card-label {
    border-color: var(--nfd-card-accent, var(--nfd-accent));
    background: #F5F8FD;
}

.nfd__native:checked + .nfd__card-label::before {
    border-color: var(--nfd-card-accent, var(--nfd-accent));
    border-width: 6px;
}

.nfd__native:focus-visible + .nfd__card-label,
.nfd__native:focus-visible + .nfd__segment-label,
.nfd__native:focus-visible + .nfd__amount-label,
.nfd__native:focus-visible + .nfd__radio-label {
    outline: 3px solid var(--nfd-accent);
    outline-offset: 2px;
}

.nfd__card-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--nfd-ink-strong);
}

.nfd__card-description {
    font-size: 14px;
    line-height: 20px;
    color: var(--nfd-ink);
    font-weight: 300;
}

/* ------------------------------------------------------------------ frequency */

.nfd__segmented {
    display: inline-flex;
    padding: 4px;
    background: var(--nfd-field);
    border-radius: var(--nfd-radius-pill);
    max-width: 100%;
}

.nfd__segment {
    position: relative;
    flex: 1 1 auto;
}

.nfd__segment-label {
    display: block;
    padding: 11px 34px;
    border-radius: var(--nfd-radius-pill);
    font-size: 16px;
    font-weight: 700;
    color: var(--nfd-ink);
    text-align: center;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color .15s ease-in-out, color .15s ease-in-out;
}

.nfd__native:checked + .nfd__segment-label {
    background: var(--nfd-accent);
    color: #FFFFFF;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}

.nfd__cadence {
    margin: 12px 0 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--nfd-accent);
}

/* ------------------------------------------------------------------ amounts */

.nfd__amounts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.nfd__amount {
    position: relative;
    flex: 1 1 120px;
    min-width: 108px;
}

.nfd__amount-label {
    display: block;
    padding: 16px 12px;
    border: 2px solid var(--nfd-line);
    border-radius: var(--nfd-radius);
    background: #FFFFFF;
    font-size: 19px;
    font-weight: 700;
    color: var(--nfd-ink-strong);
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease-in-out, background-color .15s ease-in-out, color .15s ease-in-out;
}

.nfd__amount-label:hover {
    border-color: var(--nfd-accent);
}

.nfd__native:checked + .nfd__amount-label {
    border-color: var(--nfd-accent);
    background: var(--nfd-accent);
    color: #FFFFFF;
}

/* A tick as well as the fill, so the selected amount does not rely on colour. */
.nfd__native:checked + .nfd__amount-label::after {
    content: " \2713";
    font-weight: 700;
}

.nfd__custom {
    margin-top: 18px;
    max-width: 300px;
}

.nfd__currency-input {
    position: relative;
    display: block;
}

.nfd__currency-symbol {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    font-weight: 700;
    color: var(--nfd-ink-strong);
    pointer-events: none;
}

.nfd__input--amount {
    padding-left: 34px;
    font-size: 18px;
    font-weight: 700;
}

/* ------------------------------------------------------------------ fields */

.nfd__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--nfd-gap);
}

.nfd__field--wide {
    grid-column: 1 / -1;
}

.nfd__field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.nfd__label {
    font-size: 15px;
    font-weight: 700;
    color: var(--nfd-ink-strong);
    margin-bottom: 6px;
    padding: 0;
    display: block;
}

.nfd__optional {
    font-weight: 400;
    color: var(--nfd-muted);
}

.nfd__input {
    width: 100%;
    min-height: 50px;
    background: var(--nfd-field);
    border: 2px solid transparent;
    border-radius: var(--nfd-radius-pill);
    padding: 12px 18px;
    font-family: var(--nfd-font);
    font-size: 16px;
    line-height: 24px;
    color: var(--nfd-ink-strong);
    box-sizing: border-box;
    transition: border-color .15s ease-in-out;
}

.nfd__input:focus {
    outline: none;
    border-color: var(--nfd-accent);
}

.nfd__input:focus-visible {
    outline: 3px solid var(--nfd-accent);
    outline-offset: 2px;
}

.nfd__input[aria-invalid="true"] {
    border-color: var(--nfd-error);
}

.nfd__textarea {
    min-height: 96px;
    border-radius: var(--nfd-radius);
    resize: vertical;
}

.nfd__hint {
    font-size: 13px;
    line-height: 18px;
    color: var(--nfd-muted);
    margin: 6px 0 0;
    font-weight: 400;
}

/* Stands alone under the amount buttons in the direct flow, where there is no input above it to hug. */
.nfd__hint--custom {
    margin-top: 18px;
}

/* Errors carry an icon and their own weight, never colour alone. */
.nfd__field-error {
    font-size: 14px;
    line-height: 20px;
    font-weight: 700;
    color: var(--nfd-error);
    margin: 6px 0 0;
}

.nfd__field-error::before {
    content: "\26A0 ";
}

.nfd__alert {
    background: #FDECEA;
    border-left: 4px solid var(--nfd-error);
    color: #7A1913;
    font-size: 15px;
    line-height: 22px;
    font-weight: 700;
    padding: 14px 18px;
    border-radius: 4px;
    margin-bottom: 24px;
}

.nfd__alert--static {
    background: #F1F4FA;
    border-left-color: var(--nfd-accent);
    color: var(--nfd-ink-strong);
    font-weight: 400;
}

/* ------------------------------------------------------------------ checks */

.nfd__check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.nfd__check--consent {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--nfd-line);
}

.nfd__checkbox {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin: 2px 0 0;
    accent-color: var(--nfd-accent);
    cursor: pointer;
}

.nfd__check-label {
    font-size: 15px;
    line-height: 22px;
    font-weight: 400;
    color: var(--nfd-ink);
    cursor: pointer;
    padding: 0;
    display: block;
}

.nfd__check-detail {
    font-weight: 700;
    color: var(--nfd-accent);
}

.nfd__dedication {
    padding: 18px;
    background: #F7F9FC;
    border-radius: var(--nfd-radius);
    margin: 4px 0 14px;
}

.nfd__subgroup {
    border: 0;
    padding: 0;
    margin: 0 0 16px;
}

.nfd__radio-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.nfd__radio {
    position: relative;
}

.nfd__radio-label {
    display: block;
    padding: 9px 20px;
    border: 2px solid var(--nfd-line);
    border-radius: var(--nfd-radius-pill);
    background: #FFFFFF;
    font-size: 15px;
    font-weight: 700;
    color: var(--nfd-ink-strong);
    cursor: pointer;
}

.nfd__native:checked + .nfd__radio-label {
    border-color: var(--nfd-accent);
    background: var(--nfd-accent);
    color: #FFFFFF;
}

.nfd__address-note {
    font-size: 14px;
    line-height: 20px;
    color: var(--nfd-ink-strong);
    background: #F1F4FA;
    border-left: 4px solid var(--nfd-accent);
    padding: 10px 14px;
    margin: 0 0 16px;
    font-weight: 400;
}

/* ------------------------------------------------------------------ summary */

.nfd__summary {
    background: #F7F9FC;
    border: 1px solid var(--nfd-line);
    border-radius: var(--nfd-radius);
    padding: 22px 24px;
    margin-bottom: 24px;
}

.nfd__summary-heading {
    font-size: 18px;
    font-weight: 700;
    color: var(--nfd-ink-strong);
    margin: 0 0 14px;
}

.nfd__summary-list {
    margin: 0;
}

.nfd__summary-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 7px 0;
    border-bottom: 1px solid var(--nfd-line);
}

.nfd__summary-row:last-child {
    border-bottom: 0;
}

/*
 * The rule between rows must not dangle under the last one, and which row is last depends on what is
 * hidden - the total row stands down when the amount is still to be chosen on Stripe, and the donor
 * rows only appear once there is a donor. So it is decided by what actually follows, not by position.
 */
.nfd__summary-row:not(:has(~ .nfd__summary-row:not([hidden]))) {
    border-bottom: 0;
}

.nfd__summary-row dt {
    font-size: 15px;
    color: var(--nfd-ink);
    font-weight: 400;
}

.nfd__summary-row dd {
    font-size: 16px;
    font-weight: 700;
    color: var(--nfd-ink-strong);
    margin: 0;
    text-align: right;
    word-break: break-word;
}

.nfd__summary-row--total {
    border-top: 2px solid var(--nfd-line);
    border-bottom: 0;
    margin-top: 4px;
    padding-top: 12px;
}

.nfd__summary-row--total dt,
.nfd__summary-row--total dd {
    font-size: 19px;
    font-weight: 700;
    color: var(--nfd-accent);
}

.nfd__summary-note {
    font-size: 14px;
    line-height: 20px;
    color: var(--nfd-ink);
    margin: 14px 0 0;
    font-weight: 400;
}

/* ------------------------------------------------------------------ submit */

.nfd__actions {
    text-align: center;
}

.nfd__submit {
    display: inline-block;
    width: 100%;
    max-width: 420px;
    min-height: 56px;
    padding: 15px 32px;
    border: 2px solid var(--nfd-accent);
    border-radius: var(--nfd-radius-pill);
    background: var(--nfd-accent);
    color: #FFFFFF;
    font-family: var(--nfd-font);
    font-size: 19px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color .2s ease-in-out, color .2s ease-in-out;
}

.nfd__submit:hover:not(:disabled) {
    background: transparent;
    color: var(--nfd-accent);
}

.nfd__submit:focus-visible {
    outline: 3px solid var(--nfd-ink-strong);
    outline-offset: 3px;
}

/* A disabled Donate button reads as "not ready yet", not as a broken control. */
.nfd__submit:disabled {
    background: #B9C2CC;
    border-color: #B9C2CC;
    color: #FFFFFF;
    cursor: not-allowed;
}

.nfd__secure {
    font-size: 13px;
    line-height: 19px;
    color: var(--nfd-muted);
    margin: 14px auto 0;
    max-width: 480px;
    font-weight: 400;
}

/* ==========================================================================
   Confirmation
   ========================================================================== */

.nfdc__container {
    text-align: center;
}

.nfdc__heading {
    font-size: 32px;
    line-height: 1.2;
    font-weight: 700;
    color: var(--nfd-accent);
    margin: 0 0 14px;
}

.nfdc__lead {
    font-size: 17px;
    line-height: 25px;
    color: var(--nfd-ink);
    margin: 0 auto 24px;
    max-width: 560px;
}

.nfdc__message {
    margin-bottom: 8px;
}

/* One attribute on the wrapper decides which half of the block is shown, so the
   page can never sit in a half-swapped state. */
.nfdc__result[data-state="confirmed"] .nfdc__pending,
.nfdc__result[data-state="pending"] .nfdc__confirmed {
    display: none;
}

.nfdc__spinner {
    display: block;
    width: 34px;
    height: 34px;
    margin: 0 auto 18px;
    border: 3px solid var(--nfd-line);
    border-top-color: var(--nfd-accent);
    border-radius: 50%;
    animation: nfdc-spin 900ms linear infinite;
}

@keyframes nfdc-spin {
    to {
        transform: rotate(360deg);
    }
}

.nfdc__check {
    display: block;
    width: 52px;
    height: 52px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: #78BE20;
    position: relative;
}

.nfdc__check::after {
    content: "";
    position: absolute;
    left: 19px;
    top: 12px;
    width: 12px;
    height: 22px;
    border: solid #FFFFFF;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.nfdc__details {
    text-align: left;
    max-width: 460px;
    margin: 26px auto;
    background: #F7F9FC;
    border: 1px solid var(--nfd-line);
    border-radius: var(--nfd-radius);
    padding: 18px 22px;
}

.nfdc__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 7px 0;
    border-bottom: 1px solid var(--nfd-line);
}

.nfdc__row:last-child {
    border-bottom: 0;
}

.nfdc__row dt {
    font-size: 15px;
    color: var(--nfd-ink);
}

.nfdc__row dd {
    font-size: 16px;
    font-weight: 700;
    color: var(--nfd-ink-strong);
    margin: 0;
    text-align: right;
    word-break: break-all;
}

.nfdc__reference {
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    font-weight: 400;
    color: var(--nfd-ink);
}

.nfdc__note {
    font-size: 14px;
    line-height: 21px;
    color: var(--nfd-ink);
    max-width: 520px;
    margin: 0 auto 12px;
}

.nfdc__editor-note {
    background: #FFF7E5;
    border-left: 4px solid #ED8B00;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 20px;
    text-align: left;
    color: var(--nfd-ink-strong);
    margin-top: 20px;
}

.nfdc__actions {
    margin-top: 26px;
}

.nfdc__link {
    display: inline-block;
    padding: 11px 28px;
    border: 2px solid var(--nfd-accent);
    border-radius: var(--nfd-radius-pill);
    background: var(--nfd-accent);
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    transition: background-color .2s ease-in-out, color .2s ease-in-out;
}

.nfdc__link:hover {
    background: transparent;
    color: var(--nfd-accent);
}

/* ==========================================================================
   Responsive - the site's own breakpoints, not new ones
   ========================================================================== */

@media screen and (max-width: 768px) {
    .nfd,
    .nfdc {
        padding: 32px 16px;
    }

    .nfd__heading {
        font-size: 28px;
    }

    .nfdc__heading {
        font-size: 25px;
    }

    .nfd__legend {
        font-size: 18px;
    }

    /* One column: full-width fields are easier to fill on a phone, and nothing
       has to scroll sideways. */
    .nfd__grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .nfd__cards {
        grid-template-columns: minmax(0, 1fr);
    }

    .nfd__custom {
        max-width: none;
    }

    .nfd__segmented {
        display: flex;
        width: 100%;
    }

    .nfd__segment-label {
        padding: 12px 16px;
    }

    /* Three per row, so six options make two even rows. Without this the sixth wraps alone and
       stretches to the full width, which reads as a different kind of control. */
    .nfd__amount {
        flex: 1 1 calc(33.333% - 7px);
        min-width: calc(33.333% - 7px);
    }
}

@media screen and (max-width: 600px) {
    /* Two per row keeps every amount a comfortable tap target rather than
       shrinking five of them into one line. */
    .nfd__amount {
        flex: 1 1 calc(50% - 5px);
        min-width: calc(50% - 5px);
    }

    .nfd__summary,
    .nfdc__details {
        padding: 16px;
    }

    .nfd__summary-row,
    .nfdc__row {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .nfd__summary-row dd,
    .nfdc__row dd {
        text-align: left;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nfd *,
    .nfdc * {
        transition: none !important;
        animation: none !important;
    }
}
