/* Keyboard tools for the museum's Polish and English layouts. */
:root {
    --mwl-header-height: 100px;
    --mwl-ink: #173231;
    --mwl-paper: #fffdf7;
    --mwl-accent: #ffce62;
}
html { scroll-padding-top: calc(var(--mwl-header-height) + 10px); }

#mwl-access {
    position: fixed;
    z-index: 10001;
    top: max(calc(var(--mwl-header-height) + 12px), 22vh);
    right: 0;
    display: grid;
    justify-items: end;
    gap: 4px;
    font: 600 14px/1.35 system-ui, sans-serif;
    color: var(--mwl-ink);
}
#mwl-access [hidden] { display: none !important; }
#mwl-access button, #mwl-access a { font: inherit; text-transform: none; letter-spacing: normal; }
#mwl-access .mwl-toggle, #mwl-access .mwl-skip {
    display: inline-flex;
    flex-flow: row nowrap;
    align-items: center;
    justify-content: center;
    gap: .45em;
    min-height: 42px;
    padding: 7px 13px;
    border: 1px solid #97a49e;
    border-radius: 10px 0 0 10px;
    background: var(--mwl-ink);
    color: white;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 3px 14px #102b2938;
}
#mwl-access .mwl-skip { background: var(--mwl-paper); color: var(--mwl-ink); }
#mwl-access .mwl-skip:hover { text-decoration: underline; }
#mwl-access .mwl-toggle:hover, #mwl-access .mwl-toggle[aria-expanded="true"] { background: #274e47; }
#mwl-access kbd {
    display: inline-block;
    background: #edf1ed;
    color: #173231;
    border: 1px solid #9baba4;
    border-bottom-width: 2px;
    border-radius: 5px;
    font: 650 .9em/1.2 system-ui, sans-serif;
    white-space: nowrap;
    padding: 2px 6px;
}
#mwl-access .mwl-toggle kbd { background: var(--mwl-accent); color: #182c29; border-color: #c59436; }

#mwl-tools {
    position: absolute;
    right: calc(100% + 8px);
    top: 0;
    width: min(310px, calc(100vw - 20px));
    max-height: calc(100dvh - max(var(--mwl-header-height) + 12px, 22vh) - 10px);
    overflow: auto;
    overscroll-behavior: contain;
    padding: 18px;
    border: 1px solid #97a49e;
    border-top: 4px solid var(--mwl-accent);
    border-radius: 12px;
    background: var(--mwl-paper);
    box-shadow: 0 8px 32px #102b2938;
}
#mwl-tools h2 { margin: 0 0 10px; font: 700 19px/1.25 system-ui, sans-serif; color: inherit; }
#mwl-tools dl { margin: 0 0 14px; }
#mwl-tools dl > div { display: grid; grid-template-columns: 80px 1fr; align-items: baseline; gap: 5px; margin: 6px 0; }
#mwl-tools dt, #mwl-tools dd { margin: 0; }
#mwl-tools dd { font-weight: 450; }
#mwl-tools fieldset { min-width: 0; margin: 12px 0; padding: 0; border: 0; }
#mwl-tools legend { margin: 0 0 6px; font: inherit; color: inherit; }
.mwl-options { display: flex; flex-wrap: wrap; gap: 6px; }
#mwl-tools button {
    min-height: 36px;
    padding: 5px 9px;
    border: 1px solid #82978c;
    border-radius: 6px;
    background: white;
    color: var(--mwl-ink);
    cursor: pointer;
}
#mwl-tools button:hover { border-color: #173231; }
#mwl-tools button[aria-pressed="true"] { background: #254a40; color: white; }
#mwl-tools button[aria-pressed="true"]::before { content: "✓ "; }
#mwl-tools button[aria-disabled="true"] { border-style: dashed; }
:is(.wcag-black,.wcag-yellow) #mwl-access :is(button, a, kbd, #mwl-tools) {
    background: black !important;
    color: inherit !important;
    border-color: currentColor !important;
}
.wcag-black #mwl-access { color: white !important; }
.wcag-yellow #mwl-access { color: yellow !important; }

/* An inner band stays visible in thumbnail frames and clipped menu items. */
#mwl-site :focus-visible, #mwl-site [data-mwl-arrival]:focus {
    outline: 3px dashed #facc52 !important;
    outline-offset: 1px !important;
    box-shadow: inset 0 0 0 2px #173231, inset 0 0 0 4px #ffe496, 0 0 0 5px #173231 !important;
}
#mwl-site #mwl-access :focus-visible { outline-offset: -4px !important; }
#mwl-site .element-banner-max-content-height:focus-visible { outline-offset: -4px !important; }
#mwl-site .fancybox-container :focus-visible { outline-offset: -4px !important; }
html.fancybox-enabled #mwl-access, body.fancybox-active #mwl-access, body.vbox-open #mwl-access { visibility: hidden; }
.fancybox-container:focus-within .fancybox-toolbar { opacity: 1; visibility: visible; }
#mwl-site .js-fancybox:focus-visible, #mwl-site a:has(> img):focus-visible {
    outline-offset: -5px !important;
}
#mwl-site .js-fancybox:focus-visible img, #mwl-site a:focus-visible > img {
    outline: 2px solid #173231;
    outline-offset: -2px;
}
.mwl-contact-toggle { width: 100%; padding: 0; border: 0; background: transparent; text-align: start; cursor: pointer; }
.mwl-arrow-keyboard { cursor: pointer; }
#mwl-content-start { height: 0; }
@media (prefers-reduced-motion: no-preference) {
    #mwl-tools:not([hidden]) { animation: mwl-open .16s ease-out; }
    @keyframes mwl-open { from { opacity: 0; transform: translateX(5px); } }
}
@media (max-width: 700px), (max-height: 550px) {
    html { scroll-padding-bottom: 68px; }
    body { padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
    #mwl-access {
        top: auto;
        right: max(6px, env(safe-area-inset-right, 0px));
        bottom: max(6px, env(safe-area-inset-bottom, 0px));
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        max-width: calc(100vw - 14px);
        gap: 4px;
    }
    #mwl-access .mwl-toggle, #mwl-access .mwl-skip { border-radius: 8px; padding: 6px 9px; }
    #mwl-tools {
        top: auto;
        bottom: calc(100% + 8px);
        right: 0;
        max-height: calc(100dvh - 85px);
    }
    #arrow-nav { bottom: calc(62px + env(safe-area-inset-bottom, 0px)) !important; }
}
@media (forced-colors: active) {
    #mwl-site :focus-visible, #mwl-site [data-mwl-arrival]:focus, #mwl-site #mwl-access :focus-visible {
        outline: 3px dashed Highlight !important;
        outline-offset: -3px !important;
    }
}
@media print { #mwl-access { display: none !important; } body { padding-bottom: 0; } }
