@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrainsMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --paper: #f7f3ea;
  --surface: #fffdf8;
  --ink: #211c17;
  --ink-2: #5b5248;
  --line: #cfc4af;
  --accent: #008a7a;
  --v: 1px; /* vertical spacing unit, shrunk on short desktop windows below */
  --heading-gap: calc(6px + 8 * var(--v)); /* shrinks less than section gaps, so headings stay with their section */
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171411;
    --surface: #1f1b17;
    --ink: #f2ece1;
    --ink-2: #c4b9a8;
    --line: #4d4439;
    --accent: #1aa394;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.6;
}

h1, h2, h3, p, ul { margin: 0; padding: 0; }

h1, h2, h3 { font-weight: 500; }

a { color: inherit; text-underline-offset: 3px; }

a:hover { color: var(--ink); }

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

.masthead, main, .colophon {
  max-width: 880px;
  margin-inline: auto;
  padding-inline: 16px;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: calc(18 * var(--v));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
}

.github-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  color: var(--ink-2);
}

.github-link svg { fill: currentColor; }

.intro { padding-block: 40px 28px; }

h1 {
  font-size: clamp(1.85rem, 6vw, 3.25rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.lede {
  max-width: 36em;
  margin-top: calc(20 * var(--v));
  color: var(--ink-2);
}

.signal {
  display: block;
  width: 100%;
  height: calc(56px + 24 * var(--v));
}

.signal path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.block { margin-top: calc(56 * var(--v)); }

h2 {
  color: var(--ink-2);
  font-size: 0.875rem;
  line-height: 1.3;
}

/* Cards share a row, so another tool adds no height on desktop. */
.tools {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 14px;
  margin-top: var(--heading-gap);
}

.tool {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.tool:hover { border-color: var(--accent); }

h3 { font-size: 1.35rem; line-height: 1.2; letter-spacing: -0.02em; }

/* The title is the link, and it stretches to make the whole card clickable. */
.tool h3 a { text-decoration: none; }

.tool h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 13px;
}

/* Keyboard focus rings the whole card, because that is the target. */
.tool h3 a:focus-visible { outline: none; }

.tool h3 a:focus-visible::after {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.tool-open {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}

.tool p {
  grid-column: 1 / -1;
  color: var(--ink-2);
  text-wrap: balance;
}

.principles {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px 24px;
  margin-top: var(--heading-gap);
  list-style: none;
}

.principles li {
  color: var(--ink-2);
  text-wrap: balance;
}

.principles strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-weight: 500;
}

.colophon {
  display: grid;
  gap: calc(12 * var(--v)) 24px;
  margin-top: calc(56 * var(--v));
  padding-bottom: calc(48 * var(--v));
  color: var(--ink-2);
  font-size: 0.875rem;
}

.colophon::before {
  content: "";
  grid-column: 1 / -1;
  margin-bottom: calc(12 * var(--v));
  border-top: 1px solid var(--line);
}

.colophon p { text-wrap: balance; }

/* Wide enough for columns and more room, well before the desktop rule below. */
@media (min-width: 700px) {
  .masthead, main, .colophon { padding-inline: 24px; }
  .intro { padding-block: calc(72 * var(--v)) calc(36 * var(--v)); }
  .tool { padding: 20px 24px; }
  .principles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .colophon { grid-template-columns: 2fr 1fr; }
}

/* Desktop: the whole page fits the window, down to about 620px tall.
   Page height = --fixed + --units * --v. --units adds up every multiplier of --v
   in this file, once for each time it applies on the page. --fixed is the page's
   height with --v at 0, in rem because most of it is text. Measure both again if
   a spacing rule or the copy changes the page's height. */
@media (min-width: 880px) {
  :root {
    --fixed: 30.5rem;
    --units: 444;
    --v: clamp(0.3px, (100vh - var(--fixed)) / var(--units), 1px);
  }
  .lede { max-width: none; text-wrap: balance; }
}
