/* colour vision - data-cvd="protan|deutan|tritan": §1/§2 chart palette per type, §3 image daltonization, §4 stronger non-colour cues; loaded last */


/* ── §1 chart palette per type, light: ΔE > 25 in the target type, > 15 elsewhere, 3–8:1 on cream ── */

html[data-cvd="protan"]:not([data-dark]) {
    /* worst pair: ΔE 29.3 in protanopia (from 18.4) */
    --series-1: #6C0012;   /* deep crimson - 7.9:1 on cream */
    --series-2: #5A126C;   /* purple       - 7.5:1 */
    --series-3: #007E7E;   /* teal         - 3.0:1 */
    --series-4: #757512;   /* olive-yellow - 3.0:1 */
}

html[data-cvd="deutan"]:not([data-dark]) {
    /* worst pair: ΔE 25.4 in deuteranopia (from 16.3) */
    --series-1: #363600;   /* dark olive   - 7.7:1 on cream */
    --series-2: #512448;   /* plum         - 7.7:1 */
    --series-3: #AB516C;   /* dusty pink   - 3.2:1 */
    --series-4: #3F6CCF;   /* blue         - 3.1:1 */
}

html[data-cvd="tritan"]:not([data-dark]) {
    /* worst pair: ΔE 27.7 in tritanopia (from 17.4) */
    --series-1: #243624;   /* dark green   - 8.0:1 on cream */
    --series-2: #630051;   /* deep purple  - 7.9:1 */
    --series-3: #756C6C;   /* neutral grey - 3.2:1 */
    --series-4: #0075BD;   /* blue         - 3.0:1 */
}


/* ── §2 chart palette per type, dark: measured against the lightest dark surface ── */

html[data-dark][data-cvd="protan"] {
    /* worst pair: ΔE 30.1 in protanopia */
    --series-1: #B4CFAB;   /* light sage   - 8.9:1 */
    --series-2: #E1B4FC;   /* lavender     - 8.7:1 */
    --series-3: #75752D;   /* olive        - 3.1:1 */
    --series-4: #AB517E;   /* burgundy-pink - 3.0:1 */
}

html[data-dark][data-cvd="deutan"] {
    /* worst pair: ΔE 31.2 in deuteranopia */
    --series-1: #75D8D8;   /* teal-blue    - 9.0:1 */
    --series-2: #FCB47E;   /* apricot      - 8.6:1 */
    --series-3: #6C7563;   /* olive-grey   - 3.1:1 */
    --series-4: #0075B4;   /* blue         - 3.0:1 */
}

html[data-dark][data-cvd="tritan"] {
    /* worst pair: ΔE 30.5 in tritanopia */
    --series-1: #CFC6AB;   /* sand         - 8.8:1 */
    --series-2: #12D8FC;   /* cyan         - 8.8:1 */
    --series-3: #AB635A;   /* terracotta   - 3.3:1 */
    --series-4: #637587;   /* grey-blue    - 3.2:1 */
}


/* ── §3 daltonize photo layers and meaningful SVGs (in <figure> or data-cvd-media); matrices in accessibility.js DALTONIZE ── */

html[data-cvd="protan"][data-cvd-images] :is(img, video, canvas, figure svg, .member-image-bg, .content-card-photo, [data-cvd-media]) {
    filter: url(#a11y-daltonize-protan);
}
html[data-cvd="deutan"][data-cvd-images] :is(img, video, canvas, figure svg, .member-image-bg, .content-card-photo, [data-cvd-media]) {
    filter: url(#a11y-daltonize-deutan);
}

/* hero photo is on ::before, which :is() cannot target */
html[data-cvd="protan"][data-cvd-images] .team-hero-clean::before {
    filter: url(#a11y-daltonize-protan);
}
html[data-cvd="deutan"][data-cvd-images] .team-hero-clean::before {
    filter: url(#a11y-daltonize-deutan);
}

/* ── DBTL wheel excluded: the filter drops it below ΔE 15 (deutan 19.1 → 7.5); re-measure if a --dbtl-tint changes ── */

/* ── Explore More card photos excluded: they already use filter for focus, and are decorative ── */
/* tritan: no image filter (red-green axis intact; it made pairs worse) */

/* ── clouds left out: their own filter would be overridden, and daltonization changes them < 1/255 ── */
html[data-cvd][data-cvd-images] .hero-scene .clouds > img {
    filter: var(--cloud-filter);
}


/* ── §4 non-colour cues: turn up the second channel ── */

/* links in running text inside <main> always underlined (SC 1.4.1) */
html[data-cvd] main :is(p, li, dd, td, th, blockquote, figcaption) a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* except navigation chips inside <main> */
html[data-cvd] nav a { text-decoration: none; }

/* active navigation link: a second channel beyond colour. */
html[data-cvd] a[aria-current="page"] {
    font-weight: 600;
    text-decoration-thickness: 2px;
}

/* thicker focus ring */
html[data-cvd] :focus-visible {
    outline-width: 3px;
}

/* status chips: outline added to symbol + word */
html[data-cvd] .status {
    border: 1px solid currentColor;
    border-radius: 4px;
    padding: 0.05em 0.4em;
}

/* reduce-motion: no underline transition */
@media (prefers-reduced-motion: reduce) {
    html[data-cvd] a { transition: none; }
}
