/*
 * 2026 brand reskin for the shared popup component (d.Popup, include/js/lib/popup.js: "Invite a
 * Friend", "Hand Over", ...). Loaded with \D\LAYOUT\brandPopupStylesHTML(): in the head of the
 * redesigned pages (blessapphead.php), so the untouched legacy pages keep their old look (the journal
 * popup's rules went with the journal, Nov 2026). CSS only: !important beats the
 * inline header colors the legacy JS still sets. Moved out of that function's <style> block in
 * Nov 2026, values unchanged. Colors: tokens.css; what differs in dark mode is set here.
 */
body {
    --popup-card: var(--white);
    --popup-text: var(--navy);
    --popup-header: var(--sky-wash);
    --popup-focus: var(--blaze);
    --popup-input-bg: var(--white);
}
body.pageDark {
    --popup-card: var(--slate);
    --popup-text: var(--dark-popup-text);
    --popup-header: var(--slate-raised);
    --popup-focus: var(--sky);
    --popup-input-bg: var(--control-bg);
}

.popupCover { background-color: color-mix(in srgb, var(--black) 50%, transparent) !important; }
/* include/js/lib/popup.js: a native <dialog> that fills the window, see-through, with the card
   (.popupTable) centred in it as in d.Popup, and the same dimmed background */
.popupDialog { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
    margin: 0; padding: 0; border: 0; background: transparent; overflow: hidden; }
.popupDialog::backdrop { background-color: color-mix(in srgb, var(--black) 50%, transparent); }
.popupTable {
    width: min(560px, calc(100vw - 32px)) !important;
    max-width: calc(100vw - 32px) !important;
    table-layout: fixed; /* tables grow past their width for content otherwise */
    height: auto !important;
    max-height: 88vh;
    margin: 0 !important;
    transform: translate(-50%, -50%);
    border-radius: 16px !important;
    background: var(--popup-card) !important;
    color: var(--popup-text);
    box-shadow: 0 12px 40px color-mix(in srgb, var(--shadow) 35%, transparent) !important;
}
.popupTable.small { width: min(400px, calc(100vw - 32px)) !important; }
.popupTdHeader {
    background: var(--popup-header) !important;
    color: var(--popup-text) !important;
    font-family: 'DMSans', sans-serif !important;
    font-weight: 700 !important;
    font-size: 1.15rem !important;
    padding: 18px 22px !important;
}
.popupTdHeader.warning { background: var(--peach) !important; color: var(--navy) !important; }
.popupTdBody { padding: 20px 22px !important; overflow-y: auto !important; line-height: 1.5; }
.popupTdButtons { padding: 4px 22px 20px 22px !important; gap: 12px !important; }
/* the keyboard focus ring of the v3 pages, on the real buttons of include/js/lib/popup.js
   (d.Popup's buttons are divs, which never get focus) */
.popupTdButtons button:focus-visible { outline: 3px solid var(--popup-focus); outline-offset: 2px; }
/* buttons: navy pill for the primary, outlined pill for the rest */
.popupTdButtons .flatButton, .popupTdButtons .textButton {
    border: 1px solid color-mix(in srgb, var(--navy) 35%, transparent); border-radius: 999px;
    padding: 8px 18px; background: none; font-weight: 600;
    color: var(--popup-text); cursor: pointer;
}
.popupTdButtons .flatButton:hover { border-color: var(--navy); background: color-mix(in srgb, var(--navy) 6%, transparent); }
.popupTdButtons .filledButton {
    border: none; border-radius: 999px; padding: 9px 22px;
    background: var(--navy); color: var(--white); font-weight: 700; cursor: pointer;
}
.popupTdButtons .filledButton:hover { background: var(--navy-deep); }
.popupBody input[type="text"], .popupBody input[type="email"], .popupBody textarea {
    border: 1px solid color-mix(in srgb, var(--navy) 35%, transparent); border-radius: 10px;
    background: var(--popup-input-bg); color: inherit;
    padding: 10px 14px; font: inherit; outline: none; box-sizing: border-box; width: 100%;
}
.popupBody input:focus, .popupBody textarea:focus { border-color: var(--navy) !important; }
/* legacy toggles inside popups ("attends same church as me", ...) — the same navy switch reskin
   the account page uses */
.popupBody .toggle-checkbox { display: none; }
.popupBody .toggle-switch { width: 34px; height: 20px; flex: 0 0 auto; border-radius: 999px;
    background: var(--switch-track) !important;
    position: relative; transition: background 0.15s ease; box-shadow: none; }
.popupBody .toggle-knob { position: absolute; top: 2px; left: 2px !important; width: 16px; height: 16px;
    border-radius: 50%; background: var(--white) !important; border: none !important;
    transition: left 0.15s ease; box-shadow: 0 1px 2px color-mix(in srgb, var(--shadow) 25%, transparent); }
.popupBody .toggle-checkbox:checked ~ .toggle-label .toggle-switch,
.popupBody .toggle-checkbox:checked ~ .toggle-switch,
.popupBody .toggle-checkbox:checked + label .toggle-switch { background: var(--navy) !important; }
.popupBody .toggle-checkbox:checked ~ .toggle-label .toggle-knob,
.popupBody .toggle-checkbox:checked ~ .toggle-switch .toggle-knob,
.popupBody .toggle-checkbox:checked + label .toggle-knob { left: 16px !important; }
.popupBody .toggle-text { color: inherit !important; }
