/* ==========================================================================
   Member colour themes (M-01, 2026-10-26)

   The accessibility colour sheets (Content/accessibility/css/colors/color-*.css) were written for
   the old site and only recolour the old class names. On the member pages that left the page text
   white while the rw-* cards, buttons and chips stayed white, so Dark and High contrast were
   unreadable.

   rw-layout.js stamps the chosen sheet on <html> as data-rw-theme="dark" | "high-contrast".
   Everything here is scoped to those two values, so the default look is untouched. The tokens are
   redefined under the attribute selector (not a plain :root), which the design-system header
   allows as a scoped exception. Contrast of every text/background pair was checked at 4.5:1 or
   better (see Documentation/E2E_RETEST_2026-10-26/fixes_member.md).
   ========================================================================== */

/* -------------------------------------------------------------------------
   DARK
   ------------------------------------------------------------------------- */
html[data-rw-theme="dark"] {
    --rw-ink: #f1f5fb;
    --rw-muted: #b9c4d6;
    --rw-border: #3a475d;
    --rw-surface: #18202f;
    --rw-canvas: #0d1320;
    --rw-soft: #1f2a3d;
    --rw-page-bg: #0d1320;
    --rw-primary: #8fbaff;
    --rw-primary-dark: #a9cbff;
    /* Accent used as button fill AND link text: light enough to read on dark; fills get dark text from the generated file. */
    --rw-button-primary: #8fbaff;
    --rw-button-primary-dark: #a9cbff;
    --rw-green: #5fd596;
    --rw-shadow-card: 0 6px 18px rgba(0, 0, 0, .45);
    --rw-focus-outline: 3px solid #8fbaff;
    color-scheme: dark;
}

/* -------------------------------------------------------------------------
   HIGH CONTRAST (black ground, yellow ink - matches color-black.css)
   ------------------------------------------------------------------------- */
html[data-rw-theme="high-contrast"] {
    --rw-ink: #ffff00;
    --rw-muted: #ffff00;
    --rw-border: #ffff00;
    --rw-surface: #000;
    --rw-canvas: #000;
    --rw-soft: #000;
    --rw-page-bg: #000;
    --rw-primary: #ffff00;
    --rw-primary-dark: #ffff00;
    --rw-button-primary: #ffff00;
    --rw-button-primary-dark: #ffff00;
    --rw-green: #00ff66;
    --rw-shadow-card: none;
    --rw-focus-outline: 3px solid #ffffff;
    color-scheme: dark;
}

/* -------------------------------------------------------------------------
   Shared extras (both themes). The long list of per-rule colour overrides is
   rw-member-themes.generated.css; only hand-written exceptions live here.
   ------------------------------------------------------------------------- */
html[data-rw-theme="dark"] body,
html[data-rw-theme="high-contrast"] body {
    background: var(--rw-canvas) !important;
    color: var(--rw-ink);
}

/* Old utility classes still used inside member pages (dashboard profile card, surveys box). */
html[data-rw-theme="dark"] .bg-white,
html[data-rw-theme="dark"] .bg-light,
html[data-rw-theme="dark"] .card,
html[data-rw-theme="dark"] .modal-content,
html[data-rw-theme="dark"] .dropdown-menu,
html[data-rw-theme="dark"] .list-group-item {
    background-color: var(--rw-surface);
    color: var(--rw-ink);
    border-color: var(--rw-border);
}
html[data-rw-theme="high-contrast"] .bg-white,
html[data-rw-theme="high-contrast"] .bg-light,
html[data-rw-theme="high-contrast"] .card,
html[data-rw-theme="high-contrast"] .modal-content,
html[data-rw-theme="high-contrast"] .dropdown-menu,
html[data-rw-theme="high-contrast"] .list-group-item {
    background-color: #000;
    color: #ff0;
    border-color: #ff0;
}
html[data-rw-theme="dark"] .text-black,
html[data-rw-theme="dark"] .text-blacksecondary,
html[data-rw-theme="dark"] .text-bastille,
html[data-rw-theme="dark"] .text-dark,
html[data-rw-theme="dark"] .font-opensans,
html[data-rw-theme="dark"] .card h1, html[data-rw-theme="dark"] .card h2,
html[data-rw-theme="dark"] .card h3, html[data-rw-theme="dark"] .card h4,
html[data-rw-theme="dark"] .card h5, html[data-rw-theme="dark"] .card p {
    color: var(--rw-ink) !important;
}
html[data-rw-theme="dark"] .text-muted { color: var(--rw-muted) !important; }
html[data-rw-theme="high-contrast"] .text-black,
html[data-rw-theme="high-contrast"] .text-blacksecondary,
html[data-rw-theme="high-contrast"] .text-bastille,
html[data-rw-theme="high-contrast"] .text-dark,
html[data-rw-theme="high-contrast"] .text-muted,
html[data-rw-theme="high-contrast"] .font-opensans,
html[data-rw-theme="high-contrast"] .card h1, html[data-rw-theme="high-contrast"] .card h2,
html[data-rw-theme="high-contrast"] .card h3, html[data-rw-theme="high-contrast"] .card h4,
html[data-rw-theme="high-contrast"] .card h5, html[data-rw-theme="high-contrast"] .card p {
    color: #ff0 !important;
}

/* Form controls */
html[data-rw-theme="dark"] .form-control,
html[data-rw-theme="dark"] .form-select,
html[data-rw-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html[data-rw-theme="dark"] select,
html[data-rw-theme="dark"] textarea {
    background-color: #0f1623;
    color: var(--rw-ink);
    border-color: #5b6b86;
}
html[data-rw-theme="high-contrast"] .form-control,
html[data-rw-theme="high-contrast"] .form-select,
html[data-rw-theme="high-contrast"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html[data-rw-theme="high-contrast"] select,
html[data-rw-theme="high-contrast"] textarea {
    background-color: #000;
    color: #ff0;
    border-color: #ff0;
}
html[data-rw-theme="dark"] ::placeholder { color: #a9b6cc; opacity: 1; }
html[data-rw-theme="high-contrast"] ::placeholder { color: #ff0; opacity: .85; }

/* Buttons: primary keeps its blue fill in Dark; in High contrast it is yellow with black text. */
html[data-rw-theme="high-contrast"] .rw-btn,
html[data-rw-theme="high-contrast"] .btn {
    border: 2px solid #ff0 !important;
}
html[data-rw-theme="high-contrast"] .rw-btn--primary,
html[data-rw-theme="high-contrast"] .btn-primary {
    background-color: #ff0 !important;
    color: #000 !important;
}
html[data-rw-theme="high-contrast"] .rw-btn--secondary,
html[data-rw-theme="high-contrast"] .rw-btn--ghost {
    background-color: #000 !important;
    color: #ff0 !important;
}
html[data-rw-theme="high-contrast"] a:focus-visible,
html[data-rw-theme="high-contrast"] button:focus-visible,
html[data-rw-theme="high-contrast"] input:focus-visible,
html[data-rw-theme="high-contrast"] select:focus-visible {
    outline: 3px solid #fff !important;
    outline-offset: 2px;
}
html[data-rw-theme="high-contrast"] a { text-decoration: underline; }

/* Bootstrap components used on member pages */
html[data-rw-theme="dark"] .input-group-text,
html[data-rw-theme="dark"] .page-link,
html[data-rw-theme="dark"] .accordion-item,
html[data-rw-theme="dark"] .accordion-button,
html[data-rw-theme="dark"] .nav-tabs .nav-link,
html[data-rw-theme="dark"] .table > :not(caption) > * > * {
    background-color: var(--rw-surface);
    color: var(--rw-ink);
    border-color: var(--rw-border);
}
html[data-rw-theme="high-contrast"] .input-group-text,
html[data-rw-theme="high-contrast"] .page-link,
html[data-rw-theme="high-contrast"] .accordion-item,
html[data-rw-theme="high-contrast"] .accordion-button,
html[data-rw-theme="high-contrast"] .nav-tabs .nav-link,
html[data-rw-theme="high-contrast"] .table > :not(caption) > * > * {
    background-color: #000;
    color: #ff0;
    border-color: #ff0;
}

/* Disabled buttons and form labels */
html[data-rw-theme="high-contrast"]:not(#rw-t):not(#rw-t):not(#rw-t) .btn:disabled,
html[data-rw-theme="high-contrast"]:not(#rw-t):not(#rw-t):not(#rw-t) .btn.disabled,
html[data-rw-theme="high-contrast"]:not(#rw-t):not(#rw-t):not(#rw-t) .rw-btn:disabled,
html[data-rw-theme="high-contrast"]:not(#rw-t):not(#rw-t):not(#rw-t) .rw-btn[aria-disabled="true"] {
    background: #000 !important;
    color: #ff0 !important;
    border-color: #ff0 !important;
    opacity: .85;
}
html[data-rw-theme="dark"] .form-check-label { color: var(--rw-ink); }
html[data-rw-theme="high-contrast"] .form-check-label { color: #ff0 !important; }

/* Disabled buttons in Dark: a muted fill with readable text (disabled rules in the colour sheets paint them black). */
html[data-rw-theme="dark"]:not(#rw-t):not(#rw-t):not(#rw-t) .btn:disabled,
html[data-rw-theme="dark"]:not(#rw-t):not(#rw-t):not(#rw-t) .btn.disabled,
html[data-rw-theme="dark"]:not(#rw-t):not(#rw-t):not(#rw-t) .rw-btn:disabled,
html[data-rw-theme="dark"]:not(#rw-t):not(#rw-t):not(#rw-t) .rw-btn[aria-disabled="true"] {
    background: #2a3447 !important;
    color: #d6deeb !important;
    border-color: #4a5870 !important;
}

/* Contact Us form panel (Home/contactus) */
html[data-rw-theme="dark"] .sign-up-block { background-color: var(--rw-surface) !important; color: var(--rw-ink); border-color: var(--rw-border); }
html[data-rw-theme="dark"] .sign-up-block label,
html[data-rw-theme="dark"] .sign-up-block p,
html[data-rw-theme="dark"] .sign-up-block h1,
html[data-rw-theme="dark"] .sign-up-block h2,
html[data-rw-theme="dark"] .sign-up-block h3 { color: var(--rw-ink) !important; }
html[data-rw-theme="dark"] .sign-up-block a,
html[data-rw-theme="dark"] .sign-up-block a.text-blue { color: #9cc4ff !important; }
html[data-rw-theme="high-contrast"] .sign-up-block { background-color: #000 !important; color: #ff0; border: 1px solid #ff0; }
html[data-rw-theme="high-contrast"] .sign-up-block label,
html[data-rw-theme="high-contrast"] .sign-up-block p,
html[data-rw-theme="high-contrast"] .sign-up-block h1,
html[data-rw-theme="high-contrast"] .sign-up-block h2,
html[data-rw-theme="high-contrast"] .sign-up-block h3,
html[data-rw-theme="high-contrast"] .sign-up-block a,
html[data-rw-theme="high-contrast"] .sign-up-block a.text-blue { color: #ff0 !important; }
html[data-rw-theme="dark"] .required,
html[data-rw-theme="dark"] .text-red,
html[data-rw-theme="dark"] .text-danger { color: #ff9d92 !important; }
html[data-rw-theme="dark"] legend,
html[data-rw-theme="dark"] .form-label { color: var(--rw-ink) !important; }
html[data-rw-theme="dark"] .form-text { color: var(--rw-muted) !important; }
html[data-rw-theme="high-contrast"] .required,
html[data-rw-theme="high-contrast"] .text-red,
html[data-rw-theme="high-contrast"] .text-danger,
html[data-rw-theme="high-contrast"] legend,
html[data-rw-theme="high-contrast"] .form-label,
html[data-rw-theme="high-contrast"] .form-text { color: #ff0 !important; }
