:root {
  --bg: #ffffff;
  --fg: #1d2330;
  --muted: #5b6475;
  --line: #dde1e8;
  --panel: #f5f7fa;
  --accent: #1f5fa8;
  --accent-fg: #ffffff;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171d;
    --fg: #e4e7ec;
    --muted: #9aa3b2;
    --line: #2e343f;
    --panel: #1b1f27;
    --accent: #7fb0ec;
    --accent-fg: #14171d;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

/* Elements hidden by the page's scripts stay hidden, whatever their style. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }

.wrap { max-width: 72rem; margin: 0 auto; padding: 0 1rem; }

h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 1.9rem; margin: 1.5rem 0 1rem; }
h2 { font-size: 1.35rem; margin: 2rem 0 0.75rem; }
h3 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }

.muted { color: var(--muted); }

/* Header and footer */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem;
  padding-top: 0.75rem; padding-bottom: 0.75rem;
}
.brand { font-weight: 700; font-size: 1.2rem; color: var(--fg); text-decoration: none; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.site-header nav a { text-decoration: none; color: var(--muted); }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { color: var(--fg); }
.site-header nav a[aria-current="page"] { font-weight: 600; }
.site-footer {
  margin-top: 3rem; border-top: 1px solid var(--line);
  padding: 1.25rem 0 2rem; color: var(--muted); font-size: 0.9rem;
}
.site-footer a { margin-left: 1rem; }

/* Panels and figures */
.banner {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 0.9rem 1.1rem; margin: 1.25rem 0;
}
figure { margin: 2rem 0; }
figure img { max-width: 100%; height: auto; border-radius: 6px; }
figcaption { color: var(--muted); font-size: 0.9rem; margin-top: 0.5rem; }

/* Tables */
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Definition lists (record metadata) */
dl.fields { display: grid; grid-template-columns: minmax(10rem, 16rem) 1fr; gap: 0.35rem 1.25rem; margin: 0; }
dl.fields dt { color: var(--muted); }
dl.fields dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
@media (max-width: 40rem) {
  dl.fields { grid-template-columns: 1fr; gap: 0; }
  dl.fields dd { margin-bottom: 0.6rem; }
}

/* Forms */
form.search {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.75rem 1rem; align-items: end;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 1rem;
}
form.search label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.2rem; }
input, select, button {
  font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--line); border-radius: 4px; padding: 0.35rem 0.5rem; width: 100%;
}
button, .button {
  display: inline-block; width: auto; cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--accent-fg); border-color: var(--accent); padding: 0.4rem 0.9rem;
}
.form-actions { display: flex; gap: 0.75rem; align-items: center; }
.errorlist { color: #c0392b; margin: 0.25rem 0 0; padding: 0; list-style: none; font-size: 0.85rem; }

.downloads { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; }

.pagination { display: flex; gap: 1rem; align-items: center; margin: 1rem 0; }

/* Rendered documentation */
.prose code, .prose pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
.prose pre { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 0.75rem 1rem; overflow-x: auto; }
.prose table { margin: 1rem 0; display: block; overflow-x: auto; }

/* Contributors' pages */
form.stacked { display: grid; gap: 1rem; max-width: 52rem; }
form.stacked label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
form.inline { display: inline; margin-left: 1rem; }
button.link { background: none; border: none; padding: 0; color: var(--accent); text-decoration: underline; font-size: inherit; width: auto; }
textarea {
  font: 0.9rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; color: inherit; background: var(--bg);
  border: 1px solid var(--line); border-radius: 4px; padding: 0.5rem; width: 100%;
}
.messages { list-style: none; padding: 0; margin: 1rem 0; }
.message { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 4px; padding: 0.6rem 0.9rem; }
.banner-error { border-left: 4px solid #c0392b; }
.findings { list-style: none; padding: 0; margin: 0.5rem 0; }
.finding { padding: 0.35rem 0; border-bottom: 1px solid var(--line); }
.finding-level {
  display: inline-block; min-width: 5.5rem; font-size: 0.8rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.finding-error .finding-level { color: #c0392b; }
.finding-warning .finding-level { color: #b9770e; }
.finding-note .finding-level { color: var(--muted); }
.status {
  display: inline-block; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
  border: 1px solid var(--line); border-radius: 999px; padding: 0.1rem 0.55rem; vertical-align: middle;
}
.status-published { border-color: #2e8b57; color: #2e8b57; }
.status-submitted { border-color: #b9770e; color: #b9770e; }

/* Archive upload */
.upload {
  display: grid; gap: 0.6rem; max-width: 52rem; margin: 1rem 0 1.5rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 1rem;
}
.upload label { font-weight: 600; }
.upload-actions { display: flex; gap: 0.75rem; align-items: center; }
.upload progress { width: 100%; height: 0.9rem; accent-color: var(--accent); }
.upload-status { margin: 0; min-height: 1.5em; font-variant-numeric: tabular-nums; }
.upload-error { color: #c0392b; }
.upload-done { color: #2e8b57; }
