/*
  Setpoint: one stylesheet, hand-written, no build step.
  System type only (no font files, nothing fetched from another host).

  The idiom is a field notebook: a warm paper ground, a ruled margin down
  the left of the content column, serif headings, monospaced small caps for
  labels, hairline ledger tables, and screenshots presented as a strip of
  phones. One clay accent. Light and dark follow the system.
*/

:root {
  color-scheme: light dark;
  --ground: #f5f1ea;
  --paper: #fffcf7;
  --ink: #1f1b17;
  --ink-soft: #4a433b;
  --muted: #6f665c;
  --hairline: #e3dacd;
  --rule: #cdbfae;
  --clay: #b4563b;
  --clay-ink: #8f3f29;
  --clay-wash: #f4e1d8;
  --shadow: 0 1px 2px rgba(60, 40, 20, .08), 0 12px 32px -16px rgba(60, 40, 20, .25);
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --measure: 66ch;
  --gutter: clamp(1rem, 4vw, 2.5rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #15130f;
    --paper: #1e1b16;
    --ink: #efe8dd;
    --ink-soft: #cfc5b7;
    --muted: #a3988a;
    --hairline: #2e2922;
    --rule: #463e33;
    --clay: #e2805f;
    --clay-ink: #f0a287;
    --clay-wash: #3a2419;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -16px rgba(0, 0, 0, .7);
  }
}

* { box-sizing: border-box; }

html {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0 var(--gutter) 5rem;
  max-width: calc(var(--measure) + 2 * var(--gutter) + 3.5rem);
  margin-inline: auto;
  position: relative;
}

/* The notebook's ruled margin: a vertical line down the left, which the
   headings cross with a clay tick. Only when there is room for it. */
@media (min-width: 42rem) {
  body {
    padding-left: calc(var(--gutter) + 3.5rem);
    background:
      linear-gradient(var(--rule), var(--rule)) no-repeat
      calc(var(--gutter) + 1.75rem) 0 / 1px 100%;
  }
}

/* Breadcrumb */
nav[aria-label="Breadcrumb"] p {
  margin: 0;
  padding: 1.25rem 0 0;
  font-family: var(--mono);
  font-size: .75rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
nav[aria-label="Breadcrumb"] a { color: var(--muted); }
nav[aria-label="Breadcrumb"] a:hover { color: var(--clay); }

/* Type */
h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -.015em;
  line-height: 1.15;
  color: var(--ink);
  text-wrap: balance;
}
h1 {
  font-size: clamp(2.25rem, 1.6rem + 3vw, 3.5rem);
  margin: 1.5rem 0 1rem;
  position: relative;
}
/* The landing hero: the app icon beside the name. */
.hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin: 1.5rem 0 1rem;
}
.hero h1 { margin: 0; }
.hero .mark {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  border-radius: 16px;
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow);
}
@media (min-width: 42rem) { .hero { position: relative; } .hero h1::before { display: none; } .hero::before {
    content: ""; position: absolute; left: -2.25rem; top: 50%; width: 1.25rem; height: 2px; background: var(--clay);
} }
@media (max-width: 30rem) { .hero { gap: .9rem; } .hero .mark { width: 56px; height: 56px; border-radius: 12px; } }
.hero + p > em {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.3em;
  color: var(--clay-ink);
  margin-top: -.25rem;
}
h2 {
  font-size: clamp(1.5rem, 1.25rem + 1.2vw, 2rem);
  margin: 3rem 0 .75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--hairline);
  position: relative;
}
h2, h3 { scroll-margin-top: 1.5rem; }
h3 {
  font-size: 1.2rem;
  margin: 2rem 0 .5rem;
  color: var(--ink-soft);
}
@media (min-width: 42rem) {
  h1::before, h2::before {
    content: "";
    position: absolute;
    left: -2.25rem;
    width: 1.25rem;
    height: 2px;
    background: var(--clay);
  }
  h1::before { top: .7em; }
  h2::before { top: calc(1rem + .55em); }
}

p, li, dd { max-width: var(--measure); }
p { margin: 0 0 1rem; }
strong { font-weight: 650; color: var(--ink); }
em { font-style: italic; }
small { font-size: .875em; }

a {
  color: var(--clay-ink);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--clay) 45%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
  transition: text-decoration-color .15s;
}
a:hover { text-decoration-color: var(--clay); }

code {
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: .86em;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: .05em .35em;
  color: var(--ink);
}
pre {
  font-family: var(--mono);
  font-size: .8rem;
  line-height: 1.5;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--clay);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  box-shadow: var(--shadow);
  max-width: 100%;
}

/* Lists */
ul, ol { padding-left: 1.25rem; margin: 0 0 1.25rem; }
li { margin: .4rem 0; }
li::marker { color: var(--clay); }

/* Definition lists read as ledger entries: a term in the margin's voice,
   its definition beneath, a hairline between entries. */
dl { margin: 0 0 1.5rem; padding: 0; }
dt {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 500;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--hairline);
}
dt:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
dd { margin: .3rem 0 0; color: var(--ink-soft); }
dt a { text-decoration: none; }
dt a:hover { text-decoration: underline; }

/* Tables as ledgers */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: .95rem;
  font-variant-numeric: tabular-nums;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: .7rem .9rem;
  border-top: 1px solid var(--hairline);
}
tr:first-child > th, tr:first-child > td { border-top: 0; }
th {
  font-family: var(--mono);
  font-weight: 500;
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  background: color-mix(in srgb, var(--ground) 60%, var(--paper));
}
td:first-child { color: var(--ink); font-weight: 550; }
@media (max-width: 42rem) {
  table { display: block; overflow-x: auto; white-space: normal; }
}

/* Screenshot strips: a paragraph of images becomes a row of phones that
   scrolls sideways on a narrow screen rather than wrapping or shrinking. */
p:has(> img) {
  display: flex;
  gap: 1rem;
  max-width: none;
  margin: 1.5rem 0 2rem;
  padding: .25rem .25rem 1rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
p:has(> img) > img {
  flex: 0 0 auto;
  width: min(300px, 78vw);
  height: auto;
  border-radius: 22px;
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow);
  background: var(--paper);
  scroll-snap-align: start;
}
img { max-width: 100%; height: auto; }

/* The landing page's "A look at it" caption and any other muted aside */
p:has(> img) + p { color: var(--muted); font-size: .9rem; }

/* Footer */
hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 4rem 0 1.5rem;
}
footer p { color: var(--muted); font-size: .85rem; }
footer a { color: var(--muted); }
address { font-style: normal; }
address a {
  display: inline-block;
  font-family: var(--mono);
  font-size: .95rem;
  padding: .55rem .9rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  text-decoration: none;
  background: var(--paper);
}
address a:hover { border-color: var(--clay); }

::selection { background: var(--clay-wash); color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  html { background: #fff; color: #000; }
  body { background: none; padding: 0; max-width: none; }
  p:has(> img) { display: none; }
  a { color: inherit; text-decoration: none; }
  table, pre { box-shadow: none; }
}
