/* ============================================================
   Accessibility widget (IS 5568 / WCAG 2.0 AA) + floating launchers
   The JS toggles a11y-* classes on <html>; overrides below exclude
   the widget's own DOM via the :not() chain.
   ============================================================ */

/* ---------- floating launchers ---------- */

.a11y-btn {
    position: fixed;
    bottom: clamp(1rem, 3vw, 1.75rem);
    right: clamp(1rem, 3vw, 1.75rem);
    width: 56px;
    height: 56px;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background:
        radial-gradient(circle at 30% 30%,
            rgba(31, 122, 224, 0.8) 0%,
            rgba(58, 142, 229, 0.45) 60%,
            rgba(11, 18, 32, 0.6) 100%),
        rgba(11, 18, 32, 0.92);
    -webkit-backdrop-filter: blur(10px);
            backdrop-filter: blur(10px);
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 10px 28px -8px rgba(31, 122, 224, 0.7);
    z-index: 60;
    transition: transform 0.5s var(--ease-spring), border-color 0.4s ease;
    animation: a11y-pulse 2.6s ease-in-out 1.5s 3;
}
.a11y-btn svg { width: 28px; height: 28px; }

.a11y-btn__label {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

@keyframes a11y-pulse {
    0%, 100% { box-shadow: 0 10px 28px -8px rgba(31, 122, 224, 0.7),
                           0 0 0 0 rgba(31, 122, 224, 0.45); }
    50%      { box-shadow: 0 10px 28px -8px rgba(31, 122, 224, 0.7),
                           0 0 0 12px rgba(31, 122, 224, 0); }
}

.wa-btn {
    position: fixed;
    bottom: calc(clamp(1rem, 3vw, 1.75rem) + 56px + 0.75rem);
    right: clamp(1rem, 3vw, 1.75rem);
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background:
        radial-gradient(circle at 30% 30%,
            rgba(74, 222, 128, 0.85) 0%,
            rgba(34, 197, 94, 0.45) 60%,
            rgba(11, 18, 32, 0.6) 100%),
        rgba(11, 18, 32, 0.92);
    -webkit-backdrop-filter: blur(10px);
            backdrop-filter: blur(10px);
    color: #ffffff;
    text-decoration: none;
    box-shadow: 0 10px 28px -8px rgba(74, 222, 128, 0.65);
    z-index: 60;
    transition: transform 0.5s var(--ease-spring), border-color 0.4s ease;
}
.wa-btn svg { width: 28px; height: 28px; }

.a11y-btn:hover, .a11y-btn:focus-visible,
.wa-btn:hover, .wa-btn:focus-visible {
    transform: translateY(-3px) scale(1.06);
    border-color: rgba(255, 255, 255, 0.45);
}

/* ---------- skip link ---------- */

.a11y-skip {
    position: fixed;
    top: -100px;
    inset-inline-start: 1rem;
    z-index: 10000;
    padding: 0.8rem 1.4rem;
    border-radius: 0 0 14px 14px;
    background: var(--accent);
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
    transition: top 0.3s ease;
}
.a11y-skip:focus { top: 0; outline: 3px solid #4ade80; }

/* ---------- panel ---------- */

.a11y-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(8, 12, 24, 0.45);
}
.a11y-backdrop[hidden] { display: none; }

.a11y-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    z-index: 9999;
    width: min(360px, 92vw);
    overflow-y: auto;
    padding: 22px 20px 26px;
    background: rgba(11, 18, 32, 0.96);
    -webkit-backdrop-filter: blur(18px);
            backdrop-filter: blur(18px);
    border-inline-start: 1px solid rgba(255, 255, 255, 0.08);
    color: #eef2f8;
    font-size: 15px;                    /* px on purpose — immune to text-size feature */
    transform: translateX(0);
    transition: transform 0.45s var(--ease-reveal);
}
.a11y-panel[hidden] { display: none; }

.a11y-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.a11y-panel__title {
    margin: 0;
    font-size: 19px;
    font-weight: 800;
    color: #ffffff;
}
.a11y-panel__close {
    display: grid;
    place-items: center;
    width: 38px; height: 38px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    cursor: pointer;
    transition: background 0.3s ease;
}
.a11y-panel__close:hover { background: rgba(255, 255, 255, 0.2); }
.a11y-panel__close svg { width: 16px; height: 16px; }

.a11y-group { margin-bottom: 18px; }
.a11y-group__title {
    margin: 0 0 9px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: rgba(238, 242, 248, 0.6);
}
.a11y-group__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.a11y-feature {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: #eef2f8;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    text-align: start;
    cursor: pointer;
    transition: background 0.3s ease, border-color 0.3s ease;
}
.a11y-feature:hover { background: rgba(255, 255, 255, 0.12); }
.a11y-feature.is-active {
    background: linear-gradient(135deg, var(--accent), var(--accent-soft));
    border-color: transparent;
    color: #ffffff;
    font-weight: 700;
}
.a11y-feature:focus-visible {
    outline: 3px solid #4ade80;         /* green — distinct from blue selection */
    outline-offset: 2px;
}

.a11y-panel__reset {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: transparent;
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.3s ease;
}
.a11y-panel__reset:hover { background: rgba(255, 255, 255, 0.1); }
.a11y-panel__reset:focus-visible { outline: 3px solid #4ade80; outline-offset: 2px; }

.a11y-statement-link {
    display: block;
    margin-top: 14px;
    color: rgba(238, 242, 248, 0.7);
    font-size: 13px;
    text-align: center;
    text-decoration: underline;
}
.a11y-statement-link:hover { color: var(--accent-soft); }

/* ============================================================
   Global overrides (exclusion chain keeps widget DOM untouched)
   ============================================================ */

/* --- text size (rem-based layout scales with html font-size) --- */
html.a11y-text-1 { font-size: 110% !important; }
html.a11y-text-2 { font-size: 125% !important; }
html.a11y-text-3 { font-size: 140% !important; }

/* --- color filters (composable via custom properties) --- */
html.a11y-contrast-high     { --a11y-f1: contrast(1.3); }
html.a11y-contrast-negative { --a11y-f1: invert(1) hue-rotate(180deg); }
html.a11y-grayscale         { --a11y-f2: grayscale(1); }
html.a11y-light-bg          { --a11y-f3: saturate(0.5) brightness(1.08); }

html:where(.a11y-contrast-high, .a11y-contrast-negative, .a11y-grayscale, .a11y-light-bg)
body > *:not(.a11y-widget):not(.a11y-backdrop):not(.a11y-panel):not(.a11y-btn):not(.a11y-skip) {
    filter: var(--a11y-f1, brightness(1)) var(--a11y-f2, brightness(1)) var(--a11y-f3, brightness(1)) !important;
}

/* --- readable font --- */
html.a11y-readable-font body *:not(.a11y-widget):not(.a11y-panel):not(.a11y-panel *):not(.a11y-btn):not(.a11y-skip) {
    font-family: Arial, "Helvetica Neue", sans-serif !important;
}

/* --- highlight links --- */
html.a11y-highlight-links body a:not(.a11y-widget):not(.a11y-skip) {
    text-decoration: underline !important;
    background: rgba(255, 235, 130, 0.55) !important;
    color: #0b3d91 !important;
    border-radius: 3px;
}

/* --- line spacing --- */
html.a11y-line-spacing body p,
html.a11y-line-spacing body li,
html.a11y-line-spacing body h1,
html.a11y-line-spacing body h2,
html.a11y-line-spacing body h3,
html.a11y-line-spacing body a,
html.a11y-line-spacing body button:not(.a11y-feature):not(.a11y-panel__reset):not(.a11y-panel__close) {
    line-height: 2 !important;
}

/* --- letter spacing --- */
html.a11y-letter-spacing body p,
html.a11y-letter-spacing body li,
html.a11y-letter-spacing body h1,
html.a11y-letter-spacing body h2,
html.a11y-letter-spacing body h3,
html.a11y-letter-spacing body a,
html.a11y-letter-spacing body span:not(.a11y-widget span) {
    letter-spacing: 0.12em !important;
}

/* --- stop animations (CSS + JS-inline-style driven ones) --- */
html.a11y-stop-anim body *:not(.a11y-widget):not(.a11y-panel):not(.a11y-panel *),
html.a11y-stop-anim body *::before,
html.a11y-stop-anim body *::after {
    animation: none !important;
    transition: none !important;
}
html.a11y-stop-anim .hero__device,
html.a11y-stop-anim .phone,
html.a11y-stop-anim .bcard,
html.a11y-stop-anim .fcard { transform: none !important; }
html.a11y-stop-anim .morph { filter: none !important; }
html.a11y-stop-anim .morph__a { opacity: 1 !important; filter: none !important; }
html.a11y-stop-anim .morph__b { opacity: 0 !important; }
html.a11y-stop-anim .cta__reveal { display: none !important; }
html.a11y-stop-anim .reveal,
html.a11y-stop-anim .footer-reveal,
html.a11y-stop-anim .app__point { opacity: 1 !important; transform: none !important; filter: none !important; }

/* --- big cursor --- */
html.a11y-big-cursor,
html.a11y-big-cursor body *:not(.a11y-widget) {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 24 24'><path d='M5.5 3.2v16.2l4.3-4.1 2.6 5.8 2.6-1.2-2.6-5.7 5.9-.7z' fill='%230b1220' stroke='white' stroke-width='1.4'/></svg>") 4 2, auto !important;
}
html.a11y-big-cursor body a,
html.a11y-big-cursor body button,
html.a11y-big-cursor body [role="button"] {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 24 24'><path d='M5.5 3.2v16.2l4.3-4.1 2.6 5.8 2.6-1.2-2.6-5.7 5.9-.7z' fill='%231f7ae0' stroke='white' stroke-width='1.4'/></svg>") 4 2, pointer !important;
}

@media (prefers-reduced-motion: reduce) {
    .a11y-btn { animation: none; }
    .a11y-panel { transition: none; }
}
