#dagmedia-reading-tools {
    position: relative;
    z-index: 10000;
    container-type: inline-size;
    background: var(--reading-background, #fff);
    color: var(--reading-color, #171717);
    border-bottom: 2px solid var(--reading-line, #6a6a6a);
    font: 400 16px/1.4 system-ui, sans-serif;
    letter-spacing: normal;
    text-align: start;
}

#dagmedia-reading-tools[hidden],
#dagmedia-reading-panel[hidden] { display: none !important; }

#dagmedia-reading-tools .reading-panel {
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px 16px;
    max-width: 90rem;
    margin-inline: auto;
    padding: 12px clamp(12px, 2vw, 28px);
}

#dagmedia-reading-tools h2 {
    align-self: center;
    margin: 0;
    font: 750 1em/1.3 system-ui, sans-serif;
    color: inherit;
}

#dagmedia-reading-tools fieldset {
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
}

#dagmedia-reading-tools legend {
    float: none;
    width: auto;
    max-width: 100%;
    margin: 0 0 4px;
    padding: 0;
    font: 650 0.875em/1.35 system-ui, sans-serif;
    color: inherit;
}

#dagmedia-reading-tools .reading-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

#dagmedia-reading-tools button {
    all: unset;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 6px 10px;
    border: 1px solid var(--reading-line, #6a6a6a);
    border-radius: 5px;
    cursor: pointer;
    font: 650 0.875em/1.25 system-ui, sans-serif;
    text-align: center;
}

#dagmedia-reading-tools :is(button, h2):focus-visible {
    outline: 2px solid var(--reading-link, #003b91);
    outline-offset: 2px;
}

#dagmedia-reading-tools :is(.reading-sizes, .reading-colors) button {
    min-width: 40px;
    padding-inline: 4px;
}

#dagmedia-reading-tools [data-reading-size="125"] { font-size: 1em; }
#dagmedia-reading-tools [data-reading-size="150"] { font-size: 1.125em; }
#dagmedia-reading-tools [data-reading-size="200"] { font-size: 1.375em; }

#dagmedia-reading-tools [data-reading-color] {
    background: var(--swatch-background);
    color: var(--swatch-color);
    border-color: var(--reading-line);
}

#dagmedia-reading-tools .reading-choices button[aria-pressed="true"] {
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

#dagmedia-reading-tools .reading-choices button[aria-pressed="true"]:not([data-reading-color]) {
    background: var(--reading-color, #171717);
    color: var(--reading-background, #fff);
}

#dagmedia-reading-tools .reading-off {
    margin-inline-start: auto;
    border-color: currentColor;
}

#dagmedia-reading-tools button:hover {
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

@container (min-width: 940px) and (max-width: 1150px) {
    #dagmedia-reading-tools h2 { max-width: 134px; }
    #dagmedia-reading-tools .reading-panel { gap: 10px 12px; }
}

@media (max-width: 767px) {
    #dagmedia-reading-tools .reading-panel {
        align-items: end;
        gap: 10px 12px;
    }

    #dagmedia-reading-tools h2 { flex: 0 0 100%; }
    #dagmedia-reading-tools .reading-off { margin-inline-start: 0; }
}

@media (max-width: 420px) {
    #dagmedia-reading-tools .reading-colors { gap: 4px; }
    #dagmedia-reading-tools .reading-colors button { min-width: 38px; }
}

button#dagmedia-reading-launcher.reading-launcher {
    box-sizing: border-box;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    min-width: 0;
    min-height: 0;
    padding: 0;
    color: inherit;
    background: color-mix(in srgb, currentColor 8%, transparent);
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
}

button#dagmedia-reading-launcher.reading-launcher:hover,
button#dagmedia-reading-launcher.reading-launcher.reading-enabled {
    border-color: currentColor;
}

button#dagmedia-reading-launcher:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.reading-header-fallback {
    display: flex;
    justify-content: flex-end;
    padding: 8px 12px;
}

@media (max-width: 420px) {
    button#dagmedia-reading-launcher.reading-launcher { width: 34px; height: 34px; }
}

[data-reading-color="light"], :root[data-reading-mode="light"] {
    --swatch-background: #fff;
    --swatch-color: #171717;
    --reading-link: #003b91;
    --reading-line: #6a6a6a;
    color-scheme: light;
}

[data-reading-color="dark"], :root[data-reading-mode="dark"] {
    --swatch-background: #141414;
    --swatch-color: #fff;
    --reading-link: #9ed5ff;
    --reading-line: #9c9c9c;
    color-scheme: dark;
}

[data-reading-color="blue"], :root[data-reading-mode="blue"] {
    --swatch-background: #c1e1f7;
    --swatch-color: #092e52;
    --reading-link: #003c81;
    --reading-line: #426787;
    color-scheme: light;
}

[data-reading-color="sepia"], :root[data-reading-mode="sepia"] {
    --swatch-background: #f8efd6;
    --swatch-color: #493724;
    --reading-link: #6e3908;
    --reading-line: #765b41;
    color-scheme: light;
}

[data-reading-color="green"], :root[data-reading-mode="green"] {
    --swatch-background: #222519;
    --swatch-color: #c8ed91;
    --reading-link: #d3f2a3;
    --reading-line: #a4b57f;
    color-scheme: dark;
}

[data-reading-color="yellow"], :root[data-reading-mode="yellow"] {
    --swatch-background: #111;
    --swatch-color: #ffe36d;
    --reading-link: #ffe36d;
    --reading-line: #ffe36d;
    color-scheme: dark;
}

:root[data-reading-mode] {
    --reading-background: var(--swatch-background);
    --reading-color: var(--swatch-color);
}

/* Keep image descriptions available to assistive technologies. */
:root[data-reading-hide-images] img:not(header img, nav img, [data-reading-header] img, [data-reading-image-control] img, [class*="logo"], [class*="wordmark"], [class*="brand"], [class*="logo"] img, .brand img) {
    position: absolute !important;
    inline-size: 1px !important;
    block-size: 1px !important;
    min-inline-size: 0 !important;
    min-block-size: 0 !important;
    clip-path: inset(50%) !important;
    pointer-events: none !important;
}

.reading-image-caption,
:root[data-reading-hide-images] [data-reading-image-duplicate] {
    display: none !important;
}

:root[data-reading-hide-images] [data-reading-image-caption] > .reading-image-caption {
    display: inline-block !important;
    box-sizing: border-box;
    max-inline-size: 100%;
    padding: 0.5em;
    font-size: calc(1rem * var(--reading-scale, 1.25));
    overflow-wrap: anywhere;
}

:root[data-reading-mode],
:root[data-reading-mode] :where(body, header, nav, main, aside, section, article, footer, div, details, dialog, th, td, pre, blockquote):not(#dagmedia-reading-tools, #dagmedia-reading-tools *) {
    color: var(--reading-color) !important;
    background-color: var(--reading-background) !important;
    background-image: none !important;
    border-color: var(--reading-line) !important;
    box-shadow: none !important;
}

:root[data-reading-mode] [data-reading-text] {
    color: var(--reading-color) !important;
    background-color: var(--reading-background) !important;
    text-shadow: none !important;
    font-size: calc(var(--reading-base-size) * var(--reading-scale, 1.25)) !important;
    line-height: 1.45 !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
}

:root[data-reading-mode] :is(h1,h2,h3,h4,h5,h6,p,[class*="__title"],[class*="-title"],[class*="__excerpt"],[class*="__summary"]):not(#dagmedia-reading-tools *) {
    -webkit-line-clamp: unset !important;
    max-block-size: none !important;
    text-overflow: clip !important;
}

:root[data-reading-mode] body a:not(#dagmedia-reading-tools *),
:root[data-reading-mode] body a [data-reading-text] {
    color: var(--reading-link) !important;
    text-decoration: underline !important;
    text-underline-offset: 0.13em;
}

:root[data-reading-mode] :where(input, select, textarea, button):not(#dagmedia-reading-tools *) {
    color: var(--reading-color) !important;
    background-color: var(--reading-background) !important;
    border-color: var(--reading-line) !important;
}

:root[data-reading-mode] :is(input, textarea)::placeholder {
    color: var(--reading-color) !important;
    opacity: 1 !important;
}

:root[data-reading-mode] :focus-visible:not(#dagmedia-reading-tools *) {
    outline: 3px solid var(--reading-link) !important;
    outline-offset: 2px;
}

:root[data-reading-mode], :root[data-reading-mode] body { overflow-x: clip; }

:root[data-reading-mode] body,
:root[data-reading-mode] body *:not(#dagmedia-reading-tools, #dagmedia-reading-tools *) {
    transition: none !important;
}

:root:is([data-reading-mode="dark"], [data-reading-mode="green"], [data-reading-mode="yellow"]) :where(img[class*="logo"], img[class*="wordmark"], .logo img, .brand img, .topbar__brand img, .topbar__logo img) {
    background-color: #fff !important;
    border-radius: 4px;
}

:root[data-reading-mode] :where(.topbar__burger, .burger, .burger-btn, .menu-toggle, .hamburger) > span:not([data-reading-text]) {
    background-color: var(--reading-color) !important;
}

:root[data-reading-mode] [data-reading-token] { white-space: nowrap !important; }

@media (max-width: 767px) {
    :root[data-reading-mode] .mobile-subbar { flex-wrap: wrap; }
    :root[data-reading-mode] .mobile-subbar__search { flex: 1 0 100%; max-width: 100%; }
}


:root[data-reading-mode] #dagmedia-reading-launcher {
    color: var(--reading-color) !important;
    background-color: var(--reading-background) !important;
    border-color: var(--reading-line) !important;
}


:root[data-reading-mode] [data-reading-header] {
    --reading-scale: var(--reading-header-scale, 1);
}

@media (max-width: 360px) {
    .header-tools-bar .header-actions:has(#dagmedia-reading-launcher) {
        gap: 4px;
    }
    .header-tools-bar .header-actions:has(#dagmedia-reading-launcher) :is(.theme-toggle,.menu-toggle,.search-btn) {
        width: 32px;
        min-width: 32px;
        height: 34px;
    }
    .header-tools-bar .header-actions:has(#dagmedia-reading-launcher) .search-control {
        min-width: 32px;
    }
}

@media (max-width: 360px) {
    .topbar:has(#dagmedia-reading-launcher) .topbar__logo-img {
        max-width: 104px;
        height: auto;
    }
}

/* This theme reserves space for its fixed header in the page layout. */
body:has(> #dagmedia-reading-tools:not([hidden])) .topbar:has(#dagmedia-reading-launcher) {
    position: absolute;
}

body:has(> #dagmedia-reading-tools:not([hidden])) > .topbar:has(#dagmedia-reading-launcher) {
    top: auto;
    margin-block-start: 8px;
}
