/* Quickdraw manual. The accent colours are the app's own drawing palette
   (Okabe-Ito), so the site and the diagrams in it agree. */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f8fa;
  --fg: #1f2328;
  --fg-muted: #59636e;
  --rule: #d8dee4;
  --accent: #0072B2;
  --accent-2: #009E73;
  --plate: transparent;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --bg-soft: #161b22;
    --fg: #e6edf3;
    --fg-muted: #9198a1;
    --rule: #30363d;
    --accent: #4aa8e0;
    --accent-2: #2ecc9a;
    /* The exported SVGs draw some elements in black and carry no background of
       their own, so they need paper under them here. */
    --plate: #ffffff;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* Masthead ---------------------------------------------------------------- */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  max-width: 60rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
  margin-right: auto;
}

.masthead nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }

.masthead nav a {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.masthead nav a:hover { color: var(--accent); }

/* Content ----------------------------------------------------------------- */

main {
  max-width: 48rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

main > h1:first-child { margin-top: 0; }

h1, h2, h3, h4 {
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 2.25rem 0 0.75rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--rule); }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; color: var(--fg-muted); }

p, ul, ol { margin: 0 0 1rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

strong { font-weight: 650; }

hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

blockquote {
  margin: 0 0 1rem;
  padding: 0.1rem 0 0.1rem 1rem;
  border-left: 3px solid var(--accent-2);
  color: var(--fg-muted);
}

/* Diagrams and symbol thumbnails. The SVGs assume paper, so in dark mode they
   get a plate rather than being recoloured. */

img {
  max-width: 100%;
  height: auto;
  background: var(--plate);
  border-radius: 6px;
}

img[height] { width: auto; }

p > img:only-child { display: block; margin: 1.5rem auto; padding: 0.5rem; }

em img, p em { color: var(--fg-muted); }

/* Code -------------------------------------------------------------------- */

code, pre {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.875em;
}

code {
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

pre {
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  line-height: 1.5;
}

pre code { background: none; border: 0; padding: 0; }

/* Tables. The manual's index pages are two-column link tables with no header
   row; the symbol reference uses real headers. Both have to read well. */

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}

th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--rule);
}

th { font-weight: 650; color: var(--fg-muted); font-size: 0.85rem; }

thead th { border-bottom: 2px solid var(--rule); }

/* The manual's index pages use `| | |` — a header row with no words in it,
   which otherwise renders as a blank band above the first link. kramdown fills
   those cells with a non-breaking space, so :empty cannot match them; the
   build tags the table instead. */
.headerless thead { display: none; }

tbody tr:hover { background: var(--bg-soft); }

td:first-child { white-space: nowrap; }
td:first-child a { font-weight: 600; }

/* Footer ------------------------------------------------------------------ */

footer {
  max-width: 48rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  border-top: 1px solid var(--rule);
  color: var(--fg-muted);
  font-size: 0.85rem;
}

footer p { margin: 0; }

@media (max-width: 34rem) {
  body { font-size: 15px; }
  td:first-child { white-space: normal; }
  /* kramdown emits bare tables, so the scroll container has to be the table. */
  table { display: block; overflow-x: auto; }
}
