/* jOpenSim Accessibility v1.0 — Liquid Glass UI */

#jop-accessibility-root {
    --jop-a11y-glass-bg: rgba(12, 14, 26, 0.52);
    --jop-a11y-glass-blur: 28px;
    --jop-a11y-glass-saturate: 165%;
    --jop-a11y-glass-border: rgba(255, 255, 255, 0.14);
    --jop-a11y-glass-shadow: 0 24px 64px rgba(0, 0, 0, 0.45), 0 8px 24px rgba(0, 0, 0, 0.28);
    --jop-a11y-muted: rgba(244, 247, 255, 0.72);
    --jop-a11y-border: rgba(255, 255, 255, 0.1);
    --jop-a11y-surface: rgba(255, 255, 255, 0.06);
    --jop-a11y-primary-soft: rgba(var(--jop-a11y-primary-rgb, 245, 197, 24), 0.16);
    --jop-a11y-ease: cubic-bezier(0.22, 1, 0.36, 1);
    font-family: var(--jop-a11y-font);
    z-index: 999990;
    -webkit-font-smoothing: antialiased;
}

#jop-accessibility-root,
#jop-accessibility-root * {
    box-sizing: border-box;
}

#jop-accessibility-root[data-theme="light"] {
    --jop-a11y-glass-bg: rgba(255, 255, 255, 0.72);
    --jop-a11y-glass-border: rgba(15, 23, 42, 0.1);
    --jop-a11y-muted: rgba(15, 23, 42, 0.62);
    --jop-a11y-border: rgba(15, 23, 42, 0.08);
    --jop-a11y-surface: rgba(15, 23, 42, 0.04);
}

/* ── Applied accessibility states (document level) ── */
html.jop-a11y-text-1 { font-size: 106.25%; }
html.jop-a11y-text-2 { font-size: 112.5%; }
html.jop-a11y-text-3 { font-size: 118.75%; }
html.jop-a11y-text-4 { font-size: 125%; }
html.jop-a11y-text-5 { font-size: 137.5%; }

html.jop-a11y-space-1 { letter-spacing: 0.04em; word-spacing: 0.08em; }
html.jop-a11y-space-2 { letter-spacing: 0.08em; word-spacing: 0.14em; }
html.jop-a11y-space-3 { letter-spacing: 0.12em; word-spacing: 0.2em; }

html.jop-a11y-high-contrast body {
    background: #000 !important;
    color: #fff !important;
}
html.jop-a11y-high-contrast body a { color: #ffeb3b !important; text-decoration: underline !important; }
html.jop-a11y-high-contrast body img { filter: contrast(1.2); }

html.jop-a11y-grayscale body { filter: grayscale(1); }
html.jop-a11y-invert body { filter: invert(1) hue-rotate(180deg); }
html.jop-a11y-grayscale.jop-a11y-invert body { filter: grayscale(1) invert(1) hue-rotate(180deg); }

html.jop-a11y-underline-links body a { text-decoration: underline !important; text-underline-offset: 3px; }

html.jop-a11y-big-cursor,
html.jop-a11y-big-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath fill='%23fff' stroke='%23222' stroke-width='1.2' d='M4 2l3 24 4-9 9 2z'/%3E%3C/svg%3E") 2 2, auto !important;
}

html.jop-a11y-dyslexia body {
    font-family: Verdana, Tahoma, "Segoe UI", sans-serif !important;
    line-height: 1.65 !important;
}

html.jop-a11y-reduce-motion *,
html.jop-a11y-reduce-motion *::before,
html.jop-a11y-reduce-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

html.jop-a11y-read-aloud body.jop-a11y-listening {
    cursor: text;
}
html.jop-a11y-read-aloud body.jop-a11y-listening *:hover {
    outline: 2px dashed rgba(var(--jop-a11y-primary-rgb, 245, 197, 24), 0.85);
    outline-offset: 2px;
}

.jop-a11y-reading-guide {
    position: fixed;
    left: 0;
    right: 0;
    height: 12px;
    border: 3px solid var(--jop-a11y-primary, #f5c518);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.55);
    pointer-events: none;
    z-index: 999989;
    transform: translateY(-50%);
}

/* ── Backdrop + modal shell ── */
.jop-a11y-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999991;
    background: rgba(4, 5, 12, 0.32);
    backdrop-filter: blur(14px) saturate(130%);
    -webkit-backdrop-filter: blur(14px) saturate(130%);
    opacity: 0;
    animation: jop-a11y-fade-in 0.4s var(--jop-a11y-ease) forwards;
}

.jop-a11y-shell--center {
    position: fixed;
    inset: 0;
    z-index: 999992;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    pointer-events: none;
}

.jop-a11y-card {
    position: relative;
    pointer-events: auto;
    width: min(100%, 42rem);
    max-height: min(92vh, 760px);
    display: flex;
    flex-direction: column;
    min-height: 0;
    color: var(--jop-a11y-text, #f4f7ff);
    border-radius: var(--jop-a11y-radius, 20px);
    overflow: hidden;
    isolation: isolate;
    opacity: 0;
    transform: translateY(20px) scale(0.97);
    animation: jop-a11y-rise-in 0.5s var(--jop-a11y-ease) forwards;
    box-shadow: var(--jop-a11y-glass-shadow);
}

.jop-a11y-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--jop-a11y-glass-bg);
    backdrop-filter: blur(var(--jop-a11y-glass-blur)) saturate(var(--jop-a11y-glass-saturate));
    -webkit-backdrop-filter: blur(var(--jop-a11y-glass-blur)) saturate(var(--jop-a11y-glass-saturate));
    z-index: 0;
}

.jop-a11y-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(145deg, rgba(255,255,255,0.22), rgba(255,255,255,0.04) 40%, rgba(255,255,255,0.12));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    z-index: 1;
    pointer-events: none;
}

.jop-a11y-card.jop-a11y-leaving {
    animation: jop-a11y-fade-out 0.26s var(--jop-a11y-ease) forwards;
}

.jop-a11y-body {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 1.35rem 1.35rem 1.1rem;
}

.jop-a11y-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.jop-a11y-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 10px;
}

.jop-a11y-title-wrap h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.jop-a11y-title-wrap p {
    margin: 0.15rem 0 0;
    font-size: 0.82rem;
    color: var(--jop-a11y-muted);
}

.jop-a11y-icon-btn {
    width: 38px;
    height: 38px;
    border: 1px solid var(--jop-a11y-border);
    border-radius: 12px;
    background: var(--jop-a11y-surface);
    color: inherit;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    transition: background 0.2s var(--jop-a11y-ease), border-color 0.2s;
}

.jop-a11y-icon-btn:hover,
.jop-a11y-icon-btn:focus-visible {
    background: var(--jop-a11y-primary-soft);
    border-color: rgba(var(--jop-a11y-primary-rgb), 0.35);
    outline: none;
}

.jop-a11y-scroll {
    overflow: auto;
    padding-right: 0.15rem;
    margin-top: 0.5rem;
}

.jop-a11y-section {
    margin-bottom: 1rem;
}

.jop-a11y-section h3 {
    margin: 0 0 0.55rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--jop-a11y-muted);
}

.jop-a11y-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
    gap: 0.55rem;
}

.jop-a11y-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--jop-a11y-border);
    border-radius: 14px;
    background: var(--jop-a11y-surface);
    color: inherit;
    cursor: pointer;
    text-align: left;
    min-height: 4.2rem;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.jop-a11y-option:hover,
.jop-a11y-option:focus-visible {
    border-color: rgba(var(--jop-a11y-primary-rgb), 0.35);
    outline: none;
}

.jop-a11y-option.is-active {
    background: var(--jop-a11y-primary-soft);
    border-color: rgba(var(--jop-a11y-primary-rgb), 0.55);
    box-shadow: inset 0 0 0 1px rgba(var(--jop-a11y-primary-rgb), 0.25);
}

.jop-a11y-option-icon {
    font-size: 1.15rem;
    line-height: 1;
}

.jop-a11y-option-label {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.25;
}

.jop-a11y-stepper {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
}

.jop-a11y-stepper button {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--jop-a11y-border);
    background: rgba(255,255,255,0.04);
    color: inherit;
    cursor: pointer;
    font-weight: 700;
}

.jop-a11y-stepper span {
    flex: 1;
    text-align: center;
    font-size: 0.78rem;
    color: var(--jop-a11y-muted);
}

.jop-a11y-voice-note {
    margin-top: 0.45rem;
    font-size: 0.75rem;
    color: var(--jop-a11y-muted);
    line-height: 1.4;
}

.jop-a11y-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    padding-top: 0.85rem;
    margin-top: 0.35rem;
    border-top: 1px solid var(--jop-a11y-border);
}

.jop-a11y-btn {
    border: none;
    border-radius: 12px;
    padding: 0.62rem 1rem;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, filter 0.15s;
}

.jop-a11y-btn:focus-visible { outline: 2px solid var(--jop-a11y-primary); outline-offset: 2px; }
.jop-a11y-btn--ghost {
    background: var(--jop-a11y-surface);
    color: inherit;
    border: 1px solid var(--jop-a11y-border);
}
.jop-a11y-btn--primary {
    background: linear-gradient(135deg, var(--jop-a11y-primary, #f5c518), color-mix(in srgb, var(--jop-a11y-primary) 80%, #fff));
    color: #111;
}

/* ── Float trigger ── */
.jop-a11y-float {
    position: fixed;
    z-index: 999989;
    width: 52px;
    height: 52px;
    border: 1px solid var(--jop-a11y-glass-border);
    border-radius: 16px;
    background: rgba(12, 14, 26, 0.55);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    box-shadow: 0 12px 32px rgba(0,0,0,0.35);
    color: var(--jop-a11y-text, #f4f7ff);
    cursor: pointer;
    font-size: 1.45rem;
    display: grid;
    place-items: center;
    transition: transform 0.2s var(--jop-a11y-ease), box-shadow 0.2s;
}

.jop-a11y-float:hover,
.jop-a11y-float:focus-visible {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 16px 40px rgba(0,0,0,0.42), 0 0 0 1px rgba(var(--jop-a11y-primary-rgb), 0.35);
    outline: none;
}

html.jop-a11y-body-locked,
html.jop-a11y-body-locked body {
    overflow: hidden !important;
    height: 100%;
}

@keyframes jop-a11y-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes jop-a11y-rise-in { from { opacity: 0; transform: translateY(20px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes jop-a11y-fade-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(12px) scale(0.98); } }

@media (prefers-reduced-motion: reduce) {
    .jop-a11y-backdrop,
    .jop-a11y-card,
    .jop-a11y-float { animation: none !important; opacity: 1 !important; transform: none !important; }
}

@media (max-width: 520px) {
    .jop-a11y-grid { grid-template-columns: 1fr 1fr; }
    .jop-a11y-body { padding: 1rem; }
}
