/* Tramonti accessibility toolbar. Inactive state does not alter the site. */
.tramonti-a11y,
.tramonti-a11y * {
    box-sizing: border-box;
}

.tramonti-a11y {
    position: fixed;
    right: 16px;
    top: 42%;
    z-index: 2147483000;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px !important;
    line-height: 1.25;
}

.tramonti-a11y__toggle {
    width: 52px;
    height: 52px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #174f78;
    color: #fff;
    font-size: 28px !important;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .35);
}

.tramonti-a11y__toggle:hover,
.tramonti-a11y__toggle:focus-visible {
    background: #0e3858;
}

.tramonti-a11y__panel {
    position: absolute;
    right: 62px;
    top: -80px;
    width: min(340px, calc(100vw - 92px));
    max-height: min(560px, calc(100vh - 32px));
    overflow: auto;
    border: 1px solid #c9c9c9;
    border-radius: 8px;
    background: #fff;
    color: #111;
    box-shadow: 0 7px 28px rgba(0, 0, 0, .35);
}

.tramonti-a11y__panel[hidden] {
    display: none !important;
}

.tramonti-a11y__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 50px;
    padding: 10px 12px 10px 16px;
    border-bottom: 1px solid #ddd;
    background: #174f78;
    color: #fff;
    font-size: 18px !important;
}

.tramonti-a11y__close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #fff;
    font-size: 28px !important;
    line-height: 1;
    cursor: pointer;
}

.tramonti-a11y__close:hover,
.tramonti-a11y__close:focus-visible {
    background: rgba(255, 255, 255, .18);
}

.tramonti-a11y__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: #ddd;
}

.tramonti-a11y__grid button {
    min-height: 88px;
    padding: 11px 8px;
    border: 0;
    background: #fff;
    color: #111;
    font: 600 14px/1.25 Arial, Helvetica, sans-serif !important;
    cursor: pointer;
}

.tramonti-a11y__grid button span:first-child {
    display: block;
    min-height: 30px;
    margin-bottom: 5px;
    font-size: 23px !important;
    font-weight: 700;
}

.tramonti-a11y__grid button:hover,
.tramonti-a11y__grid button:focus-visible {
    background: #eef6fb;
    outline: 3px solid #174f78;
    outline-offset: -3px;
}

.tramonti-a11y__grid button[aria-pressed="true"] {
    background: #174f78;
    color: #fff;
}

/* Visual modes are scoped to the page, while the toolbar keeps its own styling. */
html.a11y-grayscale body > *:not(.tramonti-a11y) {
    filter: grayscale(100%) !important;
}

html.a11y-high-contrast body,
html.a11y-high-contrast body > *:not(.tramonti-a11y),
html.a11y-high-contrast body > *:not(.tramonti-a11y) * {
    background-color: #000 !important;
    background-image: none !important;
    color: #fff !important;
    border-color: #fff !important;
    text-shadow: none !important;
    box-shadow: none !important;
}

html.a11y-high-contrast body > *:not(.tramonti-a11y) a {
    color: #ffff00 !important;
    text-decoration: underline !important;
}

html.a11y-high-contrast body > *:not(.tramonti-a11y) img {
    background-color: transparent !important;
}

html.a11y-negative body > *:not(.tramonti-a11y) {
    filter: invert(100%) hue-rotate(180deg) !important;
}

html.a11y-negative body > *:not(.tramonti-a11y) img,
html.a11y-negative body > *:not(.tramonti-a11y) video,
html.a11y-negative body > *:not(.tramonti-a11y) iframe {
    filter: invert(100%) hue-rotate(180deg) !important;
}

html.a11y-light-background body,
html.a11y-light-background body > *:not(.tramonti-a11y),
html.a11y-light-background body > *:not(.tramonti-a11y) * {
    background-color: #fff !important;
    background-image: none !important;
    color: #000 !important;
    border-color: #333 !important;
    text-shadow: none !important;
}

html.a11y-light-background body > *:not(.tramonti-a11y) a {
    color: #003f8f !important;
    text-decoration: underline !important;
}

@media (max-width: 600px) {
    .tramonti-a11y {
        right: 10px;
        top: auto;
        bottom: 14px;
    }

    .tramonti-a11y__panel {
        position: fixed;
        right: 10px;
        bottom: 76px;
        top: auto;
        width: calc(100vw - 20px);
        max-height: calc(100vh - 100px);
    }
}

@media print {
    .tramonti-a11y {
        display: none !important;
    }
}
