:root {
  color-scheme: light dark;
  --page-top: clamp(1.5rem, 12vh - 2rem, 7rem);
  --fg: #202224;
  --muted: #66696d;
  --bg: #f7f7f4;
  --accent: #1f5249;
  --border: #d5d5d0;
  --err: #b91c1c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e6e7e5;
    --muted: #9b9ea1;
    --bg: #161718;
    --accent: #7fbcad;
    --border: #35373a;
    --err: #f87171;
  }
}

* { box-sizing: border-box; }

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

.page {
  max-width: 40rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

main.page { padding-top: var(--page-top); }

/* Magnetic field around the header (scripts/field.py). A mask, so it takes the text
   colour in both themes; its top 190px are cut off by the top of the page. */
.home::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 0;
  right: 0;
  top: calc(var(--page-top) - 190px);
  height: 470px;
  background: var(--fg);
  -webkit-mask: url(/field.svg) center top / 900px 470px no-repeat;
  mask: url(/field.svg) center top / 900px 470px no-repeat;
  pointer-events: none;
}

@media (max-width: 559px) {
  .home::before {
    height: 420px;
    -webkit-mask: url(/field-narrow.svg) center top / 480px 420px no-repeat;
    mask: url(/field-narrow.svg) center top / 480px 420px no-repeat;
  }
}

h1 {
  margin: 0;
  font-size: 3rem;
  letter-spacing: -0.03em;
}

.hero { text-align: center; margin-bottom: 2.5rem; }
.logo { line-height: 0; margin-bottom: 1rem; }
/* Shift so the underscore under the t, not the image box, sits on the centre axis. */
.logo img { max-width: 100%; height: auto; transform: translateX(-1.55%); }

@media (prefers-color-scheme: dark) {
  /* The wordmark is a black PNG on transparency. */
  .logo img { filter: invert(1); }
}

h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }

.tagline {
  margin-top: 0.25rem;
  font-size: 1.35rem;
  color: var(--muted);
}

a { color: inherit; text-underline-offset: 0.2em; }

.subscribe {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

form { display: flex; gap: 0.5rem; flex-wrap: wrap; }

input, button {
  font: inherit;
  padding: 0.55rem 0.9rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

input {
  flex: 1 1 16rem;
  /* An input's automatic minimum is its default size, wider than a 320px screen. */
  min-width: 0;
  background: transparent;
  color: inherit;
}

button {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  cursor: pointer;
}

button:disabled { opacity: 0.6; cursor: default; }
input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.subscribe-msg { margin: 0.5rem 0 0; }
/* Collapsed rather than hidden while empty, so it stays a live region for screen readers. */
.subscribe-msg:empty { margin: 0; }
.subscribe-msg.ok { color: var(--accent); }
.subscribe-msg.err { color: var(--err); }

.fineprint { margin-top: 0.6rem; font-size: 0.75rem; line-height: 1.5; color: var(--muted); }

footer.page {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  padding-top: 4rem;
  padding-bottom: 2rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.legal h1 { font-size: 2rem; }
.legal h2 { margin-top: 2rem; }
