/* Minimal, accessible styles with no build step. Colour pairs are checked for
   WCAG AA contrast (4.5:1) by crates/web/tests/ui.rs; keep each variable on
   its own line as #rrggbb. */

:root {
  --bg: #ffffff;
  --fg: #1b1f24;
  --muted: #57606a;
  --link: #0550ae;
  --focus: #0969da;
  --border: #d0d7de;
  --error-fg: #82071e;
  --error-bg: #ffebe9;
  --warning-fg: #6b4400;
  --warning-bg: #fff8c5;
  --success-fg: #116329;
  --success-bg: #dafbe1;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --fg: #e6edf3;
    --muted: #9198a1;
    --link: #4493f8;
    --focus: #58a6ff;
    --border: #30363d;
    --error-fg: #ffdcd7;
    --error-bg: #67060c;
    --warning-fg: #f2cc60;
    --warning-bg: #3b2e00;
    --success-fg: #aff5b4;
    --success-bg: #033a16;
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

a { color: var(--link); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

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

.site-header, main, .site-footer, .flashes {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1rem;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.brand { font-weight: 600; text-decoration: none; }

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
}

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

/* Messages. One per FlashKind (ui::FlashKind), plus warning for pages that
   explain a risk. */
.flash {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
}
.flash p { margin: 0; }
/* Links take the message's own colour, which has the contrast checked
   against its background (the link colour doesn't, on every tone). */
.flash a { color: inherit; }
.flash-error { color: var(--error-fg); background: var(--error-bg); }
.flash-warning { color: var(--warning-fg); background: var(--warning-bg); border-color: var(--warning-fg); }
.flash-success { color: var(--success-fg); background: var(--success-bg); }
.flash-info { color: var(--fg); background: var(--bg); }

/* Forms. Controls are full-width up to a readable measure; choices (radio,
   checkbox) sit inline inside their label. */
label { display: block; font-weight: 600; }
label.inline { display: inline-block; font-weight: normal; margin-right: 1rem; }
.choice { margin: 0.5rem 0; }
.choice .muted { display: block; margin-left: 1.6rem; }
input, select, textarea, button { font: inherit; }
input:not([type=hidden]):not([type=radio]):not([type=checkbox]), select, textarea {
  display: block;
  width: 100%;
  max-width: 28rem;
  padding: 0.375rem;
}
button { padding: 0.5rem 1rem; }
/* A link that starts something, styled as the browser styles buttons. */
a.button { display: inline-block; padding: 0.5rem 1rem; border: 1px solid ButtonBorder; border-radius: 0.25rem; background: ButtonFace; color: ButtonText; text-decoration: none; }
button.link { padding: 0; border: 0; background: none; color: var(--link); text-decoration: underline; cursor: pointer; }
form.inline { display: inline; margin: 0; }
/* A two-step destructive action: the summary reads like a link; opened, it
   asks first. */
details.confirm { display: inline-block; }
details.confirm summary { cursor: pointer; color: var(--link); text-decoration: underline; }
details.confirm[open] { display: block; padding: 0.5rem; border: 1px solid var(--border); }
fieldset { border: 1px solid var(--border); margin: 1rem 0; }
.field-error { display: block; color: var(--error-fg); background: var(--error-bg); padding: 0.125rem 0.25rem; }

/* Header navigation. */
.site-header nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }

/* Data. A wide table scrolls sideways inside its own box on a narrow
   screen, instead of widening the page. */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
td { overflow-wrap: break-word; }
/* Fingerprints, AS2 IDs, URLs: long with no natural breaks. */
td code { overflow-wrap: anywhere; }
dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.25rem 1rem; }
dd code { overflow-wrap: anywhere; }
pre { overflow-x: auto; padding: 0.5rem; border: 1px solid var(--border); }
@media (max-width: 30rem) {
  dl { grid-template-columns: minmax(0, 1fr); }
  dd { margin-bottom: 0.5rem; }
}
dt { font-weight: 600; }
dd { margin: 0; }
.plain-list { list-style: none; padding: 0; }
.plain-list li { padding: 0.25rem 0; }
code.fingerprint, code.large { overflow-wrap: anywhere; }
code.fingerprint { font-size: 0.875rem; }
code.large, .large { font-size: 1.125rem; letter-spacing: 0.05em; }
.columns-2 { columns: 2; padding-left: 1.25rem; }

/* Badges: one shape; the tone says whether it needs attention. */
.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  vertical-align: middle;
  white-space: nowrap;
}
.badge-warning { color: var(--warning-fg); background: var(--warning-bg); border-color: var(--warning-fg); }
.badge-danger { color: var(--error-fg); background: var(--error-bg); border-color: var(--error-fg); }
.badge-dashed { color: var(--fg); border-style: dashed; border-color: var(--muted); }

/* A boxed section, e.g. a draft waiting for action. */
.panel { border: 1px solid var(--border); padding: 0 1rem; margin: 1rem 0; }
.panel-warning { border: 1px dashed var(--warning-fg); }

.qr svg { display: block; max-width: 100%; height: auto; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
