/* Groundstate blog. Same identity as the landing page: EB Garamond, white page,
   near-black ink, grey metadata in small uppercase. One reading column; a contents
   list sits beside long posts on wide screens. */

:root {
  --ink: #111111;
  --body: #222222;
  --muted: #777777;
  --faint: #a6a6a6;
  --rule: #e6e4df;
  --wash: #f5f4f0;
  --bg: #ffffff;
  --serif: 'EB Garamond', Georgia, 'Times New Roman', serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --measure: 40rem;
  --gutter: max(24px, env(safe-area-inset-left, 0px));
  --gutter-r: max(24px, env(safe-area-inset-right, 0px));
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--body);
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.6;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  padding: 6px 10px;
  background: var(--ink);
  color: var(--bg);
  font-size: 15px;
  text-decoration: none;
  z-index: 10;
}
.skip:focus { top: 12px; }

/* ---------- header and footer ---------- */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 30px var(--gutter-r) 0 var(--gutter);
}

.wordmark,
.site-header nav a,
.site-footer {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wordmark { color: var(--ink); text-decoration: none; letter-spacing: 0.14em; }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover { color: var(--ink); }

main { flex: 1 0 auto; width: 100%; }

.site-footer {
  display: flex;
  justify-content: center;
  gap: 28px;
  padding: 56px var(--gutter-r) 48px var(--gutter);
  color: var(--muted);
  letter-spacing: 0.04em;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--ink); }

/* ---------- blog index ---------- */

.index {
  max-width: 46rem;
  margin: 0 auto;
  padding: 88px var(--gutter-r) 64px var(--gutter);
}

.index h1 {
  margin: 0;
  font-weight: 400;
  font-size: 42px;
  line-height: 1.15;
  color: var(--ink);
}

.post-list { list-style: none; margin: 48px 0 0; padding: 0; }
.post-list li + li { border-top: 1px solid var(--rule); }

.post-list a {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  column-gap: 28px;
  row-gap: 2px;
  padding: 22px 0;
  text-decoration: none;
}

.post-list time {
  grid-row: 1 / span 2;
  padding-top: 0.3em;
  color: var(--muted);
  font-size: 16px;
  font-variant-numeric: lining-nums tabular-nums;
}

.post-title { color: var(--ink); font-size: 25px; line-height: 1.3; text-wrap: balance; }
.post-byline { color: var(--muted); font-size: 17px; line-height: 1.45; }

.post-list a:hover .post-title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.draft-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: 0.35em;
}

.empty { margin-top: 56px; color: var(--muted); }

@media (max-width: 560px) {
  .index { padding-top: 56px; }
  .post-list a { grid-template-columns: minmax(0, 1fr); }
  .post-list time { grid-row: auto; padding-top: 0; font-size: 15px; }
}

/* ---------- post ---------- */

.post { padding: 80px var(--gutter-r) 0 var(--gutter); }

.post-header { max-width: 46rem; margin: 0 auto 64px; text-align: center; }

.post-header h1 {
  margin: 0;
  font-weight: 400;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.14;
  letter-spacing: -0.005em;
  color: var(--ink);
  text-wrap: balance;
}

.post-subtitle {
  max-width: 42rem;
  margin: 18px auto 0;
  color: #555555;
  font-size: 22px;
  line-height: 1.45;
  text-wrap: balance;
}

.post-meta {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 16px;
  letter-spacing: 0.02em;
  font-variant-numeric: lining-nums;
}

.draft-banner {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, var(--measure)) minmax(0, 1fr);
  column-gap: 56px;
}

.prose { grid-column: 2; min-width: 0; }

.toc { grid-column: 1; grid-row: 1; justify-self: end; width: 13rem; }
.toc ol {
  position: sticky;
  top: 40px;
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  font-size: 15px;
  line-height: 1.35;
}
.toc li + li { margin-top: 11px; }
.toc a { color: var(--faint); text-decoration: none; transition: color 120ms ease; }
.toc a:hover, .toc a.active { color: var(--ink); }

@media (max-width: 1120px) {
  .post-body { display: block; }
  .prose { max-width: var(--measure); margin: 0 auto; }
  .toc { display: none; }
}

@media (max-width: 560px) {
  body { font-size: 19px; }
  .post { padding-top: 56px; }
  .post-header { margin-bottom: 44px; }
}

.post-back { max-width: var(--measure); margin: 80px auto 0; font-size: 17px; }

/* Interactive posts (posts/*.html) bring their own markup and use a wider column. */
.post-interactive .interactive { max-width: 64rem; margin: 0 auto; min-width: 0; }
.post-interactive .post-header { max-width: 64rem; margin-bottom: 48px; text-align: left; }
.post-interactive .post-subtitle { margin-left: 0; margin-right: 0; }
.post-interactive .post-back { max-width: 64rem; }
.post-back a { color: var(--muted); text-decoration: none; }
.post-back a:hover { color: var(--ink); }

/* ---------- prose ---------- */

.prose > * { margin: 0; }
.prose > * + * { margin-top: 1.05em; }

.prose h2 {
  margin-top: 2.1em;
  font-weight: 400;
  font-size: 31px;
  line-height: 1.22;
  color: var(--ink);
  text-wrap: balance;
  scroll-margin-top: 32px;
}
.prose h3 {
  margin-top: 1.7em;
  font-weight: 500;
  font-size: 22px;
  line-height: 1.3;
  color: var(--ink);
  scroll-margin-top: 32px;
}
.prose h2 + *, .prose h3 + * { margin-top: 0.55em; }

.prose a {
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--faint);
}
.prose a:hover { color: var(--ink); text-decoration-color: var(--ink); }

.prose strong { font-weight: 500; color: var(--ink); }

.prose ul, .prose ol { padding-left: 1.25em; }
.prose li + li { margin-top: 0.35em; }
.prose li > ul, .prose li > ol { margin-top: 0.35em; }

.prose blockquote {
  padding-left: 1.1em;
  border-left: 2px solid var(--rule);
  color: #444444;
  font-style: italic;
}

.prose code {
  font-family: var(--mono);
  font-size: 0.74em;
  padding: 0.12em 0.36em;
  border-radius: 3px;
  background: var(--wash);
}

.prose pre {
  overflow-x: auto;
  padding: 16px 18px;
  border-radius: 4px;
  background: var(--wash);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
}
.prose pre code { padding: 0; background: none; font-size: inherit; }

.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.6em 0; }

.prose img { display: block; max-width: 100%; height: auto; }

.prose figure { margin-top: 1.9em; margin-bottom: 1.9em; }
.prose figure + * { margin-top: 0; }
.prose figcaption { margin-top: 12px; color: var(--muted); font-size: 16px; line-height: 1.45; }
.fig-label { color: var(--ink); }

.table-wrap { overflow-x: auto; }
.prose > .table-wrap { margin-top: 1.6em; }
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 17px;
  line-height: 1.4;
  font-variant-numeric: lining-nums tabular-nums;
}
.prose th, .prose td { padding: 9px 14px 9px 0; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.prose th { font-weight: 500; color: var(--ink); border-bottom-color: var(--ink); }
.prose th[align="right"], .prose td[align="right"] { text-align: right; }
.prose th[align="center"], .prose td[align="center"] { text-align: center; }
.prose th:last-child, .prose td:last-child { padding-right: 0; }

@media (prefers-reduced-motion: reduce) {
  .toc a { transition: none; }
}
