/* CODO Accessibility Suite v2 – Sidebar UI */

:root {
  --codo-as-bg: #ffffff;
  --codo-as-fg: #111827;
  --codo-as-accent: #2563eb;
  --codo-as-muted: #e5e7eb;
  --codo-as-shadow: rgba(0,0,0,.25);
}

.codo-as-launcher {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 100000;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--codo-as-accent);
  color: #fff;
  border: none;
  box-shadow: 0 8px 24px var(--codo-as-shadow);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 26px;
  line-height: 1;
}
html[dir="ltr"] .codo-as-launcher { left: 16px; right: auto; }
html[dir="rtl"] .codo-as-launcher { right: 16px; left: auto; }

/* Panel */
.codo-as-panel {
  position: fixed;
  top: 0; bottom: 0;
  width: 320px;
  background: var(--codo-as-bg);
  color: var(--codo-as-fg);
  box-shadow: 0 0 40px var(--codo-as-shadow);
  z-index: 100000;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease;
  border-inline-start: 1px solid var(--codo-as-muted);
}
/* position by side */
.codo-as-panel[data-side="right"] { right: 0; transform: translateX(100%); }
.codo-as-panel[data-side="left"] { left: 0; transform: translateX(-100%); }
.codo-as-panel.is-open[data-side="right"] { transform: translateX(0); }
.codo-as-panel.is-open[data-side="left"] { transform: translateX(0); }

.codo-as-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: #1d4ed8; color: #fff;
}
.codo-as-panel-header h2 { margin: 0; font-size: 18px; }
.codo-as-close { background: transparent; color:#fff; border:none; font-size:24px; cursor:pointer; }

.codo-as-panel-body { padding: 8px 0; overflow: auto; }
.codo-as-row {
  display:flex; align-items:center; justify-content:space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--codo-as-muted);
}
.codo-as-row-label { font-size: 16px; }
.codo-as-toggle { width: 42px; height: 22px; }

.codo-as-panel-footer { padding: 12px 16px; }
.codo-as-reset {
  width: 100%; padding: 10px 14px; border-radius: 6px; border: 1px solid var(--codo-as-muted);
  background: #f3f4f6; cursor: pointer;
}

/* Skip links */
.codo-as-skip a {
  position: absolute;
  transform: translateY(-200%);
  background: #000; color:#fff;
  padding: 8px 12px; border-radius: 6px;
}
.codo-as-skip a:focus { transform: translateY(0); outline:2px solid var(--codo-as-accent); }

/* Screen reader utility */
.screen-reader-text { position: absolute!important; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.screen-reader-text.focusable:active,.screen-reader-text.focusable:focus { position: static!important; width:auto; height:auto; margin:0; overflow:visible; clip:auto; white-space:normal; }

/* Accessibility states (do not affect UI widgets) */
html.codo-as-contrast body:not(.codo-as-ui),
html.codo-as-contrast body:not(.codo-as-ui) *:not(.codo-as-panel):not(.codo-as-panel *):not(.codo-as-launcher) {
  color: #000 !important; background-color: #fff !important; outline-color: #000 !important;
}

/* Readable font applies broadly */
html.codo-as-readable, 
html.codo-as-readable body, 
html.codo-as-readable body *:not(.codo-as-panel):not(.codo-as-panel *):not(.codo-as-launcher) {
  font-family: Arial, Helvetica, sans-serif !important;
}

/* Highlight headings */
html.codo-as-mark-headings h1, 
html.codo-as-mark-headings h2,
html.codo-as-mark-headings h3,
html.codo-as-mark-headings h4,
html.codo-as-mark-headings h5,
html.codo-as-mark-headings h6 {
  outline: 2px dashed #2563eb;
  outline-offset: 2px;
}

/* Highlight links & buttons */
html.codo-as-mark-links a, 
html.codo-as-mark-links button, 
html.codo-as-mark-links [role="button"] {
  outline: 2px dashed #16a34a;
  outline-offset: 2px;
}

/* Font scale steps */
/* Font scale applies at root and body to affect px-based themes as well */
html.codo-as-scale-1, html.codo-as-scale-1 body { font-size: 110% !important; }
html.codo-as-scale-2, html.codo-as-scale-2 body { font-size: 120% !important; }
html.codo-as-scale-3, html.codo-as-scale-3 body { font-size: 130% !important; }
html.codo-as-scale-4, html.codo-as-scale-4 body { font-size: 140% !important; }
html.codo-as-scale-5, html.codo-as-scale-5 body { font-size: 150% !important; }

/* Reduced motion */
@media (prefers-reduced-motion: no-preference) {
  html.codo-as-reduce-motion * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}


/* Toggle switch styling */
.codo-as-row .codo-as-toggle {
  appearance: none;
  width: 40px; height: 22px;
  background: #e5e7eb;
  border-radius: 999px;
  position: relative;
  outline: none;
  cursor: pointer;
  transition: background .2s ease;
}
.codo-as-row .codo-as-toggle:checked { background: var(--codo-as-accent); }
.codo-as-row .codo-as-toggle::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff;
  transition: transform .2s ease;
}
.codo-as-row .codo-as-toggle:checked::after { transform: translateX(18px); }

/* Footer branding */
.codo-as-branding {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--codo-as-muted);
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: #6b7280;
}
.codo-as-branding img { height: 24px; width: auto; display: block; }
.codo-as-branding a { color: inherit; text-decoration: underline; }

/* === CODO v2.3 UI Enhancements === */

/* Action buttons (A+ / A−) */
.codo-as-btn {
  background: #fff;
  color: #111;
  border: 1px solid #111;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
}
.codo-as-btn:hover {
  border-color: #f9b916;
  box-shadow: 0 0 0 2px rgba(249,185,22,0.3);
}

/* Custom switches */
.codo-as-row .codo-as-toggle {
  appearance: none;
  width: 40px;
  height: 22px;
  background: #fff;
  border: 2px solid #111;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: all .25s ease;
}
.codo-as-row .codo-as-toggle::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: #111;
  border-radius: 50%;
  transition: transform .25s ease, background .25s ease;
}
.codo-as-row .codo-as-toggle:checked {
  border-color: #f9b916;
}
.codo-as-row .codo-as-toggle:checked::after {
  background: #f9b916;
  transform: translateX(18px);
}
