/* ===== Skip Link ===== */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: -1;
}
.skip-link:focus {
  position: fixed;
  top: 0;
  left: 0;
  width: auto;
  height: auto;
  padding: 10px 20px;
  background: #0e4b91;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  z-index: 10001;
  outline: 3px solid #fe0000;
  outline-offset: 2px;
  text-decoration: none;
  border-radius: 0 0 6px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ===== CSS Custom Properties (brand colours) ===== */
:root {
  --a11y-blue:        #0e4b91;
  --a11y-blue-dark:   #0a3870;
  --a11y-blue-light:  #1a6ec1;
  --a11y-accent:      #fe0000;
  --a11y-text:        #434343;
  --a11y-bg:          #ffffff;
  --a11y-border:      #e4e4e4;
  --a11y-surface:     #f6f8fc;
  --a11y-shadow:      rgba(14, 75, 145, 0.18);
}

/* ===== Focus Visible — keyboard-only focus ring (WCAG 2.4.7) =====
 * Uses :focus-visible so mouse clicks stay outline-free (no design conflict).
 * !important overrides the many outline:none rules across page CSS files.
 * ================================================================== */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible,
[role="menuitem"]:focus-visible,
[role="option"]:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid #0e4b91 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 4px rgba(14, 75, 145, 0.18) !important;
}

/* Slider/range inputs use a different indicator shape */
input[type="range"]:focus-visible {
  outline: 2px solid #0e4b91 !important;
  outline-offset: 4px !important;
}

/* High-contrast mode — swap to yellow ring */
html.a11y-hc a:focus-visible,
html.a11y-hc button:focus-visible,
html.a11y-hc input:focus-visible,
html.a11y-hc select:focus-visible,
html.a11y-hc textarea:focus-visible,
html.a11y-hc [role="button"]:focus-visible,
html.a11y-hc [tabindex]:focus-visible {
  outline: 3px solid #ffff00 !important;
  outline-offset: 3px !important;
  box-shadow: none !important;
}

/* ===== High Contrast Mode ===== */
html.a11y-hc body                       { background:#000 !important; color:#fff !important; }
html.a11y-hc a                          { color:#ffff00 !important; }
html.a11y-hc a:hover,
html.a11y-hc a:focus                    { color:#fff !important; outline:2px solid #ffff00 !important; }
html.a11y-hc h1, html.a11y-hc h2,
html.a11y-hc h3, html.a11y-hc h4,
html.a11y-hc h5, html.a11y-hc h6       { color:#fff !important; }
html.a11y-hc .btn,
html.a11y-hc button:not(#a11y-fab):not(#a11y-panel button) {
  background:#fff !important; color:#000 !important; border:2px solid #fff !important;
}
html.a11y-hc header, html.a11y-hc nav,
html.a11y-hc footer, html.a11y-hc .section-bg,
html.a11y-hc .bg-primary, html.a11y-hc .bg-info {
  background:#000 !important; border-bottom:1px solid #fff !important;
}
html.a11y-hc input, html.a11y-hc textarea,
html.a11y-hc select {
  background:#000 !important; color:#fff !important; border:1px solid #fff !important;
}

/* ===== Touch Targets — WCAG 2.5.8 (min 24×24px) ===== */
.social-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
}

/* ===== FAB Button ===== */
#a11y-fab {
  position: fixed;
  bottom: 28px;
  left: 28px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(145deg, #1a6ec1 0%, #0e4b91 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(14, 75, 145, 0.45), 0 1px 4px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  padding: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#a11y-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 22px rgba(14, 75, 145, 0.55), 0 2px 6px rgba(0,0,0,0.2);
}
#a11y-fab:focus {
  outline: 3px solid #fff;
  outline-offset: 3px;
}
#a11y-fab:active { transform: scale(0.96); }

/* ===== Panel ===== */
#a11y-panel {
  position: fixed;
  bottom: 92px;
  left: 28px;
  width: 282px;
  background: #fff;
  border-radius: 16px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.15),
    0 6px 20px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(0,0,0,0.04);
  z-index: 9998;
  font-family: 'Montserrat', Arial, sans-serif;
  font-size: 13px;
  color: #333;
  overflow: hidden;
  transform-origin: bottom left;
  transform: scale(0.8) translateY(10px);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.2s ease;
  pointer-events: none;
}
#a11y-panel.a11y-panel-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ===== Panel — Header ===== */
.a11y-panel-header {
  background: linear-gradient(135deg, #0e4b91 0%, #1a6ec1 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 14px 18px;
}

.a11y-panel-heading {
  color: #fff;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.2;
}

.a11y-close-btn {
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.18);
  border: 1.5px solid rgba(255,255,255,0.35);
  border-radius: 50%;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  padding: 0;
  font-family: Arial, sans-serif;
  flex-shrink: 0;
}
.a11y-close-btn:hover { background: rgba(255,255,255,0.32); transform: scale(1.1); }
.a11y-close-btn:focus { outline: 2px solid #fff; outline-offset: 1px; }

/* ===== Panel body ===== */
.a11y-section {
  padding: 13px 16px;
  border-bottom: 1px solid #f0f0f0;
}
.a11y-section:last-child { border-bottom: none; }

.a11y-section-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #aaa;
  margin: 0 0 9px 0;
  display: block;
}

/* ===== Colour Mode — simple button row ===== */
.a11y-mode-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.a11y-mode-btn {
  flex: 1;
  min-width: 0;
  padding: 8px 4px;
  border: 2px solid #e0e0e0;
  background: #f6f8fc;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Montserrat', Arial, sans-serif;
  font-size: 10px;
  font-weight: 600;
  color: #555;
  line-height: 1.2;
  text-align: center;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}
.a11y-mode-btn:hover {
  border-color: #0e4b91;
  background: #eef3fb;
  color: #0e4b91;
}
.a11y-mode-btn:focus {
  outline: 2px solid #0e4b91;
  outline-offset: 2px;
}
.a11y-mode-btn.a11y-mode-active {
  border-color: #0e4b91;
  background: #0e4b91;
  color: #fff;
  box-shadow: 0 2px 6px rgba(14,75,145,0.3);
}

/* ===== Text Size Buttons ===== */
.a11y-size-row {
  display: flex;
  gap: 6px;
}

.a11y-size-btn {
  flex: 1;
  padding: 10px 4px;
  border: 2px solid #e0e0e0;
  background: #f6f8fc;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Montserrat', Arial, sans-serif;
  color: #555;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}
.a11y-size-btn:hover {
  border-color: #0e4b91;
  color: #0e4b91;
  background: #eef3fb;
}
.a11y-size-btn:focus {
  outline: 2px solid #0e4b91;
  outline-offset: 2px;
}
.a11y-size-btn.a11y-size-active {
  border-color: #0e4b91;
  background: #0e4b91;
  color: #fff;
  box-shadow: 0 2px 8px rgba(14, 75, 145, 0.32);
}

.a11y-size-btn[data-size="100"] { font-size: 12px; }
.a11y-size-btn[data-size="115"] { font-size: 14px; }
.a11y-size-btn[data-size="130"] { font-size: 16px; }

/* ===== Reset button ===== */

/* ===== Reset Section ===== */
.a11y-reset-section {
  padding: 10px 16px 14px;
}

.a11y-reset-btn {
  width: 100%;
  padding: 8px 12px;
  background: #fff;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  color: #999;
  font-size: 11px;
  font-weight: 600;
  font-family: 'Montserrat', Arial, sans-serif;
  cursor: pointer;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.a11y-reset-btn:hover { border-color: #e53e3e; color: #e53e3e; background: #fff8f8; }
.a11y-reset-btn:focus { outline: 2px solid #e53e3e; outline-offset: 2px; }

/* ===== Tint Overlay ===== */
#a11y-tint-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9997;
  display: none;
}

/* ===== Colour Tint & Saturation rows ===== */
.a11y-tint-row,
.a11y-sat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.a11y-tint-row:last-child,
.a11y-sat-row:last-child {
  margin-bottom: 0;
}
.a11y-tint-row label,
.a11y-sat-row label {
  font-size: 11px;
  color: #555;
  min-width: 50px;
}
.a11y-tint-row input[type="color"] {
  width: 32px;
  height: 24px;
  border: 1.5px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  padding: 1px;
  background: none;
}
.a11y-tint-row input[type="range"],
.a11y-sat-row input[type="range"] {
  flex: 1;
  accent-color: #0e4b91;
  cursor: pointer;
}
.a11y-tint-row input[type="color"]:focus-visible,
.a11y-tint-row input[type="range"]:focus-visible,
.a11y-sat-row input[type="range"]:focus-visible {
  outline: 2px solid #0e4b91;
  outline-offset: 2px;
}

/* ===== HC overrides for the widget itself ===== */
html.a11y-hc #a11y-fab {
  background: #fff !important;
  border: 2px solid #000 !important;
  color: #000 !important;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #000 !important;
}
html.a11y-hc #a11y-panel {
  background: #000 !important;
  border: 2px solid #fff !important;
  box-shadow: none !important;
  color: #fff !important;
}
html.a11y-hc .a11y-panel-heading {
  background: #111 !important;
  border-bottom: 1px solid #fff !important;
}
html.a11y-hc .a11y-close-btn {
  background: transparent !important;
  border-color: #fff !important;
  color: #fff !important;
}
html.a11y-hc .a11y-section { border-bottom-color: #333 !important; }
html.a11y-hc .a11y-section-label { color: #aaa !important; }
html.a11y-hc .a11y-mode-btn {
  background: #111 !important;
  border-color: #444 !important;
  color: #ccc !important;
}
html.a11y-hc .a11y-mode-btn:hover,
html.a11y-hc .a11y-mode-btn.a11y-mode-active {
  background: #fff !important;
  border-color: #fff !important;
  color: #000 !important;
  box-shadow: none !important;
}
html.a11y-hc .a11y-panel-header { background: #111 !important; border-bottom: 1px solid #555 !important; }
html.a11y-hc .a11y-size-btn {
  background: #000 !important;
  color: #fff !important;
  border-color: #555 !important;
}
html.a11y-hc .a11y-size-btn.a11y-size-active {
  background: #fff !important;
  color: #000 !important;
  border-color: #fff !important;
}
html.a11y-hc .a11y-reset-btn {
  background: #000 !important;
  color: #ccc !important;
  border-color: #555 !important;
}
html.a11y-hc .a11y-reset-btn:hover {
  border-color: #ff6666 !important;
  color: #ff6666 !important;
}
html.a11y-hc .a11y-tint-row label,
html.a11y-hc .a11y-sat-row label { color: #ccc !important; }
html.a11y-hc .a11y-tint-row input[type="color"] {
  border-color: #fff !important;
}
html.a11y-hc .a11y-tint-row input[type="range"],
html.a11y-hc .a11y-sat-row input[type="range"] {
  accent-color: #fff !important;
}
