/* MapAlerter accessibility panel — website port of the MapAlerter app's a11y.css. Same button,
   panel, switches and display modes; colours come from the brand theme (assets/brand/theme.css)
   instead of the app's dark palette. Behaviour lives in js/a11y.js. Everything here is local.

   Colour checks (WCAG 2.2 AA): text >= 4.5:1, UI borders/icons >= 3:1. The button and panel use
   solid colours so these ratios are the rendered ones. */

/* ---------------------------------------------------------------------------------------------
   Floating button: bottom-left, 48px target. Solid --primary-7 fill, 2px --accent-3 ring, white
   glyph (white on #002D3D is 14.6:1; the ring stands out from both light and dark page areas). */
.a11y-fab{
  position:fixed;left:16px;bottom:16px;z-index:1500;
  width:52px;height:52px;border-radius:50%;padding:0;margin:0;cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  background:var(--primary-7);border:3px solid var(--accent-3);color:#ffffff;
  box-shadow:0 2px 10px rgba(0,0,0,.35);
}
.a11y-fab:hover{background:var(--primary-6);}
.a11y-fab svg{width:28px;height:28px;display:block;fill:currentColor;}
.a11y-fab[hidden]{display:none;}
@media print{.a11y-fab,.a11y-reader{display:none !important;}}
/* Keep the last footer links clear of the button when scrolled to the very bottom. */
body:has(.a11y-fab) .ma-alerts-strip{padding-bottom:80px;}

/* ---------------------------------------------------------------------------------------------
   Panel (modal dialog), above UIkit modals (z-index 1010). */
.a11y-overlay{
  position:fixed;inset:0;z-index:2700;display:none;
  background:rgba(var(--primary-7-rgb),.6);align-items:center;justify-content:center;padding:16px;
}
.a11y-overlay.is-open{display:flex;}
.a11y-panel{
  width:100%;max-width:420px;max-height:90vh;overflow-y:auto;
  background:#ffffff;color:var(--text);font-family:var(--font);font-size:16px;line-height:1.45;
  border:2px solid var(--primary-7);border-radius:12px;padding:20px 20px 22px;
  box-shadow:0 12px 32px rgba(0,0,0,.35);
}
.a11y-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:6px;}
.a11y-title{margin:0;font-size:1.35em;font-weight:700;color:var(--primary-7);}
.a11y-close{
  width:44px;height:44px;flex:0 0 auto;border-radius:50%;cursor:pointer;
  background:#ffffff;color:var(--primary-7);border:2px solid var(--primary-7);
  font-size:20px;line-height:1;padding:0;
}
.a11y-group-title{
  margin:16px 0 8px;font-size:.8em;font-weight:700;text-transform:uppercase;letter-spacing:.06em;
  color:var(--text-muted);
}
.a11y-seg{display:flex;gap:8px;}
.a11y-seg button{
  flex:1 1 0;min-height:44px;border-radius:8px;cursor:pointer;font:inherit;font-weight:700;
  background:#ffffff;color:var(--primary-7);border:2px solid var(--primary-7);padding:8px 10px;
}
.a11y-seg button[aria-pressed="true"]{background:var(--primary-7);color:#ffffff;}

/* On/off switches: role="switch" buttons, so screen readers announce on/off. */
.a11y-switch{
  display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;
  min-height:48px;margin-top:8px;padding:8px 12px;border-radius:8px;cursor:pointer;text-align:left;
  background:#ffffff;color:var(--primary-7);border:2px solid var(--grey-6);
  font:inherit;font-weight:700;
}
.a11y-switch .a11y-track{
  position:relative;flex:0 0 auto;width:48px;height:28px;border-radius:14px;
  background:#ffffff;border:2px solid var(--primary-7);
}
.a11y-switch .a11y-track::after{
  content:"";position:absolute;top:2px;left:2px;width:20px;height:20px;border-radius:50%;
  background:var(--primary-7);transition:transform .15s ease;
}
.a11y-switch[aria-checked="true"]{border-color:var(--primary-7);}
.a11y-switch[aria-checked="true"] .a11y-track{background:var(--primary-5);border-color:var(--primary-5);}
.a11y-switch[aria-checked="true"] .a11y-track::after{transform:translateX(20px);background:#ffffff;}

.a11y-row{display:flex;gap:8px;}
.a11y-btn{
  flex:1 1 0;min-height:44px;border-radius:8px;cursor:pointer;font:inherit;font-weight:700;
  padding:8px 10px;text-align:center;text-decoration:none;
  display:flex;align-items:center;justify-content:center;
  background:#ffffff;color:var(--primary-7);border:2px solid var(--primary-7);
}
.a11y-btn.is-primary{background:var(--primary-5);border-color:var(--primary-5);color:#ffffff;}
.a11y-btn.is-danger{border-color:var(--danger-6);color:var(--danger-6);}
.a11y-note{margin:8px 0 0;font-size:.85em;line-height:1.45;color:var(--text-muted);}
.a11y-note a{color:var(--link);text-decoration:underline;}
.a11y-status{margin:8px 0 0;min-height:1.2em;font-size:.85em;color:var(--text-muted);}

/* Toast after "Permanently Hide" (announced via role="status"). */
.a11y-toast{
  position:fixed;left:16px;right:16px;bottom:84px;z-index:2800;
  margin:0 auto;max-width:400px;padding:12px 16px;border-radius:8px;text-align:center;
  background:#ffffff;color:var(--primary-7);border:2px solid var(--primary-7);font-weight:700;
}

/* ---------------------------------------------------------------------------------------------
   Text size (Website: set in the panel). The site's sizes are in rem, so scaling the root size
   scales the page. */
html.a11y-text-1{font-size:20.5px;}
html.a11y-text-2{font-size:23px;}
@media (max-width:639px){ html.a11y-text-1{font-size:19.5px;} html.a11y-text-2{font-size:22px;} }

/* ---------------------------------------------------------------------------------------------
   HIGH CONTRAST: black and white, links in dark blue, every pairing >= 7:1 (WCAG AAA).
   Redefines the brand variables, so header, buttons, tags and panels follow. */
html.a11y-hc{
  --primary-1:#ffffff; --primary-2:#ffffff; --primary-3:#000000; --primary-4:#000000;
  --primary-5:#000000; --primary-6:#000000; --primary-7:#000000; --primary-8:#000000;
  --accent-1:#ffffff; --accent-2:#ffffff; --accent-3:#ffff00; --accent-4:#ffff00; --accent-6:#000000;
  --secondary-2:#ffffff; --secondary-6:#000000; --secondary-7:#000000;
  --success-1:#ffffff; --success-6:#000000; --success-7:#000000;
  --warning-1:#ffffff; --warning-4:#000000; --warning-7:#000000; --warning-text:#000000;
  --danger-0:#ffffff; --danger-1:#ffffff; --danger-6:#8a0000; --danger-7:#8a0000;
  --grey-1:#ffffff; --grey-3:#000000; --grey-4:#000000; --grey-6:#000000; --grey-7:#000000;
  --neutral-1:#ffffff;
  --text:#000000; --text-muted:#000000; --link:#00338a; --focus:#ffbf00;
}
html.a11y-hc body{font-weight:600;background:#ffffff;color:#000000;}
html.a11y-hc a:not(.uk-button){color:#00338a;text-decoration:underline;}
html.a11y-hc .ma-on-dark a:not(.uk-button){color:#ffffff;}
html.a11y-hc .uk-button{border:2px solid currentColor;}
html.a11y-hc .ma-panel, html.a11y-hc .ma-table td, html.a11y-hc .ma-table th{border-color:#000000;}
html.a11y-hc .a11y-fab{background:#000000;border-color:#ffff00;color:#ffffff;}

/* ---------------------------------------------------------------------------------------------
   Underline links (WCAG 1.4.1 — links identifiable without relying on colour alone). */
html.a11y-links a{text-decoration:underline !important;text-underline-offset:2px;}

/* ---------------------------------------------------------------------------------------------
   Reduce motion (WCAG 2.3.3) — also applied automatically when the device asks for it and the
   user hasn't chosen otherwise (a11y.js adds the class from prefers-reduced-motion). */
html.a11y-nomotion *,
html.a11y-nomotion *::before,
html.a11y-nomotion *::after{
  animation-duration:.001ms !important;animation-iteration-count:1 !important;
  transition-duration:.001ms !important;scroll-behavior:auto !important;
}

/* ---------------------------------------------------------------------------------------------
   Increase text spacing — the exact WCAG 1.4.12 values: line height 1.5x, paragraph spacing 2x,
   letter spacing 0.12em, word spacing 0.16em. */
html.a11y-spacing body *:not(.leaflet-container):not(.leaflet-container *){
  line-height:1.5 !important;letter-spacing:.12em !important;word-spacing:.16em !important;
}
html.a11y-spacing p{margin-bottom:2em !important;}

/* ---------------------------------------------------------------------------------------------
   Read aloud — the block being spoken is highlighted, and a "Stop reading" pill sits beside the
   accessibility button until reading ends. */
.a11y-reading{
  outline:3px solid #b45309 !important;outline-offset:3px;border-radius:6px;
  background-color:rgba(255,191,71,.4) !important;
}
.a11y-reader{position:fixed;left:80px;bottom:18px;z-index:1500;}
.a11y-reader-btn{
  min-height:48px;padding:0 18px;border-radius:24px;cursor:pointer;font:inherit;font-weight:700;
  background:#ffffff;color:var(--primary-7);border:2px solid var(--primary-7);box-shadow:0 2px 8px rgba(0,0,0,.3);
}
html.a11y-hc .a11y-reader-btn{background:#000000;color:#ffffff;border-color:#ffff00;}
