.writing h1 {
  margin-bottom: var(--s2);
}

.writing .post-meta {
  margin-bottom: var(--s5);
  font-size: 16px;
}

.writing h2 {
  margin-top: var(--s6);
}

.writing h3 {
  margin: var(--s5) 0 var(--s2);
}

.writing .pdf-download {
  display: inline-block;
}

.writing .pdf-paper {
  margin: 0 0 var(--s5);
  padding: 0;
  background: var(--bg);
  isolation: isolate;
  box-shadow: 0 18px 42px rgb(0 0 0 / 16%), 0 2px 8px rgb(0 0 0 / 10%);
}

.writing .pdf-paper img {
  width: 100%;
  margin: 0;
  opacity: .92;
  mix-blend-mode: multiply;
}

@media (prefers-color-scheme: dark) {
  .writing .pdf-paper {
    box-shadow: 0 18px 42px rgb(0 0 0 / 40%), 0 2px 8px rgb(0 0 0 / 24%);
  }

  .writing .pdf-paper img {
    filter: invert(1);
    mix-blend-mode: screen;
  }
}

/* A page burnt by paper-burn.js: the canvas carries the paper, so the shadow
   follows its burnt outline instead of the figure's box. */
.writing .pdf-paper {
  --burn: #160d08;
  --scorch: #7d4f24;
}

.writing .pdf-paper.is-burnt {
  background: none;
  box-shadow: none;
  filter: drop-shadow(0 18px 21px rgb(0 0 0 / 16%)) drop-shadow(0 2px 4px rgb(0 0 0 / 10%));
}

.writing .pdf-paper img[hidden] {
  display: none;
}

.writing .pdf-paper canvas {
  display: block;
  width: 100%;
  height: auto;
}

@media (prefers-color-scheme: dark) {
  .writing .pdf-paper {
    --burn: #ffab57;
    --scorch: #b3451a;
  }

  .writing .pdf-paper.is-burnt {
    filter: drop-shadow(0 18px 21px rgb(0 0 0 / 40%)) drop-shadow(0 2px 4px rgb(0 0 0 / 24%));
  }
}

.writing li {
  font-size: 18px;
  line-height: var(--line);
}

.writing code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
}

/* Long inline code (hashes, paths) wraps instead of widening the page;
   code blocks keep their lines and scroll sideways instead. */
.writing :not(pre) > code {
  overflow-wrap: anywhere;
}

.writing pre {
  max-width: 100%;
  margin: var(--s4) 0;
  padding: var(--s3);
  overflow-x: auto;
  border: 1px solid color-mix(in srgb, var(--fg) 25%, transparent);
  font-size: 15px;
  line-height: 1.5;
}

.writing table {
  width: 100%;
  margin: var(--s4) 0;
  border-collapse: collapse;
  font-size: 16px;
}

.writing th,
.writing td {
  padding: var(--s2);
  border-bottom: 1px solid color-mix(in srgb, var(--fg) 25%, transparent);
  text-align: left;
  vertical-align: top;
}

.writing img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: var(--s4) auto;
}

.writing blockquote {
  margin: var(--s4) 0;
  padding-left: var(--s3);
  border-left: 2px solid var(--fg);
}

/* The handwritten pages as text, closed until asked for. */
.transcript {
  margin-top: var(--s5);
}

.transcript summary {
  width: max-content;
  font-size: 18px;
  line-height: var(--line);
  cursor: pointer;
}

.transcript h2 {
  margin: var(--s4) 0 var(--s2);
  font-size: 16px;
  font-weight: 600;
}

.post-list {
  margin-top: var(--s5);
  padding: 0;
  list-style: none;
}

/* Date and title share a baseline; the description hangs under the title. */
.post-list li {
  display: grid;
  grid-template-columns: 9em minmax(0, 1fr);
  column-gap: var(--s4);
  align-items: baseline;
  margin: 0 0 var(--s5);
}

.post-list li:last-child {
  margin-bottom: 0;
}

.post-list time {
  font-size: 15px;
}

.post-list h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.post-list p {
  grid-column: 2;
  margin: var(--s1) 0 0;
  font-size: 16px;
  line-height: 26px;
}

@media (max-width: 599px) {
  .post-list li {
    grid-template-columns: minmax(0, 1fr);
  }

  .post-list p {
    grid-column: 1;
  }
}

.post-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--s4);
  margin-top: var(--s6);
  font-size: 16px;
  line-height: 24px;
}

.post-nav span {
  display: block;
  font-size: 15px;
}

.post-nav a {
  text-decoration: none;
}

.post-nav a:hover {
  text-decoration: underline;
}

/* Margin note: follows the page, stopping one step below the sticky bar. */
.toc {
  position: sticky;
  top: var(--anchor-offset);
  font-size: 15px;
  line-height: var(--line);
}

.toc h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.toc ol {
  padding: 0;
  list-style: none;
}

.toc li {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toc a {
  text-decoration: none;
}

.toc a:hover,
.toc a[aria-current] {
  text-decoration: underline;
}

/* Live build panel on the Riemann Hypothesis post (rh-progress.js). */
.rh-live {
  margin: var(--s4) 0;
  padding: var(--s3);
  border: 1px solid color-mix(in srgb, var(--fg) 25%, transparent);
}

.rh-live-track {
  height: 10px;
  margin: var(--s2) 0 var(--s3);
  background: color-mix(in srgb, var(--fg) 12%, transparent);
}

.rh-live-bar {
  width: 0;
  height: 100%;
  background: var(--fg);
  transition: width 600ms var(--ease);
}

.rh-live dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--s1) var(--s3);
  margin: 0 0 var(--s3);
  font-size: 16px;
}

.rh-live dt {
  opacity: 0.7;
}

.rh-live dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.rh-live pre {
  white-space: pre-wrap;
  font-size: 14px;
}

.rh-live-note {
  font-size: 14px;
  opacity: 0.7;
}

.rh-live .rh-h {
  margin: var(--s4) 0 var(--s2);
  font-weight: 700;
}

.rh-live svg {
  display: block;
  width: 100%;
  height: auto;
}

.rh-map svg rect:hover {
  fill-opacity: 0.4;
}

.rh-area {
  display: grid;
  grid-template-columns: minmax(0, 11em) 1fr 3.2em;
  gap: var(--s2);
  align-items: center;
  font-size: 14px;
  line-height: 1.9;
}

.rh-area-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.rh-area-track {
  height: 8px;
  background: color-mix(in srgb, var(--fg) 12%, transparent);
}

.rh-area-track span {
  display: block;
  height: 100%;
  background: var(--fg);
  transition: width 600ms var(--ease);
}

.rh-area-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rh-lists {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14em, 1fr));
  gap: 0 var(--s4);
}

.writing .rh-files {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.writing .rh-files li {
  font-size: 14px;
  display: flex;
  gap: var(--s2);
  justify-content: space-between;
  line-height: 1.9;
}

.writing .rh-files li span:first-child {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.writing .rh-files li span:last-child {
  flex: none;
  font-variant-numeric: tabular-nums;
}

.rh-share {
  margin-top: var(--s3);
  padding: var(--s2) var(--s3);
  border: 1px solid var(--fg);
  background: none;
  color: inherit;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.rh-share:hover {
  background: var(--fg);
  color: var(--bg);
}

.writing figure.rh-figure {
  margin: var(--s4) 0;
}

.writing figure.rh-figure figcaption {
  font-size: 14px;
  opacity: 0.7;
}
