/* PublicCMS: shared contrast corrections for template A and the CMS.
   WCAG 2.2 AA color targets; the full conformance audit is a separate task. */

/* The first four tab stops; the panel never consumes page layout space. */
.skip-links { position: fixed; z-index: 1000; top: .75rem; left: .75rem; width: 1px; height: 1px; padding: 0; margin: 0; overflow: hidden; clip-path: inset(50%); border: 0; background: #fff; color: #123958; }
.skip-links:focus-within { width: max-content; height: auto; max-width: calc(100vw - 1.5rem); max-height: calc(100vh - 1.5rem); max-height: calc(100dvh - 1.5rem); overflow: auto; clip-path: none; padding: .5rem; border: 2px solid #123958; border-radius: 6px; }
.skip-links .skip-link { position: static; display: block; min-height: 44px; margin: .2rem; padding: .6rem .8rem; border: 1px solid #526780; border-radius: 4px; background: #fff; color: #123958; overflow-wrap: anywhere; }
.skip-links .skip-link:hover, .skip-links .skip-link:focus { background: #edf3f9; color: #123958; }
:is(#access-tools, #menu-glowne, #tresc):focus { outline: 3px solid #10395f; outline-offset: -3px; }
#menu-glowne:focus { outline-color: #fff; outline-offset: -4px; }
html[data-contrast="high"] :is(#access-tools, #menu-glowne, #tresc):focus { outline-color: #ffdf00; }

/* Keep the active menu's text/background together so themes cannot mix them. */
.theme-classic .main-menu a[aria-current="page"] {
  color: #fff;
  background: #17466e;
  box-shadow: inset 0 -3px 0 #ffcc66;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: .3em;
}
.theme-classic .main-menu a[aria-current="page"]:is(:hover, :focus-visible, :active) {
  color: #fff;
  background: #29618c;
}

/* Readable secondary copy and image labels with a known, opaque background. */
.breadcrumbs li + li::before { color: #526780; }
.muted { color: #526780; }
.generated-tag { background: #fffef0; color: #203b50; }
.logo-square { background: #2468b8; }

/* Boundaries stay visible on white and pale hover backgrounds. */
.theme-classic .carousel-controls button { border-color: #526780; }
.field input, .field textarea, .field select { border-color: #64758a; }
.button.secondary { border-color: #64758a; }
.template-choice { border-color: #64758a; color: #1b2b45; }
.template-choice[aria-pressed="true"] { border-color: #17609e; }
.template-choice[aria-pressed="true"] > strong { text-decoration: underline; text-underline-offset: .25em; }
.sortbar select, .sortbar button { border-color: #64758a; }
input::placeholder, textarea::placeholder { color: #526780; opacity: 1; }
input[type="checkbox"], input[type="radio"] { accent-color: #17466e; }
.admin-sidebar a[aria-current="page"] {
  box-shadow: inset 4px 0 0 #ffcc66;
  text-decoration: underline;
  text-underline-offset: .25em;
}

/* A dark outer ring and white inner ring work on light and dark surfaces.
   Explicit current-item selectors keep the menu's inset highlight from
   overriding the focus ring. Underlines retain the selected-item cue. */
body a:focus-visible,
body button:focus-visible,
body input:focus-visible,
body select:focus-visible,
body textarea:focus-visible,
body summary:focus-visible,
.main-menu a[aria-current="page"]:focus-visible,
.theme-classic .main-menu a[aria-current="page"]:focus-visible,
.admin-sidebar a[aria-current="page"]:focus-visible {
  outline: 3px solid #10395f;
  outline-offset: 3px;
  box-shadow: 0 0 0 3px #fff;
}
body :is(a, button, input, select, textarea, summary) { scroll-margin-block: 1rem; }

/* Preserve system colors when the visitor uses an OS high-contrast mode. */
@media (forced-colors: active) {
  body :is(a, button, input, select, textarea, summary):focus-visible {
    outline: 3px solid Highlight !important;
    box-shadow: none !important;
  }
  .main-menu a[aria-current="page"],
  .admin-sidebar a[aria-current="page"],
  .template-choice[aria-pressed="true"] {
    outline: 2px solid CanvasText;
    outline-offset: -2px;
  }
}
