:root {
    --ft-a11y-font-scale: 1;
    --ft-a11y-line-scale: 1;
}

.ft-a11y {
    position: fixed;
    z-index: 1100;
    direction: rtl;
    font-family: var(--ft-font);
}

.ft-a11y[data-corner="bottom-right"] {
    right: var(--ft-a11y-offset-x);
    bottom: var(--ft-a11y-offset-y);
}

.ft-a11y[data-corner="bottom-left"] {
    left: var(--ft-a11y-offset-x);
    bottom: var(--ft-a11y-offset-y);
}

.ft-a11y[data-corner="top-right"] {
    right: var(--ft-a11y-offset-x);
    top: var(--ft-a11y-offset-y);
}

.ft-a11y[data-corner="top-left"] {
    left: var(--ft-a11y-offset-x);
    top: var(--ft-a11y-offset-y);
}

.ft-a11y__toggle {
    width: 52px;
    height: 52px;
    border: 0;
    border-radius: 999px;
    background: var(--ft-a11y-button-bg);
    color: var(--ft-a11y-button-text);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
}

.ft-a11y__toggle:focus-visible {
    outline: 3px solid var(--ft-a11y-accent);
    outline-offset: 2px;
}

.ft-a11y__icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.ft-a11y__panel {
    position: absolute;
    width: min(340px, calc(100vw - 24px));
    max-height: min(78vh, 560px);
    overflow: auto;
    background: var(--ft-a11y-panel-bg);
    color: var(--ft-a11y-panel-text);
    border: 1px solid var(--ft-a11y-panel-border);
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, .22);
    padding: 14px;
}

.ft-a11y[data-corner^="bottom"] .ft-a11y__panel {
    bottom: 64px;
}

.ft-a11y[data-corner^="top"] .ft-a11y__panel {
    top: 64px;
}

.ft-a11y[data-corner$="right"] .ft-a11y__panel {
    right: 0;
}

.ft-a11y[data-corner$="left"] .ft-a11y__panel {
    left: 0;
}

.ft-a11y__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.ft-a11y__header h3 {
    margin: 0;
    font-size: 16px;
    color: inherit;
}

.ft-a11y__close {
    border: 0;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    color: inherit;
    padding: 2px 6px;
}

.ft-a11y__group {
    border-top: 1px solid var(--ft-a11y-panel-border);
    padding-top: 10px;
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.ft-a11y__group h4 {
    margin: 0;
    font-size: 13px;
    color: var(--ft-a11y-accent);
}

.ft-a11y__group label {
    display: grid;
    gap: 4px;
    font-size: 13px;
}

.ft-a11y__group select {
    width: 100%;
    border: 1px solid var(--ft-a11y-panel-border);
    border-radius: 6px;
    background: #fff;
    color: #111;
    padding: 8px 10px;
    font-family: inherit;
}

.ft-a11y__check {
    display: flex !important;
    align-items: center;
    gap: 8px;
}

.ft-a11y__actions {
    margin-top: 12px;
}

.ft-a11y__actions .button {
    width: 100%;
    border-color: var(--ft-a11y-panel-border);
}

.ft-a11y-reading-mask {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1090;
    display: none;
}

.ft-a11y-reading-mask::before,
.ft-a11y-reading-mask::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    background: rgba(0, 0, 0, .45);
}

.ft-a11y-reading-mask::before {
    top: 0;
    bottom: calc(var(--ft-a11y-mask-y, 45vh) + 44px);
}

.ft-a11y-reading-mask::after {
    top: calc(var(--ft-a11y-mask-y, 45vh) - 44px);
    bottom: 0;
}

.ft-a11y-structure {
    position: fixed;
    z-index: 1095;
    inset-inline-end: 16px;
    top: 16px;
    width: min(360px, calc(100vw - 24px));
    max-height: min(70vh, 540px);
    background: var(--ft-a11y-panel-bg);
    color: var(--ft-a11y-panel-text);
    border: 1px solid var(--ft-a11y-panel-border);
    border-radius: 12px;
    box-shadow: 0 14px 35px rgba(0, 0, 0, .25);
    overflow: hidden;
}

.ft-a11y-structure__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--ft-a11y-panel-border);
}

.ft-a11y-structure__head button {
    border: 0;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    color: inherit;
}

.ft-a11y-structure__body {
    max-height: calc(min(70vh, 540px) - 48px);
    overflow: auto;
    padding: 10px 12px;
}

.ft-a11y-structure__body ul {
    margin: 0;
    padding-inline-start: 0;
    list-style: none;
    display: grid;
    gap: 6px;
}

.ft-a11y-structure__body li {
    margin: 0;
    font-size: 14px;
}

.ft-a11y-structure__body a {
    display: inline-block;
    color: var(--ft-a11y-panel-text);
    text-decoration: none;
    border-bottom: 1px dashed var(--ft-a11y-accent);
}

.ft-a11y-structure__body .level-2 { padding-inline-start: 12px; }
.ft-a11y-structure__body .level-3 { padding-inline-start: 24px; }
.ft-a11y-structure__body .level-4 { padding-inline-start: 36px; }
.ft-a11y-structure__body .level-5 { padding-inline-start: 48px; }
.ft-a11y-structure__body .level-6 { padding-inline-start: 60px; }

html.ft-a11y-scale {
    --ft-fs-h1: calc(40px * var(--ft-a11y-font-scale));
    --ft-fs-h2: calc(28px * var(--ft-a11y-font-scale));
    --ft-fs-h3: calc(23px * var(--ft-a11y-font-scale));
    --ft-fs-body: calc(17px * var(--ft-a11y-font-scale));
    --ft-fs-small: calc(14px * var(--ft-a11y-font-scale));
}

body.ft-a11y-line-height :where(p, li, a, span, small, label, td, th, input, textarea, button, h1, h2, h3, h4, h5, h6) {
    line-height: calc(1.25em * var(--ft-a11y-line-scale));
}

body.ft-a11y-readable-font,
body.ft-a11y-readable-font :where(p, li, a, span, input, textarea, button, h1, h2, h3, h4, h5, h6, label) {
    font-family: Arial, Tahoma, sans-serif !important;
    letter-spacing: 0 !important;
}

body.ft-a11y-contrast-dark {
    background: #111 !important;
    color: #fff !important;
}

body.ft-a11y-contrast-dark :where(section, article, aside, header, footer, nav, main, div, p, li, h1, h2, h3, h4, h5, h6, span, a) {
    background-color: transparent !important;
    color: #fff !important;
    border-color: #666 !important;
}

body.ft-a11y-contrast-light {
    background: #fff !important;
    color: #111 !important;
}

body.ft-a11y-contrast-light :where(section, article, aside, header, footer, nav, main, div, p, li, h1, h2, h3, h4, h5, h6, span, a) {
    color: #111 !important;
    border-color: #333 !important;
}

body.ft-a11y-contrast-high {
    filter: contrast(1.35) saturate(1.1);
}

body.ft-a11y-grayscale {
    filter: grayscale(1);
}

body.ft-a11y-hide-images img,
body.ft-a11y-hide-images svg,
body.ft-a11y-hide-images picture,
body.ft-a11y-hide-images video {
    opacity: 0 !important;
}

body.ft-a11y-hide-images img {
    background: repeating-linear-gradient(
        45deg,
        #f3f4f6,
        #f3f4f6 10px,
        #e5e7eb 10px,
        #e5e7eb 20px
    ) !important;
}

body.ft-a11y-pause-animations *,
body.ft-a11y-pause-animations *::before,
body.ft-a11y-pause-animations *::after {
    animation-play-state: paused !important;
    animation-duration: 0s !important;
    transition-duration: 0s !important;
    scroll-behavior: auto !important;
}

body.ft-a11y-highlight-links a {
    text-decoration: underline !important;
    text-decoration-thickness: 2px !important;
    text-underline-offset: 2px !important;
}

body.ft-a11y-focus-outline :focus-visible {
    outline: 3px solid var(--ft-a11y-accent) !important;
    outline-offset: 2px !important;
}

body.ft-a11y-reading-mask .ft-a11y-reading-mask {
    display: block;
}

@media (max-width: 768px) {
    .ft-a11y {
        --ft-a11y-offset-x: 12px;
        --ft-a11y-offset-y: 12px;
    }

    .ft-a11y__panel {
        width: min(330px, calc(100vw - 18px));
    }
}
