/* Reading size: only the outermost published content root is scaled. */
html[data-ate-mode="on"] {
    --ate-reader-factor:1;
    --ate-reader-natural:calc(var(--set__i-user-content-font-size, 100) * .01em);
}
html[data-ate-mode="on"][data-ate-reader-size="-2"] { --ate-reader-factor:.88; }
html[data-ate-mode="on"][data-ate-reader-size="-1"] { --ate-reader-factor:.94; }
html[data-ate-mode="on"][data-ate-reader-size="1"] { --ate-reader-factor:1.1; }
html[data-ate-mode="on"][data-ate-reader-size="2"] { --ate-reader-factor:1.2; }
html[data-ate-mode="on"][data-ate-reader-size="3"] { --ate-reader-factor:1.32; }
html[data-ate-mode="on"]:not([data-ate-reader-size="0"]) :is(.ipsRichText--user, [data-role="commentContent"]):not(:where(.ipsEditor, .ipsEditor *, [contenteditable], [contenteditable] *)):not(:has(.ipsEditor, [contenteditable])):not(:where(:is(.ipsRichText--user, [data-role="commentContent"]) *)) {
    font-size:calc(var(--ate-reader-base, var(--ate-reader-natural)) * var(--ate-reader-factor)) !important;
}

/* Contrast and readable fonts are local, not inherited from body/html. */
html[data-ate-mode="on"].atePref--contrast :is(.ipsRichText--user, [data-role="commentContent"]):not(:where(.ipsEditor, .ipsEditor *, [contenteditable], [contenteditable] *)):not(:has(.ipsEditor, [contenteditable])) { color:var(--i-color_hard, CanvasText) !important; }
html[data-ate-mode="on"].atePref--contrast :is(.ipsRichText--user, [data-role="commentContent"]):not(:where(.ipsEditor, .ipsEditor *, [contenteditable], [contenteditable] *)):not(:has(.ipsEditor, [contenteditable])) a[href]:not(:where(.ipsEditor, .ipsEditor *, [contenteditable], [contenteditable] *)),
html[data-ate-mode="on"].atePref--underlineLinks :is(.ipsRichText--user, [data-role="commentContent"]):not(:where(.ipsEditor, .ipsEditor *, [contenteditable], [contenteditable] *)):not(:has(.ipsEditor, [contenteditable])) a[href]:not(:where(.ipsEditor, .ipsEditor *, [contenteditable], [contenteditable] *)),
html[data-ate-mode="on"].atePref--underlineLinks :is(.ipsFooter, .ipsBreadcrumb) a[href]:not(:where(.ipsEditor, .ipsEditor *, [contenteditable], [contenteditable] *)) {
    text-decoration:underline !important;
    text-underline-offset:.18em;
}
html[data-ate-mode="on"].atePref--lineSpacing :is(.ipsRichText--user, [data-role="commentContent"]):not(:where(.ipsEditor, .ipsEditor *, [contenteditable], [contenteditable] *)):not(:has(.ipsEditor, [contenteditable])),
html[data-ate-mode="on"].atePref--lineSpacing :is(.ipsRichText--user, [data-role="commentContent"]):not(:where(.ipsEditor, .ipsEditor *, [contenteditable], [contenteditable] *)):not(:has(.ipsEditor, [contenteditable])) :is(p, li, blockquote, td, th):not(:where(.ipsEditor, .ipsEditor *, [contenteditable], [contenteditable] *)) { line-height:2.1 !important; }
html[data-ate-mode="on"].atePref--lineSpacing :is(.ipsRichText--user, [data-role="commentContent"]):not(:where(.ipsEditor, .ipsEditor *, [contenteditable], [contenteditable] *)):not(:has(.ipsEditor, [contenteditable])) p:not(:where(.ipsEditor, .ipsEditor *, [contenteditable], [contenteditable] *)) { margin-block-end:1em; }
html[data-ate-mode="on"].atePref--readableFont :is(.ipsRichText--user, [data-role="commentContent"]):not(:where(.ipsEditor, .ipsEditor *, [contenteditable], [contenteditable] *)):not(:has(.ipsEditor, [contenteditable])) {
    font-family:"Atkinson Hyperlegible", Verdana, Tahoma, "Segoe UI", system-ui, sans-serif !important;
    letter-spacing:.01em;
}
/* Limit expensive effects rules to navigation, published content and our own controls. */
html[data-ate-mode="on"].atePref--reduceMotion { scroll-behavior:auto !important; }
html[data-ate-mode="on"].atePref--reduceMotion :is(:is(.ipsHeader, .ipsFooter, .ipsBreadcrumb, .ipsMobileFooter, .ateToolkit, .ateContentPreference), :is(.ipsRichText--user, [data-role="commentContent"])):not(:where(.ipsEditor, .ipsEditor *, [contenteditable], [contenteditable] *)),
html[data-ate-mode="on"].atePref--reduceMotion :is(:is(.ipsHeader, .ipsFooter, .ipsBreadcrumb, .ipsMobileFooter, .ateToolkit, .ateContentPreference), :is(.ipsRichText--user, [data-role="commentContent"])) :is(a, button, img):not(:where(.ipsEditor, .ipsEditor *, [contenteditable], [contenteditable] *)) {
    animation-duration:.001ms !important; animation-iteration-count:1 !important;
    transition-duration:.001ms !important; transition-delay:0s !important;
}
html[data-ate-mode="on"].atePref--reduceEffects :is(:is(.ipsHeader, .ipsFooter, .ipsBreadcrumb, .ipsMobileFooter, .ateToolkit, .ateContentPreference), :is(.ipsRichText--user, [data-role="commentContent"])):not(:where(.ipsEditor, .ipsEditor *, [contenteditable], [contenteditable] *)),
html[data-ate-mode="on"].atePref--reduceEffects :is(:is(.ipsHeader, .ipsFooter, .ipsBreadcrumb, .ipsMobileFooter, .ateToolkit, .ateContentPreference), :is(.ipsRichText--user, [data-role="commentContent"])) :is(a, button, img):not(:where(.ipsEditor, .ipsEditor *, [contenteditable], [contenteditable] *)) {
    box-shadow:none !important; text-shadow:none !important;
    backdrop-filter:none !important; -webkit-backdrop-filter:none !important;
}
html[data-ate-mode="on"].atePref--focusStrong :is(a, button, input, select, textarea):focus-visible:not(:where(.ipsEditor, .ipsEditor *, [contenteditable], [contenteditable] *)) {
    outline:3px solid var(--ate-focus) !important; outline-offset:3px !important;
}


/* Phase 22: explicit app-owned prose and sample status contracts only. */
html[data-ate-mode="on"][data-ate-paragraph-spacing="on"] [data-ate-reading-scope="published"] > p[data-ate-reading-prose="1"]:not(:where(.ipsEditor, .ipsEditor *, [contenteditable], [contenteditable] *)):not(:has(:is([contenteditable], .ipsEditor, button, input, select, textarea, [role="button"], img, video, audio, iframe, pre, code, blockquote, table))) {
    margin-block-end:2em;
}
[data-ate-advanced-preview] {
    display:flex; flex-wrap:wrap; gap:.65rem; min-inline-size:0;
}
[data-ate-advanced-preview] > [data-ate-status-sample] {
    display:inline-flex; align-items:center; gap:.55em; max-inline-size:100%;
    box-sizing:border-box; padding:.4em .7em; border:1px solid currentColor;
    border-radius:.4rem; color:var(--ate-text); background:var(--ate-surface);
    overflow-wrap:anywhere;
}
[data-ate-advanced-preview] [data-ate-status-shape] {
    flex:0 0 .8em; inline-size:.8em; block-size:.8em;
    border:2px solid currentColor; border-radius:50%; box-sizing:border-box;
}
[data-ate-advanced-preview] [data-ate-status-sample="unread"] > [data-ate-status-shape] {
    background:currentColor; border-radius:0;
}
html[data-ate-mode="on"] [data-ate-advanced-preview][data-ate-palette="blueAmber"] > [data-ate-status-sample="read"] {
    color:#fff; background:#174e90;
}
html[data-ate-mode="on"] [data-ate-advanced-preview][data-ate-palette="blueAmber"] > [data-ate-status-sample="unread"] {
    color:#fff; background:#754700;
}
html[data-ate-mode="on"] [data-ate-advanced-preview][data-ate-palette="monochrome"] > [data-ate-status-sample="read"] {
    color:#111; background:#fff;
}
html[data-ate-mode="on"] [data-ate-advanced-preview][data-ate-palette="monochrome"] > [data-ate-status-sample="unread"] {
    color:#fff; background:#111;
}
html[data-ate-mode="on"] [data-ate-advanced-preview][data-ate-cues="on"] > [data-ate-status-sample] {
    font-weight:700; border-width:2px;
}
html[data-ate-mode="on"] [data-ate-advanced-preview][data-ate-cues="on"] > [data-ate-status-sample="unread"] {
    border-style:dashed;
}
/* Contrast improves the owned preview without replacing the selected palette. */
html[data-ate-mode="on"].atePref--contrast [data-ate-advanced-preview][data-ate-palette="theme"] > [data-ate-status-sample] {
    color:CanvasText; background:Canvas;
}
html[data-ate-mode="on"].atePref--contrast [data-ate-reading-scope="published"] > p[data-ate-reading-prose="1"]:not(:has(a)):not(:where(.ipsEditor, .ipsEditor *, [contenteditable], [contenteditable] *)):not(:has(:is([contenteditable], .ipsEditor, button, input, select, textarea, [role="button"], img, video, audio, iframe, pre, code, blockquote, table))) {
    color:CanvasText; background:Canvas;
}
@media (forced-colors:active) {
    html[data-ate-mode] [data-ate-advanced-preview][data-ate-palette] > [data-ate-status-sample] {
        color:CanvasText; background:Canvas; border-color:CanvasText;
    }
    [data-ate-advanced-preview] [data-ate-status-shape] { border-color:CanvasText; }
    /* Filled backgrounds may be suppressed by the OS. Shape and text remain. */
}

/* Phase 21: opt-in measure for explicitly owned, static published prose only.
 * Do not attach these attributes to native templates until verified. No inherited
 * typography or display changes: media, quotes, code and actions stay intact. */
html[data-ate-mode="on"][data-ate-reading-mode="on"] [data-ate-reading-scope="published"] > p[data-ate-reading-prose="1"]:not(:where(.ipsEditor, .ipsEditor *, [contenteditable], [contenteditable] *)):not(:has(:is([contenteditable], .ipsEditor, button, input, select, textarea, [role="button"], img, video, audio, iframe, pre, code, blockquote, table))) {
    max-inline-size:min(100%, 65ch);
    margin-inline:auto;
    overflow-wrap:anywhere;
}
