/* Field Note: the reading layer of the Campsite blog, for this site.
   The design and the reasons behind each value live in DESIGN.md.
   One 768px box centered on the page; the 16/24/32px gutter sits inside it, so text runs 704px wide. */

/* Inter from its author's open host, with a metric-matched Arial fallback so the swap doesn't shift text. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("https://rsms.me/inter/font-files/InterVariable.woff2?v=4.1") format("woff2"); }
@font-face { font-family: "Inter"; font-style: italic; font-weight: 100 900; font-display: swap; src: url("https://rsms.me/inter/font-files/InterVariable-Italic.woff2?v=4.1") format("woff2"); }
@font-face { font-family: "Inter Fallback"; src: local("Arial"); ascent-override: 90.49%; descent-override: 22.56%; line-gap-override: 0%; size-adjust: 107.06%; }

:root {
  --bg: #ffffff;
  --ink: #171717;          /* neutral-900: titles, headings, names */
  --body: #525252;         /* neutral-600: running text */
  --muted: #737373;        /* neutral-500: quotes */
  --faint: #a3a3a3;        /* neutral-400: dates, back link, list markers */
  --rule: #e5e5e5;         /* neutral-200: hr, quote bar */
  --border: rgba(0,0,0,.1);/* 0.5px lines that work on any surface */
  --wash: #fafafa;         /* code and embed fill */
  --chip: #f5f5f5;         /* inline code fill */
  --chip-border: rgba(0,0,0,.1);
  --hover: rgba(0,0,0,.05);/* index row hover */
  --ring: rgba(0,0,0,.05); /* hairline around images and embeds */
  --link: #3b82f6;
  --code: #171717;

  --sans: "Inter", "Inter Fallback", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --mono: "JetBrains Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
}
/* Dark follows the system unless the theme switch has set data-theme on <html>. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a; --ink: #f5f5f5; --body: #d4d4d4; --muted: #8a8a8a; --faint: #737373;
    --rule: #262626; --border: rgba(255,255,255,.12); --wash: #171717; --chip: #262626; --chip-border: #404040;
    --hover: rgba(255,255,255,.1); --ring: rgba(255,255,255,.08);
    --link: #3b82f6; --code: #f5f5f5;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0a0a; --ink: #f5f5f5; --body: #d4d4d4; --muted: #8a8a8a; --faint: #737373;
  --rule: #262626; --border: rgba(255,255,255,.12); --wash: #171717; --chip: #262626; --chip-border: #404040;
  --hover: rgba(255,255,255,.1); --ring: rgba(255,255,255,.08);
  --link: #3b82f6; --code: #f5f5f5;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
img { max-width: 100%; height: auto; }
/* rsms Inter 4 has an optical-size axis, and browsers switch to its tight Display cut at large sizes. Campsite's Google Inter has no such axis, so turn it off to keep the titles Campsite's shape. */
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--sans); font-optical-sizing: none; -webkit-text-size-adjust: 100%; }
::selection { background: color-mix(in srgb, var(--link) 22%, transparent); }
a:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 6px; }

/* ---------- Column ---------- */
.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 768px) minmax(0, 1fr);
  padding-block: max(64px, env(safe-area-inset-top, 0px)) max(64px, env(safe-area-inset-bottom, 0px));
}
@media (min-width: 1024px) { .shell { padding-block: 96px; } }
.page {
  grid-column: 2; display: flex; flex-direction: column; gap: 48px; min-width: 0;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
@media (min-width: 768px) { .page { padding-left: 24px; padding-right: 24px; } }
@media (min-width: 1024px) { .page { padding-left: 32px; padding-right: 32px; } }

/* ---------- Header ---------- */
.head { display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 1024px) { .head { gap: 8px; } }
.back { align-self: flex-start; font-size: 16px; color: var(--faint); text-decoration: none; transition: color .1s; }
.back:hover { color: var(--ink); }
@media (min-width: 1024px) { .back { margin-bottom: 16px; } }
/* Theme switch: a sun or moon in the top right, level with the first line of the page. The ::after widens the hit area to 44px. */
.page { position: relative; }
.theme { position: absolute; top: 0; right: max(16px, env(safe-area-inset-right, 0px)); display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; background: none; color: var(--faint); cursor: pointer; transition: color .1s, transform 160ms cubic-bezier(0.23, 1, 0.32, 1); }
.theme[hidden] { display: none; }
/* The home page's first line is the 18px name (27px line), so the box grows to keep the icon on its cap center. */
.page:has(.home-head) .theme { height: 27px; }
.theme::after { content: ""; position: absolute; inset: -10px; }
.theme:active { transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) { .theme:hover { color: var(--ink); } }
/* After a click the new icon turns and fades in; on page load it just appears. */
.theme[data-animate] svg { transition: opacity 200ms cubic-bezier(0.23, 1, 0.32, 1), transform 200ms cubic-bezier(0.23, 1, 0.32, 1), filter 200ms cubic-bezier(0.23, 1, 0.32, 1); }
@starting-style { .theme[data-animate] svg { opacity: 0; transform: rotate(-45deg) scale(0.8); filter: blur(2px); } }
@media (min-width: 768px) { .theme { right: 24px; } }
@media (min-width: 1024px) { .theme { right: 32px; } }
.theme:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 6px; }
.title-block { display: flex; flex-direction: column; gap: 24px; }
h1 {
  margin: 0; font-weight: 600; line-height: 1.1; letter-spacing: -1px;
  font-size: clamp(2.4rem, 5vw, 3.4rem); text-wrap: balance; color: var(--ink);
}
@media (min-width: 1024px) { h1 { letter-spacing: -1.8px; } }
.dateline { margin: 0; font-size: 16px; color: var(--faint); font-variant-numeric: tabular-nums; }
@media (min-width: 1024px) { .dateline { font-size: 18px; } }

/* Home: the name is a heading, not a page title, so it stays small. */
.home-head { gap: 0; }
.home-head .name { font-size: 18px; letter-spacing: 0; line-height: 1.5; font-weight: 600; }
.place { margin: 0; font-size: 18px; color: var(--faint); }

.published { margin: 0; font-size: 16px; color: var(--faint); }
.published a { color: inherit; text-decoration: none; transition: color .1s; }
.published a:hover { color: var(--ink); }
@media (min-width: 1024px) { .published { font-size: 18px; } }

/* ---------- Prose ---------- */
.prose { font-size: 18px; line-height: 1.625; color: var(--body); min-width: 0; overflow-wrap: break-word; }
.prose > * { margin: 0 0 24px; }
.prose > :last-child { margin-bottom: 0; }
.prose a { color: var(--link); text-decoration: none; }
.prose a:hover { text-decoration: underline; text-underline-offset: 3px; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose h2, .prose h3 {
  font-size: 20px; line-height: 28px; font-weight: 600; color: var(--ink);
  margin: 24px 0 13.33px; text-wrap: balance;
}
.prose :is(h2, h3) + * { margin-top: 0; }
.prose ul, .prose ol { padding-left: 28px; }
.prose li { margin: 12px 0; padding-left: 8px; }
.prose li::marker { color: var(--faint); }
.prose li > ul, .prose li > ol { margin: 12px 0 0; }
.prose blockquote {
  margin-left: 0; margin-right: 0; padding-left: 18px; border-left: 4px solid var(--rule);
  color: var(--muted); font-style: italic;
}
/* Long quotes (an update note, a whole passage) read better upright; the bar still marks them. */
.prose blockquote:has(> :nth-child(3)) { font-style: normal; }
.prose blockquote > * { margin: 0 0 16px; }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 56px 0; }
.prose hr + * { margin-top: 0; }
.prose img { display: block; border-radius: 8px; box-shadow: 0 0 0 1px var(--ring); }
.prose iframe {
  display: block; width: 100%; aspect-ratio: 16 / 10; border: 0;
  border-radius: 8px; background: var(--wash); box-shadow: 0 0 0 1px var(--ring);
}

/* ---------- Code ---------- */
.prose :not(pre) > code {
  font-family: var(--mono); font-size: .888889em; font-weight: 500; color: var(--ink); font-variant-ligatures: none;
  background: var(--chip); border: .5px solid var(--chip-border); background-clip: padding-box;
  border-radius: 4px; padding: 1px 4px; white-space: pre-wrap;
}
.prose pre {
  background: var(--wash); color: var(--code);
  border-radius: 4.8px; padding: 16px; overflow-x: auto; tab-size: 2;
}
/* `font` resets font-variant-ligatures, so turn them off again after it. */
.prose pre code { font: 500 14.2222px/21.3333px var(--mono); font-variant-ligatures: none; white-space: pre-wrap; color: var(--code); }

/* ---------- Lists of pages (from Campsite's "More writing") ---------- */
.section { display: flex; flex-direction: column; gap: 8px; }
.section-head { display: flex; align-items: center; gap: 16px; padding-block: 8px; }
.section-head h2 { margin: 0; font-size: 16px; font-weight: 500; color: var(--ink); }
@media (min-width: 1024px) { .section-head h2 { font-size: 18px; } }
.section-head::after { content: ""; flex: 1; border-bottom: .5px solid var(--border); }
.rows { display: flex; flex-direction: column; gap: 20px; margin: 0; padding: 0; list-style: none; }
@media (min-width: 1024px) { .rows { gap: 1px; } }
.row { position: relative; display: flex; flex-direction: column; gap: 4px; border-radius: 8px; transition: background-color .1s; }
@media (min-width: 1024px) { .row { margin-inline: -18px; padding: 14px 18px; } .row:hover { background: var(--hover); } }
.row-line { display: flex; flex-direction: column; gap: 2px; }
@media (min-width: 1024px) { .row-line { flex-direction: row; align-items: baseline; gap: 12px; } }
.row-title { flex: 1; min-width: 0; margin: 0; font-size: 18px; font-weight: 500; line-height: 1.375; color: var(--ink); text-wrap: balance; }
@media (min-width: 1024px) { .row-title { font-size: 20px; } }
.row-title a { color: inherit; text-decoration: none; }
.row-title a::after { content: ""; position: absolute; inset: 0; border-radius: 8px; }
.row-meta { font-size: 16px; color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-meta:empty { display: none; }
@media (min-width: 1024px) { .row-meta { font-size: 18px; } }
.row-desc { margin: 0; font-size: 16px; line-height: 1.5; color: var(--body); }

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