/**
 * MCS Disability Site — Clarity Design Layer
 * Version 6.2.0
 *
 * A site-wide, light-first presentation layer built for readers with brain fog,
 * visual fatigue, low vision, and chemical-sensitivity-related cognitive load.
 * Content and template routing remain unchanged. This stylesheet is loaded last.
 */

/* ========================================================================== 
   1. FOUNDATIONS
   ========================================================================== */
:root {
    --deep-blue: #173b4f;
    --trust-blue: #245d70;
    --calm-teal: #2f766f;
    --light-teal: #edf7f4;
    --warm-bg: #f7faf8;
    --pure-white: #ffffff;
    --text-dark: #20312f;
    --text-medium: #4d5f5b;
    --text-light: #55655f;      /* v6.1.0 was #6d7d79 — 3.95:1 (V31 FAIL). Now >=5.6:1 */
    --text-muted: #4d5f5b;      /* v6.1.0 NEW — legacy rules use var(--text-muted,#4a5568);
                                   the token was never defined, so dark mode fell back to the
                                   literal #4a5568 (1.91:1 on dark surfaces). Now defined in both modes. */
    --border-light: #dbe7e3;
    --warning-orange: #9b6426;
    --success-green: #2f766f;
    --citation-purple: #5b557f;

    --clarity-page: #f7faf8;
    --clarity-surface: #ffffff;
    --clarity-surface-soft: #f0f7f5;
    --clarity-surface-warm: #fbf8f2;
    --clarity-ink: #20312f;
    --clarity-muted: #566864;
    --clarity-faint: #596763;   /* v6.1.0 was #73827f — 3.67:1 on soft surfaces (V31 FAIL). Now >=5.4:1 */
    --clarity-navy: #173b4f;
    --clarity-teal: #2f766f;
    --clarity-teal-dark: #205d57;
    --clarity-gold: #a56d27;
    --clarity-line: #dbe7e3;
    --clarity-line-strong: #bfd3ce;
    --clarity-danger: #8b3d3d;
    --clarity-shadow: 0 1px 2px rgba(25, 53, 48, 0.04), 0 10px 30px rgba(25, 53, 48, 0.07);
    --clarity-shadow-lift: 0 2px 4px rgba(25, 53, 48, 0.05), 0 20px 46px rgba(25, 53, 48, 0.11);
    --clarity-radius-sm: 10px;
    --clarity-radius: 18px;
    --clarity-radius-lg: 26px;
    --clarity-reading: 820px;
    --clarity-wide: 1160px;
}

html[data-theme="dark"] {
    --deep-blue: #dceef3;
    --trust-blue: #9ec7d0;
    --calm-teal: #83c9be;
    --light-teal: #1b3b3a;
    --warm-bg: #102127;
    --pure-white: #162d34;
    --text-dark: #edf4f3;
    --text-medium: #c4d1cf;
    --text-light: #9fb0ad;
    --text-muted: #c4d1cf;      /* v6.1.0 NEW — see light-mode note; 8.01:1 on dark surfaces */
    --border-light: #315058;

    --clarity-page: #102127;
    --clarity-surface: #162d34;
    --clarity-surface-soft: #19383a;
    --clarity-surface-warm: #263229;
    --clarity-ink: #edf4f3;
    --clarity-muted: #c4d1cf;
    --clarity-faint: #9fb0ad;
    --clarity-navy: #dceef3;
    --clarity-teal: #83c9be;
    --clarity-teal-dark: #a2ddd4;
    --clarity-gold: #ddb66d;
    --clarity-line: #315058;
    --clarity-line-strong: #476971;
    --clarity-danger: #f0aaaa;
    --clarity-shadow: 0 1px 2px rgba(0,0,0,.2), 0 12px 32px rgba(0,0,0,.22);
    --clarity-shadow-lift: 0 2px 5px rgba(0,0,0,.25), 0 22px 48px rgba(0,0,0,.34);
}

html {
    background: var(--clarity-page);
    scroll-padding-top: 92px;
}

body {
    font-family: "Atkinson Hyperlegible", "Source Sans 3", system-ui, -apple-system, sans-serif !important;
    font-size: 18px;
    line-height: 1.72;
    color: var(--clarity-ink);
    background: var(--clarity-page);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

body,
body.inner-page,
body.mcsd-page {
    overflow-wrap: break-word;
}

h1, h2, h3, h4, h5, h6,
.logo,
.hero-answer,
.stat-number,
.number {
    font-family: "Atkinson Hyperlegible", "Source Sans 3", Arial, sans-serif !important;
    color: var(--clarity-navy);
    letter-spacing: -0.025em;
}

h1 { font-size: clamp(2.35rem, 5vw, 4.3rem); line-height: 1.06; }
h2 { font-size: clamp(1.85rem, 3.5vw, 3rem); line-height: 1.13; }
h3 { font-size: clamp(1.3rem, 2.2vw, 1.72rem); line-height: 1.25; }
h4 { font-size: 1.16rem; line-height: 1.35; }

p { margin: 0 0 1.05em; }
p:last-child { margin-bottom: 0; }

main a:not(.btn):not(.door):not(.guide-card):not(.cross-link-card):not(.citation):not(.mcsx-link),
.content-block a,
.faq-item a,
.glossary-term a {
    color: var(--clarity-teal-dark);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
}

main a:hover,
main a:focus-visible { color: var(--clarity-navy); }

:focus-visible {
    outline: 3px solid #d7a84a;
    outline-offset: 3px;
}

::selection { background: #d9eee9; color: #183c38; }

.container {
    max-width: var(--clarity-wide);
    padding-left: clamp(18px, 4vw, 34px);
    padding-right: clamp(18px, 4vw, 34px);
}

.container-narrow,
.content-block {
    max-width: var(--clarity-reading);
}

/* ========================================================================== 
   2. NAVIGATION
   ========================================================================== */
nav[role="navigation"] {
    background: color-mix(in srgb, var(--clarity-surface) 95%, transparent) !important;
    border-bottom: 1px solid var(--clarity-line);
    box-shadow: 0 4px 18px rgba(25, 53, 48, 0.05);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.nav-container {
    max-width: 1240px;
    min-height: 72px;
    padding: 10px 26px;
    gap: 18px;
}

.logo {
    color: var(--clarity-navy) !important;
    font-size: clamp(1.06rem, 2vw, 1.32rem);
    white-space: nowrap;
}
.logo span { color: var(--clarity-teal) !important; }

.nav-links { gap: 3px; align-items: center; }
.nav-links > li > a,
.dropdown-toggle {
    color: var(--clarity-ink) !important;
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    padding: 9px 10px;
    border-radius: 999px;
}

.nav-links > li > a:hover,
.nav-links > li > a:focus,
.dropdown-toggle:hover,
.dropdown-toggle:focus {
    color: var(--clarity-teal-dark) !important;
    background: var(--clarity-surface-soft) !important;
}

.nav-links > li > a[style] {
    color: var(--clarity-teal-dark) !important;
    background: var(--clarity-surface-soft);
    box-shadow: inset 0 0 0 1px var(--clarity-line-strong);
}

.dropdown-menu,
.search-panel {
    background: var(--clarity-surface) !important;
    border: 1px solid var(--clarity-line) !important;
    border-radius: 14px !important;
    box-shadow: var(--clarity-shadow-lift) !important;
}

.dropdown-menu a { color: var(--clarity-ink) !important; border-radius: 8px; }
.dropdown-menu a:hover { background: var(--clarity-surface-soft) !important; color: var(--clarity-teal-dark) !important; }
.nav-group-label { color: var(--clarity-faint) !important; }

.search-toggle,
.mobile-menu-btn,
.nav-toggle { color: var(--clarity-navy) !important; }
.search-toggle:hover { background: var(--clarity-surface-soft); }
.search-input {
    background: var(--clarity-surface) !important;
    color: var(--clarity-ink) !important;
    border-color: var(--clarity-line-strong) !important;
}
.sr-title { color: var(--clarity-navy) !important; }
.sr-excerpt { color: var(--clarity-muted) !important; }

/* ========================================================================== 
   3. INNER PAGE HERO + WAYFINDING
   ========================================================================== */
.inner-hero {
    padding: 118px 0 48px !important;
    background:
        radial-gradient(circle at 14% 12%, rgba(47,118,111,.12), transparent 34%),
        radial-gradient(circle at 90% 25%, rgba(36,93,112,.10), transparent 30%),
        linear-gradient(180deg, var(--clarity-surface) 0%, var(--clarity-surface-soft) 100%) !important;
    border-bottom: 1px solid var(--clarity-line);
}

.inner-hero .container { max-width: 1040px; }
.inner-hero .section-header {
    max-width: 900px;
    margin: 0 auto !important;
    text-align: center;
}
.inner-hero h1 { margin: 8px auto 18px; max-width: 980px; }
.inner-hero .section-intro {
    max-width: 820px;
    margin: 0 auto;
    color: var(--clarity-muted) !important;
    font-size: clamp(1.05rem, 2vw, 1.24rem);
    line-height: 1.62;
}

.breadcrumb {
    position: static !important;
    margin: 0 auto 20px !important;
    max-width: 900px;
    color: var(--clarity-faint);
}
.breadcrumb ol { justify-content: center; }
.breadcrumb a { color: var(--clarity-teal-dark) !important; }

.section-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--clarity-teal-dark) !important;
    background: var(--clarity-surface-soft) !important;
    border: 1px solid var(--clarity-line-strong);
    border-radius: 999px;
    padding: 6px 12px;
    font-family: "Atkinson Hyperlegible", system-ui, sans-serif !important;
    font-size: 0.77rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.mcsd-page-toc {
    position: relative;
    z-index: 5;
    max-width: 980px;
    margin: -19px auto 22px;
    padding: 0 20px;
}
.mcsd-page-toc details {
    background: var(--clarity-surface);
    border: 1px solid var(--clarity-line);
    border-radius: 15px;
    box-shadow: var(--clarity-shadow);
    overflow: hidden;
}
.mcsd-page-toc summary {
    list-style: none;
    cursor: pointer;
    padding: 13px 18px;
    color: var(--clarity-navy);
    font-weight: 700;
}
.mcsd-page-toc summary::-webkit-details-marker { display: none; }
.mcsd-page-toc summary::after { content: "+"; float: right; color: var(--clarity-teal); font-size: 1.25rem; }
.mcsd-page-toc details[open] summary::after { content: "–"; }
.mcsd-page-toc-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 16px;
}
.mcsd-page-toc a {
    display: inline-flex;
    color: var(--clarity-teal-dark);
    background: var(--clarity-surface-soft);
    border: 1px solid var(--clarity-line);
    border-radius: 999px;
    padding: 7px 11px;
    font-size: .88rem;
    line-height: 1.2;
    text-decoration: none;
}
.mcsd-page-toc a:hover,
.mcsd-page-toc a.is-current { background: var(--clarity-teal); color: #fff; border-color: var(--clarity-teal); }

/* ========================================================================== 
   4. SECTIONS + READING RHYTHM
   ========================================================================== */
section { padding: 58px 0; }
section:nth-child(even) { background: var(--clarity-surface-soft); }
section:nth-child(odd) { background: var(--clarity-surface); }

.inner-hero,
.back-home,
.cross-links,
footer { background: initial; }

.section-header {
    max-width: 900px;
    margin: 0 auto 30px !important;
    text-align: center;
}
.section-header h2 {
    margin: 12px auto 13px;
    max-width: 920px;
}
.section-header h2::after,
.section-header h1::after {
    content: "";
    display: block;
    width: 56px;
    height: 3px;
    margin: 15px auto 0;
    border-radius: 999px;
    background: var(--clarity-teal);
}
.section-header .section-intro,
.section-intro {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    color: var(--clarity-muted) !important;
    font-size: 1.04rem;
}

.content-block {
    margin-left: auto !important;
    margin-right: auto !important;
}
.content-block > h2:first-child,
.content-block > h3:first-child { margin-top: 0; }
.content-block h2 { margin-top: 1.8em; }
.content-block h3 { margin-top: 1.45em; }
.content-block h4 { margin-top: 1.3em; }
.content-block ul,
.content-block ol { padding-left: 1.25rem; margin: 0 0 1.25rem; }
.content-block li { margin-bottom: .55rem; }

/* ========================================================================== 
   5. CARDS + GRIDS
   ========================================================================== */
.card-grid,
.resources-grid,
.guides-grid,
.science-grid,
.cross-link-grid,
.symptom-grid,
.two-col {
    gap: 20px !important;
}

.card,
.mechanism-card,
.symptom-item,
.trigger-category,
.resource-category,
.guide-card,
.science-card,
.science-stat,
.science-about-card,
.cross-link-card,
.glossary-term,
.faq-item,
.about-box,
.download-cta,
.test-step,
.eval-step,
.supp-card,
.journey-section {
    background: var(--clarity-surface) !important;
    color: var(--clarity-ink) !important;
    border: 1px solid var(--clarity-line) !important;
    border-radius: var(--clarity-radius) !important;
    box-shadow: var(--clarity-shadow);
}

.card,
.mechanism-card,
.symptom-item,
.trigger-category,
.resource-category,
.science-about-card,
.about-box,
.test-step,
.eval-step,
.supp-card { padding: clamp(20px, 3vw, 28px) !important; }

.card:hover,
.guide-card:hover,
.science-card:hover,
.cross-link-card:hover,
.mechanism-card:hover {
    transform: translateY(-2px) !important;
    box-shadow: var(--clarity-shadow-lift) !important;
    border-color: var(--clarity-line-strong) !important;
}

.card h3,
.card h4,
.mechanism-card h4,
.resource-category h4,
.cross-link-card h4,
.guide-card-body h3 a,
.science-card-title,
.glossary-term h3,
.faq-item h3 { color: var(--clarity-navy) !important; }

.card p,
.mechanism-card p,
.resource-category p,
.cross-link-card p,
.guide-card-body p,
.science-card p,
.glossary-term p,
.faq-item p { color: var(--clarity-muted) !important; }

.card-icon,
.download-cta-icon {
    background: var(--clarity-surface-soft) !important;
    color: var(--clarity-teal) !important;
    border-radius: 13px !important;
}

/* ========================================================================== 
   6. CALLOUTS + LISTS + TIMELINES
   ========================================================================== */
.key-points,
.key-points-box,
.warning-box,
.bio-callout,
.crisis-inline,
.note,
.verdict-list {
    max-width: var(--clarity-reading);
    margin-left: auto;
    margin-right: auto;
    background: var(--clarity-surface-soft) !important;
    color: var(--clarity-ink) !important;
    border: 1px solid var(--clarity-line) !important;
    border-left: 5px solid var(--clarity-teal) !important;
    border-radius: 14px !important;
    padding: 22px 24px !important;
    box-shadow: none !important;
}
.warning-box { background: var(--clarity-surface-warm) !important; border-left-color: var(--clarity-gold) !important; }
.key-points h4,
.warning-box h4,
.bio-callout h4 { color: var(--clarity-navy) !important; }

.styled-list { padding-left: 0 !important; }
.styled-list li {
    position: relative;
    list-style: none;
    padding: 13px 14px 13px 44px !important;
    margin: 0 0 9px;
    background: var(--clarity-surface);
    border: 1px solid var(--clarity-line);
    border-radius: 12px;
}
.styled-list li::before {
    left: 14px !important;
    top: 13px !important;
    color: var(--clarity-teal) !important;
}

.phase-timeline::before { background: var(--clarity-line-strong) !important; }
.phase-item {
    background: var(--clarity-surface) !important;
    border: 1px solid var(--clarity-line) !important;
    border-radius: 14px !important;
    padding: 20px 22px 20px 30px !important;
    margin-bottom: 15px !important;
}
.phase-item::before { background: var(--clarity-teal) !important; border-color: var(--clarity-surface) !important; }
.phase-label { color: var(--clarity-teal-dark) !important; }

.trigger-tag,
.filter-btn,
.page-jump a,
.guide-badge,
.unit-badge,
.jmeta-pill {
    border-radius: 999px !important;
}

/* ========================================================================== 
   7. TABLES + ACCORDIONS
   ========================================================================== */
.mcsd-table-wrap {
    overflow-x: auto;
    margin: 22px auto;
    border: 1px solid var(--clarity-line);
    border-radius: 15px;
    background: var(--clarity-surface);
    box-shadow: var(--clarity-shadow);
}
.mcsd-table-wrap table { margin: 0 !important; border: 0 !important; min-width: 680px; }

.trigger-table,
.clinical-test-table,
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--clarity-surface) !important;
    color: var(--clarity-ink) !important;
}
.trigger-table th,
.clinical-test-table th,
table th {
    background: var(--clarity-navy) !important;
    color: #fff !important;
    font-family: "Atkinson Hyperlegible", system-ui, sans-serif !important;
    font-size: .9rem;
    letter-spacing: .02em;
    text-align: left;
}
.trigger-table td,
.clinical-test-table td,
table td {
    background: var(--clarity-surface) !important;
    color: var(--clarity-ink) !important;
    border-color: var(--clarity-line) !important;
    vertical-align: top;
}
.trigger-table tr:nth-child(even) td,
table tr:nth-child(even) td { background: var(--clarity-surface-soft) !important; }

.content-block details,
.mcsx-details,
.mcsd-ds details {
    background: var(--clarity-surface) !important;
    color: var(--clarity-ink) !important;
    border: 1px solid var(--clarity-line) !important;
    border-radius: 14px !important;
    box-shadow: 0 1px 0 rgba(25,53,48,.03);
    margin: 12px 0 !important;
    padding: 0 20px !important;
}
.content-block details summary,
.mcsx-details > summary,
.mcsd-ds details summary {
    color: var(--clarity-navy) !important;
    padding: 17px 0 !important;
    font-size: 1.02rem;
    font-weight: 700;
}
.content-block details[open],
.mcsx-details[open] { border-color: var(--clarity-line-strong) !important; box-shadow: var(--clarity-shadow); }
.content-block details > *:not(summary),
.mcsx-details > *:not(summary) { color: var(--clarity-muted) !important; }

/* ========================================================================== 
   8. RESEARCH, FAQ, GUIDES, GLOSSARY
   ========================================================================== */
.key-research-box,
.references-section {
    max-width: 920px;
    margin-left: auto;
    margin-right: auto;
    background: var(--clarity-surface) !important;
    border: 1px solid var(--clarity-line) !important;
    border-radius: var(--clarity-radius) !important;
    box-shadow: var(--clarity-shadow);
}
.key-research-header,
.references-section h2 { border-color: var(--clarity-line) !important; }
.key-research-header h3,
.key-research-title,
.key-research-title a,
.reference-item a { color: var(--clarity-navy) !important; }
.key-research-citation,
.key-research-finding,
.reference-item { color: var(--clarity-muted) !important; }

.faq-item,
.glossary-term {
    padding: 22px 24px !important;
    margin-bottom: 14px !important;
}
.faq-item:last-child,
.glossary-term:last-child { margin-bottom: 0 !important; }

.guide-card { overflow: hidden; }
.guide-card-body { padding: 24px !important; }
.guide-read-link,
.link-btn { color: var(--clarity-teal-dark) !important; }

.science-filter-bar { background: var(--clarity-surface) !important; border-color: var(--clarity-line) !important; }
.filter-btn { background: var(--clarity-surface-soft) !important; color: var(--clarity-ink) !important; border-color: var(--clarity-line) !important; }
.filter-btn.active { background: var(--clarity-teal) !important; color: #fff !important; }

/* ========================================================================== 
   9. BUTTONS + DOWNLOADS
   ========================================================================== */
.btn,
.btn-primary,
.download-btn,
.mini.solid,
.mcsx-link {
    border-radius: 999px !important;
    font-family: "Atkinson Hyperlegible", system-ui, sans-serif !important;
    font-weight: 700 !important;
}
.btn,
.btn--teal,
.btn-primary,
.download-btn {
    background: var(--clarity-teal) !important;
    color: #fff !important;
    border: 1px solid var(--clarity-teal) !important;
    box-shadow: 0 6px 16px rgba(47,118,111,.18);
}
.btn:hover,
.btn--teal:hover,
.btn-primary:hover,
.download-btn:hover {
    background: var(--clarity-teal-dark) !important;
    color: #fff !important;
    transform: translateY(-1px);
}
.btn--blue { background: var(--clarity-navy) !important; border-color: var(--clarity-navy) !important; }
.download-cta { text-align: center; padding: 34px !important; }

/* ========================================================================== 
   10. HOMEPAGE — LIGHT, CALM, DECISION-FIRST
   ========================================================================== */
body.mcsd-home { background: var(--clarity-page) !important; color: var(--clarity-ink) !important; }
body.mcsd-home .hero {
    padding: 126px 0 56px !important;
    background:
        radial-gradient(circle at 15% 25%, rgba(47,118,111,.13), transparent 31%),
        radial-gradient(circle at 88% 22%, rgba(36,93,112,.11), transparent 31%),
        linear-gradient(180deg, var(--clarity-surface) 0%, var(--clarity-surface-soft) 100%) !important;
    color: var(--clarity-ink) !important;
    border-bottom: 1px solid var(--clarity-line);
}
body.mcsd-home .hero::before,
body.mcsd-home .hero::after { opacity: .35 !important; }
body.mcsd-home .hero-title,
body.mcsd-home .hero h1 { color: var(--clarity-navy) !important; }
body.mcsd-home .hero-answer { color: var(--clarity-teal) !important; }
body.mcsd-home .hero-subtitle { color: var(--clarity-muted) !important; }
body.mcsd-home .hero-affirm span {
    color: var(--clarity-teal-dark) !important;
    background: var(--clarity-surface) !important;
    border: 1px solid var(--clarity-line) !important;
    border-radius: 999px;
}
body.mcsd-home .hero-art { filter: saturate(.72); }
body.mcsd-home .hero-stats {
    background: color-mix(in srgb, var(--clarity-surface) 86%, transparent) !important;
    border: 1px solid var(--clarity-line) !important;
    border-radius: 20px !important;
    box-shadow: var(--clarity-shadow);
}
body.mcsd-home .hero-stat .number { color: var(--clarity-navy) !important; }
body.mcsd-home .hero-stat .label { color: var(--clarity-muted) !important; }

.mcsd-ds .doors,
.mcsd-ds .directory { background: var(--clarity-surface) !important; }
.mcsd-ds .doors-head,
.mcsd-ds .directory-head { text-align: center; max-width: 850px; margin-left: auto; margin-right: auto; }
.mcsd-ds .door {
    background: var(--clarity-surface) !important;
    color: var(--clarity-ink) !important;
    border: 1px solid var(--clarity-line) !important;
    box-shadow: var(--clarity-shadow) !important;
    border-radius: 20px !important;
}
.mcsd-ds .door:hover { box-shadow: var(--clarity-shadow-lift) !important; border-color: var(--clarity-line-strong) !important; }
.mcsd-ds .door h3 { color: var(--clarity-navy) !important; }
.mcsd-ds .door p { color: var(--clarity-muted) !important; }
.mcsd-ds .door .who,
.mcsd-ds .door .go { color: var(--clarity-teal-dark) !important; }

/* ========================================================================== 
   11. MATTRESS PAGE BRIDGE
   ========================================================================== */
body.page-safe-mattresses,
body.page-safe-mattresses .inner-hero,
body.page-safe-mattresses #safe-mattress-guide,
body.page-safe-mattresses #safe-mattress-guide > section {
    background-color: var(--clarity-page) !important;
}
body.page-safe-mattresses #safe-mattress-guide > section:nth-child(even) { background: var(--clarity-surface-soft) !important; }
body.page-safe-mattresses #safe-mattress-guide > section:nth-child(odd) { background: var(--clarity-surface) !important; }

.mcsx-top-two {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    max-width: 940px;
    margin: 0 auto 24px;
}
.mcsx-top-two-card {
    background: var(--clarity-surface);
    border: 1px solid var(--clarity-line);
    border-top: 5px solid var(--clarity-teal);
    border-radius: var(--clarity-radius);
    padding: 24px;
    box-shadow: var(--clarity-shadow);
}
.mcsx-top-two-card h3 { margin: 0 0 8px; }
.mcsx-top-two-card p { color: var(--clarity-muted); }
.mcsx-top-two-card ul { margin: 13px 0 0; padding-left: 1.1rem; }
.mcsx-top-two-card li { margin: 7px 0; }
.mcsx-top-two-label { color: var(--clarity-teal-dark); font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

.mcsx-grid { gap: 18px !important; max-width: 1060px; margin: 0 auto; }
.mcsx-card {
    border-radius: var(--clarity-radius) !important;
    border-color: var(--clarity-line) !important;
    box-shadow: var(--clarity-shadow);
    padding: 24px !important;
}
.mcsx-card.is-match { border-color: var(--clarity-teal) !important; box-shadow: 0 0 0 2px var(--clarity-teal), var(--clarity-shadow-lift) !important; }
.mcsx-filter { background: var(--clarity-surface-soft) !important; border-color: var(--clarity-line-strong) !important; border-radius: 16px !important; }
.mcsx-independence { max-width: 940px; margin-left: auto; margin-right: auto; }

/* ========================================================================== 
   12. CROSS LINKS + FOOTER
   ========================================================================== */
.cross-links {
    background: var(--clarity-surface-soft) !important;
    border-top: 1px solid var(--clarity-line);
    border-bottom: 1px solid var(--clarity-line);
}
.cross-link-card { padding: 22px !important; text-decoration: none !important; }

.back-home { background: var(--clarity-surface) !important; }

footer {
    background: #173b4f !important;
    color: #e9f2f1 !important;
    padding: 54px 0 26px !important;
}
footer a { color: #b8e3dc !important; }
footer p { color: #e9f2f1; }
footer .disclaimer {
    background: rgba(255,255,255,.08) !important;
    color: #e9f2f1 !important;
    border: 1px solid rgba(255,255,255,.14) !important;
    border-radius: 14px !important;
    padding: 20px !important;
}
.footer-nav,
.footer-ecosystem,
.footer-copyright,
.footer-cite { max-width: 900px; margin-left: auto; margin-right: auto; text-align: center; }
.footer-bottom-bar { border-color: rgba(255,255,255,.14) !important; }

.back-to-top {
    background: var(--clarity-teal) !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,.7) !important;
    box-shadow: var(--clarity-shadow-lift);
}

/* ========================================================================== 
   13. INLINE-STYLE DEFENSES + DARK MODE
   ========================================================================== */
html[data-theme="dark"] body,
html[data-theme="dark"] .inner-page { background: var(--clarity-page) !important; }
html[data-theme="dark"] .card,
html[data-theme="dark"] .content-block details,
html[data-theme="dark"] .faq-item,
html[data-theme="dark"] .glossary-term,
html[data-theme="dark"] .key-research-box,
html[data-theme="dark"] .science-card,
html[data-theme="dark"] .guide-card,
html[data-theme="dark"] .cross-link-card { color: var(--clarity-ink) !important; }

/* Many legacy callouts carry a literal light background inline. Keep their text
   dark in both modes so no page becomes unreadable. */
:where(.key-points,.warning-box,.card,.content-block,.faq-item,.glossary-term)[style*="background"] {
    color: #20312f !important;
}
:where(.key-points,.warning-box,.card,.content-block,.faq-item,.glossary-term)[style*="background"] :where(p,li,span,strong,em,h2,h3,h4) {
    color: #20312f !important;
}

/* ========================================================================== 
   14. RESPONSIVE + REDUCED MOTION
   ========================================================================== */
@media (max-width: 980px) {
    .nav-container { padding-left: 18px; padding-right: 18px; }
    .nav-links {
        background: var(--clarity-surface) !important;
        border: 1px solid var(--clarity-line) !important;
        box-shadow: var(--clarity-shadow-lift) !important;
    }
    .nav-links a { color: var(--clarity-ink) !important; }
    .dropdown-menu { box-shadow: none !important; border: 0 !important; }
    .mcsx-top-two { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    body { font-size: 17px; line-height: 1.68; }
    .inner-hero { padding-top: 104px !important; padding-bottom: 38px !important; }
    body.mcsd-home .hero { padding-top: 108px !important; }
    section { padding: 44px 0; }
    .section-header { margin-bottom: 24px !important; }
    .card-grid,
    .resources-grid,
    .guides-grid,
    .science-grid,
    .cross-link-grid,
    .symptom-grid,
    .two-col { grid-template-columns: 1fr !important; }
    .mcsd-page-toc { margin-top: -14px; padding: 0 14px; }
    .mcsd-page-toc-links { flex-direction: column; align-items: stretch; }
    .mcsd-page-toc a { border-radius: 10px; }
    .card,
    .mechanism-card,
    .symptom-item,
    .resource-category,
    .faq-item,
    .glossary-term { padding: 20px !important; }
    .footer-bottom-bar { flex-direction: column; text-align: center; }
}

@media (max-width: 520px) {
    h1 { font-size: 2.25rem; }
    h2 { font-size: 1.8rem; }
    .container { padding-left: 17px; padding-right: 17px; }
    .inner-hero .section-intro { font-size: 1rem; }
    .section-label { font-size: .7rem; }
    .mcsx-card,
    .mcsx-top-two-card { padding: 19px !important; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}

@media print {
    nav[role="navigation"],
    .mcsd-page-toc,
    .back-to-top,
    .back-home,
    footer { display: none !important; }
    body { background: #fff !important; color: #000 !important; font-size: 11pt; }
    section { padding: 20px 0 !important; background: #fff !important; }
    .card,
    .faq-item,
    .glossary-term,
    .key-research-box { box-shadow: none !important; break-inside: avoid; }
}

/* ==========================================================================
   15. SPACING NORMALIZATION (v6.0.0 polish)
   The biggest source of the "haphazard / some tight, some loose" spacing was
   per-template inline section padding (style="padding:...") overriding the
   rhythm set in §4. This forces one consistent vertical rhythm site-wide. The
   hero and thin utility bands intentionally keep their own tighter spacing.
   ========================================================================== */
section:not(.inner-hero):not(.hero) {
    padding-top: 56px !important;
    padding-bottom: 56px !important;
}
@media (max-width: 768px) {
    section:not(.inner-hero):not(.hero) {
        padding-top: 40px !important;
        padding-bottom: 40px !important;
    }
}

/* Thin utility bands stay tight and even (ID/class beats the rule above). */
.guide-download-bar,
#on-this-page,
#mcsx-contact-cta,
.orientation-banner {
    padding-top: 22px !important;
    padding-bottom: 22px !important;
}

/* One consistent header-to-content gap everywhere. */
.section-header { margin-bottom: 28px !important; }

/* Neutralize ad-hoc top margins so the header->content and block->block gaps
   read evenly instead of randomly tight or loose. */
.content-block > *:first-child { margin-top: 0 !important; }
.content-block > .card-grid,
.content-block > .trigger-table,
.content-block > .key-points,
.content-block > .mcsx-grid,
.content-block > .mcsx-independence { margin-top: 22px !important; }

/* Even, consistent grid gutters regardless of per-template inline gaps. */
.card-grid { gap: 22px !important; }

/* Consistent gap between stacked deeper-explanation accordions. */
.mcsx-details,
.content-block > details { margin: 12px auto !important; max-width: 880px; }

/* ==========================================================================
   16. v6.1.0 — VISITOR VISIBILITY + POLISH PASS
   Appended last so it wins the cascade without editing legacy rules.
   Every value below was derived from a measured WCAG ratio, not estimated.
   Gates: V31 (contrast, BLOCK), V30/V32 (targets/focus), V37 (spacing scale).
   No template markup and no content were changed by this section.
   ========================================================================== */

/* --- 16.1 Breadcrumb: strip the leaked main-nav navy band -----------------
   The bare `nav{background:rgba(26,54,93,.96)}` rule in site.css also matched
   <nav class="breadcrumb">, giving 2.95:1 text and 1.56:1 links. That rule is
   now scoped to nav[role="navigation"]; this is the belt-and-braces reset so
   the breadcrumb can never inherit a dark band from any legacy sheet. */
.breadcrumb {
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    border: 0 !important;
    padding: 0 !important;
}
.breadcrumb,
.breadcrumb ol,
.breadcrumb li { color: var(--clarity-muted) !important; }
.breadcrumb a { color: var(--clarity-teal-dark) !important; text-decoration: underline; text-underline-offset: 3px; }
html[data-theme="dark"] .breadcrumb,
html[data-theme="dark"] .breadcrumb ol,
html[data-theme="dark"] .breadcrumb li { color: var(--clarity-muted) !important; }
html[data-theme="dark"] .breadcrumb a { color: var(--clarity-teal) !important; }

/* --- 16.2 References section: was white text on a white card --------------
   site.css paints .references-section navy with white text; clarity §8 forces
   the card background light. The text rules were never re-pointed, so the H2,
   the "Sources" label and every reference line rendered white-on-white (1:1)
   on all 7 templates that use it. Selectors below are deliberately more
   specific than the legacy !important rules they correct. */
section.references-section { color: var(--clarity-ink) !important; }
section.references-section h2 { color: var(--clarity-navy) !important; }
section.references-section .section-label {
    background: var(--clarity-surface-soft) !important;
    color: var(--clarity-teal-dark) !important;
    border: 1px solid var(--clarity-line) !important;
}
section.references-section .reference-item {
    color: var(--clarity-ink) !important;
    border-bottom-color: var(--clarity-line) !important;
}
section.references-section .reference-item a,
section.references-section a { color: var(--clarity-teal-dark) !important; }
section.references-section .reference-number {
    background: #256f6d !important;   /* was #319795 -> 3.51:1 with white; now 5.88:1 */
    color: #ffffff !important;
}
html[data-theme="dark"] section.references-section { color: var(--clarity-ink) !important; }
html[data-theme="dark"] section.references-section h2 { color: var(--clarity-navy) !important; }
html[data-theme="dark"] section.references-section .reference-item { color: var(--clarity-muted) !important; }
html[data-theme="dark"] section.references-section .section-label,
html[data-theme="dark"] section.references-section .reference-item a,
html[data-theme="dark"] section.references-section a { color: var(--clarity-teal) !important; }

/* --- 16.3 "Also explore" band: same white-on-white failure ---------------- */
section.guides-also-explore { color: var(--clarity-ink) !important; }
section.guides-also-explore h2 { color: var(--clarity-navy) !important; }
section.guides-also-explore p,
section.guides-also-explore li,
section.guides-also-explore span { color: var(--clarity-muted) !important; }
section.guides-also-explore a { color: var(--clarity-teal-dark) !important; }
html[data-theme="dark"] section.guides-also-explore h2 { color: var(--clarity-navy) !important; }
html[data-theme="dark"] section.guides-also-explore p,
html[data-theme="dark"] section.guides-also-explore li,
html[data-theme="dark"] section.guides-also-explore span { color: var(--clarity-muted) !important; }
html[data-theme="dark"] section.guides-also-explore a { color: var(--clarity-teal) !important; }

/* --- 16.4 Buttons in dark mode --------------------------------------------
   --clarity-teal is a LIGHT teal in dark mode (#83c9be), so white button text
   measured 1.9:1. Dark ink on the light teal measures 8.72:1 and is the
   conventional dark-mode treatment. Light mode already passes (5.33:1). */
html[data-theme="dark"] .btn,
html[data-theme="dark"] .btn--teal,
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] button.btn,
html[data-theme="dark"] a.btn { color: #102127 !important; }
html[data-theme="dark"] .btn--blue { color: var(--clarity-ink) !important; }
html[data-theme="dark"] .back-to-top { color: #102127 !important; }

/* --- 16.5 Phase labels ----------------------------------------------------
   Teal-dark on teal measured 1.43:1 (light) and 1.25:1 (dark). */
.phase-label { color: #ffffff !important; }                                  /* on --clarity-teal: 5.33:1 */
html[data-theme="dark"] .phase-label { color: #102127 !important; }           /* on light teal: 8.72:1 */

/* --- 16.6 Legacy callouts that carry an inline light background -----------
   §13 keeps their text dark because the inline bg is light — but clarity §6
   overrides those boxes to a DARK surface in dark mode, so the forced #1a202c
   text became 1.3:1. Re-point the text whenever the box is actually dark. */
html[data-theme="dark"] .key-points[style*="background"],
html[data-theme="dark"] .key-points[style*="background"] h3,
html[data-theme="dark"] .key-points[style*="background"] h4,
html[data-theme="dark"] .key-points[style*="background"] p,
html[data-theme="dark"] .key-points[style*="background"] li,
html[data-theme="dark"] .key-points[style*="background"] strong,
html[data-theme="dark"] .key-points[style*="background"] em,
html[data-theme="dark"] .key-points[style*="background"] span,
html[data-theme="dark"] .warning-box[style*="background"],
html[data-theme="dark"] .warning-box[style*="background"] h3,
html[data-theme="dark"] .warning-box[style*="background"] h4,
html[data-theme="dark"] .warning-box[style*="background"] p,
html[data-theme="dark"] .warning-box[style*="background"] li,
html[data-theme="dark"] .warning-box[style*="background"] strong,
html[data-theme="dark"] .warning-box[style*="background"] em,
html[data-theme="dark"] .warning-box[style*="background"] span { color: var(--clarity-ink) !important; }
html[data-theme="dark"] .key-points[style*="background"] h3,
html[data-theme="dark"] .key-points[style*="background"] h4,
html[data-theme="dark"] .warning-box[style*="background"] h3,
html[data-theme="dark"] .warning-box[style*="background"] h4 { color: var(--clarity-navy) !important; }

/* --- 16.7 Links that never received a colour -----------------------------
   A handful of inline links fell through to the UA default #0000EE, which is
   1.34:1 on a dark surface. Scope to content areas only. */
html[data-theme="dark"] .content-block a:where(:not(.btn):not(.card):not(.citation):not(.cross-link-card):not([style*="background"])),
html[data-theme="dark"] .container-narrow a:where(:not(.btn):not(.card):not(.citation):not(.cross-link-card):not([style*="background"])),
html[data-theme="dark"] .key-points a:where(:not(.btn):not(.citation):not([style*="background"])),
html[data-theme="dark"] .phase-item a:where(:not(.btn):not([style*="background"])) { color: var(--clarity-teal) !important; }
/* An <a> that carries its own solid inline background is a button in all but
   name — it keeps its own label colour rather than the body-link colour. */
html[data-theme="dark"] a[style*="background"][style*="color: #fff"],
html[data-theme="dark"] a[style*="background"][style*="color:#fff"],
a[style*="#319795"][style*="color: #fff"],
a[style*="#319795"][style*="color:#fff"] { color: #ffffff !important; }
html[data-theme="dark"] a.citation { color: #b9b2e6 !important; }             /* was #5b557f -> 1.83:1 */

/* --- 16.8 Guide download band -------------------------------------------- */
html[data-theme="dark"] .guide-download-bar span,
html[data-theme="dark"] .guide-download-bar p { color: var(--clarity-muted) !important; }
html[data-theme="dark"] .guide-download-bar strong { color: var(--clarity-ink) !important; }

/* --- 16.9 Minimum readable text size (Creative-CSS-Builder §9.6) ----------
   Uppercase, letter-spaced micro-labels were rendering at 10.4px and 12.3px. */
.section-label { font-size: 0.85rem !important; letter-spacing: 0.07em !important; }
.nav-group-label { font-size: 0.78rem !important; color: var(--clarity-faint) !important; }
.reference-item { font-size: 0.95rem !important; }

/* --- 16.10 Focus visibility (V32) + target size (V30) --------------------- */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
details:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--clarity-teal-dark) !important;
    outline-offset: 3px !important;
    border-radius: 4px;
}
html[data-theme="dark"] a:focus-visible,
html[data-theme="dark"] button:focus-visible,
html[data-theme="dark"] summary:focus-visible,
html[data-theme="dark"] select:focus-visible,
html[data-theme="dark"] input:focus-visible,
html[data-theme="dark"] textarea:focus-visible,
html[data-theme="dark"] [tabindex]:focus-visible { outline-color: var(--clarity-teal) !important; }
.breadcrumb a,
.page-jump a,
summary { min-height: 24px; }
summary { padding-top: 2px; padding-bottom: 2px; }

/* --- 16.11 Vertical rhythm (V37) -----------------------------------------
   The hero closed with 48px and the next section opened with 58px, leaving a
   ~106px dead band under every page title. Evened out top-to-bottom. */
.inner-hero { padding: 112px 0 34px !important; }
.inner-hero .breadcrumb { margin-bottom: 14px !important; }
.inner-hero .section-header { margin-bottom: 0 !important; }
section { padding: 48px 0; }
.content-block + .content-block { margin-top: 26px; }
@media (max-width: 768px) {
    .inner-hero { padding: 92px 0 26px !important; }
    section { padding: 38px 0; }
}

/* --- 16.12 Inline-style contrast overrides --------------------------------
   Some legacy templates hardcode colours in a style="" attribute. Markup is
   NOT edited in this pass, so these are corrected from CSS: a stylesheet
   declaration marked !important outranks a non-important inline declaration.
   Every replacement below was measured, not estimated. */

/* Legacy navy / slate body text hardcoded inline — invisible on dark surfaces
   (#1a365d 1.19:1, #4a5568 1.91:1, #2c5282 1.81:1). Light mode already passes,
   so these are scoped to dark only and leave the light rendering untouched. */
html[data-theme="dark"] [style*="#1a365d"],
html[data-theme="dark"] [style*="#1A365D"] { color: var(--clarity-navy) !important; }
html[data-theme="dark"] [style*="#4a5568"],
html[data-theme="dark"] [style*="#4A5568"],
html[data-theme="dark"] [style*="#2c5282"],
html[data-theme="dark"] [style*="#718096"] { color: var(--clarity-muted) !important; }

/* Comparison-matrix yes/no markers. The green failed in LIGHT mode (3.25:1 on
   white) and the red failed in DARK mode (2.63:1) — fix each where it fails. */
[style*="#38a169"] { color: #22683a !important; }                              /* 6.75:1 on white */
html[data-theme="dark"] [style*="#38a169"] { color: #7fd6a0 !important; }      /* 8.24:1 on dark  */
html[data-theme="dark"] [style*="#c53030"] { color: #f2a0a0 !important; }      /* 7.07:1 on dark  */

/* Solid teal CTA button: white on #319795 measured 3.51:1. */
[style*="background: #319795"],
[style*="background:#319795"],
[style*="background: var(--calm-teal, #319795)"],
[style*="background:var(--calm-teal,#319795)"] { background-color: #256f6d !important; background-image: none !important; }     /* 5.88:1 with white */
.reference-number { background: #256f6d !important; color: #ffffff !important; }

/* White "jump to category" pills inherit var(--deep-blue), which flips to a
   near-white in dark mode and disappears against the white pill (1.2:1). */
html[data-theme="dark"] a[style*="background: white"],
html[data-theme="dark"] a[style*="background:white"] { color: #173b4f !important; }

/* --- 16.13 Permanently-dark homepage zone --------------------------------
   .zone-slate keeps a dark slate background in EVERY mode, but only its <p>
   text was re-pointed for light mode, so headings, list items and the eyebrow
   used light-mode dark ink on a dark panel (1.13:1). Text in a permanently
   dark zone must stay light in all modes. */
html[data-theme="light"] .mcsd-ds .zone-slate h1,
html[data-theme="light"] .mcsd-ds .zone-slate h2,
html[data-theme="light"] .mcsd-ds .zone-slate h3,
html[data-theme="light"] .mcsd-ds .zone-slate h4,
html[data-theme="light"] .mcsd-ds .zone-slate strong,
html[data-theme="light"] .mcsd-ds .zone-slate em,
html[data-theme="light"] .mcsd-ds .zone-slate b { color: #edefe9 !important; }
html[data-theme="light"] .mcsd-ds .zone-slate li,
html[data-theme="light"] .mcsd-ds .zone-slate span,
html[data-theme="light"] .mcsd-ds .zone-slate .eyebrow,
html[data-theme="light"] .mcsd-ds .zone-slate .lede,
html[data-theme="light"] .mcsd-ds .zone-slate .mech-cap { color: #c3cfc9 !important; }
html[data-theme="light"] .mcsd-ds .zone-slate a:not(.btn) { color: #9fe0d4 !important; }
/* Any nested light card inside the slate zone keeps its own dark text. */
html[data-theme="light"] .mcsd-ds .zone-slate .card,
html[data-theme="light"] .mcsd-ds .zone-slate .card h1,
html[data-theme="light"] .mcsd-ds .zone-slate .card h2,
html[data-theme="light"] .mcsd-ds .zone-slate .card h3,
html[data-theme="light"] .mcsd-ds .zone-slate .card h4,
html[data-theme="light"] .mcsd-ds .zone-slate .card p,
html[data-theme="light"] .mcsd-ds .zone-slate .card li,
html[data-theme="light"] .mcsd-ds .zone-slate .card span { color: var(--clarity-ink) !important; }

/* --- 16.14 Dark-homepage token correction ---------------------------------
   home.css re-declares --trust-blue as #2C5282 inside its dark-mode block, so
   inline `color: var(--trust-blue)` links rendered navy-on-navy (1.81:1) on
   the dark homepage. Re-point the token for that scope only; clarity loads
   after home.css, so this wins at equal specificity. */
html[data-theme="dark"] .mcsd-home { --trust-blue: #9ec7d0; }

/* ==========================================================================
   17. v6.2.0 — FULL-SITE SWEEP (all 57 templates, JS active)
   v6.1.0 sampled 7 pages with CSS only. This pass rendered EVERY template with
   modes.js + clarity.js running — so the injected "On this page" panel, opened
   <details> and current-link states are measured too — across light / dark /
   low-stim. Everything here is a defect that sampling missed.

   GUIDING RULE: in dark mode, make the SURFACE genuinely dark and keep text
   light. Forcing dark text onto a panel that clarity has already darkened just
   inverts the failure, so backgrounds are corrected first, colour second.
   Still zero markup and zero copy changes.
   ========================================================================== */

/* --- 17.1 Text tokens used as a BACKGROUND -------------------------------
   --deep-blue / --clarity-navy are TEXT tokens: dark in light mode, LIGHT in
   dark mode. Any component using one as a background turns pale in dark mode
   while its label stays white (1.2:1). Pin those surfaces to a real dark navy
   so the intended dark band survives in both modes. */
html[data-theme="dark"] table th,
html[data-theme="dark"] .trigger-table th,
html[data-theme="dark"] .clinical-test-table th,
html[data-theme="dark"] .mcsd-tool-hdr,
html[data-theme="dark"] .clinical-stat-strip,
html[data-theme="dark"] [style*="background: var(--deep-blue)"],
html[data-theme="dark"] [style*="background:var(--deep-blue)"],
html[data-theme="dark"] [style*="background: var(--deep-blue, #1a365d)"],
html[data-theme="dark"] [style*="background:var(--deep-blue,#1a365d)"] {
    background-color: #173b4f !important;
    background-image: none !important;
    color: #ffffff !important;
}
html[data-theme="dark"] .mcsd-tool-hdr .hdr-tag,
html[data-theme="dark"] .mcsd-tool-hdr .step-ind,
html[data-theme="dark"] .clinical-stat-strip .cstat-num,
html[data-theme="dark"] .clinical-stat-strip .cstat-label,
html[data-theme="dark"] .clinical-stat-strip sup,
html[data-theme="dark"] [style*="background: var(--deep-blue)"] *,
html[data-theme="dark"] [style*="background:var(--deep-blue)"] *,
html[data-theme="dark"] [style*="background: var(--deep-blue, #1a365d)"] *,
html[data-theme="dark"] [style*="background:var(--deep-blue,#1a365d)"] * { color: #eef4f6 !important; }

/* Accent pills keep their light-teal fill in dark mode — dark ink reads best
   on it (8.72:1) and preserves the "current item" highlight. */
html[data-theme="dark"] .mcsd-page-toc a:hover,
html[data-theme="dark"] .mcsd-page-toc a.is-current,
html[data-theme="dark"] .filter-btn.active,
html[data-theme="dark"] button.filter-btn.active { color: #102127 !important; }

/* --- 17.2 Inline LIGHT panel backgrounds in dark mode ---------------------
   Sections hardcoding a pale panel inline stayed pale in dark mode. Darken the
   SURFACE (not the text) so dark mode stays dark and the existing light text
   remains correct. */
html[data-theme="dark"] [style*="#f7fafc"],
html[data-theme="dark"] [style*="#e8f4f4"],
html[data-theme="dark"] [style*="#ebf8ff"],
html[data-theme="dark"] [style*="#e6fffa"],
html[data-theme="dark"] [style*="background:#fff"],
html[data-theme="dark"] [style*="background: #fff"] {
    background-color: var(--clarity-surface) !important;
    background-image: none !important;
    color: var(--clarity-ink) !important;
    border-color: var(--clarity-line) !important;
}

/* --- 17.3 White pills / white cards in dark mode -------------------------- */
html[data-theme="dark"] .page-jump a {
    background: var(--clarity-surface-soft) !important;
    color: var(--clarity-ink) !important;
    border-color: var(--clarity-line) !important;
}
html[data-theme="dark"] .explore-link-pill { color: var(--clarity-ink) !important; }

/* --- 17.4 Deep indigo body text on dark surfaces -------------------------- */
html[data-theme="dark"] .bio-callout-label,
html[data-theme="dark"] .bio-callout p,
html[data-theme="dark"] .bio-callout em { color: #cfcaf5 !important; }        /* 8.04:1 */

/* --- 17.5 Download CTA — clarity lightened the card, children stayed white
   Identical failure to .references-section: the container was re-pointed but
   site.css still forces white on the heading, subtitle, body and note, so the
   whole block rendered white-on-white (1:1). */
.download-cta { color: var(--clarity-ink) !important; }
.download-cta h3 { color: var(--clarity-navy) !important; }
.download-cta p,
.download-cta-subtitle,
.download-cta .download-cta-subtitle,
.download-cta-note,
.download-cta .download-cta-note { color: var(--clarity-muted) !important; }
.download-cta strong { color: var(--clarity-ink) !important; }

/* --- 17.6 404 hero — background lightened, heading/subtitle stayed white --- */
.mcsd-404-hero,
.mcsd-404-content h1,
.mcsd-404-hero h1 { color: var(--clarity-navy) !important; }
.mcsd-404-hero .hero-subtitle,
.mcsd-404-content .hero-subtitle,
.mcsd-404-content p { color: var(--clarity-muted) !important; }

/* --- 17.7 Solid teal controls below floor with white labels ---------------
   Anchors and buttons that carry their own teal fill inline: pin the fill to a
   teal that clears 4.5:1 with white, in BOTH modes, and keep the label white. */
.btn-start,
button.btn-start,
.filter-count,
.science-filter .filter-count,
[style*="background: var(--calm-teal)"],
[style*="background:var(--calm-teal)"],
[style*="background: var(--calm-teal, #319795)"],
[style*="background:var(--calm-teal,#319795)"] {
    background-color: #256f6d !important;
    background-image: none !important;
    color: #ffffff !important;
}
a[style*="background"][style*="color: #fff"],
a[style*="background"][style*="color:#fff"],
html[data-theme="dark"] a[style*="background"][style*="color: #fff"],
html[data-theme="dark"] a[style*="background"][style*="color:#fff"] { color: #ffffff !important; }

/* --- 17.8 Warning / verdict chips a little under floor -------------------- */
.chip.cs { color: #8a4116 !important; }                                   /* 7.11:1 */
.supp-card .supp-verdict,
.supp-card--red .supp-verdict { color: #8f2626 !important; }              /* 6.44:1 */

/* --- 17.9 Journey meta pills (pale text on pale pill) --------------------- */
html[data-theme="light"] .jmeta-pill.jmeta-bio { color: #1d6c62 !important; }   /* 5.51:1 on the pale pill */
html[data-theme="light"] .jmeta-pill.jmeta-real { color: #1f6b3a !important; }  /* 5.79:1 */
html[data-theme="light"] .jmeta-pill.jmeta-note { color: #7a4c10 !important; } /* 6.21:1 */
/* In dark mode the pill itself goes dark, so the original light inks are the
   correct pairing there — darkening them too would just invert the failure. */
html[data-theme="dark"] .jmeta-pill.jmeta-bio { color: #81e6d9 !important; }   /* 6.74:1 */
html[data-theme="dark"] .jmeta-pill.jmeta-real { color: #9ae6b4 !important; }  /* 6.79:1 */
html[data-theme="dark"] .jmeta-pill.jmeta-note { color: #fbd38d !important; }  /* 7.73:1 */

/* --- 17.10 Remaining uncoloured links in dark mode ------------------------
   v6.1.0 scoped this to a few containers; several pages place body links
   elsewhere, where they still fell to the UA default blue (1.53:1). */
html[data-theme="dark"] body a:where(:not(.btn):not(.door):not(.card):not(.guide-card):not(.cross-link-card):not(.citation):not(.mcsx-link):not(.logo):not(.explore-link-pill):not(.page-jump a):not([style*="background"])) {
    color: var(--clarity-teal) !important;
}
/* NOTE: the exclusions above sit inside :where() so they add NO specificity —
   otherwise this catch-all would out-rank the component rules below and repaint
   the TOC pills teal-on-teal. Component rules must win. */
html[data-theme="dark"] nav.mcsd-page-toc a.is-current,
html[data-theme="dark"] nav.mcsd-page-toc a:hover { color: #102127 !important; }
html[data-theme="dark"] .page-jump a { color: var(--clarity-ink) !important; }

/* --- 17.11 Template-defined pale panels ----------------------------------
   A few components are styled inside a template's own <style> block rather
   than in a stylesheet (so no [style] attribute to match). .journey-quote is
   a pale teal blockquote that stayed pale in dark mode, leaving light navy
   text at 1.14:1. Darken the surface; the existing text then reads at 8.3:1. */
html[data-theme="dark"] .journey-quote,
html[data-theme="dark"] .crisis-box,
html[data-theme="dark"] .journey-pullquote {
    background-color: var(--clarity-surface-soft) !important;
    background-image: none !important;
    border-color: var(--clarity-line) !important;
}
/* These panels carry two text variants (a navy quote and an amber aside); once
   the surface is dark BOTH must read light, or the amber one drops to 1.5:1. */
html[data-theme="dark"] .journey-quote,
html[data-theme="dark"] .journey-quote p,
html[data-theme="dark"] .journey-quote em,
html[data-theme="dark"] .journey-quote strong,
html[data-theme="dark"] .journey-quote cite,
html[data-theme="dark"] .journey-quote span,
html[data-theme="dark"] .crisis-box p,
html[data-theme="dark"] .journey-pullquote p { color: var(--clarity-ink) !important; }

/* --- 17.12 Journey hero — dark gradient overridden, white text left behind
   The template declares .journey-hero with a dark gradient, but clarity's
   .inner-hero rule carries !important, so the hero renders LIGHT while the
   template still paints the H1 white and the subtitle pale grey — the title
   of the page was invisible (pixel-measured 1.05:1 / 1.41:1 on the painted
   background; a background-colour walk cannot see this because the hero is a
   gradient). Re-pointed to match every other inner hero rather than
   reinstating a one-off dark band. */
.journey-hero h1,
.inner-hero.journey-hero h1 { color: var(--clarity-navy) !important; }
.journey-hero .journey-subtitle,
.journey-hero .section-intro,
.inner-hero.journey-hero .section-intro { color: var(--clarity-muted) !important; }
.journey-hero .section-label,
.inner-hero.journey-hero .section-label {
    background: var(--clarity-surface-soft) !important;
    color: var(--clarity-teal-dark) !important;
    border: 1px solid var(--clarity-line) !important;
}
html[data-theme="dark"] .journey-hero h1 { color: var(--clarity-navy) !important; }
html[data-theme="dark"] .journey-hero .journey-subtitle,
html[data-theme="dark"] .journey-hero .section-intro { color: var(--clarity-muted) !important; }
html[data-theme="dark"] .journey-hero .section-label { color: var(--clarity-teal) !important; }

/* --- 17.13 Homepage chrome was underlining itself -------------------------
   components.css applies `text-decoration: underline` to EVERY anchor inside
   .mcsd-ds, and the homepage body carries that class — so the logo, the main
   nav, the dropdown toggles, the skip link, the back-to-top control and the
   citation markers all rendered underlined on the homepage and plain on all 56
   other pages. Underlines on PROSE links are kept (they help scanning and are
   an accessibility win); only the chrome is corrected, so the homepage now
   matches the rest of the site. */
.mcsd-ds .logo,
.mcsd-ds nav a,
.mcsd-ds .nav-links a,
.mcsd-ds .dropdown-toggle,
.mcsd-ds .skip-link,
.mcsd-ds .back-to-top,
.mcsd-ds .citation,
.mcsd-ds .btn,
.mcsd-ds .door,
.mcsd-ds .card,
.mcsd-ds .guide-card,
.mcsd-ds .cross-link-card,
.mcsd-ds footer a { text-decoration: none !important; }
