/* ============================================================
 * user_ui — Referral welcome popup.
 * ============================================================
 *
 * The <dialog> of `shared/_referral_welcome_popup.html`, opened as a
 * modal by the `ReferralWelcome` Component (`ge/referral_welcome`).
 * A modal dialog sits in the browser's top layer, so it needs no
 * z-index; the ::backdrop dims the page behind it. Theme-aware
 * through the design tokens (--surface-2 / --text / --text-dim /
 * --line), so it follows both themes.
 *
 * Section-local classes:
 *   - .referral-welcome          the dialog
 *   - .referral-welcome-title    the heading
 *   - .referral-welcome-text     one message
 *   - .referral-welcome-actions  the row of the link and the form
 *   - .referral-welcome-form     the `method="dialog"` form
 *   - .referral-welcome-link     the Giveaway link (with the shared
 *                                `.btn.primary`)
 *   - .referral-welcome-close    the Close button (with the shared
 *                                `.btn.ghost`)
 *
 * Loaded by base.html with the chrome sheets, after
 * cookie_notice/cookie_notice.css.
 * ============================================================ */

/* ------------------------------------------------------------
 * 1. The dialog.
 * ---------------------------------------------------------- */
.referral-welcome {
    width: min(440px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-2);
    color: var(--text);
    box-shadow: 0 24px 64px rgba(0, 0, 0, .45);
}
/* Flat in light mode (DESIGN_SYSTEM.md §9) — the border separates
   the dialog from the dimmed page. */
html[data-theme="light"] .referral-welcome {
    box-shadow: none;
}

.referral-welcome::backdrop {
    background: rgba(0, 0, 0, .6);
}

/* ------------------------------------------------------------
 * 2. Heading and messages.
 * ---------------------------------------------------------- */
.referral-welcome-title {
    margin: 0 0 12px;
    font-size: 22px;
    line-height: 1.25;
    color: var(--text);
}

.referral-welcome-text {
    margin: 0 0 12px;
    font-size: 15px;
    line-height: 1.55;
    color: var(--text-dim);
}

/* ------------------------------------------------------------
 * 3. Actions — the link and the Close button side by side;
 *    stacked full width on a phone.
 * ---------------------------------------------------------- */
.referral-welcome-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.referral-welcome-form {
    margin: 0;
}

.referral-welcome-link:focus-visible,
.referral-welcome-close:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 3px;
}

@media (max-width: 640px) {
    .referral-welcome {
        padding: 20px;
    }
    /* Column in DOM order — never reversed, so the visual order
       matches the keyboard order. */
    .referral-welcome-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .referral-welcome-close {
        width: 100%;
    }
}

/* ------------------------------------------------------------
 * 4. Print — the popup is screen chrome only.
 * ---------------------------------------------------------- */
@media print {
    .referral-welcome {
        display: none;
    }
}
