/**
 * SOSU Barrierefreiheit Toolbar CSS
 * 
 * Copyright (c) 2025 Elias Arnold
 * You should have received a copy of the licence with this file.
 * If not, please contact the Author at licence@eliasarnold.com
 */

@media (prefers-reduced-motion: reduce) {
    .sosu-barrierefreiheit-toolbar,
    .sosu-barrierefreiheit-toolbar * {
        transition: none !important;
        animation: none !important;
        scroll-behavior: auto !important;
    }
}


/* Screen reader text - hide visually but maintain accessibility */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* Toolbar Container */
/* Default state is collapsed (no background) */
.sosu-barrierefreiheit-toolbar {
    background-color: transparent;
    border: none;
    box-shadow: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 16px;
    position: fixed;
    z-index: 99999;
    filter: none !important; /* keep toolbar visually stable */
    opacity: 0;
    visibility: hidden;
}

/* Show toolbar once positioned */
.sosu-barrierefreiheit-toolbar.positioned {
    opacity: 1;
    visibility: visible;
}

/* When options are active, show the background */
.sosu-barrierefreiheit-toolbar:has(.sosu-barrierefreiheit-toolbar-options.active) {
    background-color: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Toolbar Positions */
.sosu-barrierefreiheit-toolbar-top {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.sosu-barrierefreiheit-toolbar-bottom {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.sosu-barrierefreiheit-toolbar-left {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.sosu-barrierefreiheit-toolbar-right {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

/* Toolbar Header */
.sosu-barrierefreiheit-toolbar-header {
    background-color: transparent;
    align-items: center;
    display: flex;
    justify-content: space-between;
    padding: 5px 5px;
}

.sosu-barrierefreiheit-toolbar-header h2 {
    color: #333;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    padding: 0;
}

.sosu-barrierefreiheit-toolbar-toggle {
    background: none;
    border: none;
    color: #333;
    cursor: pointer;
    padding: 2px;
    margin: 0 auto;
}

.sosu-barrierefreiheit-toolbar-toggle svg {
    display: block;
    height: 66px;
    width: 66px;
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.3));
    border-radius: 50%;
}

/* Make the SVG smaller when toolbar options are active */
.sosu-barrierefreiheit-toolbar:has(.sosu-barrierefreiheit-toolbar-options.active) .sosu-barrierefreiheit-toolbar-toggle svg {
    height: 30px;
    width: 30px;
    transition: all 0.3s ease;
}

/* Toolbar Options */
.sosu-barrierefreiheit-toolbar-options {
    display: none;
    padding: 10px 15px;
    border-top: 1px solid #ddd;
}

.sosu-barrierefreiheit-toolbar-options.active {
    display: block;
}

/* Options Buttons */
.sosu-barrierefreiheit-option {
    align-items: center;
    background: none;
    border: none;
    border-radius: 4px;
    color: #333;
    cursor: pointer;
    display: flex;
    margin-bottom: 8px;
    padding: 8px 12px;
    text-align: left;
    width: 100%;
    transition: background-color 0.2s ease;
}

/* Lower specificity for option states */
.sosu-barrierefreiheit-option:where(:hover, :focus) {
    background-color: #f5f5f5;
}
.sosu-barrierefreiheit-option:where(.active) {
    background-color: #e6f2ff;
    color: #0066cc;
}


.sosu-barrierefreiheit-option svg {
    height: 20px;
    margin-right: 10px;
    width: 20px;
}

.sosu-barrierefreiheit-option-reset {
    margin-top: 15px;
    border-top: 1px solid #ddd;
    padding-top: 15px;
}

/* ACCESSIBILITY STYLES */

/* Accessibility Styles: LARGE TEXT*/

/* Granular font size classes for 8px-24px */
.sosu-barrierefreiheit-large-text-08 { font-size: 0.5rem !important; }     /* 8px */
.sosu-barrierefreiheit-large-text-09 { font-size: 0.5625rem !important; }  /* 9px */
.sosu-barrierefreiheit-large-text-10 { font-size: 0.625rem !important; }   /* 10px */
.sosu-barrierefreiheit-large-text-11 { font-size: 0.6875rem !important; }  /* 11px */
.sosu-barrierefreiheit-large-text-12 { font-size: 0.75rem !important; }    /* 12px */
.sosu-barrierefreiheit-large-text-13 { font-size: 0.8125rem !important; }  /* 13px */
.sosu-barrierefreiheit-large-text-14 { font-size: 0.875rem !important; }   /* 14px */
.sosu-barrierefreiheit-large-text-15 { font-size: 0.9375rem !important; }  /* 15px */
.sosu-barrierefreiheit-large-text-16 { font-size: 1rem !important; }       /* 16px */
.sosu-barrierefreiheit-large-text-17 { font-size: 1.0625rem !important; }  /* 17px */
.sosu-barrierefreiheit-large-text-18 { font-size: 1.125rem !important; }   /* 18px */
.sosu-barrierefreiheit-large-text-19 { font-size: 1.1875rem !important; }  /* 19px */
.sosu-barrierefreiheit-large-text-20 { font-size: 1.25rem !important; }    /* 20px */
.sosu-barrierefreiheit-large-text-21 { font-size: 1.3125rem !important; }  /* 21px */
.sosu-barrierefreiheit-large-text-22 { font-size: 1.375rem !important; }   /* 22px */
.sosu-barrierefreiheit-large-text-23 { font-size: 1.4375rem !important; }  /* 23px */
.sosu-barrierefreiheit-large-text-24 { font-size: 1.5rem !important; }     /* 24px */


/*.sosu-barrierefreiheit-large-text {*/
/*    !* Adjust this to your desired minimum readable size *!*/
/*    --sosu-min-font: 1.125rem; !* ~18px *!*/
/*}*/

/*!* Apply a floor to common text/interactive elements (exclude headings) *!*/
/*.sosu-barrierefreiheit-large-text :is(*/
/*    body, p, span, li, dt, dd, blockquote, figcaption,*/
/*    a, button, label, summary,*/
/*    input, select, textarea,*/
/*    strong, em, code, pre,*/
/*    table, thead, tbody, tfoot, tr, th, td*/
/*) {*/
/*    !* Ensure the font is at least --sosu-min-font, but never reduce it *!*/
/*    font-size: clamp(var(--sosu-min-font), 1em, 200rem) !important;*/
/*    line-height: 1.5 !important;*/
/*}*/

/*!* Do NOT touch headings, so existing large sizes stay large (or theme-defined) *!*/
/*.sosu-barrierefreiheit-large-text :is(h1, h2, h3, h4, h5, h6) {*/
/*    !* No overrides here on purpose *!*/
/*}*/


/*!* ========== High Contrast (site-agnostic) ========== *!*/
/*!* Apply by toggling the class on <html> or <body>: .sosu-barrierefreiheit-high-contrast *!*/

/*!* 1) Baseline: do NOT filter media or components likely to carry imagery *!*/
/*.sosu-barrierefreiheit-high-contrast :is(*/
/*  img, video, picture, canvas, iframe, svg*/
/*) {*/
/*    filter: none !important;*/
/*}*/

/*!* Heuristics to avoid filtering background-image containers and common “visual” wrappers *!*/
/*.sosu-barrierefreiheit-high-contrast :where(*/
/*  [style*="background-image"],*/
/*  [style*="background: url"],*/
/*  [style*="background:url"],*/
/*  [role="img"],*/
/*  .has-background,*/
/*  .has-background-dim,*/
/*  .wp-block-cover,*/
/*  .wp-block-cover__image-background,*/
/*  [class*="cover"],*/
/*  [class*="hero"],*/
/*  [class*="banner"],*/
/*  [class*="slider"],*/
/*  [class*="carousel"],*/
/*  [class*="gallery"]*/
/*) {*/
/*    filter: none !important;*/
/*}*/

/*!* 2) Apply contrast boost only to text and interactive elements *!*/
/*!* Keep specificity low; exclude the toolbar so fixed positioning stays stable *!*/
/*.sosu-barrierefreiheit-high-contrast :is(*/
/*  p, h1, h2, h3, h4, h5, h6,*/
/*  ul, ol, li, dl, dt, dd,*/
/*  blockquote, figcaption, caption,*/
/*  a, button, summary, details,*/
/*  label, input, select, textarea,*/
/*  small, strong, em, code, pre,*/
/*  table, thead, tbody, tfoot, tr, th, td*/
/*):not(#sosu-barrierefreiheit-toolbar):not(#sosu-barrierefreiheit-toolbar *) {*/
/*    filter: contrast(140%) saturate(110%) !important;*/
/*}*/

/*!* 3) Optional: accessibility niceties in high-contrast mode *!*/
/*.sosu-barrierefreiheit-high-contrast :focus-visible {*/
/*    outline: 2px solid #0c0d0e;*/
/*    outline-offset: 2px;*/
/*    border-radius: 3px;*/
/*}*/

/*!* 4) Escape hatch: opt out any subtree by adding data-hc="off" on a container *!*/
/*.sosu-barrierefreiheit-high-contrast [data-hc="off"],*/
/*.sosu-barrierefreiheit-high-contrast [data-hc="off"] * {*/
/*    filter: none !important;*/
/*}*/

/*!* Keep the toolbar unaltered in all modes *!*/
/*.sosu-barrierefreiheit-toolbar {*/
/*    filter: none !important;*/
/*}*/

/*!* 1) Mild text-shadow where text is likely placed over imagery*/
/*   Heuristics: cover/hero/banner/slider/gallery and bg-image containers. *!*/
/*.sosu-barrierefreiheit-high-contrast :where(*/
/*  [style*="background-image"],*/
/*  [style*="background: url"],*/
/*  [style*="background:url"],*/
/*  .wp-block-cover,*/
/*  .wp-block-cover__image-background,*/
/*  [class*="cover"],*/
/*  [class*="hero"],*/
/*  [class*="banner"],*/
/*  [class*="slider"],*/
/*  [class*="carousel"],*/
/*  [class*="gallery"],*/
/*  .uicore-cover-img*/
/*) :is(h1,h2,h3,h4,h5,h6,p,span,a,button,figcaption,blockquote) {*/
/*    !* Subtle shadow that helps light text on busy/bright imagery *!*/
/*    text-shadow:*/
/*            0 1px 2px rgba(0,0,0,.7),*/
/*            0 0 0.5em rgba(0,0,0,.35);*/
/*}*/


/*!* Accessibility Styles: Grayscale (exclude toolbar so fixed positioning stays stable) *!*/
/*.sosu-barrierefreiheit-grayscale :not(#sosu-barrierefreiheit-toolbar):not(#sosu-barrierefreiheit-toolbar *) {*/
/*    filter: grayscale(100%) !important;*/
/*}*/

/* Mobile toolbar positions */
@media screen and (max-width: 600px) {
    /* Bottom Mid */
    .sosu-barrierefreiheit-toolbar-bottom-mid {
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: auto;
    }

    /* Left Top */
    .sosu-barrierefreiheit-toolbar-left-top {
        top: 10px;
        left: 10px;
        transform: none;
        width: auto;
    }

    /* Right Top */
    .sosu-barrierefreiheit-toolbar-right-top {
        top: 10px;
        right: 10px;
        transform: none;
        width: auto;
    }

    /* Left Bottom */
    .sosu-barrierefreiheit-toolbar-left-bottom {
        bottom: 10px;
        left: 10px;
        transform: none;
        width: auto;
    }

    /* Right Bottom */
    .sosu-barrierefreiheit-toolbar-right-bottom {
        bottom: 10px;
        right: 10px;
        transform: none;
        width: auto;
    }

    /*  Right Middle  */
    .sosu-barrierefreiheit-toolbar-right-middle {
        right: 10px;
        bottom: 50%;
        transform: none;
        width: auto;
    }
    /*  Left Middle  */
    .sosu-barrierefreiheit-toolbar-left-middle {
        left: 10px;
        bottom: 50%;
        transform: none;
        width: auto;
    }
}

/* Link-style option (Sign language link) */
.sosu-barrierefreiheit-link {
    align-items: center;
    background: none;
    border: none;
    border-radius: 4px;
    color: #333;
    cursor: pointer;
    display: flex;
    font-size: 16px;
    margin-bottom: 8px;
    padding: 8px 12px;
    text-align: left;
    text-decoration: none;
    width: 100%;
    transition: background-color 0.2s ease;
}

.sosu-barrierefreiheit-link:hover,
.sosu-barrierefreiheit-link:focus {
    background-color: #f5f5f5;
    color: #333;
}

.sosu-barrierefreiheit-link:visited {
    color: #333;
}

.sosu-barrierefreiheit-link svg {
    width: 20px;
    height: 20px;
    margin-right: 10px;
}

/* Hidden state */
/*#sosu_api_simplify-text-button {*/
/*    display: none !important;*/
/*}*/

/* Audio player block */
.sosu-barrierefreiheit-audio-player {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.sosu-barrierefreiheit-audio-header {
    align-items: center;
    background: none;
    border: none;
    border-radius: 4px;
    color: #333;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    margin-bottom: 8px;
    padding: 8px 12px;
    text-align: left;
    width: 100%;
    font-weight: 400;
    border-bottom: 1px solid #e0e0e0;
}

.sosu-barrierefreiheit-audio-header svg {
    height: 20px;
    width: 20px;
    margin-right: 10px;
    flex-shrink: 0;
}

.sosu-barrierefreiheit-audio-header span {
    flex: 1;
    text-align: left;
}

/* (duplicate kept intentionally for clarity) */
.sosu-barrierefreiheit-audio-player {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}
