/* Mobile-Anpassung TCO — ergänzt das alte Desktop-Layout, ohne es zu ersetzen.
   Wird NACH allen anderen Styles eingebunden, damit @media-Regeln greifen. */

/* Burger-Button ist auf Desktop versteckt */
.nav-toggle {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1100;
    width: 48px;
    height: 48px;
    padding: 0;
    background: #fff;
    border: 1px solid #c4b27b;
    border-radius: 4px;
    cursor: pointer;
}
.nav-toggle:focus-visible {
    outline: 2px solid #8d3913;
    outline-offset: 2px;
}
.nav-toggle .bar {
    display: block;
    width: 26px;
    height: 3px;
    margin: 5px auto;
    background: #8d3913;
    border-radius: 2px;
    transition: transform .2s, opacity .2s;
}
.nav-toggle[aria-expanded="true"] .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .bar:nth-child(2) {
    opacity: 0;
}
.nav-toggle[aria-expanded="true"] .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Skip-Link für Tastatur-/Screenreader-Nutzer */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
}
.skip-link:focus {
    left: 0;
    top: 0;
    z-index: 1200;
    padding: 8px 12px;
    background: #8d3913;
    color: #fff;
    text-decoration: none;
}

/* Bessere Kontraste — WCAG-AA */
#footer p#copyright,
#footer .mod_customnav a,
#footer .mod_customnav span {
    color: #6e6650;
}
#pageHeaderRightAddress,
#pageHeaderRightContent h2,
#pageHeaderRightContent p {
    color: #8a7a47;
}
#pageHeaderRightContent h1,
#pageHeaderRightContent p {
    color: #4d6a30;
}
.mod_changelanguage h4 {
    color: #6e6650;
}

/* ===== Mobile-Breakpoint ===== */
@media (max-width: 900px) {

    /* Festgeschriebene Widths brechen */
    body {
        background: #fff none;
        text-align: left;
    }
    #wrapper {
        width: auto !important;
        max-width: 100%;
        margin: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        box-sizing: border-box;
    }
    #header,
    #container,
    #main,
    #footer {
        width: auto !important;
        max-width: 100%;
        margin: 0 !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
        box-sizing: border-box;
    }
    #container {
        background-image: none;
        padding-top: 12px !important;
        padding-bottom: 24px !important;
        min-height: 0;
    }

    /* Header: absolute Positionierung auflösen */
    #header {
        height: auto;
        padding-top: 12px !important;
        padding-bottom: 12px !important;
        position: relative;
        background-color: #fdf7df;
    }
    #pageHeaderLeft {
        display: none;
    }
    #pageHeaderRight {
        position: static;
        width: auto;
        margin: 0;
        padding-right: 56px; /* Platz für Burger */
        text-align: center;
    }
    #pageHeaderRightContent {
        text-align: center;
    }
    #pageHeaderRightContent h1,
    #pageHeaderRightContent p {
        font-size: 1.2em;
        line-height: 1.25;
    }
    #pageHeaderRightImg img {
        max-width: 100%;
        height: auto;
    }
    #frank {
        font-size: 1.1em;
        text-align: center;
    }
    #frank span {
        padding-right: 0 !important;
        display: block;
    }

    /* Main: volle Breite, Sidebar überlagert */
    #main {
        width: auto !important;
        min-height: 0;
        margin-top: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    #main .inside {
        padding: 0;
    }
    #left {
        display: none;
    }

    /* Sidebar als Off-Canvas (von rechts hereinschiebend) */
    #right {
        position: fixed;
        top: 0;
        right: 0;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff;
        box-shadow: -4px 0 16px rgba(0,0,0,.25);
        transform: translateX(100%);
        transition: transform .25s ease-out;
        overflow-y: auto;
        z-index: 1050;
    }
    body.nav-open #right {
        transform: translateX(0);
    }
    #right .inside {
        margin: 0 !important;
        padding: 56px 16px 24px !important;
        border-left: 0 !important;
    }
    .mod_navigation ul li {
        padding: 10px 6px !important;
    }
    .mod_navigation li a,
    .mod_navigation span {
        font-size: 1.1em;
        padding: 8px 12px !important;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    /* Hover-Effekt mobile abklingen lassen */
    .mod_navigation ul li:hover {
        border-top-color: #ECEFD7;
        border-bottom-color: #ECEFD7;
        background: transparent;
    }

    /* Sprachumschalter im Sidebar-Bereich */
    #right .mod_changelanguage {
        position: static !important;
        margin-bottom: 16px;
    }

    /* Overlay hinter der Sidebar */
    .nav-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.45);
        z-index: 1040;
    }
    body.nav-open .nav-overlay {
        display: block;
    }

    /* Burger zeigen */
    .nav-toggle {
        display: block;
    }

    /* Footer */
    #footer {
        margin: 16px 0 !important;
        padding: 12px !important;
    }
    #footer .inside {
        position: relative;
    }
    #footer p#copyright {
        margin: 0 0 16px 0 !important;
        padding-top: 12px !important;
        text-align: center;
    }
    #footer .mod_customnav {
        position: static !important;
        top: auto !important;
        left: auto !important;
    }
    #footer .mod_customnav ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px 0;
    }
    #footer .mod_customnav li {
        float: none !important;
    }
    #footer .mod_changelanguage {
        position: static !important;
        top: auto !important;
        left: auto !important;
        margin-bottom: 12px;
        text-align: center;
    }
    #footer .mod_changelanguage h4 {
        text-align: center;
    }
    #footer .mod_changelanguage ul {
        display: flex;
        justify-content: center;
        gap: 16px;
    }
    #footer .mod_changelanguage li {
        float: none !important;
    }

    /* TCO-Praxisboxen (Shenzhou etc.) responsive */
    #shenzhou, #hanna, #klang, #waterland {
        width: auto !important;
        height: auto !important;
        margin: 16px 0 !important;
        padding: 16px !important;
        background-image: none !important;
    }
    #shenzhou img, #hanna img, #klang img, #waterland img,
    #container_e img {
        float: none !important;
        max-width: 100%;
        height: auto;
        margin: 0 0 12px 0 !important;
    }
    #container_e h2,
    #container_e h3,
    #container_e h4 {
        margin-left: 0 !important;
    }

    /* Karte und Kontakt-Layout */
    #map {
        width: auto !important;
        max-width: 100%;
        margin-left: 0 !important;
        height: auto;
        aspect-ratio: 4/3;
    }
    #anschrift {
        float: none !important;
        margin-bottom: 20px;
    }
    #wrapper_k {
        margin-bottom: 12px;
    }

    /* Tap-Target-Größe für Links */
    .mod_customnav a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* Sehr schmale Geräte */
@media (max-width: 420px) {
    #pageHeaderRightContent h1,
    #pageHeaderRightContent p {
        font-size: 1.05em;
    }
    #frank {
        font-size: 1em;
    }
}

/* ==========================================================================
   Accessibility-Toolbar (fixiert unten rechts) — übernommen aus updatefrei.de
   ========================================================================== */
.a11y-toolbar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: Tahoma, Verdana, Arial, sans-serif;
}
.a11y-fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #8d3913;
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}
.a11y-fab:hover { background: #6b2a0e; }
.a11y-fab:focus-visible { outline: 3px solid #8d3913; outline-offset: 3px; }
.a11y-fab[aria-expanded="true"] { background: #6b2a0e; }

.a11y-panel {
    position: absolute;
    bottom: 64px;
    right: 0;
    width: 272px;
    background: #fff;
    border: 1px solid rgba(127,116,72,0.18);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    padding: 20px;
    color: #333;
}
.a11y-panel[hidden] {
    display: block !important;
    opacity: 0;
    transform: scale(0.92);
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.a11y-panel:not([hidden]) {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.a11y-panel-title {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 16px;
    color: #333;
}
.a11y-control {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(127,116,72,0.10);
}
.a11y-control:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.a11y-control label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #5a4a2a;
}
.a11y-btn-row {
    display: flex;
    gap: 6px;
}
.a11y-btn-s {
    flex: 1;
    padding: 8px 4px;
    border: 1px solid rgba(127,116,72,0.18);
    background: #fff;
    color: #333;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    font-family: Tahoma, Verdana, Arial, sans-serif;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.a11y-btn-s:hover {
    background: #fdf7df;
    border-color: #8d3913;
}
.a11y-btn-s:focus-visible { outline: 2px solid #8d3913; outline-offset: 2px; }

.a11y-btn-block {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid rgba(127,116,72,0.18);
    background: #fff;
    color: #333;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    font-family: Tahoma, Verdana, Arial, sans-serif;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.12s, border-color 0.12s;
}
.a11y-btn-block:hover {
    background: #fdf7df;
    border-color: #8d3913;
}
.a11y-btn-block:focus-visible { outline: 2px solid #8d3913; outline-offset: 2px; }
.a11y-btn-block[aria-pressed="true"] {
    background: #8d3913;
    color: #fff;
    border-color: #8d3913;
}
.a11y-reset {
    border-color: rgba(180,60,60,0.3);
    color: #8b3a3a;
}
.a11y-reset:hover {
    background: #8b3a3a;
    color: #fff;
    border-color: #8b3a3a;
}

/* Hoher Kontrast — Schwarz/Weiß/Gelb */
body.high-contrast,
body.high-contrast * {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #555 !important;
}
body.high-contrast a {
    color: #ff0 !important;
    text-decoration: underline !important;
}
body.high-contrast button:not(.a11y-fab):not(.a11y-btn-s):not(.a11y-btn-block):not(.a11y-reset):not(.nav-toggle) {
    background: #fff !important;
    color: #000 !important;
    border: 2px solid #fff !important;
}
body.high-contrast .a11y-panel {
    background: #222 !important;
    border: 2px solid #fff !important;
}
body.high-contrast .a11y-btn-s,
body.high-contrast .a11y-btn-block {
    background: #333 !important;
    color: #fff !important;
    border-color: #888 !important;
}
/* Hintergrundbilder im High-Contrast-Modus unterdrücken */
body.high-contrast,
body.high-contrast #container,
body.high-contrast #header,
body.high-contrast #pageHeaderLeft {
    background-image: none !important;
}

/* Toolbar auf Mobile etwas kleiner */
@media (max-width: 820px) {
    .a11y-toolbar { bottom: 12px; right: 12px; }
    .a11y-fab { width: 46px; height: 46px; }
    .a11y-panel { width: 256px; right: 0; bottom: 58px; }
}

/* Beim Druck Toolbar ausblenden */
@media print {
    .a11y-toolbar { display: none !important; }
}
