/**
 * Accessibility Toolkit - Frontend Styles
 */

/* ==========================================================================
   CSS Custom Properties (can be overridden by admin settings)
   ========================================================================== */
:root {
    --atk-primary: #2563eb;
    --atk-primary-dark: #1d4ed8;
    --atk-primary-light: #3b82f6;
    --atk-panel-header: #2563eb;
    --atk-active: #2563eb;
    --atk-white: #ffffff;
    --atk-header-text: #ffffff;
    --atk-gray-50: #f8fafc;
    --atk-gray-100: #f1f5f9;
    --atk-gray-200: #e2e8f0;
    --atk-gray-300: #cbd5e1;
    --atk-gray-400: #94a3b8;
    --atk-gray-500: #64748b;
    --atk-gray-600: #475569;
    --atk-gray-700: #334155;
    --atk-gray-800: #1e293b;
    --atk-gray-900: #0f172a;
    --atk-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --atk-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --atk-radius: 24px;
    --atk-radius-md: 16px;
    --atk-radius-sm: 12px;
    --atk-transition: 0.2s ease;
    /* Motion: decelerating curve for entering, mirrored curve for exiting */
    --atk-ease-out: cubic-bezier(0.32, 0.72, 0, 1);
    --atk-ease-in: cubic-bezier(1, 0, 0.68, 0.28);
    --atk-press: transform 0.1s ease-out;
    /* --atk-panel-width: 420px;  */
    --atk-panel-width: 45%;
    --atk-panel-min-width: 400px;
    --atk-panel-max-width: 800px;
    --atk-z-index: 999999;
}

/* ==========================================================================
   Screen Reader Only
   ========================================================================== */
.atk-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ==========================================================================
   Widget Container - MUST NOT BE AFFECTED BY FILTERS
   ========================================================================== */
#atk-widget {
    position: fixed !important;
    bottom: 24px !important;
    z-index: var(--atk-z-index) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Prevent any filters from affecting widget */
    filter: none !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

#atk-widget *,
#atk-widget *::before,
#atk-widget *::after {
    box-sizing: border-box;
    filter: none !important;
}

#atk-widget.atk-position-right {
    right: 24px !important;
}

#atk-widget.atk-position-left {
    left: 24px !important;
}

/* ==========================================================================
   Toggle Button
   ========================================================================== */
.atk-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: var(--atk-primary);
    color: var(--atk-white);
    cursor: pointer;
    box-shadow: var(--atk-shadow);
    transition: transform 0.3s var(--atk-ease-out), opacity 0.3s ease, box-shadow var(--atk-transition);
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

/* Hidden while scrolling down; slides down + fades out, reappears on scroll up or near top */
.atk-toggle-btn.atk-btn-hidden {
    transform: translateY(24px);
    opacity: 0;
    pointer-events: none;
}

@media (hover: hover) {
    .atk-toggle-btn:hover {
        transform: scale(1.05);
    }
}

/* feedback on press, before release */
.atk-toggle-btn:active {
    transform: scale(0.94);
    transition: var(--atk-press);
}

.atk-toggle-btn:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--atk-primary) 55%, transparent);
    outline-offset: 3px;
}

.atk-toggle-btn .atk-icon {
    width: 32px;
    height: 32px;
}

/* Size variations */
.atk-size-small .atk-toggle-btn {
    width: 48px;
    height: 48px;
}

.atk-size-small .atk-toggle-btn .atk-icon {
    width: 24px;
    height: 24px;
}

.atk-size-large .atk-toggle-btn {
    width: 72px;
    height: 72px;
}

.atk-size-large .atk-toggle-btn .atk-icon {
    width: 36px;
    height: 36px;
}

/* ==========================================================================
   Panel - Full Overlay Style
   ========================================================================== */
.atk-panel {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    width: var(--atk-panel-width);
    min-width: var(--atk-panel-min-width);
    max-width: var(--atk-panel-max-width);
    height: 100vh !important;
    background: var(--atk-gray-100) !important;
    box-shadow: var(--atk-shadow);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateX(100%);
    /* exits along the curve it entered on, mirrored */
    transition: opacity 0.3s var(--atk-ease-in), transform 0.35s var(--atk-ease-in), visibility 0.35s;
    will-change: transform;
    display: flex;
    flex-direction: column;
    filter: none !important;
}

.atk-position-left .atk-panel {
    right: auto !important;
    left: 0 !important;
    transform: translateX(-100%);
}

.atk-panel.atk-panel-open {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    transition: opacity 0.25s var(--atk-ease-out), transform 0.4s var(--atk-ease-out), visibility 0.4s;
}

/* Panel Header
   Single toolbar row (title + close) over a controls row, so everything sits
   on one grid instead of three centered stacks. */
.atk-panel-header {
    background: var(--atk-panel-header);
    color: var(--atk-header-text);
    padding: 18px 16px 16px;
    flex-shrink: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    /* light catching the top edge of the material */
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--atk-header-text) 22%, transparent);
}

/* Scroll edge: soft fade where the header meets content, not a hard divider */
.atk-panel-header::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    top: 100%;
    height: 12px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.10), rgba(0, 0, 0, 0));
    pointer-events: none;
}

.atk-header-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 36px;
}

.atk-panel-title {
    font-size: clamp(19px, 2.4vw, 22px);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.015em; /* tighter tracking as the type grows */
    margin: 0;
    flex: 1;
    min-width: 0;
    color: var(--atk-header-text);
}

.atk-panel-close {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: color-mix(in srgb, var(--atk-header-text) 16%, transparent);
    color: var(--atk-header-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--atk-transition), transform 0.1s ease-out;
}

.atk-panel-close:hover {
    background: color-mix(in srgb, var(--atk-header-text) 28%, transparent);
}

/* feedback on press, not on release */
.atk-panel-close:active {
    transform: scale(0.92);
}

.atk-panel-close svg {
    width: 20px;
    height: 20px;
}

/* Header controls row: language + statement sit side by side */
.atk-header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.atk-lang-flag {
    width: 20px;
    height: 15px;
    border-radius: 2px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.atk-lang-btn,
.atk-statement-link {
    height: 34px;
    border-radius: 17px;
    border: 1px solid color-mix(in srgb, var(--atk-header-text) 28%, transparent);
    background-color: color-mix(in srgb, var(--atk-header-text) 12%, transparent);
    color: var(--atk-header-text);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.005em; /* small text reads better slightly opened up */
    cursor: pointer;
    transition: background-color var(--atk-transition), border-color var(--atk-transition), transform 0.1s ease-out;
}

.atk-lang-btn:hover,
.atk-statement-link:hover {
    background-color: color-mix(in srgb, var(--atk-header-text) 22%, transparent);
    border-color: color-mix(in srgb, var(--atk-header-text) 50%, transparent);
    color: var(--atk-header-text);
}

.atk-lang-btn:active,
.atk-statement-link:active {
    transform: scale(0.97);
}

.atk-lang-btn:focus-visible,
.atk-statement-link:focus-visible {
    outline: 2px solid var(--atk-header-text);
    outline-offset: 2px;
}

.atk-lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-inline: 14px;
    white-space: nowrap;
}

/* Search field: sits in the panel header on both the main and language view */
.atk-search-wrap {
    --atk-search-fg: var(--atk-header-text);
    position: relative;
    display: flex;
    align-items: center; /* spacing comes from the header's own flex gap */
}

.atk-search-input {
    width: 100%;
    height: 36px;
    padding-inline: 12px 36px; /* end: room for the clear button */
    border-radius: 18px;
    border: 1px solid color-mix(in srgb, var(--atk-search-fg) 28%, transparent);
    background-color: color-mix(in srgb, var(--atk-search-fg) 12%, transparent);
    color: var(--atk-search-fg);
    font-size: 14px;
}

.atk-search-input::-webkit-search-cancel-button,
.atk-search-input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
}

.atk-search-input::placeholder {
    color: color-mix(in srgb, var(--atk-search-fg) 70%, transparent);
}

.atk-search-input:focus-visible {
    outline: 2px solid var(--atk-search-fg);
    outline-offset: 2px;
}

.atk-search-clear {
    position: absolute;
    inset-inline-end: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background-color: color-mix(in srgb, var(--atk-search-fg) 22%, transparent);
    color: var(--atk-search-fg);
    cursor: pointer;
    /* materializes with the text instead of popping in */
    transition: background-color var(--atk-transition), transform 0.14s cubic-bezier(0.2, 0, 0.2, 1), opacity 0.14s ease-out;
}

.atk-search-clear[hidden] {
    display: none;
}

@starting-style {
    .atk-search-clear {
        opacity: 0;
        transform: scale(0.7);
    }
}

.atk-search-clear svg {
    width: 12px;
    height: 12px;
    stroke-width: 2.5;
}

.atk-search-clear:hover {
    background-color: color-mix(in srgb, var(--atk-search-fg) 36%, transparent);
}

.atk-search-clear:active {
    transform: scale(0.88);
}

.atk-search-clear:focus-visible {
    outline: 2px solid var(--atk-search-fg);
    outline-offset: 2px;
}

.atk-lang-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 8px;
}

.atk-modules-empty {
    margin: 0;
    padding: 32px 12px;
    text-align: center;
    color: var(--atk-gray-500);
    font-size: 14px;
}

.atk-lang-empty {
    order: 2; /* stays below the (re-ordered) result rows */
    margin: 0;
    padding: 24px 12px;
    text-align: center;
    color: var(--atk-gray-500);
    font-size: 14px;
}

.atk-lang-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    flex-shrink: 0;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: none;
    color: var(--atk-gray-900);
    font-size: 14px;
    text-align: start;
    cursor: pointer;
    transition: background-color var(--atk-transition), transform 0.1s ease-out;
}

.atk-lang-option[hidden],
.atk-module[hidden],
.atk-profile-item[hidden],
.atk-modules-grid[hidden],
.atk-modules-card[hidden],
.atk-profiles-card[hidden] {
    display: none;
}

.atk-lang-option:hover {
    background-color: var(--atk-gray-100, rgba(0, 0, 0, 0.06));
}

/* feedback on press, not on release */
.atk-lang-option:active {
    transform: scale(0.98);
}

.atk-lang-option-label {
    flex: 1;
}

/* Selected row: tint + accent border + accent label + check disc, so it
   reads as chosen at a glance instead of relying on weight alone */
.atk-lang-option-active {
    font-weight: 600;
    color: var(--atk-primary);
    background-color: color-mix(in srgb, var(--atk-primary) 10%, transparent);
    border-color: color-mix(in srgb, var(--atk-primary) 45%, transparent);
}

.atk-lang-option-active:hover {
    background-color: color-mix(in srgb, var(--atk-primary) 16%, transparent);
}

.atk-lang-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--atk-primary);
    color: var(--atk-white);
}

.atk-lang-check svg {
    width: 12px;
    height: 12px;
}

.atk-statement-link {
    padding-inline: 16px;
    text-decoration: none;
    white-space: nowrap;
}

/* Statement Panel */
.atk-statement-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.atk-statement-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    color: var(--atk-gray-700);
    font-size: 14px;
    line-height: 1.7;
}

.atk-statement-content h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--atk-gray-900);
    margin: 24px 0 8px 0;
}

.atk-statement-content h3:first-child {
    margin-top: 0;
}

.atk-statement-content p {
    margin: 0 0 12px 0;
}

.atk-statement-content ul {
    margin: 0 0 12px 0;
    padding-left: 20px;
}

.atk-statement-content li {
    margin-bottom: 6px;
}

.atk-statement-content a {
    color: var(--atk-primary);
    text-decoration: underline;
}

.atk-statement-date {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--atk-gray-200);
    color: var(--atk-gray-500);
    font-size: 13px;
}

/* Panel Content */
.atk-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.atk-panel-content::-webkit-scrollbar {
    width: 6px;
}

.atk-panel-content::-webkit-scrollbar-track {
    background: transparent;
}

.atk-panel-content::-webkit-scrollbar-thumb {
    background: var(--atk-gray-300);
    border-radius: 3px;
}

/* ==========================================================================
   Profile Section
   ========================================================================== */
.atk-profiles-card {
    background: var(--atk-white);
    border-radius: var(--atk-radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 16px -8px rgba(15, 23, 42, 0.12);
}

.atk-profiles-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--atk-gray-800);
    margin: 0 0 16px 0;
}

.atk-profile-item {
    display: flex;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--atk-gray-100);
}

.atk-profile-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.atk-profile-item:first-of-type {
    padding-top: 0;
}

.atk-profile-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--atk-gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 14px;
    flex-shrink: 0;
}

.atk-profile-icon svg {
    width: 24px;
    height: 24px;
    color: var(--atk-gray-600);
}

.atk-profile-info {
    flex: 1;
}

.atk-profile-name {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.005em;
    color: var(--atk-gray-800);
    margin: 0 0 3px 0;
}

.atk-profile-desc {
    font-size: 13px;
    color: var(--atk-gray-500);
    margin: 0;
}

/* Toggle Switch */
.atk-toggle-switch {
    position: relative;
    width: 52px;
    height: 30px;
    flex-shrink: 0;
}

.atk-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.atk-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--atk-gray-300);
    transition: background-color 0.25s var(--atk-ease-out);
    border-radius: 30px;
}

.atk-toggle-switch input:focus-visible + .atk-toggle-slider {
    outline: 3px solid color-mix(in srgb, var(--atk-primary) 55%, transparent);
    outline-offset: 3px;
}

.atk-toggle-slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    /* a switch is a physical thing - the knob settles with a touch of overshoot */
    transition: transform 0.35s cubic-bezier(0.34, 1.35, 0.64, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.atk-toggle-switch input:checked + .atk-toggle-slider {
    background-color: var(--atk-primary);
}

.atk-toggle-switch input:checked + .atk-toggle-slider:before {
    transform: translateX(22px);
}

/* ==========================================================================
   Module Cards
   ========================================================================== */
.atk-modules-card {
    background: var(--atk-white);
    border-radius: var(--atk-radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 16px -8px rgba(15, 23, 42, 0.12);
}

.atk-modules-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.012em;
    color: var(--atk-gray-800);
    margin: 0 0 16px 0;
}

.atk-modules-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

/* Individual Module */
.atk-module {
    background: var(--atk-gray-50);
    border-radius: var(--atk-radius-sm);
    padding: 20px 12px;
    text-align: center;
    cursor: pointer;
    transition: background-color var(--atk-transition), border-color var(--atk-transition), transform 0.1s ease-out;
    border: 2px solid transparent;
    -webkit-tap-highlight-color: transparent;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

@media (hover: hover) {
    .atk-module:hover {
        background: var(--atk-gray-100);
    }
}

.atk-module:active {
    transform: scale(0.97);
}

.atk-module:focus-visible {
    outline: 2px solid var(--atk-primary);
    outline-offset: 2px;
}

.atk-module.atk-module-active {
    background: #eff6ff; /* fallback for browsers without color-mix */
    background: color-mix(in srgb, var(--atk-active) 8%, #ffffff);
    border-color: var(--atk-active);
}

.atk-module-icon {
    width: 32px;
    height: 32px;
    margin: 0 auto 12px;
    color: var(--atk-gray-700);
}

.atk-module.atk-module-active .atk-module-icon {
    color: var(--atk-active);
}

.atk-module-icon svg {
    width: 100%;
    height: 100%;
    stroke-width: 1.5;
}

.atk-module-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--atk-gray-700);
    line-height: 1.3;
}

.atk-module.atk-module-active .atk-module-label {
    color: var(--atk-active);
}

/* ==========================================================================
   Stepper Module (Font Size, Line Height - 0% to 100% in 10% steps)
   ========================================================================== */
.atk-module-stepper {
    grid-column: span 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    min-height: auto;
}

.atk-module-stepper .atk-module-label {
    margin-bottom: 14px;
    font-size: 14px;
    font-weight: 600;
}

.atk-stepper-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    justify-content: center;
}

.atk-stepper-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--atk-primary);
    color: var(--atk-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--atk-transition), transform 0.1s ease-out;
    font-size: 24px;
    -webkit-tap-highlight-color: transparent;
    font-weight: 400;
    line-height: 1;
}

@media (hover: hover) {
    .atk-stepper-btn:hover {
        background: var(--atk-primary-dark);
    }
}

.atk-stepper-btn:active:not(:disabled) {
    transform: scale(0.9);
}

.atk-stepper-btn:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--atk-primary) 55%, transparent);
    outline-offset: 2px;
}

.atk-stepper-btn:disabled {
    background: var(--atk-gray-300);
    cursor: not-allowed;
    transform: none;
}

.atk-stepper-btn svg {
    width: 22px;
    height: 22px;
}

.atk-stepper-value {
    min-width: 80px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--atk-gray-700);
    padding: 8px 16px;
    background: var(--atk-white);
    border-radius: 8px;
    border: 1px solid var(--atk-gray-200);
}

/* ==========================================================================
   Cycle Module
   ========================================================================== */
.atk-module-cycle {
    flex-direction: column;
    gap: 4px;
}

.atk-cycle-value {
    font-size: 11px;
    font-weight: 600;
    color: var(--atk-active);
    margin-top: 2px;
}

/* ==========================================================================
   Reset Button
   ========================================================================== */
.atk-reset-btn {
    width: 100%;
    padding: 18px;
    background: var(--atk-primary);
    color: var(--atk-white);
    border: none;
    border-radius: var(--atk-radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--atk-transition), transform 0.1s ease-out;
    margin-top: 8px;
    letter-spacing: -0.005em;
    -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
    .atk-reset-btn:hover {
        background: var(--atk-primary-dark);
    }
}

.atk-reset-btn:active {
    transform: scale(0.98);
}

.atk-reset-btn:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--atk-primary) 55%, transparent);
    outline-offset: 2px;
}

/* ==========================================================================
   Reading Line - Black inner, colored outer border
   ========================================================================== */
.atk-reading-line {
    position: fixed;
    left: 0;
    right: 0;
    height: 18px;
    background: #000000;
    border-top: 3px solid var(--atk-primary);
    border-bottom: 3px solid var(--atk-primary);
    top: 0;
    pointer-events: none;
    z-index: calc(var(--atk-z-index) - 1);
    opacity: 0;
    transition: opacity var(--atk-transition);
    will-change: transform;
}

.atk-reading-line.atk-active {
    opacity: 1;
}

/* ==========================================================================
   Reading Mask
   ========================================================================== */
.atk-reading-mask {
    position: fixed;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: calc(var(--atk-z-index) - 1);
    opacity: 0;
    transition: opacity var(--atk-transition);
}

.atk-reading-mask.atk-active {
    opacity: 1;
}

.atk-reading-mask-top {
    top: 0;
}

.atk-reading-mask-bottom {
    bottom: 0;
}

/* Reading Handle - Touch drag handle for mobile */
.atk-reading-handle {
    position: fixed;
    right: 12px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--atk-primary);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: calc(var(--atk-z-index) + 1);
    transform: translateY(-50%);
    touch-action: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    cursor: grab;
}

.atk-reading-handle.atk-active {
    display: flex;
}

.atk-reading-handle-grip {
    color: var(--atk-white);
    font-size: 20px;
    line-height: 1;
    user-select: none;
    pointer-events: none;
}

/* ==========================================================================
   Text Magnifier
   ========================================================================== */
.atk-magnifier {
    position: fixed;
    padding: 16px 20px;
    background: var(--atk-gray-900);
    color: var(--atk-white);
    font-size: 28px;
    line-height: 1.4;
    border-radius: var(--atk-radius-sm);
    pointer-events: none;
    z-index: calc(var(--atk-z-index) + 1);
    opacity: 0;
    transition: opacity var(--atk-transition);
    max-width: 450px;
    box-shadow: var(--atk-shadow);
}

.atk-magnifier.atk-active {
    opacity: 1;
}

/* ==========================================================================
   Big Cursor
   ========================================================================== */
/* ponytail: echter System-Cursor als SVG statt eines nachgezogenen DOM-Elements */
body.atk-bigger-cursor,
body.atk-bigger-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2248%22%20height%3D%2248%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22M3%202%20L3%2020%20L7.6%2015.6%20L10.8%2022.4%20L13.6%2021.1%20L10.5%2014.6%20L16.6%2014.4%20Z%22%20fill%3D%22%23fff%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.4%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E") 6 4, auto !important;
}

body.atk-bigger-cursor a,
body.atk-bigger-cursor button,
body.atk-bigger-cursor label,
body.atk-bigger-cursor select,
body.atk-bigger-cursor summary,
body.atk-bigger-cursor [role="button"],
body.atk-bigger-cursor [onclick],
body.atk-bigger-cursor input[type="button"],
body.atk-bigger-cursor input[type="submit"],
body.atk-bigger-cursor input[type="reset"],
body.atk-bigger-cursor input[type="checkbox"],
body.atk-bigger-cursor input[type="radio"] {
    cursor: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2248%22%20height%3D%2248%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22M9%2021.5c-.9%200-1.7-.35-2.3-1l-3.4-3.5a1.4%201.4%200%200%201%201.9-2l1.8%201.5V5.4a1.5%201.5%200%200%201%203%200v5.6h.6V7.4a1.5%201.5%200%200%201%203%200v3.6h.6V8.4a1.5%201.5%200%200%201%203%200v2.6h.6V9.9a1.5%201.5%200%200%201%203%200v6.6c0%202.8-2.2%205-5%205Z%22%20fill%3D%22%23fff%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.4%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E") 18 6, pointer !important;
}

body.atk-bigger-cursor input[type="text"],
body.atk-bigger-cursor input[type="email"],
body.atk-bigger-cursor input[type="search"],
body.atk-bigger-cursor input[type="url"],
body.atk-bigger-cursor input[type="tel"],
body.atk-bigger-cursor input[type="password"],
body.atk-bigger-cursor textarea {
    cursor: text !important;
}

/* ==========================================================================
   Accessibility Styles Applied to Body
   ========================================================================== */

/* Text Size - Applied to html for rem inheritance + all text elements for px-based sizes */
html.atk-text-size-10 { font-size: 110% !important; }
html.atk-text-size-20 { font-size: 120% !important; }
html.atk-text-size-30 { font-size: 130% !important; }
html.atk-text-size-40 { font-size: 140% !important; }
html.atk-text-size-50 { font-size: 150% !important; }
html.atk-text-size-60 { font-size: 160% !important; }
html.atk-text-size-70 { font-size: 170% !important; }
html.atk-text-size-80 { font-size: 180% !important; }
html.atk-text-size-90 { font-size: 190% !important; }
html.atk-text-size-100 { font-size: 200% !important; }

/* ponytail: kein `font-size: inherit` auf p/h1..h6/div mehr - das hat die
   Groessenhierarchie plattgemacht und Ueberschriften beim Vergroessern
   verkleinert. Skaliert wird nur noch ueber html{font-size}, also alles was
   rem/em/% nutzt. Ceiling: Themes mit harten px-Groessen skalieren nicht mit;
   dafuer muesste JS die Basisgroessen einmal messen und inline setzen. */

/* Exclude the accessibility widget from text scaling.
   ponytail: nur der Container wird abgekoppelt - das alte `revert !important`
   auf jedem Kind hat die px-Groessen des Widgets ueberschrieben. */
html[class*="atk-text-size-"] #atk-widget {
    font-size: 16px !important;
}

/* Line Height - 10% increments from 0 to 100% (widget excluded) */
body.atk-line-height-10 *:not(#atk-widget):not(#atk-widget *) { line-height: 1.6 !important; }
body.atk-line-height-20 *:not(#atk-widget):not(#atk-widget *) { line-height: 1.7 !important; }
body.atk-line-height-30 *:not(#atk-widget):not(#atk-widget *) { line-height: 1.8 !important; }
body.atk-line-height-40 *:not(#atk-widget):not(#atk-widget *) { line-height: 1.9 !important; }
body.atk-line-height-50 *:not(#atk-widget):not(#atk-widget *) { line-height: 2.0 !important; }
body.atk-line-height-60 *:not(#atk-widget):not(#atk-widget *) { line-height: 2.1 !important; }
body.atk-line-height-70 *:not(#atk-widget):not(#atk-widget *) { line-height: 2.2 !important; }
body.atk-line-height-80 *:not(#atk-widget):not(#atk-widget *) { line-height: 2.3 !important; }
body.atk-line-height-90 *:not(#atk-widget):not(#atk-widget *) { line-height: 2.4 !important; }
body.atk-line-height-100 *:not(#atk-widget):not(#atk-widget *) { line-height: 2.5 !important; }

/* Letter Spacing - Simple on/off (widget excluded) */
body.atk-letter-spacing *:not(#atk-widget):not(#atk-widget *) {
    letter-spacing: 0.12em !important;
}

/* Font Weight (widget excluded) */
body.atk-font-weight *:not(#atk-widget):not(#atk-widget *) { font-weight: 700 !important; }

/* Readable Font (widget excluded) */
body.atk-readable-font,
body.atk-readable-font *:not(#atk-widget):not(#atk-widget *) {
    font-family: Arial, Helvetica, sans-serif !important;
}

/* Dyslexic Font */
@font-face {
    font-family: 'OpenDyslexic';
    src: url('../fonts/OpenDyslexic-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'OpenDyslexic';
    src: url('../fonts/OpenDyslexic-Bold.woff') format('woff');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

body.atk-dyslexic-font,
body.atk-dyslexic-font *:not(#atk-widget):not(#atk-widget *) {
    font-family: 'OpenDyslexic', Arial, sans-serif !important;
}

/* Text Align (widget excluded) */
body.atk-text-align-left *:not(#atk-widget):not(#atk-widget *) { text-align: left !important; }
body.atk-text-align-center *:not(#atk-widget):not(#atk-widget *) { text-align: center !important; }
body.atk-text-align-right *:not(#atk-widget):not(#atk-widget *) { text-align: right !important; }

/* Highlight Links */
body.atk-highlight-links a:not(#atk-widget a) {
    background-color: #ffff00 !important;
    color: #000000 !important;
    padding: 2px 6px !important;
    text-decoration: underline !important;
    border-radius: 3px !important;
}

/* ==========================================================================
   Color Contrast Modes - EXCLUDE WIDGET
   ========================================================================== */

/* Dark Contrast */
body.atk-dark-contrast {
    background: #000 !important;
}

body.atk-dark-contrast *:not(#atk-widget):not(#atk-widget *):not(.atk-reading-line):not(.atk-reading-mask):not(.atk-magnifier):not(.atk-reading-handle):not(.atk-reading-handle *) {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #333 !important;
}

body.atk-dark-contrast img:not(#atk-widget img) {
    opacity: 0.85;
}

/* Light Contrast */
body.atk-light-contrast {
    background: #fff !important;
}

body.atk-light-contrast *:not(#atk-widget):not(#atk-widget *):not(img):not(.atk-reading-line):not(.atk-reading-mask):not(.atk-magnifier):not(.atk-reading-handle):not(.atk-reading-handle *) {
    background-color: #fff !important;
    color: #000 !important;
    border-color: #000 !important;
}

/* Don't affect images in light contrast */
body.atk-light-contrast img {
    /* Keep images as they are */
}

/* High Contrast */
body.atk-high-contrast {
    background: #000 !important;
}

body.atk-high-contrast *:not(#atk-widget):not(#atk-widget *):not(img):not(.atk-reading-line):not(.atk-reading-mask):not(.atk-magnifier):not(.atk-reading-handle):not(.atk-reading-handle *) {
    background-color: #000 !important;
    color: #ffff00 !important;
    border-color: #ffff00 !important;
}

body.atk-high-contrast a:not(#atk-widget a) {
    color: #00ffff !important;
}

/* Don't affect images in high contrast */
body.atk-high-contrast img {
    /* Keep images as they are */
}

/* Monochrome - applied to html like saturation: a filter on the root element
   does NOT create a containing block for position:fixed descendants,
   per-element filters do (breaks sticky/fixed headers of the site) */
html.atk-monochrome {
    filter: grayscale(100%) !important;
}

/* Saturation - applied to html to avoid stacking filters on individual elements */
html.atk-saturation-10 { filter: saturate(1.2) !important; }
html.atk-saturation-20 { filter: saturate(1.4) !important; }
html.atk-saturation-30 { filter: saturate(1.6) !important; }
html.atk-saturation-40 { filter: saturate(1.8) !important; }
html.atk-saturation-50 { filter: saturate(2.0) !important; }
html.atk-saturation-60 { filter: saturate(2.2) !important; }
html.atk-saturation-70 { filter: saturate(2.4) !important; }
html.atk-saturation-80 { filter: saturate(2.6) !important; }
html.atk-saturation-90 { filter: saturate(2.8) !important; }
html.atk-saturation-100 { filter: saturate(3.0) !important; }

/* ==========================================================================
   Orientation Styles
   ========================================================================== */

/* Stop Animations - EXCLUDE WIDGET */
body.atk-stop-animations *:not(#atk-widget):not(#atk-widget *):not(.atk-panel),
body.atk-stop-animations *:not(#atk-widget):not(#atk-widget *):not(.atk-panel)::before,
body.atk-stop-animations *:not(#atk-widget):not(#atk-widget *):not(.atk-panel)::after {
    animation: none !important;
    animation-duration: 0s !important;
    transition: none !important;
}

/* Highlight Titles - BLACK text on YELLOW background */
body.atk-highlight-titles h1:not(#atk-widget h1),
body.atk-highlight-titles h2:not(#atk-widget h2),
body.atk-highlight-titles h3:not(#atk-widget h3),
body.atk-highlight-titles h4:not(#atk-widget h4),
body.atk-highlight-titles h5:not(#atk-widget h5),
body.atk-highlight-titles h6:not(#atk-widget h6) {
    background: linear-gradient(to right, #fef08a, #fde047) !important;
    color: #000000 !important;
    padding: 6px 14px !important;
    border-radius: 6px !important;
    /* display: inline-block !important; */
}

/* Highlight Content */
body.atk-highlight-content *:not(#atk-widget):not(#atk-widget *):hover {
    outline: 3px solid var(--atk-primary) !important;
    outline-offset: 3px !important;
}

/* Keyboard Navigation */
body.atk-keyboard-nav *:focus {
    outline: 3px solid var(--atk-primary) !important;
    outline-offset: 4px !important;
    box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.25) !important;
}

/* Hide Images - COMPLETELY HIDDEN */
body.atk-hide-images img:not(#atk-widget img),
body.atk-hide-images picture,
body.atk-hide-images video,
body.atk-hide-images figure img {
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Background images: nur das Bild entfernen, niemals das Element verstecken -
   sonst verschwindet der Text darin mit (Hero, CTA-Sections etc.).
   ponytail: greift nur bei inline style; per Stylesheet gesetzte Hintergruende
   bleiben sichtbar - erst per JS-Scan der computed styles loesen, wenn noetig. */
body.atk-hide-images [style*="background-image"]:not(#atk-widget):not(#atk-widget *) {
    background-image: none !important;
}

/* ==========================================================================
   Accessibility Profiles - EXCLUDE WIDGET FROM ALL FILTERS
   ========================================================================== */

/* ==========================================================================
   TTS Highlight for clicked text
   ========================================================================== */
.atk-tts-highlight {
    background-color: var(--atk-primary) !important;
    color: #fff !important;
    padding: 2px 4px;
    border-radius: 3px;
}

/* ==========================================================================
   Mobile Responsive
   ========================================================================== */
@media (max-width: 480px) {
    #atk-widget {
        bottom: 16px !important;
    }
    
    #atk-widget.atk-position-right {
        right: 16px !important;
    }
    
    #atk-widget.atk-position-left {
        left: 16px !important;
    }
    
    .atk-panel {
        width: 100% !important;
    }
    
    .atk-modules-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .atk-module {
        padding: 16px 10px;
        min-height: 90px;
    }

    .atk-panel-header {
        padding: 14px 14px 14px;
        gap: 12px;
    }

    .atk-lang-btn {
        flex: 1;
        justify-content: center;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    #atk-widget,
    .atk-reading-line,
    .atk-reading-mask,
    .atk-magnifier {
        display: none !important;
    }
}

/* ==========================================================================
   Reduced Motion Support
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    /* not "no feedback" - a short cross-fade instead of movement */
    .atk-panel,
    .atk-panel.atk-panel-open {
        transition: opacity 0.2s ease, visibility 0.2s !important;
        transform: none !important;
    }

    .atk-toggle-btn,
    .atk-module,
    .atk-panel-close,
    .atk-lang-btn,
    .atk-search-clear,
    .atk-statement-link,
    .atk-stepper-btn,
    .atk-reset-btn,
    .atk-toggle-slider,
    .atk-toggle-slider:before {
        transition: opacity 0.15s ease, background-color 0.15s ease !important;
    }

    .atk-toggle-btn:hover,
    .atk-toggle-btn:active,
    .atk-lang-option:active,
    .atk-search-clear:active,
    .atk-module:active,
    .atk-panel-close:active,
    .atk-lang-btn:active,
    .atk-statement-link:active,
    .atk-stepper-btn:active:not(:disabled),
    .atk-reset-btn:active {
        transform: none;
    }
}

/* ==========================================================================
   High Contrast
   ========================================================================== */
@media (prefers-contrast: more) {
    .atk-lang-option-active {
        background-color: transparent;
        border: 2px solid currentColor;
    }

    .atk-panel-close,
    .atk-lang-btn,
    .atk-statement-link {
        background-color: transparent;
        border: 2px solid var(--atk-header-text);
    }

    .atk-panel-header::after {
        display: none;
    }
}

