/*
 * Light and dark: the theme switch (/theme.js) writes the choice as
 * <html data-theme="light|dark">; without it the system's choice applies.
 * The dark values are written twice (system dark, and data-theme="dark");
 * keep the two blocks the same.
 */
:root {
  --bg: #ffffff;
  --text: #1f2933;
  --muted: #52606d;
  --line: #d9e2ec;
  --accent: #1f5fae;
  --hover: #eef2f6;
  --draft-bg: #fff7e6;
  --draft-line: #f0b429;
  color-scheme: light dark;
}

:root[data-theme='light'] {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #111827;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --line: #374151;
    --accent: #6aa6f0;
    --hover: #1f2937;
    --draft-bg: #3b2f12;
    --draft-line: #b7791f;
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #111827;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --line: #374151;
  --accent: #6aa6f0;
  --hover: #1f2937;
  --draft-bg: #3b2f12;
  --draft-line: #b7791f;
  color-scheme: dark;
}

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

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 16px 64px;
}

/* The links and, at the end of the row, the theme switch. */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 14px;
}

/* As the app's header switch: 32 px, icon only, its name in a tooltip. */
.theme-switch {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.theme-switch[hidden] {
  display: none;
}

.theme-switch:hover {
  background: var(--hover);
  color: var(--text);
}

.theme-switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-switch svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-switch:hover::after,
.theme-switch:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 1;
  width: max-content;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  line-height: 1.35;
  pointer-events: none;
}

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

a[aria-current='page'] {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

h1 {
  margin: 0 0 4px;
  font-size: 28px;
  line-height: 1.25;
}

h2 {
  margin: 32px 0 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 19px;
}

.updated {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.draft {
  margin: 16px 0 24px;
  padding: 12px 16px;
  border: 1px solid var(--draft-line);
  border-radius: 6px;
  background: var(--draft-bg);
  font-size: 14px;
}

.fill {
  padding: 0 3px;
  border-radius: 3px;
  background: var(--draft-bg);
  outline: 1px dashed var(--draft-line);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

li {
  margin: 4px 0;
}
