/* Explorer High Contrast, revision 8.
   Reopen CP69's FIRST important layer: layered !important beats the later
   unlayered component/Cyber rules. The repeated state attribute intentionally
   beats the old measured-prose selector in this same layer. Link this last.
   Every rule is opt-in; no theme tokens, geometry, fonts, images or iframe
   documents are changed when Contrast is Standard. */
@layer ar-reading-options69 {
  /* Legacy whole-control hover filters alter already measured text ink.
     Keep the High pair stable while retaining image-leaf finish and Standard hover. */
  html body[data-reading-contrast="high"][data-reading-contrast="high"] #search-results .search-study-row.fs-card,
  html body[data-reading-contrast="high"][data-reading-contrast="high"] #search-form .gold-button,
  html body[data-reading-contrast="high"][data-reading-contrast="high"] #welcome-use-search {
    filter: none !important;
  }
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) [data-ar-hc-text],
  html body[data-reading-contrast="high"][data-reading-contrast="high"][data-ar-hc-text]:not([data-ar-hc-measuring]) {
    color: var(--ar-hc-ink) !important;
    -webkit-text-fill-color: var(--ar-hc-ink) !important;
    text-shadow: none !important;
    /* Color must not interpolate through a low-contrast foreground. */

  }
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) [data-ar-hc-opacity] {
    opacity: 1 !important;
  }
  /* Keep this rule active DURING measurement too: disabling a backing plate
     must not launch a background transition, which can request another scan.
     Border/shadow/transform motion remains; photo and Cyber animation stays. */
  html body[data-reading-contrast="high"][data-reading-contrast="high"] [data-ar-hc-text],
  html body[data-reading-contrast="high"][data-reading-contrast="high"][data-ar-hc-text] {
    transition-property: border-color, box-shadow, transform !important;
  }
  /* A small text-local plate is used only when an image or a broad gradient
     cannot provide a predictable 7:1 foreground. The artwork itself remains. */
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) [data-ar-hc-backed] {
    background-color: var(--ar-hc-backdrop) !important;
    background-image: none !important;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
  }
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) [data-ar-hc-text]::placeholder {
    color: var(--ar-hc-ink) !important;
    -webkit-text-fill-color: var(--ar-hc-ink) !important;
    opacity: 1 !important;
    text-shadow: none !important;
  }
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) [data-ar-hc-text]::before,
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) [data-ar-hc-text]::after {
    color: inherit !important;
    -webkit-text-fill-color: currentColor !important;
  }
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) [data-ar-hc-before]::before {
    color: var(--ar-hc-before-ink) !important;
    -webkit-text-fill-color: var(--ar-hc-before-ink) !important;
    opacity: 1 !important;
    text-shadow: none !important;
  }
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) [data-ar-hc-before-backed]::before {
    background-color: var(--ar-hc-before-backdrop) !important;
    background-image: none !important;
  }
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) [data-ar-hc-after]::after {
    color: var(--ar-hc-after-ink) !important;
    -webkit-text-fill-color: var(--ar-hc-after-ink) !important;
    opacity: 1 !important;
    text-shadow: none !important;
  }
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) [data-ar-hc-after-backed]::after {
    background-color: var(--ar-hc-after-backdrop) !important;
    background-image: none !important;
  }
  /* Actual diagram lettering only. SVG shapes, illustrations and sprites are
     deliberately excluded. A contrasting stroke protects text over SVG fills. */
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) :is(text,tspan)[data-ar-hc-text] {
    fill: var(--ar-hc-ink) !important;
    stroke: var(--ar-hc-backdrop) !important;
    stroke-width: 3px !important;
    stroke-linejoin: round !important;
    paint-order: stroke fill !important;
  }
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) a[data-ar-hc-text] {
    text-decoration-line: underline !important;
    text-decoration-color: currentColor !important;
    text-underline-offset: .18em;
  }
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) [data-ar-hc-text]:focus-visible {
    outline: 3px solid var(--ar-hc-ink) !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 2px #000, 0 0 0 6px #fff !important;
  }
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) [data-ar-hc-text]:is(:disabled,[aria-disabled="true"]) {
    border-style: dashed !important;
  }
  /* Read original theme colors synchronously without the old CP69 prose ink.
     This attribute exists only within one read/write transaction; no frame is
     yielded while it is present. Typography preferences remain applied. */
  html body[data-reading-contrast="high"][data-ar-hc-measuring] [data-reading-text69][data-reading-text69] {
    color: revert-layer !important;
  }
  /* Highlight pseudo-elements paint their own text colors and bypass normal
     element ink. Keep saved/current states visibly distinct at >=7:1, including
     red-letter spans. These rules do not alter ranges or saved marker data. */
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) ::highlight(ar-reader-saved) {
    background-color: #292929 !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    text-shadow: none !important;
  }
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) ::highlight(ar-reader-current) {
    background-color: #dedede !important;
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
    text-shadow: none !important;
  }
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) ::selection {
    background-color: #ffffff !important;
    color: #111111 !important;
    -webkit-text-fill-color: #111111 !important;
    text-shadow: none !important;
  }
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) .words-of-jesus::highlight(ar-reader-saved),
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) .words-of-jesus *::highlight(ar-reader-saved) {
    color: #ffb4b4 !important;
    -webkit-text-fill-color: #ffb4b4 !important;
  }
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) .words-of-jesus::highlight(ar-reader-current),
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) .words-of-jesus *::highlight(ar-reader-current) {
    color: #8b0011 !important;
    -webkit-text-fill-color: #8b0011 !important;
  }
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) .words-of-jesus::selection,
  html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) .words-of-jesus *::selection {
    color: #8b0011 !important;
    -webkit-text-fill-color: #8b0011 !important;
  }
  @media (forced-colors: active) {
    html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) [data-ar-hc-text] {
      color: CanvasText !important;
      -webkit-text-fill-color: CanvasText !important;
      forced-color-adjust: auto;
    }
    html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) [data-ar-hc-text]::placeholder,
    html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) [data-ar-hc-before]::before,
    html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) [data-ar-hc-after]::after { color: CanvasText !important; -webkit-text-fill-color: CanvasText !important; }
    html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) [data-ar-hc-backed],
    html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) [data-ar-hc-before-backed]::before,
    html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) [data-ar-hc-after-backed]::after { background: Canvas !important; }
    html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) :is(text,tspan)[data-ar-hc-text] { fill: CanvasText !important; stroke: Canvas !important; }
  }
  @media print {
    html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) [data-ar-hc-text] { color: #000 !important; -webkit-text-fill-color: #000 !important; }
    html body[data-reading-contrast="high"][data-reading-contrast="high"]:not([data-ar-hc-measuring]) [data-ar-hc-backed] { background: #fff !important; }
  }
}
