/* ============================================================================
   referral.css — partner referral block, org report, email preview
   ============================================================================
   A NEW file rather than an addition to design-system.css, and deliberately so:
   design-system.css exists in four hand-synced copies (repo root, pro/, cloud/,
   priority/). Anything added there has to be applied four times or the copies
   drift. Nothing here introduces a token, a color, or a type size - every value
   below is a var() pointing at design-system.css - so there is nothing to sync.

   Loaded by calculator.html, report.html and preview.html.
   ========================================================================== */

/* ---------- Referral block (calculator results, preview) ------------------ */

.referral-card {
    background-color: var(--color-primary-subtle);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    font-family: var(--font-sans);
}

.referral-eyebrow {
    font-size: var(--text-2xs);
    font-weight: var(--weight-semi);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--color-primary);
    margin: 0;
}

.referral-org {
    font-family: var(--font-sans);
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
    color: var(--color-text-strong);
    /* An organization's own name is free text from orgs.json and can be long.
       Wrapping is correct; truncating someone's name is not. */
    overflow-wrap: break-word;
    margin: var(--space-2) 0 0;
}

.referral-lede {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
    max-width: var(--measure-text);
    margin: var(--space-2) 0 0;
}

.referral-services {
    list-style: none;
    margin: var(--space-4) 0 0;
    padding: 0;
    border-top: 1px solid var(--color-border);
}

.referral-services li {
    border-bottom: 1px solid var(--color-border);
}

.referral-link,
.referral-link-plain {
    display: block;
    padding: var(--space-3) 0;
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
    line-height: var(--leading-snug);
    color: var(--color-primary);
    text-decoration: none;
    overflow-wrap: break-word;
    transition: color var(--transition-fast);
}

.referral-link:hover,
.referral-link:focus-visible {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

/* A service whose URL failed the scheme allowlist. Still shown, because the
   organization gave us the information, but it is not a link and must not
   look like one. */
.referral-link-plain {
    color: var(--color-text);
    font-weight: var(--weight-normal);
    cursor: default;
}

.referral-contact {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--color-text);
    margin: var(--space-4) 0 0;
}

.referral-site {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-4);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-sm);
    background-color: var(--color-primary);
    color: var(--color-on-primary);
    font-size: var(--text-sm);
    font-weight: var(--weight-semi);
    text-decoration: none;
}

.referral-site:hover {
    background-color: var(--color-primary-hover);
}

.referral-disclaimer {
    font-size: var(--text-2xs);
    line-height: var(--leading-normal);
    color: var(--color-text-muted);
    margin: var(--space-4) 0 0;
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-border);
}

/* ---------- Staff-facing pages (report.html, preview.html) --------------- */

.ref-page {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    margin: 0;
}

.ref-shell {
    max-width: 640px;
    margin: 0 auto;
    /* 16px side gutter at phone width. */
    padding: var(--space-8) var(--space-4) var(--space-10);
}

.ref-h1 {
    font-size: var(--text-2xl);
    font-weight: var(--weight-semi);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
    color: var(--color-text-strong);
    margin: var(--space-2) 0 0;
}

.ref-sub {
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
    margin: var(--space-3) 0 0;
}

.ref-field {
    display: block;
    margin: var(--space-5) 0 0;
}

.ref-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.ref-input {
    width: 100%;
    height: var(--control-height-lg);
    padding: 0 var(--space-3);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    color: var(--color-text);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
}

.ref-input:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
    border-color: var(--color-primary);
}

.ref-hint {
    font-size: var(--text-xs);
    line-height: var(--leading-normal);
    color: var(--color-text-muted);
    margin: var(--space-2) 0 0;
}

.ref-status {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    margin: var(--space-5) 0 0;
}

.ref-status[data-kind="error"] { color: var(--color-danger); }

/* ---------- Report figures ---------------------------------------------- */

.ref-stats {
    margin: var(--space-6) 0 0;
    border-top: 1px solid var(--color-border);
}

.ref-stat {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-4);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--color-border);
}

.ref-stat-label {
    font-size: var(--text-sm);
    line-height: var(--leading-snug);
    color: var(--color-text-secondary);
}

.ref-stat-value {
    font-size: var(--text-xl);
    font-weight: var(--weight-semi);
    font-variant-numeric: tabular-nums;
    color: var(--color-text-strong);
    white-space: nowrap;
}

/* A figure held back by the suppression floor. Shown as withheld rather than
   omitted: an organization should be able to see that the number exists and
   why it is not there yet, instead of wondering whether the tool is broken. */
.ref-stat-value[data-suppressed="true"] {
    font-size: var(--text-sm);
    font-weight: var(--weight-normal);
    color: var(--color-text-muted);
    white-space: normal;
}

.ref-note {
    font-size: var(--text-xs);
    line-height: var(--leading-relaxed);
    color: var(--color-text-muted);
    margin: var(--space-6) 0 0;
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

/* ---------- Example banner (preview.html only) -------------------------- */

.ref-example-banner {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    line-height: var(--leading-relaxed);
    color: var(--color-warning);
    background-color: var(--color-warning-subtle);
    border-left: 3px solid var(--color-warning);
    border-radius: var(--radius-sm);
    padding: var(--space-3) var(--space-4);
    margin: 0 0 var(--space-6);
}

/* ---------- Print -------------------------------------------------------- */

@media print {
    .referral-card {
        border: 1px solid #999;
        border-left-width: 3px;
        break-inside: avoid;
    }
    .referral-disclaimer { color: #555; }
    .ref-example-banner { border-left-color: #999; color: #333; }
}
