/* Shared by the existing static references and React routes. */
:where(a[href], button, input, textarea, select, summary):focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}
html[data-standalone] :is(input, textarea, select):focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}
html[data-standalone][data-theme="dark"] {
  --bg: #0a0b0d;
  --card: #0f1116;
  --ink: #f4f4f0;
  --dim: #a6a8ae;
  --line: #393d46;
  --oxide: #ccff00;
  --acc: #ccff00;
  --good: #90c79c;
  --ok: #90c79c;
  --bad: #ff9b91;
  --warn: #e7cf76;
}
/* The dark colour scheme gives native fields light ink. Pair it with the
   existing card surface instead of an inherited hard-coded white background. */
html[data-standalone][data-theme="dark"] :is(input, textarea, select) {
  color: var(--ink);
  background-color: var(--card);
}
html[data-standalone][data-theme="dark"] :is(input, textarea)::placeholder {
  color: var(--dim);
  opacity: 1;
}
html[data-standalone][data-theme="dark"] .A { color: var(--good); }
html[data-standalone][data-theme="dark"] .B { color: #91d4e3; }
html[data-standalone][data-theme="dark"] .C { color: var(--oxide); }
pre:focus-visible, [aria-label="Scrollable table"]:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* Sourcey keeps its existing reference layout and colours. These small captions
   and required-field labels carry information, so they need text contrast. */
#sourcey a { min-width: 0; overflow-wrap: anywhere; }
#sourcey #content-area { overflow-wrap: anywhere; }
#sourcey :not(pre) > code { white-space: normal; overflow-wrap: anywhere; }
#sourcey a.group.flex.flex-col { flex: 1 1 0; }
#sourcey .card-item-content p[style*="opacity:0.5"] { opacity: 1 !important; }
#sourcey .card-item-content code { color: #555861; }
#sourcey .text-red-600 { color: #b91c1c; }
html.dark #sourcey .card-item-content code { color: #bfc3cb; }
html.dark #sourcey .text-red-600 { color: #fca5a5; }
.sdd-scroll-table { max-width: 100%; overflow-x: auto; }
html.dark #sourcey { --color-gray-500: 162 166 175; }
html.dark #sourcey .godoc-doc { color: #c4c7cf; }
html.dark #sourcey .godoc-toc a, html.dark #sourcey .godoc-toc h4 { color: #bfc3cb; }
#sourcey a.nav-link.active { color: #006980; }
html.dark #sourcey a.nav-link.active { color: #91d4e3; }
html.dark #sourcey .godoc-symbol,
html.dark #sourcey .godoc-field-sig,
html.dark #sourcey .godoc-field-type,
html.dark #sourcey .godoc-field-doc,
html.dark #sourcey .godoc-fields > summary { color: #c4c7cf; }
/* The existing copy control has its own toolbar space above generated text. */
.out > pre { padding-top: 3.5rem; }

/* Search results and key hints convey navigation, including in the open dialog. */
#sourcey .search-category,
#sourcey .search-result-tag,
#sourcey .search-footer-hint,
#sourcey .search-footer kbd,
#sourcey #search-open kbd { color: #555861; }
html.dark #sourcey .search-category,
html.dark #sourcey .search-result-tag,
html.dark #sourcey .search-footer-hint,
html.dark #sourcey .search-footer kbd,
html.dark #sourcey #search-open kbd { color: #bfc3cb; }

/* Sourcey's desktop anchor has no box when the mobile search button is shown. */
@media (max-width: 1023px) {
  #sourcey #search-dialog.open .search-dialog-inner {
    left: 1rem !important;
    right: 1rem !important;
    top: 4.5rem !important;
    width: auto !important;
    max-width: calc(100vw - 2rem) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  #sourcey *, #sourcey *::before, #sourcey *::after,
  .mobile-nav-dialog, .mobile-nav-dialog::backdrop {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Both case studies had a fixed dark callout and lime controls in light mode.
   Follow the same saved theme as the reading surface without changing their layout. */
html[data-standalone] .cta[data-theme-surface] {
  color: var(--ink); background: var(--card); border: 1px solid var(--line);
}
html[data-standalone] .cta[data-theme-surface] h2 { color: var(--ink); }
html[data-standalone] .cta[data-theme-surface] p { color: var(--dim); }
html[data-standalone] .cta[data-theme-surface] .btn { color: var(--bg); background: var(--oxide); }
html[data-standalone] .cta[data-theme-surface] .btn.alt { color: var(--oxide); background: transparent; border-color: var(--line); }
