/* Footer */
.footer {
    background: var(--gray-900);
    color: var(--gray-400);
    padding: var(--space-12) 0 var(--space-8);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: var(--space-8);
    margin-bottom: var(--space-8);
}

.footer-brand-name {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--white);
    font-weight: var(--font-bold);
    font-size: var(--text-lg);
    margin-bottom: var(--space-2);
}

.footer-brand-name .brand-icon {
    width: 28px;
    height: 28px;
    font-size: 10px;
}

.footer-brand-desc {
    color: var(--gray-500);
    font-size: var(--text-sm);
    max-width: 280px;
    line-height: var(--leading-relaxed);
}

.footer-social {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.footer-social a {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: var(--gray-800);
    color: var(--gray-400);
    transition: all var(--transition-fast);
    font-size: var(--text-xs);
    text-decoration: none;
}

.footer-social a:hover {
    background: var(--primary);
    color: var(--white);
}

.footer h4 {
    color: var(--white);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-4);
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.footer-links a {
    color: var(--gray-500);
    font-size: var(--text-sm);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--white);
}

.footer-bottom {
    border-top: 1px solid var(--gray-800);
    padding-top: var(--space-6);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-xs);
    color: var(--gray-600);
}

.footer-legal {
    display: flex;
    gap: var(--space-4);
}

.footer-legal a {
    color: var(--gray-600);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-legal a:hover {
    color: var(--white);
}

.back-to-top {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    width: 40px;
    height: 40px;
    background: var(--gray-800);
    color: var(--gray-400);
    border: 1px solid var(--gray-700);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
    z-index: 50;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-6);
    }

    .footer-bottom {
        flex-direction: column;
        gap: var(--space-3);
        text-align: center;
    }
}

@media (max-width: 480px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Compact / collapsible footer (logged-in users) — collapsed by default ===== */
.footer-compact {
    padding: var(--space-6) 0;
}
.footer-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 4px 0;
    font: inherit;
    text-align: left;
}
.footer-toggle-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: var(--font-bold);
    font-size: var(--text-base);
    color: var(--white);
}
.footer-toggle-brand .brand-icon {
    width: 26px;
    height: 26px;
    font-size: 10px;
}
.footer-toggle-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-400);
    white-space: nowrap;
    transition: color var(--transition-fast);
}
.footer-toggle:hover .footer-toggle-more {
    color: var(--white);
}
.footer-toggle-chev {
    font-size: 12px;
    transition: transform 0.25s ease;
}
.footer-compact.is-open .footer-toggle-chev {
    transform: rotate(180deg);
}
/* collapsed: hide the link grid; the toggle bar + bottom line stay */
.footer-compact .footer-grid {
    display: none;
}
.footer-compact.is-open .footer-grid {
    display: grid;
    margin-top: var(--space-6);
}
.footer-compact .footer-bottom {
    margin-top: var(--space-5);
}
.footer-compact.is-open .footer-bottom {
    margin-top: var(--space-8);
}
@media (max-width: 480px) {
    .footer-toggle-more .lbl {
        display: none;
    }
}

/* ── Tip jar ─────────────────────────────────────────────
   Two equal QR tiles under the social row. QR needs dark-on-light
   contrast to scan, so each tile keeps a white pad against the
   dark footer ground. Hover/focus opens a rich tooltip; the click
   itself always goes to the URL, which is what mobile relies on. */
.footer-support {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid rgba(255, 255, 255, .10);
}
.footer-support-label {
    display: block;
    font-size: 11px;
    font-weight: var(--font-bold);
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--gray-500);
    margin-bottom: var(--space-3);
}
.footer-support-row { display: flex; gap: var(--space-3); }
.fs-item { display: flex; flex-direction: column; width: 88px; }

.fs-tile {
    position: relative;
    width: 88px;
    height: 88px;
    padding: 6px;
    background: var(--white);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    display: block;
    text-decoration: none;
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.fs-tile img { width: 100%; height: 100%; display: block; border-radius: var(--radius-sm); }
.fs-tile:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0, 0, 0, .35); }
.fs-tile-coffee:hover { border-color: var(--accent); }
.fs-tile-paypal:hover { border-color: #0070BA; }
.fs-tile:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; }

.fs-cap {
    text-align: center;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--gray-500);
    margin-top: 6px;
    letter-spacing: .02em;
}

/* Rich tooltip */
.fs-tip {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 0;
    transform: translateY(6px) scale(.97);
    transform-origin: bottom left;
    width: 264px;
    padding: 13px 15px;
    background: var(--white);
    color: var(--gray-900);
    border-radius: var(--radius-md);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 20;
    text-align: left;
    transition: opacity 170ms ease, transform 170ms ease, visibility 170ms;
}
.fs-tip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 38px;              /* centre of the 88px tile */
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: var(--white);
}
.fs-tile:hover .fs-tip,
.fs-tile:focus-visible .fs-tip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}
.fs-tip-head { display: flex; align-items: center; gap: var(--space-2); margin-bottom: 7px; }
.fs-tip-badge {
    width: 24px; height: 24px; flex: 0 0 auto;
    border-radius: var(--radius); display: grid; place-items: center;
    font-size: 11px; background: var(--gray-100, #F3F4F6); color: var(--gray-700);
}
.fs-tile-coffee .fs-tip-badge { background: var(--accent); color: var(--gray-900); }
.fs-tile-paypal .fs-tip-badge { background: #0070BA; color: var(--white); }
.fs-tip-title { font-weight: var(--font-bold); font-size: var(--text-sm); line-height: 1.3; }
.fs-tip-body { display: block; font-size: 12.5px; line-height: 1.55; color: var(--gray-700); margin-bottom: 9px; }
.fs-tip-foot {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
    border-top: 1px solid #E5E7EB; padding-top: 8px; font-size: 11px;
}
.fs-tip-url { color: var(--gray-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-tip-go { font-weight: var(--font-bold); color: var(--primary); white-space: nowrap; }

@media (max-width: 640px) {
    .fs-tip { width: 216px; }
}
@media (prefers-reduced-motion: reduce) {
    .fs-tile, .fs-tip { transition: none; }
    .fs-tile:hover { transform: none; }
}

/* Logged-in users get the collapsible footer, whose toggle already shows the
   brand lockup. The grid's own brand block then renders it a second time once
   expanded — hide it there so the brand appears once, not twice. */
.footer-compact .footer-brand-name {
    display: none;
}

/* ── Donation confirmation modal ──────────────────────────────────────────
   Lives in the footer so it is available on every page. Opens only after the
   visitor returns to the tab, never before they have had a chance to pay. */
.dn-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(15, 23, 42, .72);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.dn-overlay[hidden] { display: none; }
.dn-modal {
    /* Flex column with a pinned footer: on a short viewport the body scrolls
       rather than the whole dialog, so the confirm button is never pushed
       off-screen the way it was when the modal itself was the scroller. */
    width: min(520px, 100%);
    max-height: min(88vh, 760px);
    display: flex;
    flex-direction: column;
    background: var(--white);
    border-radius: var(--radius-xl, 16px);
    box-shadow: 0 30px 70px rgba(0, 0, 0, .45);
    color: var(--gray-900);
    overflow: hidden;
}
.dn-top { flex: 0 0 auto; padding: 24px 30px 0; text-align: center; }
.dn-mark {
    width: 46px; height: 46px; margin: 0 auto 12px;
    border-radius: var(--radius-xl, 16px); display: grid; place-items: center;
    background: var(--accent-light, #FEF3C7); color: var(--accent-hover, #B45309); font-size: 20px;
}
.dn-title { font-size: 20px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 7px; }
.dn-sub { font-size: 13.5px; color: var(--gray-500); margin: 0 0 16px; }

.dn-body { flex: 1 1 auto; overflow-y: auto; padding: 0 30px 18px; display: flex; flex-direction: column; gap: 15px; }
.dn-label {
    display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--gray-500); margin-bottom: 7px;
}
.dn-label em { font-style: normal; font-weight: 500; text-transform: none; letter-spacing: 0; }

.dn-amt { display: flex; gap: 8px; }
.dn-amt-in {
    flex: 1; display: flex; align-items: center; padding: 0 12px;
    border: 1.5px solid var(--border, #E5E7EB); border-radius: var(--radius-md, 8px);
    transition: border-color var(--transition-fast);
}
.dn-amt-in:focus-within { border-color: var(--primary); }
.dn-amt-in input {
    width: 100%; border: 0; outline: 0; background: transparent; padding: 11px 0;
    font-size: 20px; font-weight: 700; font-family: inherit; color: var(--gray-900);
    font-variant-numeric: tabular-nums;
}
.dn-cur {
    display: flex; gap: 2px; padding: 3px;
    background: var(--gray-50, #F9FAFB);
    border: 1.5px solid var(--border, #E5E7EB); border-radius: var(--radius-md, 8px);
}
.dn-cur button {
    border: 0; background: transparent; color: var(--gray-500); font-weight: 700;
    font-size: 13px; padding: 0 13px; border-radius: var(--radius, 6px); cursor: pointer; font-family: inherit;
}
.dn-cur button.on { background: var(--primary); color: var(--white); }

.dn-chips { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 9px; }
.dn-chip {
    border: 1px solid var(--border, #E5E7EB); background: transparent; color: var(--gray-900);
    border-radius: 9999px; padding: 6px 13px; font-size: 12.5px; font-weight: 600;
    cursor: pointer; font-family: inherit; font-variant-numeric: tabular-nums;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}
.dn-chip:hover { border-color: var(--primary); }
.dn-chip.on { background: var(--primary-light, #DBEAFE); border-color: var(--primary); color: var(--primary); }

.dn-in {
    width: 100%; padding: 10px 12px; font-size: 13.5px; font-family: inherit;
    border: 1.5px solid var(--border, #E5E7EB); border-radius: var(--radius-md, 8px);
    color: var(--gray-900); background: var(--white);
}
.dn-in:focus { outline: 0; border-color: var(--primary); }

.dn-asuser {
    display: flex; align-items: center; gap: 10px; padding: 9px 11px;
    background: var(--gray-50, #F9FAFB); border-radius: var(--radius-md, 8px);
}
.dn-av {
    width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto; object-fit: cover;
    background: var(--primary); color: var(--white);
    display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.dn-asuser-name { font-size: 13.5px; font-weight: 600; }
.dn-asuser-note { font-size: 11.5px; color: var(--gray-500); }

.dn-anon { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--gray-700); cursor: pointer; }
.dn-anon input { width: 15px; height: 15px; accent-color: var(--primary); }
.dn-notice { font-size: 11.5px; color: var(--gray-500); line-height: 1.5; margin: 0; }
.dn-notice a { color: var(--primary); }

.dn-msg { font-size: 12.5px; color: var(--gray-500); min-height: 1em; }
.dn-msg.err { color: var(--error, #DC2626); }

.dn-foot {
    flex: 0 0 auto;
    padding: 14px 30px 20px; border-top: 1px solid var(--border, #E5E7EB);
    background: var(--white);
    display: flex; flex-direction: column; gap: 8px;
}
.dn-btn {
    border: 0; border-radius: var(--radius-md, 8px); padding: 12px 18px;
    font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.dn-btn-go { background: var(--accent); color: #231400; }
.dn-btn-go:hover:not(:disabled) { filter: brightness(1.06); }
.dn-btn-go:disabled { opacity: .6; cursor: default; }
.dn-btn-ghost { background: transparent; color: var(--gray-500); font-weight: 600; }
.dn-fine { font-size: 11px; color: var(--gray-400); text-align: center; margin: 0; }

.footer-support-label { text-decoration: none; }
.footer-support-label:hover { color: var(--gray-400); }
.footer-support-label i { font-size: 9px; margin-left: 3px; }

@media (prefers-reduced-motion: reduce) {
    .dn-amt-in, .dn-chip { transition: none; }
}
