/* Accessibility Panel Styles */

/* Screen Reader Only - visually hidden but accessible */
.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;
}

/* Skip-Link für Barrierefreiheit */
/* Standardmäßig versteckt, nur bei Tastaturfokus sichtbar */
.skip-link {
    position: absolute !important;
    left: -9999px !important;
    top: 0 !important;
    background: #000 !important;
    color: #fff !important;
    padding: 8px 16px !important;
    text-decoration: none !important;
    z-index: 10000000 !important;
    font-weight: bold !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

.skip-link:focus {
    left: 0 !important;
    top: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
    outline: 3px solid #fff !important;
    outline-offset: 2px !important;
}

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

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

@font-face {
    font-family: 'OpenDyslexic';
    src: url('/assets/fonts/OpenDyslexic-Italic.woff') format('woff');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'OpenDyslexic';
    src: url('/assets/fonts/OpenDyslexic-BoldItalic.woff') format('woff');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

/* Floating Action Button */
.a11y-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #8b2a0f;
    color: #ffffff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10000001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    pointer-events: auto;
}

.a11y-fab:hover,
.a11y-fab:focus {
    background-color: #6b1f0a;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    outline: 3px solid #ffffff;
    outline-offset: 2px;
}

.a11y-fab:active {
    transform: scale(0.95);
}

.a11y-fab svg {
    width: 28px;
    height: 28px;
}

/* Panel Dialog */
.a11y-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.a11y-panel[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Panel Overlay */
.a11y-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: auto;
}

.a11y-panel[aria-hidden="false"] .a11y-panel-overlay {
    opacity: 1;
    visibility: visible;
}

.a11y-panel-content {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    z-index: 10000000;
    transition: transform 0.3s ease;
    --panel-scale: 0.9;
    /* Filter transition removed - filters are applied via JavaScript and should not animate */
    will-change: transform;
    /* Note: isolation removed to allow filters to work properly */
    overflow-y: auto;
}

.a11y-panel[aria-hidden="false"] .a11y-panel-content {
    transform: translateX(-50%) scale(1);
    --panel-scale: 1;
}


/* Panel Header */
.a11y-panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.a11y-panel-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #333333;
}

.a11y-panel-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: #666666;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
}

.a11y-panel-close:hover,
.a11y-panel-close:focus {
    background-color: #f0f0f0;
    color: #333333;
    outline: 2px solid #8b2a0f;
    outline-offset: 2px;
}

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

/* Panel Body */
.a11y-panel-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.a11y-section {
    margin-bottom: 32px;
}

.a11y-section:last-child {
    margin-bottom: 0;
}

.a11y-section h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333333;
}

.a11y-control-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.a11y-control-group label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 12px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.a11y-control-group label:hover {
    background-color: #f5f5f5;
}

.a11y-control-group input[type="radio"],
.a11y-control-group input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    cursor: pointer;
    border: 2px solid #8b2a0f !important;
    background-color: #ffffff !important;
    position: relative;
    flex: 0 0 20px !important;
    align-self: center;
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
}

.a11y-control-group input[type="radio"] {
    border-radius: 50%;
}

.a11y-control-group input[type="checkbox"] {
    border-radius: 4px;
}

/* Checked state - filled circle/checkmark */
.a11y-control-group input[type="radio"]:checked {
    background-color: #8b2a0f !important;
    border-color: #8b2a0f !important;
}

.a11y-control-group input[type="radio"]:checked::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 8px !important;
    height: 8px !important;
    background-color: #ffffff !important;
    border-radius: 50% !important;
    display: block !important;
}

.a11y-control-group input[type="checkbox"]:checked {
    background-color: #8b2a0f !important;
    border-color: #8b2a0f !important;
}

.a11y-control-group input[type="checkbox"]:checked::after {
    content: '' !important;
    position: absolute !important;
    top: 2px !important;
    left: 6px !important;
    width: 5px !important;
    height: 10px !important;
    border: solid #ffffff !important;
    border-width: 0 2px 2px 0 !important;
    transform: rotate(45deg) !important;
    display: block !important;
}

.a11y-control-group input[type="radio"]:focus,
.a11y-control-group input[type="checkbox"]:focus {
    outline: 2px solid #8b2a0f;
    outline-offset: 2px;
}

/* Hover state */
.a11y-control-group input[type="radio"]:hover,
.a11y-control-group input[type="checkbox"]:hover {
    border-color: #6b1f0a;
}

.a11y-control-group span {
    font-size: 16px;
    color: #333333;
    flex: 1;
}

/* Font Size Controls */
.a11y-control-group:has(#font-size-decrease) {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.a11y-btn-small {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    border: 2px solid #8b2a0f;
    background-color: #ffffff;
    color: #8b2a0f;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.a11y-btn-small:hover,
.a11y-btn-small:focus {
    background-color: #8b2a0f;
    color: #ffffff;
    outline: 2px solid #8b2a0f;
    outline-offset: 2px;
}

.a11y-value {
    font-size: 18px;
    font-weight: 600;
    color: #333333;
    min-width: 60px;
    text-align: center;
}

/* Panel Footer */
.a11y-panel-footer {
    padding: 20px 24px;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.a11y-footer-buttons {
    display: flex;
    gap: 12px;
    flex-direction: row;
}

.a11y-btn-primary {
    flex: 1;
    padding: 12px 24px;
    background-color: #8b2a0f;
    color: #ffffff;
    border: 2px solid #8b2a0f;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.a11y-btn-primary:hover,
.a11y-btn-primary:focus {
    background-color: #6b1f0a;
    border-color: #6b1f0a;
    outline: 2px solid #8b2a0f;
    outline-offset: 2px;
}

.a11y-btn-reset {
    flex: 1;
    padding: 12px 24px;
    background-color: #f5f5f5;
    color: #333333;
    border: 2px solid #cccccc;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.a11y-btn-reset:hover,
.a11y-btn-reset:focus {
    background-color: #e0e0e0;
    border-color: #999999;
    outline: 2px solid #8b2a0f;
    outline-offset: 2px;
}

/* Reading Line */
.reading-line {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #8b2a0f;
    z-index: 9999997;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.reading-line.active {
    opacity: 1;
    visibility: visible;
}

/* Accessibility Feature Classes */
/* Apply filters to content wrapper instead of body */
#a11y-content-wrapper.high-contrast {
    filter: contrast(1.5) !important;
    background-color: #ffffff;
    min-height: 100vh;
}

/* IMPORTANT: Do NOT apply filter to html or body - this breaks position:fixed elements!
   CSS filters on html/body create a new containing block for position:fixed elements.
   Only apply filter to #a11y-content-wrapper */

/* Ensure body has background when high contrast (but NO filter on body!) */
body.high-contrast {
    background-color: #ffffff !important;
    background: #ffffff !important;
}

/* Fallback: apply to body if wrapper doesn't exist */
body.high-contrast:not(:has(.a11y-fab)) {
    filter: contrast(1.5);
}

/* High contrast mode - no special position rules needed since filter is not on html/body */

/* High contrast mode - panel elements should also have high contrast */
/* Since filter is only on wrapper, panel elements need their own filter */
body.high-contrast .a11y-panel-content {
    filter: contrast(1.5) !important;
}

body.high-contrast .a11y-fab {
    filter: contrast(1.5) !important;
}

/* Apply filters to content wrapper instead of body */
#a11y-content-wrapper.inverted {
    filter: invert(1) hue-rotate(180deg) !important;
    /* Ensure wrapper has a background so filter can work */
    background-color: #ffffff;
    min-height: 100vh;
}

/* IMPORTANT: Do NOT apply filter to html or body - this breaks position:fixed elements!
   CSS filters on html/body create a new containing block for position:fixed elements.
   Only apply filter to #a11y-content-wrapper */

/* Ensure body has background when inverted (but NO filter on body!) */
body.inverted {
    background-color: #ffffff !important;
    background: #ffffff !important;
}

/* No fallback filter on body - it breaks position:fixed elements */

/* Inverted mode - no special position rules needed since filter is not on html/body */

/* Inverted mode - panel elements should also be inverted */
/* Since filter is only on wrapper, panel elements need their own filter */
body.inverted .a11y-panel-content {
    filter: invert(1) hue-rotate(180deg) !important;
}

body.inverted .a11y-fab {
    filter: invert(1) hue-rotate(180deg) !important;
}

/* Font size scaling using zoom (works with px-based designs) */
/* Note: zoom is supported in all modern browsers including Firefox 126+ */
/* Reduced zoom factors for better usability */
html.font-size-120 {
    zoom: 1.05;  /* 5% zoom */
}

html.font-size-150 {
    zoom: 1.12;  /* 12% zoom */
}

html.font-size-200 {
    zoom: 1.2;   /* 20% zoom - maximum */
}

body.dyslexia-font,
body.dyslexia-font * {
    font-family: 'OpenDyslexic', 'Comic Sans MS', 'Comic Sans', cursive, sans-serif !important;
}

/* OpenDyslexic is larger than standard fonts, so reduce size */
body.dyslexia-font {
    font-size: 85% !important;
}

/* Headings keep normal size in dyslexia font (no reduction needed) */
body.dyslexia-font h1,
body.dyslexia-font h2,
body.dyslexia-font h3 {
    font-size: 100% !important;
}

/* Slide numbers */
body.dyslexia-font .slide-nr,
body.dyslexia-font #curr-slide-nr {
    font-size: 92% !important;
}

/* Adjust zoom levels when dyslexia font is active */
html.font-size-120 body.dyslexia-font {
    font-size: 80% !important;
}

html.font-size-120 body.dyslexia-font h1,
html.font-size-120 body.dyslexia-font h2,
html.font-size-120 body.dyslexia-font h3 {
    font-size: 100% !important;
}

html.font-size-120 body.dyslexia-font .slide-nr,
html.font-size-120 body.dyslexia-font #curr-slide-nr {
    font-size: 88% !important;
}

html.font-size-150 body.dyslexia-font {
    font-size: 75% !important;
}

html.font-size-150 body.dyslexia-font h1,
html.font-size-150 body.dyslexia-font h2,
html.font-size-150 body.dyslexia-font h3 {
    font-size: 100% !important;
}

html.font-size-150 body.dyslexia-font .slide-nr,
html.font-size-150 body.dyslexia-font #curr-slide-nr {
    font-size: 82% !important;
}

html.font-size-200 body.dyslexia-font {
    font-size: 70% !important;
}

html.font-size-200 body.dyslexia-font h1,
html.font-size-200 body.dyslexia-font h2,
html.font-size-200 body.dyslexia-font h3 {
    font-size: 100% !important;
}

html.font-size-200 body.dyslexia-font .slide-nr,
html.font-size-200 body.dyslexia-font #curr-slide-nr {
    font-size: 78% !important;
}

body.highlight-links a:not(.button):not(nav a) {
    background-color: #ffff00 !important;
    color: #000000 !important;
    padding: 2px 4px !important;
    border-radius: 2px !important;
    font-weight: 700 !important;
    text-decoration: underline !important;
}

body.large-cursor,
body.large-cursor * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><circle cx="16" cy="16" r="14" fill="%23000" opacity="0.5"/><circle cx="16" cy="16" r="2" fill="%23fff"/></svg>') 16 16, auto !important;
}

body.stop-animations *,
body.stop-animations *::before,
body.stop-animations *::after {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
}

body.stop-animations img[src$=".gif"] {
    animation-play-state: paused !important;
}

body.focus-mode .hero,
body.focus-mode aside:not(.blog-sidebar):not(.a11y-panel),
body.focus-mode .image-links,
body.focus-mode .slider:not(.siema) {
    display: none !important;
}

/* Ensure FAB and Panel are always visible, even in focus mode */
body.focus-mode .a11y-fab {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

body.focus-mode .a11y-panel {
    display: flex !important;
}

body.focus-mode .a11y-panel[aria-hidden="false"] {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

body.focus-mode .a11y-panel-overlay {
    display: block !important;
}

body.focus-mode .a11y-panel[aria-hidden="false"] .a11y-panel-overlay {
    visibility: visible !important;
    opacity: 1 !important;
}

body.focus-mode .a11y-panel-content {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* ================================================
   GLOBAL FORM STYLING
   Radio Buttons and Checkboxes for entire website
   ================================================ */

/* Base styling for all radio buttons and checkboxes */
input[type="radio"],
input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    cursor: pointer;
    border: 2px solid #8b2a0f;
    background-color: #ffffff;
    position: relative;
    vertical-align: middle;
    margin-right: 8px;
}

input[type="radio"] {
    border-radius: 50%;
}

input[type="checkbox"] {
    border-radius: 4px;
}

/* Checked state for radio buttons */
input[type="radio"]:checked {
    background-color: #8b2a0f;
    border-color: #8b2a0f;
}

input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background-color: #ffffff;
    border-radius: 50%;
    display: block;
}

/* Checked state for checkboxes */
input[type="checkbox"]:checked {
    background-color: #8b2a0f;
    border-color: #8b2a0f;
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 6px;
    width: 5px;
    height: 10px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    display: block;
}

/* Focus state */
input[type="radio"]:focus,
input[type="checkbox"]:focus {
    outline: 2px solid #8b2a0f;
    outline-offset: 2px;
}

/* Hover state */
input[type="radio"]:hover,
input[type="checkbox"]:hover {
    border-color: #6b1f0a;
}

/* Disabled state */
input[type="radio"]:disabled,
input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .a11y-fab {
        width: 56px;
        height: 56px;
        bottom: 16px;
        right: 16px;
    }

    .a11y-fab svg {
        width: 24px;
        height: 24px;
    }

    .a11y-panel-content {
        width: 95%;
        max-height: calc(100vh - 20px);
        top: 10px;
    }

    .a11y-panel-header {
        padding: 16px 20px;
    }

    .a11y-panel-header h2 {
        font-size: 20px;
    }

    .a11y-panel-body {
        padding: 20px;
    }

    .a11y-panel-footer {
        padding: 16px 20px;
    }

    .a11y-footer-buttons {
        flex-direction: column;
    }

    .a11y-btn-primary,
    .a11y-btn-reset {
        width: 100%;
    }
}
