/* ==========================================================================
   Accessibility Styles — Hawaii Guide
   Skip link, focus indicators, sr-only, a11y widget panel
   ========================================================================== */

/* --- Screen Reader Only (visually hidden, accessible to AT) --- */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* --- Skip to Content Link --- */
.hg-skip-link {
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100000;
  background: #1b4332;
  color: #fff !important;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  transition: top 0.2s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.hg-skip-link:focus {
  top: 0;
  outline: 3px solid #52b788;
  outline-offset: 2px;
}

/* --- Focus Indicators (keyboard users only) --- */
/* Override the problematic :focus{outline:0} in main CSS */
*:focus-visible {
  outline: 3px solid #1866B4 !important;
  outline-offset: 2px !important;
}
/* Buttons and links get a subtler ring */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #1866B4 !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 5px rgba(24, 102, 180, 0.15) !important;
}
/* Don't show outlines for mouse clicks */
*:focus:not(:focus-visible) {
  outline: none !important;
  box-shadow: none !important;
}

/* --- Accessibility Widget Button (utility bar) --- */
.hg-a11y-btn {
  position: relative;
}
.hg-a11y-icon {
  vertical-align: -2px;
}

/* --- Accessibility Panel --- */
.hg-a11y-panel {
  display: none;
  position: fixed;
  top: 40px;
  left: 10px;
  z-index: 99999;
  width: 280px;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.hg-a11y-panel.hg-a11y-open {
  display: block;
}

.hg-a11y-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid #e5e5e5;
}
.hg-a11y-panel-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #1b4332;
}
.hg-a11y-panel-close {
  background: none;
  border: none;
  font-size: 22px;
  color: #666;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.hg-a11y-panel-close:hover {
  color: #333;
}

.hg-a11y-panel-body {
  padding: 10px 16px 16px;
}

/* Toggle row */
.hg-a11y-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}
.hg-a11y-toggle:last-child {
  border-bottom: none;
}
.hg-a11y-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #333;
  font-weight: 500;
}
.hg-a11y-toggle-label i {
  font-size: 16px;
  color: #1b4332;
  width: 20px;
  text-align: center;
}

/* Switch */
.hg-a11y-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.hg-a11y-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.hg-a11y-switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ccc;
  border-radius: 24px;
  transition: background 0.2s;
}
.hg-a11y-switch-slider:before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.hg-a11y-switch input:checked + .hg-a11y-switch-slider {
  background: #1b4332;
}
.hg-a11y-switch input:checked + .hg-a11y-switch-slider:before {
  transform: translateX(20px);
}
.hg-a11y-switch input:focus-visible + .hg-a11y-switch-slider {
  outline: 3px solid #1866B4;
  outline-offset: 2px;
}

/* Font size slider */
.hg-a11y-font-row {
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}
.hg-a11y-font-row label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #333;
  font-weight: 500;
  margin-bottom: 8px;
}
.hg-a11y-font-row label i {
  font-size: 16px;
  color: #1b4332;
  width: 20px;
  text-align: center;
}
.hg-a11y-font-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.hg-a11y-font-btn {
  width: 36px;
  height: 36px;
  border: 2px solid #1b4332;
  background: #fff;
  color: #1b4332;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.hg-a11y-font-btn:hover {
  background: #1b4332;
  color: #fff;
}
.hg-a11y-font-val {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  min-width: 40px;
  text-align: center;
}

/* Reset button */
.hg-a11y-reset {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 8px 0;
  border: 2px solid #ccc;
  border-radius: 8px;
  background: #fff;
  color: #666;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, color 0.15s;
}
.hg-a11y-reset:hover {
  border-color: #c3232f;
  color: #c3232f;
}

/* --- Applied Accessibility Modes --- */

/* Larger text */
body.hg-a11y-larger-text p,
body.hg-a11y-larger-text li,
body.hg-a11y-larger-text td,
body.hg-a11y-larger-text dd,
body.hg-a11y-larger-text blockquote,
body.hg-a11y-larger-text .article-content {
  font-size: 22px !important;
  line-height: 1.7 !important;
}
body.hg-a11y-larger-text h1 { font-size: 38px !important; }
body.hg-a11y-larger-text h2 { font-size: 32px !important; }
body.hg-a11y-larger-text h3 { font-size: 28px !important; }
body.hg-a11y-larger-text h4 { font-size: 24px !important; }
body.hg-a11y-larger-text h5, body.hg-a11y-larger-text h6 { font-size: 22px !important; }

/* High contrast */
body.hg-a11y-high-contrast {
  filter: contrast(1.35) !important;
}
body.hg-a11y-high-contrast img,
body.hg-a11y-high-contrast picture,
body.hg-a11y-high-contrast video,
body.hg-a11y-high-contrast iframe {
  filter: contrast(0.75) !important;
}

/* Highlight links */
body.hg-a11y-highlight-links a:not(.btn):not(.hg-a11y-panel a) {
  background: #fff2cc !important;
  color: #0d47a1 !important;
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
  padding: 1px 3px !important;
  border-radius: 2px !important;
}

/* Readable font */
body.hg-a11y-readable-font,
body.hg-a11y-readable-font * {
  font-family: Georgia, "Times New Roman", Times, serif !important;
  letter-spacing: 0.3px !important;
  word-spacing: 2px !important;
}

/* Pause animations */
body.hg-a11y-pause-anims *,
body.hg-a11y-pause-anims *::before,
body.hg-a11y-pause-anims *::after {
  animation-play-state: paused !important;
  transition: none !important;
}

/* Big cursor */
body.hg-a11y-big-cursor,
body.hg-a11y-big-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M5 2 L5 28 L12 21 L19 28 L23 24 L16 17 L25 17 Z' fill='black' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E") 5 2, auto !important;
}

/* Line height spacing */
body.hg-a11y-line-spacing p,
body.hg-a11y-line-spacing li,
body.hg-a11y-line-spacing td,
body.hg-a11y-line-spacing dd,
body.hg-a11y-line-spacing blockquote {
  line-height: 2.2 !important;
}

/* Panel overlay backdrop */
.hg-a11y-backdrop {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  z-index: 99998;
}
.hg-a11y-backdrop.hg-a11y-open {
  display: block;
}

/* Print: hide widget */
@media print {
  .hg-a11y-panel,
  .hg-a11y-backdrop,
  .hg-a11y-btn {
    display: none !important;
  }
}

/* Responsive: full width on very small screens */
@media (max-width: 360px) {
  .hg-a11y-panel {
    left: 5px;
    right: 5px;
    width: auto;
  }
}
