.essay {
  position: relative;
  hanging-punctuation: first allow-end last;
}

.essay p {
  margin: 0;
  text-align: var(--text-align);
  hyphens: var(--hyphens);
  -webkit-hyphens: var(--hyphens);
}
.essay p + p { text-indent: var(--paragraph-indent); }
.essay p + p > * { text-indent: 0; }

@media (max-width: 649px) {
  .essay { --text-align: left; --paragraph-indent: 1.5em; }
}

.essay-title {
  margin: var(--space-5) 0 var(--space-3);
  font-family: var(--font-heading);
  font-size: var(--step-4);
  font-weight: 600;
  font-variant-caps: small-caps;
  font-variant-numeric: lining-nums;
  letter-spacing: -0.01em;
  line-height: 1.1;
  text-align: center;
  text-wrap: balance;
}

.page-metadata {
  margin: 0 auto var(--space-5);
  max-width: 34rem;
  text-align: center;
  line-height: 1.5;
}
.page-metadata p { margin: 0 0 0.6em; text-align: center; text-indent: 0; }
.page-description { font-style: italic; }
.page-description em { font-style: normal; }
.page-metadata-fields {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  font-size: var(--step--1);
  color: var(--text-muted);
}
.page-metadata-fields > span { white-space: nowrap; }
.page-metadata-fields > span:not(:last-child)::after {
  content: "\2022";
  margin: 0 0.7em;
  opacity: 0.35;
}
.metadata-label { font-variant-caps: all-small-caps; letter-spacing: 0.04em; color: var(--text-faint); }
.page-status { font-size: var(--step--1); color: var(--text-muted); }
.status-placeholder { color: var(--accent); }
.page-tags a { color: var(--text-muted); margin: 0 0.25em; }

.epigraph {
  margin: 0 auto var(--space-5);
  padding: 0 2.5em;
  width: fit-content;
  max-width: 100%;
}
.epigraph blockquote {
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}
.epigraph blockquote::before,
.epigraph blockquote::after {
  position: absolute;
  font-size: 2.5em;
  line-height: 1;
  color: var(--text-faint);
}
.epigraph blockquote::before { content: "\201C"; left: -0.9em; top: -0.15em; }
.epigraph blockquote::after { content: "\201D"; right: -0.9em; bottom: -0.55em; }
.epigraph p { font-style: italic; text-align: left; margin: 0; }
.epigraph p + p { text-indent: 0; }
.epigraph .attribution {
  margin-top: 0.4em;
  text-wrap: balance;
  font-style: normal;
  font-size: var(--step--1);
  text-align: right;
  color: var(--text-muted);
}

.toc {
  margin: 0 0 var(--space-4);
  padding: 0.6em 0.9em 0.7em;
  border: var(--rule-width) solid var(--rule);
  background: var(--bg-raised);
  font-size: var(--step--1);
  line-height: var(--line-height-tight);
}
.toc-title {
  margin: 0 0 0.4em;
  font-size: 1em;
  font-weight: 600;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.toc ol,
.toc ul {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1.6em;
  counter-reset: toc;
}
.toc li {
  position: relative;
  margin: 0.35em 0;
  counter-increment: toc;
}
.toc li::before {
  content: counter(toc) "\2006";
  position: absolute;
  right: calc(100% + 0.35em);
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--text-faint);
}
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.essay > section { clear: both; }

@media (min-width: 900px) {
  .toc {
    float: left;
    width: var(--toc-width);
    margin: 0 var(--space-4) var(--space-3) 0;
  }
}

.abstract {
  display: flow-root;
  margin-bottom: var(--space-4);
  padding: 0.7em 1em;
  border: var(--rule-width) solid var(--rule);
  font-size: 0.95em;
}
.abstract p + p { text-indent: 0; margin-top: 0.5em; }

.essay h2,
.essay h3,
.footnotes::before {
  display: flow-root;
  font-family: var(--font-heading);
  font-variant-numeric: lining-nums;
  line-height: 1.15;
  scroll-margin-top: 1rem;
}
.essay h2,
.footnotes::before {
  margin: var(--space-5) 0 var(--space-3);
  padding: 0 0.05em 0.1em var(--space-4);
  border-bottom: var(--rule-width) solid var(--rule);
  font-size: var(--step-3);
  font-weight: 600;
  font-variant-caps: small-caps;
  letter-spacing: -0.01em;
  text-align: right;
}
.essay h3 {
  margin: var(--space-4) 0 var(--space-2);
  padding-bottom: 0.1em;
  border-bottom: var(--rule-width) dotted var(--rule);
  font-size: var(--step-1);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.footnotes::before { content: "Notes"; font-size: var(--step-2); }
.essay h2 a, .essay h3 a { text-decoration: none; color: inherit; }

.essay h2 + p,
.essay h3 + p { text-indent: 0; }

.initial-letter {
  float: left;
  margin: 0.06em 0.1em 0 0;
  font-family: var(--font-initial);
  font-size: var(--drop-cap-size);
  font-weight: 600;
  line-height: 0.78;
  color: var(--accent);
}

.essay hr {
  margin: var(--space-5) 0;
  border: 0;
  text-align: center;
  line-height: 1;
  overflow: visible;
}
.essay hr::after {
  content: var(--rule-ornament-1);
  font-size: 1.4em;
  color: var(--text-faint);
}
.essay hr:nth-of-type(3n+2)::after { content: var(--rule-ornament-2); }
.essay hr:nth-of-type(3n)::after { content: var(--rule-ornament-3); letter-spacing: 0.3em; }

.essay blockquote:not(.epigraph blockquote) {
  margin: var(--space-4) 0;
  padding: 0.8em 1.2em;
  border: var(--rule-width) solid var(--rule);
  background: var(--bg-raised);
  font-size: 0.95em;
}
.essay blockquote p { text-align: left; }
.essay blockquote cite,
.essay blockquote .attribution {
  display: block;
  margin-top: 0.4em;
  font-style: normal;
  font-size: var(--step--1);
  text-align: right;
  color: var(--text-muted);
}

.essay pre {
  margin: var(--space-4) 0;
  padding: 0.8em 1em;
  overflow-x: auto;
  border: var(--rule-width) solid var(--rule);
  background: var(--code-bg);
  line-height: 1.45;
  font-size: 0.78em;
  tab-size: 4;
}
.essay :not(pre) > code {
  padding: 0 0.2em;
  border: var(--rule-width) solid var(--rule);
  background: var(--code-bg);
  font-size: 0.82em;
  white-space: nowrap;
}
.code-comment,
.sourceCode .co { color: var(--text-faint); font-style: italic; }
.code-keyword,
.sourceCode .kw,
.sourceCode .cf,
.sourceCode .im { color: var(--accent); }

.essay figure { margin: var(--space-4) 0; }
.essay table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step--1);
  line-height: 1.4;
  font-variant-numeric: lining-nums tabular-nums;
  border-top: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
}
.essay caption {
  caption-side: top;
  padding-bottom: 0.4em;
  text-align: left;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.essay th, .essay td { padding: 0.3em 0.6em; text-align: left; vertical-align: top; }
.essay thead th { border-bottom: 1px solid var(--text-muted); font-weight: 600; }
.essay tbody tr:nth-child(even) { background: var(--table-stripe); }
.essay td.number, .essay th.number { text-align: right; }
.table-scroll { overflow-x: auto; }

.math-display {
  margin: var(--space-3) 0;
  overflow-x: auto;
  overflow-y: hidden;
  text-align: center;
  text-indent: 0;
}
.essay .katex { font-size: 1.05em; }
@media (max-width: 649px) {
  .math-display { font-size: 0.85em; }
}

.references ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.references li,
.csl-entry {
  margin: 0 0 0.7em;
  padding-left: 2em;
  text-indent: -2em;
  font-size: var(--step--1);
  line-height: 1.5;
  text-align: left;
}
.ref-author,
.csl-entry .smallcaps { font-variant-caps: small-caps; letter-spacing: 0.02em; }
.ref-year,
.csl-entry u { color: var(--text-muted); text-decoration: none; }
.ref-note { color: var(--text-muted); }

.footnotes {
  margin-top: var(--space-5);
  font-size: var(--step--1);
  line-height: 1.5;
}
.footnotes > hr { display: none; }
.footnotes ol { padding-left: 1.6em; }
.footnotes li { margin-bottom: 0.6em; }
.footnotes li p { text-align: left; }
.footnotes li:target { background: var(--accent-soft); }
.footnote-back { margin-left: 0.3em; text-decoration: none; color: var(--text-muted); }
.footnote-back::before { content: " "; }

a.footnote-ref {
  text-decoration: none;
  color: var(--accent);
}
.footnote-ref sup {
  padding: 0 0.1em;
  font-size: 0.7em;
  font-variant-numeric: lining-nums;
  line-height: 0;
  vertical-align: super;
}

.lang-mark {
  display: inline-block;
  padding: 0 0.3em;
  border: var(--rule-width) solid var(--rule);
  font-size: 0.75em;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.05em;
  line-height: 1.3;
  color: var(--text-muted);
  vertical-align: 0.1em;
}

.writing-index h1 { text-align: center; }
.writing-table { margin-top: var(--space-4); }
.writing-table td.date { white-space: nowrap; color: var(--text-muted); }
.writing-table .year-row td {
  padding-top: 1em;
  background: var(--bg);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  border-bottom: 1px solid var(--rule);
}
.writing-table .status { font-variant-caps: all-small-caps; letter-spacing: 0.04em; color: var(--text-muted); }
.writing-table .unwritten { color: var(--text-muted); }
.writing-table .venue { display: block; margin-top: 0.15em; font-size: var(--step--1); color: var(--text-muted); }
@media (max-width: 649px) {
  .writing-table thead { display: none; }
  .writing-table tr { display: grid; grid-template-columns: auto 1fr; column-gap: 0.8em; padding: 0.35em 0; }
  .writing-table td { padding: 0 0.4em; }
  .writing-table td.title { grid-column: 1 / -1; grid-row: 2; }
  .writing-table td.status { grid-column: 2; grid-row: 1; }
  .writing-table .year-row td { grid-column: 1 / -1; }
}

.essay h3 .when { float: right; margin-left: 1em; font-weight: 400; font-variant-caps: normal; text-transform: none; letter-spacing: 0; font-size: 0.85em; color: var(--text-muted); }
.essay .where { margin: -0.4em 0 0.6em; color: var(--text-muted); font-size: var(--step--1); }
.essay .contact p { text-align: left; text-indent: 0; margin: 0 0 0.3em; hyphens: none; }
