/* Plain, readable, WCAG 2.1 AA: text contrast at least 4.5:1 in both schemes, a visible focus
   ring, and a layout that reflows to 320px without horizontal scrolling (1.4.10). */

:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #555555;      /* 7.4:1 on white */
  --link: #0b57a4;       /* 6.6:1 on white */
  --rule: #d0d0d0;
  --code-bg: #f3f3f3;
  --focus: #b8520a;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --fg: #ececec;
    --muted: #b0b0b0;    /* 9.1:1 on #121212 */
    --link: #8cc4ff;     /* 9.6:1 on #121212 */
    --rule: #3a3a3a;
    --code-bg: #232323;
    --focus: #ffb070;
  }
}

* { box-sizing: border-box; }
html { font-size: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1.0625rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--link); }
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
main:focus { outline: none; }

.skip-link {
  position: absolute; left: 0.5rem; top: -3rem;
  background: var(--bg); color: var(--link); padding: 0.5rem 1rem; z-index: 10;
}
.skip-link:focus { top: 0.5rem; }

.site-header, main, .site-footer { max-width: 72rem; margin: 0 auto; padding: 0 1rem; }
.site-header nav {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center;
  padding: 0.75rem 0; border-bottom: 1px solid var(--rule);
}
.brand { font-weight: 700; text-decoration: none; }
.account { margin-left: auto; display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; color: var(--muted); }
.account form { margin: 0; }
button, input[type=submit] {
  font: inherit; padding: 0.4rem 0.9rem; cursor: pointer;
  border: 1px solid var(--fg); border-radius: 4px; background: var(--bg); color: var(--fg);
}
input[type=email], input[type=text] {
  font: inherit; padding: 0.4rem 0.6rem; width: 100%; max-width: 24rem;
  border: 1px solid var(--muted); border-radius: 4px; background: var(--bg); color: var(--fg);
}
.site-footer { margin-top: 3rem; padding: 1rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.9375rem; }

.code, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }
code { background: var(--code-bg); padding: 0.05em 0.3em; border-radius: 3px; }

.breadcrumb ol, .components ul { list-style: none; padding: 0; margin: 1rem 0 0.5rem; display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.breadcrumb li + li::before { content: "›"; margin-right: 1rem; color: var(--muted); }
.components a[aria-current=page] { font-weight: 700; text-decoration: none; color: var(--fg); }
.components { border-bottom: 1px solid var(--rule); padding-bottom: 0.5rem; }

.unit-list, .component-list { padding-left: 1.25rem; }
.unit-list li, .component-list li { margin: 0.35rem 0; }
.meta, .provenance { color: var(--muted); font-size: 0.9375rem; }
.component-list .meta { display: block; }
.provenance { margin-top: 2.5rem; }

.page-layout { display: grid; gap: 2rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 60rem) {
  .page-layout { grid-template-columns: 16rem minmax(0, 1fr); }
  .toc { position: sticky; top: 1rem; align-self: start; max-height: calc(100vh - 2rem); overflow-y: auto; }
}
.toc h2 { font-size: 1rem; margin-top: 1.5rem; }
.toc ol { padding-left: 1.25rem; font-size: 0.9375rem; }

.prose { max-width: 46rem; overflow-wrap: break-word; }
.prose h2 { margin-top: 2.25rem; scroll-margin-top: 1rem; }
.prose h3 { scroll-margin-top: 1rem; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }
.prose blockquote { margin: 1rem 0; padding-left: 1rem; border-left: 4px solid var(--rule); }
.table-wrap { overflow-x: auto; margin: 1rem 0; }
.prose table { border-collapse: collapse; }
.prose th, .prose td { border: 1px solid var(--rule); padding: 0.35rem 0.6rem; text-align: left; vertical-align: top; }

.entrance { max-width: 32rem; }
.passkey-login { margin: 2rem 0; padding-top: 1rem; border-top: 1px solid var(--rule); }
.passkey-login h2 { font-size: 1.125rem; }

/* Text for screen readers only, e.g. which passkey a "Remove" link removes. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.messages { border: 1px solid var(--rule); padding: 0 1rem; margin: 1rem 0; }
