/* Workpen: white and dark navy, square corners, one typeface. Light by default,
   dark when the system is dark, or when the toggle says so (html[data-theme]). */

:root {
  --bg: #ffffff;
  --fg: #1f2a44;
  --muted: #586179;
  --rule: #dde1ea;
  --surface: #f4f6fa;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131a2b;
    --fg: #f4f6fa;
    --muted: #a3acc2;
    --rule: #2c3858;
    --surface: #1f2a44;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #131a2b;
  --fg: #f4f6fa;
  --muted: #a3acc2;
  --rule: #2c3858;
  --surface: #1f2a44;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1.0625rem/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

.skip {
  position: absolute;
  left: -999px;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  background: var(--fg);
  color: var(--bg);
}

/* Header and footer */

.bar,
.foot {
  border-color: var(--rule);
  border-style: solid;
  border-width: 0;
}

.bar {
  border-bottom-width: 1px;
}

.foot {
  border-top-width: 1px;
  color: var(--muted);
  font-size: 0.9375rem;
}

.bar-inner,
.foot-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: 60rem;
  margin: 0 auto;
  padding: 1rem 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.mark {
  width: 1.9rem;
  height: auto;
  display: block;
}

.bar nav,
.foot nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.bar nav a,
.foot nav a {
  text-decoration: none;
}

.bar nav a:hover,
.foot nav a:hover,
.bar nav a[aria-current] {
  text-decoration: underline;
  text-underline-offset: 0.35em;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--fg);
}

/* Content */

.content {
  max-width: 44rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 4.5rem;
}

.content h1,
.content h2,
.content h3 {
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.content h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  margin: 0 0 1.25rem;
}

.content {
  overflow-wrap: break-word;
}

.content h1 + h2 {
  margin-top: 2rem;
}

.content h2 {
  font-size: 1.5rem;
  margin: 3rem 0 0.75rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}

.content h3 {
  font-size: 1.1875rem;
  margin: 2rem 0 0.5rem;
}

.content p,
.content ul,
.content ol {
  margin: 0 0 1.1rem;
}

.content li {
  margin: 0.3rem 0;
}

.heading-permalink {
  display: none;
}

.content code {
  font: 0.9em ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  padding: 0.1em 0.35em;
  background: var(--surface);
  border: 1px solid var(--rule);
}

.content pre {
  margin: 0 0 1.4rem;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--rule);
  line-height: 1.5;
}

.content pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.9rem;
}

.content table {
  width: 100%;
  margin: 0 0 1.4rem;
  border-collapse: collapse;
  font-size: 0.975rem;
}

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

.content th {
  background: var(--surface);
}

.content blockquote {
  margin: 0 0 1.1rem;
  padding-left: 1rem;
  border-left: 3px solid var(--fg);
  color: var(--muted);
}

/* Home */

.home .content h1 {
  font-size: clamp(2.25rem, 6.5vw, 3.5rem);
  margin-top: 1.5rem;
}

.home .content h1 + p {
  font-size: 1.3rem;
  line-height: 1.5;
  color: var(--muted);
  max-width: 36rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 2rem 0 1rem;
}

.button {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border: 1px solid var(--fg);
  border-radius: 0;
  background: var(--fg);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}

.button:hover {
  text-decoration: none;
  opacity: 0.88;
}

.button.secondary {
  background: transparent;
  color: var(--fg);
}

.button.secondary:hover {
  background: var(--surface);
  opacity: 1;
}

.note {
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 40rem) {
  .bar nav,
  .foot nav {
    gap: 1rem;
  }

  .content {
    padding-top: 2rem;
  }

  /* A wide table scrolls inside the page instead of pushing it sideways. */
  .content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }
}

/* Contact form */

.contact-form {
  margin-top: 2rem;
}

.contact-form label {
  display: block;
  margin: 0 0 0.35rem;
  font-weight: 600;
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
  display: block;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}

.contact-form input:hover,
.contact-form textarea:hover {
  border-color: var(--muted);
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--fg);
  outline: 1px solid var(--fg);
  outline-offset: 0;
}

.contact-form textarea {
  resize: vertical;
  min-height: 9rem;
}

.contact-form button.button {
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

/* The honeypot: present for bots, out of sight and reach for people. */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-errors {
  margin: 1.5rem 0 0;
  padding: 0.85rem 1rem 0.85rem 2rem;
  border: 1px solid var(--fg);
  background: var(--surface);
}

.contact-form .note {
  margin: 1rem 0 0;
}
