/* Home Garage Doors - accessibility widget styles. Self-hosted, no third-party code.
   Every size below is in px (not rem/em) on purpose: the "Bigger text" feature
   scales the root font-size for the whole site, and rem/em values inside the
   widget would scale right along with it otherwise. */

#a11y-root, #a11y-root * {
    box-sizing: border-box;
}

/* ---------- Floating toggle button ---------- */
#a11y-toggle {
    position: fixed;
    left: 32px;
    bottom: 32px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-accent, #D90429);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 8px 26px rgba(217, 4, 41, 0.4);
    /* Only transform is animated (compositor-friendly); box-shadow swaps instantly on hover. */
    transition: transform 0.25s ease;
    padding: 0;
}

#a11y-toggle:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(217, 4, 41, 0.5);
}

#a11y-toggle svg {
    width: 30px;
    height: 30px;
    stroke: #fff;
    fill: none;
}

@media (max-width: 768px) {
    #a11y-toggle { left: 16px; bottom: 16px; width: 50px; height: 50px; }
    #a11y-toggle svg { width: 26px; height: 26px; }
}

/* ---------- Overlay ---------- */
#a11y-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 20, 0.45);
    z-index: 1200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

#a11y-overlay.a11y-open {
    opacity: 1;
    pointer-events: auto;
}

/* ---------- Panel ---------- */
#a11y-panel {
    position: fixed;
    z-index: 1201;
    background: #fff;
    color: #111;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 16px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
    /* mobile: bottom sheet */
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 82vh;
    border-radius: 18px 18px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

#a11y-panel.a11y-open {
    transform: translateY(0);
}

@media (min-width: 769px) {
    #a11y-panel {
        left: 0;
        right: auto;
        top: 0;
        bottom: 0;
        max-height: none;
        width: 400px;
        border-radius: 0 18px 18px 0;
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.25);
        transform: translateX(-100%);
    }
    #a11y-panel.a11y-open {
        transform: translateX(0);
    }
}

#a11y-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 21px;
    border-bottom: 2px solid #f0f0f0;
    flex-shrink: 0;
}

#a11y-panel-header h2 {
    font-family: 'Barlow', Arial, sans-serif;
    font-size: 22px;
    font-weight: 900;
    text-transform: uppercase;
    color: #111;
    margin: 0;
}

#a11y-close {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: #f3f3f3;
    color: #111;
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

#a11y-close:hover { background: #e8e8e8; }

#a11y-panel-body {
    overflow-y: auto;
    padding: 18px 21px;
    flex: 1;
}

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

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

.a11y-section-title {
    font-family: 'Barlow', Arial, sans-serif;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary-accent, #D90429);
    margin: 0 0 12px;
}

.a11y-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f2f2f2;
}

.a11y-row:last-child { border-bottom: none; }

.a11y-row-label {
    font-size: 15px;
    font-weight: 600;
    color: #111;
}

/* segmented "dots" for multi-level controls */
.a11y-dots {
    display: flex;
    gap: 6px;
}

.a11y-dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #ccc;
    background: #fff;
    color: #555;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.a11y-dot[aria-pressed="true"],
.a11y-dot.a11y-filled {
    background: var(--primary-accent, #D90429);
    border-color: var(--primary-accent, #D90429);
    color: #fff;
}

.a11y-dot:focus-visible,
#a11y-toggle:focus-visible,
#a11y-close:focus-visible,
.a11y-switch:focus-visible,
.a11y-choice-btn:focus-visible,
.a11y-footer-btn:focus-visible,
.a11y-struct-item:focus-visible {
    outline: 3px solid #111;
    outline-offset: 2px;
}

/* simple on/off switch */
.a11y-switch {
    position: relative;
    width: 48px;
    height: 26px;
    border-radius: 20px;
    border: none;
    background: #ccc;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

.a11y-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    /* transform instead of animating "left" - compositor-friendly, same 22px slide */
    transition: transform 0.2s ease;
}

.a11y-switch[aria-pressed="true"] {
    background: var(--primary-accent, #D90429);
}

.a11y-switch[aria-pressed="true"]::after {
    transform: translateX(22px);
}

/* 2-way choice buttons (e.g. text align) */
.a11y-choice-group {
    display: flex;
    gap: 8px;
}

.a11y-choice-btn {
    border: 2px solid #ddd;
    background: #fff;
    color: #333;
    font-size: 13px;
    font-weight: 700;
    padding: 7px 14px;
    border-radius: 8px;
    cursor: pointer;
}

.a11y-choice-btn[aria-pressed="true"] {
    background: var(--primary-accent, #D90429);
    border-color: var(--primary-accent, #D90429);
    color: #fff;
}

/* page structure list */
#a11y-structure-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 10px;
}

.a11y-struct-item {
    display: block;
    width: 100%;
    text-align: left;
    background: #fff;
    border: none;
    border-bottom: 1px solid #f2f2f2;
    padding: 9px 13px;
    font-size: 14px;
    color: #222;
    cursor: pointer;
}

.a11y-struct-item:last-child { border-bottom: none; }
.a11y-struct-item:hover { background: #faf5f5; }

.a11y-struct-item .a11y-struct-tag {
    display: inline-block;
    min-width: 32px;
    font-size: 11px;
    font-weight: 800;
    color: var(--primary-accent, #D90429);
    margin-right: 8px;
}

.a11y-struct-empty {
    padding: 11px 13px;
    font-size: 13px;
    color: #888;
}

/* footer */
#a11y-panel-footer {
    display: flex;
    gap: 12px;
    padding: 16px 21px;
    border-top: 2px solid #f0f0f0;
    flex-shrink: 0;
}

.a11y-footer-btn {
    flex: 1;
    padding: 12px 16px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    cursor: pointer;
    border: 2px solid var(--primary-dark, #111111);
    background: #fff;
    color: var(--primary-dark, #111111);
}

.a11y-footer-btn.a11y-footer-btn-primary {
    background: var(--primary-dark, #111111);
    color: #fff;
}

/* =========================================================
   Site-wide effects, scoped to the real page content only
   (body > * excluding our own root) so the widget is never
   affected by the settings it controls.
   ========================================================= */

/* Bigger text scales the root font-size directly, since this site's
   type scale is written in rem; #a11y-panel pins its own font-size in
   px above so the widget's own layout does not grow with it. */
html.a11y-text-1 { font-size: 112% !important; }
html.a11y-text-2 { font-size: 125% !important; }
html.a11y-text-3 { font-size: 145% !important; }

html.a11y-lh-1 body > *:not(#a11y-root) * { line-height: 1.6 !important; }
html.a11y-lh-2 body > *:not(#a11y-root) * { line-height: 1.9 !important; }
html.a11y-lh-3 body > *:not(#a11y-root) * { line-height: 2.2 !important; }

html.a11y-align-center body > *:not(#a11y-root) :is(p, li, h1, h2, h3, h4, h5, h6) {
    text-align: center !important;
}

html.a11y-font-readable body > *:not(#a11y-root),
html.a11y-font-readable body > *:not(#a11y-root) * {
    font-family: Arial, Verdana, sans-serif !important;
}

html.a11y-grayscale body > *:not(#a11y-root) { filter: grayscale(1) !important; }

html.a11y-hide-images body > *:not(#a11y-root) img,
html.a11y-hide-images body > *:not(#a11y-root) picture,
html.a11y-hide-images body > *:not(#a11y-root) video {
    visibility: hidden !important;
}
html.a11y-hide-images body > *:not(#a11y-root) [style*="background-image"] {
    background-image: none !important;
}

html.a11y-pause-anim body > *:not(#a11y-root),
html.a11y-pause-anim body > *:not(#a11y-root) *,
html.a11y-pause-anim body > *:not(#a11y-root) *::before,
html.a11y-pause-anim body > *:not(#a11y-root) *::after {
    animation-play-state: paused !important;
    transition: none !important;
}

html.a11y-highlight-links body > *:not(#a11y-root) a {
    text-decoration: underline !important;
    outline: 2px solid var(--primary-accent, #D90429) !important;
    outline-offset: 2px !important;
}

/* contrast: dark */
html.a11y-contrast-dark body > *:not(#a11y-root) {
    background: #111111 !important;
    color: #f0f0f0 !important;
}
html.a11y-contrast-dark body > *:not(#a11y-root) * {
    background-color: #111111 !important;
    color: #f0f0f0 !important;
    border-color: #444 !important;
}
html.a11y-contrast-dark body > *:not(#a11y-root) a {
    color: #ff6b81 !important;
}
html.a11y-contrast-dark body > *:not(#a11y-root) button,
html.a11y-contrast-dark body > *:not(#a11y-root) [class*="btn"] {
    background-color: var(--primary-accent, #D90429) !important;
    color: #fff !important;
}

/* contrast: high */
html.a11y-contrast-high body > *:not(#a11y-root) {
    background: #000 !important;
    color: #fff !important;
}
html.a11y-contrast-high body > *:not(#a11y-root) * {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
}
html.a11y-contrast-high body > *:not(#a11y-root) a {
    color: #ffd400 !important;
    text-decoration: underline !important;
}
html.a11y-contrast-high body > *:not(#a11y-root) button,
html.a11y-contrast-high body > *:not(#a11y-root) [class*="btn"] {
    background-color: #000 !important;
    color: #ffd400 !important;
    border: 2px solid #ffd400 !important;
}
html.a11y-contrast-high body > *:not(#a11y-root) img,
html.a11y-contrast-high body > *:not(#a11y-root) picture {
    filter: grayscale(1) contrast(1.2) !important;
}

html.a11y-contrast-high body > *:not(#a11y-root) ::placeholder,
html.a11y-contrast-dark body > *:not(#a11y-root) ::placeholder {
    color: #aaa !important;
    opacity: 1 !important;
}

/* The widget lives in #a11y-root, a direct child of <body>. Every effect
   rule above (other than the root-level text scaling) is scoped to
   "body > *:not(#a11y-root) ..." so it can never match anything inside
   the widget. #a11y-panel/#a11y-toggle fix their own font-size in px so
   the text-scaling rule (which must apply to <html> for rem to work
   site-wide) cannot resize the widget either. */

@media (prefers-reduced-motion: reduce) {
    #a11y-toggle, #a11y-overlay, #a11y-panel, .a11y-switch::after {
        transition: none;
    }
}
