/* Color-vision accessibility — always-on cues + optional CVD modes.
   Least-obtrusive: one corner control; preference saved locally. */

/* —— Always on —— */
:focus-visible {
  outline: 3px solid currentColor !important;
  outline-offset: 3px !important;
}

/* Non-color cue for body/content links (skip buttons & nav chrome). */
.entry-content a:not([class*="button"]):not([class*="btn"]):not(.wp-block-button__link),
.prose a:not([class*="button"]):not([class*="btn"]),
article .wp-block-post-content a:not(.wp-block-button__link),
.rfd-page-content a:not(.rfd-button),
.vovn-prose a,
.vovn-content a:not(.vovn-button) {
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: from-font;
}

@media (prefers-contrast: more) {
  body {
    -webkit-font-smoothing: antialiased;
  }
  a {
    text-decoration: underline;
  }
}

/* —— Optional color-vision modes (html[data-cvd]) —— */
html[data-cvd="protanopia"] {
  filter: url("#nlh-cvd-protanopia");
}
html[data-cvd="deuteranopia"] {
  filter: url("#nlh-cvd-deuteranopia");
}
html[data-cvd="tritanopia"] {
  filter: url("#nlh-cvd-tritanopia");
}
html[data-cvd="achromatopsia"] {
  filter: grayscale(1) contrast(1.05);
}
html[data-cvd="high-contrast"] {
  filter: contrast(1.18) saturate(1.05);
}
html[data-cvd="high-contrast"] body {
  font-weight: 500;
}

/* —— Control chrome (fixed, bottom-left, quiet) —— */
.nlh-cvd {
  position: fixed;
  z-index: 99990;
  left: 0.5rem;
  right: auto;
  bottom: 1.1rem;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.75rem;
  line-height: 1.3;
  color: #111;
}
.nlh-cvd__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: 2.25rem;
  min-height: 2.25rem;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0.35rem;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: inherit;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.nlh-cvd__toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}
.nlh-cvd__toggle:focus-visible {
  outline: 3px solid #111 !important;
  outline-offset: 3px !important;
}
.nlh-cvd__toggle-icon {
  display: block;
  width: 0.95rem;
  height: 0.95rem;
}
/* Icon-only control — label stays for screen readers only. */
.nlh-cvd__toggle-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.nlh-cvd__panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 0.55rem);
  width: min(17.5rem, calc(100vw - 1.7rem));
  padding: 0.75rem;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(12px);
}
.nlh-cvd__panel[hidden] {
  display: none !important;
}
.nlh-cvd__title {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.62);
}
.nlh-cvd__list {
  display: grid;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nlh-cvd__option {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 2.4rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 0.55rem;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.nlh-cvd__option:hover,
.nlh-cvd__option:focus-visible {
  background: rgba(0, 0, 0, 0.05);
}
.nlh-cvd__option[aria-checked="true"] {
  border-color: rgba(0, 0, 0, 0.2);
  background: rgba(0, 0, 0, 0.06);
  font-weight: 650;
}
.nlh-cvd__hint {
  margin: 0.55rem 0 0;
  font-size: 0.72rem;
  color: rgba(0, 0, 0, 0.55);
}

/* Dark OS surfaces for the control itself */
@media (prefers-color-scheme: dark) {
  .nlh-cvd {
    color: #f4f0e8;
  }
  .nlh-cvd__toggle,
  .nlh-cvd__panel {
    background: rgba(22, 20, 18, 0.94);
    border-color: rgba(255, 255, 255, 0.14);
    color: #f4f0e8;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  }
  .nlh-cvd__title,
  .nlh-cvd__hint {
    color: rgba(244, 240, 232, 0.62);
  }
  .nlh-cvd__option:hover,
  .nlh-cvd__option:focus-visible {
    background: rgba(255, 255, 255, 0.08);
  }
  .nlh-cvd__option[aria-checked="true"] {
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.1);
  }
  .nlh-cvd__toggle:focus-visible {
    outline-color: #f4f0e8 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nlh-cvd__toggle {
    transition: none;
  }
}
