/* ==========================================================================
   Skip to main content link
   Invisible until keyboard-focused, then snaps into view at top-left.
   ========================================================================== */
.a11y-skip-link {
  position: absolute;
  top: -100px;
  left: 12px;
  z-index: 10000;
  background: #185659;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 0 0 10px 10px;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  transition: top 0.18s ease;
}
.a11y-skip-link:focus,
.a11y-skip-link:focus-visible {
  top: 0;
  outline: 3px solid #ffd56e;
  outline-offset: 2px;
}

/* Visible focus ring on the main landmark while it's the focus target */
#main:focus { outline: none; }

/* ==========================================================================
   Accessibility Menu — core set
   - Floating trigger (bottom-left)
   - Text size +/-, high contrast, link highlight, larger cursor, pause anim
   - Reset
   ========================================================================== */

:root {
  --a11y-teal: #1f6f73;
  --a11y-teal-dark: #185659;
  --a11y-slate: #1a2330;
  --a11y-bg: #ffffff;
  --a11y-text: #1a2330;
  --a11y-border: #e3e8ec;
}

/* Trigger button */
.a11y-trigger {
  position: fixed;
  left: 18px;
  bottom: 18px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--a11y-teal);
  color: #fff;
  border: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, background 0.18s ease;
  padding: 0;
}
.a11y-trigger:hover,
.a11y-trigger:focus-visible {
  background: var(--a11y-teal-dark);
  transform: scale(1.05);
  outline: 3px solid #ffd56e;
  outline-offset: 2px;
}
.a11y-trigger svg { width: 28px; height: 28px; display: block; }

/* Panel */
.a11y-panel {
  position: fixed;
  left: 18px;
  bottom: 82px;
  width: 300px;
  max-width: calc(100vw - 36px);
  background: var(--a11y-bg);
  color: var(--a11y-text);
  border: 1px solid var(--a11y-border);
  border-radius: 14px;
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.22);
  padding: 14px 14px 12px;
  z-index: 9999;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.a11y-panel[data-open="true"] {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.a11y-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.a11y-panel__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--a11y-slate);
  margin: 0;
}
.a11y-panel__close {
  background: transparent;
  border: none;
  color: var(--a11y-slate);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}
.a11y-panel__close:hover { background: #f1f4f6; }

.a11y-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 8px;
}
.a11y-row + .a11y-row { border-top: 1px solid #f1f4f6; }
.a11y-row__label {
  font-size: 14px;
  color: var(--a11y-slate);
  flex: 1;
}
.a11y-row__hint {
  display: block;
  font-size: 11px;
  color: #6b7785;
  margin-top: 1px;
  font-weight: 400;
}

/* Text-size stepper */
.a11y-stepper { display: inline-flex; align-items: center; gap: 4px; }
.a11y-stepper button {
  width: 30px; height: 30px;
  border-radius: 6px;
  background: #f1f4f6;
  color: var(--a11y-slate);
  border: 1px solid var(--a11y-border);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.a11y-stepper button:hover { background: #e3e8ec; }
.a11y-stepper__value {
  min-width: 34px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--a11y-slate);
}

/* Toggles */
.a11y-toggle {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex: none;
}
.a11y-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.a11y-toggle__slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #c9d2db;
  border-radius: 24px;
  transition: 0.18s;
}
.a11y-toggle__slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.18s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.a11y-toggle input:checked + .a11y-toggle__slider { background: var(--a11y-teal); }
.a11y-toggle input:checked + .a11y-toggle__slider::before { transform: translateX(18px); }
.a11y-toggle input:focus-visible + .a11y-toggle__slider { outline: 2px solid #ffd56e; outline-offset: 2px; }

/* Reset button */
.a11y-reset {
  width: 100%;
  margin-top: 8px;
  background: transparent;
  border: 1px solid var(--a11y-border);
  color: var(--a11y-slate);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.a11y-reset:hover { background: #f1f4f6; }

/* ===================== Applied modes ===================== */

/* Text-size scaling — applied to <html> as data-a11y-textscale="X" */
html[data-a11y-textscale="1"] body { font-size: 110%; }
html[data-a11y-textscale="2"] body { font-size: 120%; }
html[data-a11y-textscale="3"] body { font-size: 135%; }

/* High contrast */
html[data-a11y-contrast="on"] body,
html[data-a11y-contrast="on"] body * {
  background-color: #000 !important;
  background-image: none !important;
  color: #fff !important;
  border-color: #fff !important;
  box-shadow: none !important;
  text-shadow: none !important;
}
html[data-a11y-contrast="on"] body { background: #000 !important; }
html[data-a11y-contrast="on"] a,
html[data-a11y-contrast="on"] a * {
  color: #ffd56e !important;
}
html[data-a11y-contrast="on"] img,
html[data-a11y-contrast="on"] video,
html[data-a11y-contrast="on"] svg {
  filter: grayscale(1) contrast(1.1);
}
/* keep our own a11y panel readable in high contrast */
html[data-a11y-contrast="on"] .a11y-panel {
  background-color: #ffffff !important;
  color: #1a2330 !important;
  border: 1px solid #1a2330 !important;
}
html[data-a11y-contrast="on"] .a11y-panel * {
  background-color: transparent !important;
  color: #1a2330 !important;
  border-color: #c9d2db !important;
  filter: none !important;
}
html[data-a11y-contrast="on"] .a11y-panel .a11y-row__hint { color: #6b7785 !important; }
html[data-a11y-contrast="on"] .a11y-panel .a11y-stepper button {
  background: #f1f4f6 !important;
}
html[data-a11y-contrast="on"] .a11y-panel .a11y-toggle input:checked + .a11y-toggle__slider {
  background: var(--a11y-teal) !important;
}
html[data-a11y-contrast="on"] .a11y-panel .a11y-toggle__slider {
  background: #c9d2db !important;
}
html[data-a11y-contrast="on"] .a11y-panel .a11y-toggle__slider::before {
  background: #fff !important;
}
html[data-a11y-contrast="on"] .a11y-trigger {
  background-color: var(--a11y-teal) !important;
  color: #fff !important;
  border: 2px solid #fff !important;
}
html[data-a11y-contrast="on"] .a11y-trigger * {
  background-color: transparent !important;
  color: #fff !important;
  filter: none !important;
}

/* Link highlight */
html[data-a11y-links="on"] a:not(.a11y-trigger):not(.a11y-panel a) {
  text-decoration: underline !important;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
  outline: 1px dashed currentColor;
  outline-offset: 2px;
  padding: 1px 2px;
  border-radius: 3px;
}

/* Larger cursor */
html[data-a11y-cursor="on"],
html[data-a11y-cursor="on"] * {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'><polygon points='4,2 4,30 12,22 18,36 22,34 16,20 28,20' fill='black' stroke='white' stroke-width='2'/></svg>") 4 2, auto !important;
}
html[data-a11y-cursor="on"] a,
html[data-a11y-cursor="on"] button,
html[data-a11y-cursor="on"] [role="button"],
html[data-a11y-cursor="on"] input,
html[data-a11y-cursor="on"] select,
html[data-a11y-cursor="on"] textarea {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'><path d='M20 4 L20 26 M12 18 L20 26 L28 18' fill='none' stroke='black' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'/><path d='M20 4 L20 26 M12 18 L20 26 L28 18' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>") 20 20, pointer !important;
}

/* Pause animations */
html[data-a11y-motion="off"] *,
html[data-a11y-motion="off"] *::before,
html[data-a11y-motion="off"] *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}
html[data-a11y-motion="off"] video {
  /* don't auto-stop user videos — only decorative animations */
}

/* Screen-reader-only helper */
.a11y-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Small screens */
@media (max-width: 480px) {
  .a11y-panel { width: calc(100vw - 36px); }
}
