/* =========================================================
   Skip navigation link (ACC-02)
   Visually hidden until focused — allows keyboard users to
   jump directly to main content bypassing the navigation bar.
   ========================================================= */

.skip-link {
  position: absolute;
  top: -40px;
  left: 8px;
  z-index: 99999;
  padding: 8px 16px;
  background: #005FCC;
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  border-radius: 0 0 4px 4px;
  text-decoration: none;
  transition: top 0.1s;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid var(--a11y-focus);
  outline-offset: 2px;
}

/* =========================================================
   Accessibility launcher + menu (bottom-right icon)
   ========================================================= */

:root{
  --a11y-bg: #111827;         /* dark slate */
  --a11y-border: #374151;
  --a11y-fg: #ffffff;
  --a11y-focus: #FFBF47;      /* strong focus outline */
  --a11y-link-underline: #1D4ED8; /* accessible-ish blue underline */
  --a11y-menu-width: 320px;
}

/* Floating accessibility icon button */
.a11y-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10001;

  width: 56px;
  height: 56px;
  border-radius: 50%;

  background: #005FCC;   /* standard accessibility blue */
  border: 2px solid #ffffff;
  color: #ffffff;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  box-shadow: 0 10px 24px rgba(0,0,0,0.25);
  cursor: pointer;
}

.a11y-toggle:hover {
  background: #0047A6;
}

.a11y-toggle:focus-visible {
  outline: 3px solid var(--a11y-focus);
  outline-offset: 3px;
}

.a11y-toggle svg {
  width: 32px;   /* slightly larger */
  height: 32px;
  fill: currentColor;
}

/* The menu panel (opens above the button) */
.a11y-panel {
  position: fixed;
  right: 14px;
  bottom: 76px; /* above the toggle */
  z-index: 10000;

  width: var(--a11y-menu-width);
  max-width: calc(100vw - 28px);

  background: var(--a11y-bg);
  border: 1px solid var(--a11y-border);
  color: var(--a11y-fg);
  border-radius: 16px;
  padding: 12px;

  box-shadow: 0 14px 40px rgba(0,0,0,0.28);
}

.a11y-panel[hidden] { display: none !important; }

.a11y-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom: 10px;
}

.a11y-title{
  font-size: 16px;
  margin: 0;
}

.a11y-help{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.6);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  background: rgba(255,255,255,0.08);
}

.a11y-help:hover{
  background: rgba(255,255,255,0.18);
}

.a11y-help:focus-visible{
  outline: 3px solid var(--a11y-focus);
  outline-offset: 2px;
}

.a11y-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}

.a11y-btn {
  appearance: none;
  border: 1px solid #D1D5DB;
  background: #FFFFFF;
  color: #111827;

  padding: 8px 10px;
  border-radius: 999px;
  font-size: 14px;
  line-height: 1;
  font-weight: 700;

  cursor: pointer;
}

.a11y-btn:hover { background: #F3F4F6; }
.a11y-btn:active { transform: translateY(1px); }

.a11y-btn:focus-visible {
  outline: 3px solid var(--a11y-focus);
  outline-offset: 2px;
}

/* Toggle-style buttons show pressed state clearly */
.a11y-btn[aria-pressed="true"]{
  background: #111827;
  color: #fff;
  border-color: #fff;
}

.a11y-btn-danger{
  border-color: #FCA5A5;
  background: #FEF2F2;
  color: #991B1B;
}

.a11y-btn-danger:hover{
  background: #FEE2E2;
}

/* Small explanatory text */
.a11y-hint{
  font-size: 12px;
  color: #D1D5DB;
  margin-top: 6px;
}

/* =========================================================
   Features applied to page via body classes
   ========================================================= */

/* High contrast yellow */
body.a11y-contrast-yellow {
  background: #000 !important;
  color: #fff !important;
}

body.a11y-contrast-yellow a {
  color: #FFD400 !important;
}

/* High contrast white (very clean) */
body.a11y-contrast-white {
  background: #000 !important;
  color: #fff !important;
}

body.a11y-contrast-white a {
  color: #ffffff !important;
  text-decoration: underline;
}

/* Underline links (clear and consistent)
   - Underline colour uses currentColor by default; we add thickness/offset for clarity
*/
body.a11y-underline-links a {
  text-decoration-line: underline !important;
  text-decoration-thickness: 3px;
  text-underline-offset: 3px;
}

/* If NOT in contrast mode, ensure underline has good visibility */
body.a11y-underline-links:not(.a11y-contrast-yellow):not(.a11y-contrast-white) a {
  text-decoration-color: var(--a11y-link-underline) !important;
}

/* Text spacing presets (WCAG-ish friendly)
   - Keep these moderate; too aggressive can break layouts.
*/
body.a11y-spacing-plus {
  line-height: 1.8 !important;
  letter-spacing: 0.06em !important;
  word-spacing: 0.16em !important;
}

body.a11y-spacing-minus {
  line-height: 1.45 !important;
  letter-spacing: 0.01em !important;
  word-spacing: 0.02em !important;
}

/* Cursor: expects cursor images in /public/assets/cursors/
   e.g. /public/assets/cursors/large-arrow-yellow-64.png etc
*/
/* Large cursor (custom image) */
body.a11y-cursor-yellow,
body.a11y-cursor-yellow * {
  cursor: url("./cursors/large-arrow-yellow-64.png") 4 4, auto !important;
}

body.a11y-cursor-white,
body.a11y-cursor-white * {
  cursor: url("./cursors/large-arrow-white-64.png") 4 4, auto !important;
}

/* Reading ruler (overlay follows cursor)
   JS positions #a11y-ruler
*/
#a11y-ruler {
  position: fixed;
  left: 0;
  top: 0;
  height: 22px;
  width: 100vw;
  z-index: 9999;
  pointer-events: none;

  /* bright bands */
  background: linear-gradient(
    to bottom,
    #C8FF00 0%,
    #C8FF00 40%,
    #000000 40%,
    #000000 60%,
    #C8FF00 60%,
    #C8FF00 100%
  );

  opacity: 0.95;
  border-top: 1px solid rgba(0,0,0,0.35);
  border-bottom: 1px solid rgba(0,0,0,0.35);
}

#a11y-ruler[hidden] { display: none !important; }

/* =========================================================
   High contrast: table gridlines and striping
   - In contrast modes, borders should be yellow on black
   ========================================================= */

body.a11y-contrast-yellow .table > :not(caption) > * > *,
body.a11y-contrast-white  .table > :not(caption) > * > * {
  border-color: #FFD400 !important;
}

body.a11y-contrast-yellow .table,
body.a11y-contrast-white  .table {
  color: #fff !important;
}

body.a11y-contrast-yellow .table-striped > tbody > tr:nth-of-type(odd) > *,
body.a11y-contrast-white  .table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: #111 !important;
}

/* Header cells: keep readable separation without losing contrast */
body.a11y-contrast-yellow .table thead th,
body.a11y-contrast-white  .table thead th {
  background-color: #000 !important;
}
