/* ============================================================
   Accessibility Widget - Tec Dynamics
   Floating bottom-left button + panel; body-class overrides
   for the rest of the site.
   ============================================================ */

:root {
    --td-a11y-accent: #faaf40;
    --td-a11y-dark:   #1a1a2e;
}

/* ---------- Button + Panel chrome ---------- */
.td-a11y {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9998;
    font-family: Arial, sans-serif;
}

.td-a11y-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: var(--td-a11y-dark);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.td-a11y-btn:hover,
.td-a11y-btn:focus-visible {
    transform: scale(1.05);
    outline: 3px solid var(--td-a11y-accent);
    outline-offset: 2px;
}
.td-a11y-btn svg {
    width: 28px;
    height: 28px;
    fill: var(--td-a11y-accent);
}

.td-a11y-panel {
    position: absolute;
    bottom: 64px;
    left: 0;
    width: 280px;
    background: #fff;
    color: #1a1a2e;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    padding: 16px;
    border: 1px solid #eee;
}
.td-a11y-panel[hidden] { display: none; }

.td-a11y-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--td-a11y-accent);
}
.td-a11y-panel-head h2 {
    font-size: 16px;
    margin: 0;
    color: var(--td-a11y-dark);
}
.td-a11y-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #555;
    padding: 0 6px;
}

.td-a11y-section { margin: 12px 0; }
.td-a11y-label {
    display: block;
    font-size: 12px;
    font-weight: bold;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.td-a11y-label small {
    text-transform: none;
    letter-spacing: 0;
    font-weight: normal;
    color: #999;
}

.td-a11y-row {
    display: flex;
    gap: 6px;
}
.td-a11y-row button {
    flex: 1;
    padding: 8px 6px;
    border: 1px solid #ddd;
    background: #f8f9fa;
    color: #1a1a2e;
    cursor: pointer;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.15s ease;
}
.td-a11y-row button:hover,
.td-a11y-row button:focus-visible {
    background: var(--td-a11y-accent);
    border-color: var(--td-a11y-accent);
    outline: none;
}
.td-a11y-row button[aria-pressed="true"],
.td-a11y-row button.is-active {
    background: var(--td-a11y-dark);
    color: var(--td-a11y-accent);
    border-color: var(--td-a11y-dark);
}

.td-a11y-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    background: #f8f9fa;
    color: #1a1a2e;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 6px;
    text-align: left;
}
.td-a11y-toggle:hover,
.td-a11y-toggle:focus-visible {
    border-color: var(--td-a11y-accent);
    outline: none;
}
.td-a11y-toggle-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ccc;
    flex-shrink: 0;
    transition: background 0.15s ease;
}
.td-a11y-toggle[aria-pressed="true"] {
    background: var(--td-a11y-dark);
    color: var(--td-a11y-accent);
    border-color: var(--td-a11y-dark);
}
.td-a11y-toggle[aria-pressed="true"] .td-a11y-toggle-dot {
    background: var(--td-a11y-accent);
}

.td-a11y-reset {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    background: #fff;
    color: #c0392b;
    cursor: pointer;
    border-radius: 6px;
    font-size: 13px;
}
.td-a11y-reset:hover { background: #fee; }

.td-a11y-note {
    font-size: 11px;
    color: #999;
    text-align: center;
    margin: 8px 0 0;
}

/* ============================================================
   GLOBAL EFFECTS triggered by body classes
   ============================================================ */

/* ---------- Text scaling (root font-size) ---------- */
html.td-a11y-text-1 { font-size: 90%; }
html.td-a11y-text-3 { font-size: 115%; }
html.td-a11y-text-4 { font-size: 130%; }

/* ---------- High contrast ---------- */
body.td-a11y-contrast,
body.td-a11y-contrast * {
    background-color: #000 !important;
    color: #ffeb3b !important;
    text-shadow: none !important;
    box-shadow: none !important;
}
body.td-a11y-contrast a,
body.td-a11y-contrast a * {
    color: #4ad1ff !important;
    text-decoration: underline !important;
}
body.td-a11y-contrast img,
body.td-a11y-contrast svg,
body.td-a11y-contrast video {
    filter: contrast(1.2) brightness(1.05);
}
body.td-a11y-contrast input,
body.td-a11y-contrast textarea,
body.td-a11y-contrast select,
body.td-a11y-contrast button {
    background-color: #000 !important;
    color: #ffeb3b !important;
    border: 1px solid #ffeb3b !important;
}
/* Keep the a11y widget itself readable in contrast mode */
body.td-a11y-contrast .td-a11y-panel,
body.td-a11y-contrast .td-a11y-panel * {
    background-color: #000 !important;
    color: #ffeb3b !important;
    border-color: #ffeb3b !important;
}

/* ---------- Highlight all links ---------- */
body.td-a11y-links a {
    text-decoration: underline !important;
    font-weight: bold !important;
    outline: 1px dashed currentColor;
    outline-offset: 2px;
}

/* ---------- Readable font ---------- */
body.td-a11y-font,
body.td-a11y-font * {
    font-family: Verdana, Tahoma, Arial, sans-serif !important;
    letter-spacing: 0.02em !important;
    line-height: 1.6 !important;
}

/* ---------- Bigger cursor (custom 32px SVG inline) ---------- */
body.td-a11y-cursor,
body.td-a11y-cursor * {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'><path d='M4 2 L4 32 L12 24 L17 36 L22 34 L17 22 L28 22 Z' fill='%23000' stroke='%23faaf40' stroke-width='2'/></svg>") 4 2, auto !important;
}
body.td-a11y-cursor a,
body.td-a11y-cursor button,
body.td-a11y-cursor [role="button"] {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'><path d='M12 4 L12 22 L8 22 L14 30 L20 22 L16 22 L16 4 Z' fill='%23faaf40' stroke='%23000' stroke-width='2'/></svg>") 14 4, pointer !important;
}

/* ---------- TTS reading indicator ---------- */
.td-a11y-reading-now {
    background: var(--td-a11y-accent) !important;
    color: var(--td-a11y-dark) !important;
    outline: 2px solid var(--td-a11y-dark);
    outline-offset: 2px;
}

/* ---------- Mobile tweaks ---------- */
@media (max-width: 480px) {
    .td-a11y { bottom: 16px; left: 16px; }
    .td-a11y-panel { width: calc(100vw - 32px); }
}
