/* Donation popup. Everything is scoped under #donate because the page
   skeleton has its own .btn with a different colour and shape, and the
   modal sits outside .lp so none of the landing rules reach it.
   Two steps: amount (tier select + custom field), then details. */

#donate {
    position: fixed; inset: 0; z-index: 100; display: flex;
    font-family: var(--font); color: #1F1F1F; line-height: 1.6; text-align: start;
}
#donate[hidden] { display: none; }
#donate .modal__scrim {
    position: absolute; inset: 0; background: rgba(16, 12, 34, .62);
    backdrop-filter: blur(2px);
}
#donate .modal__box {
    position: relative; z-index: 1;
    width: 100%; max-width: 560px; margin: auto;
    background: var(--white); border-radius: 14px;
    padding: 0 0 24px; overflow-x: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
    max-height: calc(100dvh - 32px); overflow-y: auto; -webkit-overflow-scrolling: touch;
    animation: pop .18s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
#donate .modal__box:focus { outline: none; }

/* ---------- title band and close ---------- */
#donate .mband {
    position: relative; background: #F0F0F0; border-radius: 14px 14px 0 0;
    padding-block: 22px 20px; padding-inline: 30px 64px;   /* room for the close button */
}
#donate .mband__title { margin: 0; font-size: 19px; font-weight: 700; line-height: 1.4; color: #222; text-align: start; }
#donate .mband__x {
    position: absolute; inset-inline-end: 14px; inset-block-start: 14px;
    width: 38px; height: 38px; background: none; border: 0; border-radius: 50%;
    font-size: 30px; line-height: 1; color: #1F3BB3; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
#donate .mband__x:hover { background: #E4E4E4; }
#donate .mband__x:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

/* ---------- step indicator ---------- */
#donate .stepper { list-style: none; display: flex; align-items: center; gap: 0; margin: 22px 30px 18px; padding: 0; }
#donate .stepper__dot {
    flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; border: 1.5px solid #333;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 600; color: #333; background: #fff;
    transition: background .2s, color .2s;
}
#donate .stepper__dot.is-on { background: #333; color: #fff; }
#donate .stepper__line { flex: 1 1 auto; height: 1.5px; background: #BDBDBD; margin: 0 18%; }
#donate .stepper .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- fields ---------- */
#donate .form { padding: 0 30px; }
#donate .field { margin-bottom: 13px; }
#donate .field label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; color: #333; }
#donate .field input {
    width: 100%;
    direction: inherit;     /* Chrome forces LTR on type=tel; this restores the page direction */
    font-family: var(--font); font-size: 16px;   /* 16 prevents auto-zoom on iOS */
    color: #111; background: var(--white);
    border: 1.5px solid #E2E2E2; border-radius: 9px; padding: 12px 14px;
    transition: border-color .15s ease;
}
#donate .field input::placeholder { color: #B4B4B4; }
#donate .field input:focus { outline: none; border-color: var(--purple); }
#donate .field input.is-bad { border-color: #D64545; }
#donate .hint { margin: 6px 0 0; font-size: 12.5px; color: #6F6F6F; line-height: 1.5; }
#donate .err { margin: 6px 0 0; font-size: 12.5px; color: #D64545; line-height: 1.5; min-height: 0; }
#donate .err:empty { display: none; }

#donate .selectwrap { position: relative; }
#donate .selectwrap select {
    width: 100%;
    font-family: var(--font); font-size: 16px;
    color: #111; background: var(--white);
    border: 1.5px solid #E2E2E2; border-radius: 9px;
    padding: 12px 14px; padding-inline-end: 42px;   /* room for the arrow */
    appearance: none; -webkit-appearance: none;
    cursor: pointer; line-height: 1.4;
    transition: border-color .15s ease;
}
#donate .selectwrap select:focus { outline: none; border-color: var(--purple); }
#donate .selectwrap select.is-bad { border-color: #D64545; }
#donate .selectwrap__arrow {
    position: absolute; top: 50%; inset-inline-end: 13px; transform: translateY(-50%);
    width: 20px; height: 20px; fill: #6F6F6F; pointer-events: none;
}
#donate .phonerow { display: grid; grid-template-columns: minmax(118px, 36%) 1fr; gap: 10px; align-items: end; }
#donate .phonerow .selectwrap select { padding-inline-end: 34px; }

/* Custom amount without number spinners, which misalign digits in RTL */
#donate #f-custom::-webkit-outer-spin-button,
#donate #f-custom::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#donate #f-custom { -moz-appearance: textfield; }

/* ---------- consent ---------- */
#donate .check {
    display: flex; align-items: flex-start; gap: 9px;
    margin: 4px 0 0; font-size: 13.5px; line-height: 1.6; color: #555; cursor: pointer;
}
#donate .check input { width: 19px; height: 19px; margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--pink); cursor: pointer; }
#donate .check a { color: var(--purple); }

/* ---------- buttons ---------- */
#donate .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    background: var(--pink); color: var(--white);
    font-family: var(--font); font-size: 18px; font-weight: 600;
    padding: 17px 40px; border: 2px solid #fff; border-radius: 40px;
    text-decoration: none; cursor: pointer;
    box-shadow: 0 4px 14px rgba(63, 78, 27, .3);
    transition: transform .16s ease, background-color .2s ease;
}
#donate .btn:hover { background: var(--pink-d); transform: translateY(-2px); }
#donate .btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
#donate .btn svg { width: 20px; height: 20px; fill: currentColor; flex: 0 0 auto; }
#donate .btn--submit { width: 100%; margin-top: 20px; border-radius: 10px; padding: 16px 20px; font-size: 17px; }
#donate .btn--submit:disabled { opacity: .7; cursor: default; transform: none; }
#donate .btn--next { width: 100%; }
#donate .btnrow { display: grid; grid-template-columns: 1fr 1.25fr; gap: 12px; margin-top: 20px; }
#donate .btnrow .btn--submit { margin-top: 0; }
#donate .btn--prev {
    border: 1.5px solid #C9C9C9; background: #F0F0F0; color: #555; border-radius: 10px; padding: 16px 20px;
    font-family: var(--font); font-size: 17px; font-weight: 700; cursor: pointer;
}
#donate .btn--prev:hover { background: #E6E6E6; }

#donate .modal__note { margin: 12px 0 0; text-align: center; font-size: 12.5px; line-height: 1.6; color: #6F6F6F; }

/* ---------- small screens ----------
   Even after shrinking, a four-field form is taller than a 640px screen,
   so on short phones the popup still scrolls a little inside. */
@media (max-width: 767px) {
    #donate { padding: 14px; }
    #donate .modal__box {
        max-width: none; max-height: calc(100dvh - 28px);
        padding: 0 0 calc(20px + env(safe-area-inset-bottom));
    }
    #donate .mband { padding-block: 18px 16px; padding-inline: 18px 54px; }
    #donate .mband__title { font-size: 16.5px; }
    #donate .stepper { margin: 18px 18px 14px; }
    #donate .stepper__dot { width: 36px; height: 36px; font-size: 15px; }
    #donate .form { padding: 0 18px; }
    #donate .btn--prev, #donate .btn--submit { padding: 14px 12px; font-size: 16px; }
}
@media (max-height: 700px) {
    #donate { padding: 8px; }
    #donate .modal__box { max-height: calc(100dvh - 16px); }
    #donate .field { margin-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) {
    #donate .modal__box { animation: none; }
    #donate .btn:hover { transform: none; }
}
