/* ==========================================================================
   Paper pages – loaded in addition to site.css
   ========================================================================== */

.paper {
  max-width: 44rem;
  margin-inline: auto;
  padding-block: clamp(1.5rem, 4vw, 3rem) 3rem;
  font: 1.125rem/1.72 var(--serif);
  hyphens: manual;
  overflow-wrap: break-word;          /* long plain-text URLs must not widen the page */
}
.paper.wide { max-width: none; }

/* ── Head of the paper ───────────────────────────────────────────────────── */
.crumb { margin: 0 0 1.5rem; font: 500 .92rem/1.4 var(--sans); }
.crumb a { text-decoration: none; }
.crumb a:hover { text-decoration: underline; }

.paper h1 {
  margin: 0 0 1rem;
  font: 600 clamp(1.95rem, 1.3rem + 2.7vw, 3rem)/1.1 var(--serif);
  letter-spacing: -.02em;
}
.cite { margin: 0 0 1.25rem; color: var(--muted); font: .98rem/1.5 var(--sans); }
.cite .key { margin-right: .5rem; font: 500 .84rem var(--mono); color: var(--accent); }

.byline {
  display: block; margin: 1.5rem 0; padding: 1rem 0;
  border-block: 1px solid var(--rule);
  font: normal .98rem/1.55 var(--sans); color: var(--muted);
}
.byline .who { display: block; color: var(--ink); font-weight: 600; }
.byline .line { display: block; }
.byline a { overflow-wrap: anywhere; }

.abstract {
  margin: 1.75rem 0;
  padding: 1.15rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent);
  border-radius: 2px var(--radius) var(--radius) 2px;
}
.abstract p { margin: 0; font-size: 1.04rem; line-height: 1.68; }
.abstract p + p { margin-top: .8rem; }
.abstract b:first-child { font: 700 .76rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-right: .35rem; }

.downloads { display: flex; flex-wrap: wrap; gap: .55rem; margin: 1.4rem 0 0; padding: 0; list-style: none; font-family: var(--sans); }
.downloads a {
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .42rem .95rem .42rem .55rem; border: 1px solid var(--rule); border-radius: 999px;
  background: var(--surface); color: var(--ink); font-size: .9rem; line-height: 1.3; text-decoration: none;
}
.downloads a::before {
  content: "FILE"; padding: .18rem .45rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font: 700 .66rem/1 var(--mono); letter-spacing: .06em;
}
.downloads a[href$=".txt"]::before { content: "TXT"; }
.downloads a[href$=".doc"]::before { content: "DOC"; }
.downloads a[href$=".rtf"]::before { content: "RTF"; }
.downloads a[href$=".pdf"]::before { content: "PDF"; }
.downloads a[href$=".zip"]::before { content: "ZIP"; }
.downloads a:hover { border-color: var(--accent); }

.note, .notice {
  margin: 1.75rem 0; padding: .9rem 1.25rem;
  background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  border-left: 4px solid var(--warn); border-radius: 2px var(--radius) var(--radius) 2px;
  font-size: 1rem; line-height: 1.65;
}
.note p, .notice { margin-block: 0; }
.note p + p { margin-top: .7rem; }
.notice { font: 500 .96rem/1.5 var(--sans); }

/* ── Table of contents ───────────────────────────────────────────────────── */
.toc {
  margin: 2.25rem 0 1rem; padding: 1.25rem 1.5rem 1.4rem;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  font: .98rem/1.45 var(--sans);
}
.toc h2 { margin: 0 0 .9rem; font: 700 .76rem/1.2 var(--mono); letter-spacing: .15em; text-transform: uppercase; color: var(--muted); }
.toc ul { margin: 0; padding: 0; list-style: none; }
.toc ul ul { margin: .15rem 0 .45rem; padding-left: 1.2rem; border-left: 1px solid var(--rule); }
.toc li { margin: .28rem 0; }
.toc > ul > li > a { font-weight: 600; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* ── Body ────────────────────────────────────────────────────────────────── */
.paper-body { margin-top: 1.5rem; }
.paper-body > :first-child { margin-top: 0; }
.paper-body p { margin: 0 0 1.05rem; }
.paper-body h2, .paper-body h3, .paper-body h4, .paper-body h5 { line-height: 1.25; }
.paper-body h2 {
  margin: 3.25rem 0 1.1rem; padding-top: 1.6rem; border-top: 1px solid var(--rule);
  font: 600 clamp(1.5rem, 1.25rem + 1vw, 1.85rem)/1.2 var(--serif); letter-spacing: -.012em;
}
.paper-body h3 { margin: 2.4rem 0 .8rem; font: 600 clamp(1.25rem, 1.12rem + .5vw, 1.4rem)/1.25 var(--serif); }
.paper-body h4 { margin: 1.9rem 0 .6rem; font: 700 1.04rem/1.3 var(--sans); letter-spacing: .005em; }
.paper-body h5 { margin: 1.5rem 0 .5rem; font: 600 .86rem/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.paper-body ul, .paper-body ol { margin: 0 0 1.1rem; padding-left: 1.5rem; }
.paper-body li { margin: .4rem 0; }
.paper-body li > p { margin: .25rem 0; }
.paper-body li > ul, .paper-body li > ol { margin-block: .4rem 0; }

.paper-body blockquote {
  margin: 1.25rem 0; padding: .1rem 0 .1rem 1.25rem;
  border-left: 3px solid var(--rule);
}
.paper-body blockquote p:last-child { margin-bottom: 0; }

.paper-body sup, .paper-body sub { line-height: 0; }
.paper-body u { text-decoration-thickness: .06em; text-underline-offset: .15em; }

/* Inline and block code */
code {
  padding: .08em .32em; border-radius: 4px;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  font: .84em/1.3 var(--mono); overflow-wrap: anywhere;
}
.paper-body .code, .paper-body blockquote.code {
  display: block; margin: 1.1rem 0 1.3rem; padding: .85rem 1.1rem;
  background: var(--surface); border: 1px solid var(--rule); border-left: 3px solid var(--accent);
  border-radius: 2px 8px 8px 2px;
  font: .88rem/1.6 var(--mono); color: var(--ink); overflow-x: auto; overflow-wrap: anywhere;
}
.paper-body .code code { padding: 0; background: none; font: inherit; }
.paper-body .code .indent { margin: 0 0 0 2ch; padding: 0; border: 0; font: inherit; }

/* Figures and emoticons */
.paper-body img.figure {
  display: block; margin: 1.5rem auto; border: 1px solid var(--rule); border-radius: 6px;
  background: #fff;
}
.paper-body img.emoticon { display: inline; width: 1.05em; height: 1.05em; vertical-align: -.2em; }

/* Tables */
.table-wrap { width: fit-content; margin: 1.5rem 0; max-width: 100%; overflow-x: auto; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); }
.table-wrap:focus-visible { outline-offset: 0; }
table.data { width: auto; min-width: min(100%, 20rem); border-collapse: collapse; font: .93rem/1.45 var(--sans); }
table.data td, table.data th { padding: .5rem .85rem; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
table.data tr:last-child > td, table.data tr:last-child > th { border-bottom: 0; }
table.data th { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); font-weight: 650; white-space: nowrap; }
table.data tbody tr:nth-child(even) > td { background: color-mix(in srgb, var(--ink) 3.5%, transparent); }
table.data td.c, table.data th.c { text-align: center; }
table.data td.r { text-align: right; }
table.data code { font-size: .88em; }
.paper.wide table.data { width: 100%; }
.paper.wide .table-wrap { width: 100%; margin-top: 2rem; }
.paper.wide table.data td { white-space: nowrap; }

.center { text-align: center; }
.paper-body p.center { margin-block: 1.1rem; }

/* References */
.paper-body ul.refs { list-style: none; padding: 0; }
.paper-body ul.refs > li { margin: .9rem 0; padding-left: 1.1rem; border-left: 2px solid var(--rule); font-size: 1.02rem; line-height: 1.6; }
.paper-body ul.refs > li > p { margin: 0; }

.to-toc { margin: 1.75rem 0 0; text-align: right; font: .88rem/1.4 var(--sans); }
.to-toc a { color: var(--muted); text-decoration: none; }
.to-toc a::before { content: "\2191\00a0"; }
.to-toc a:hover { color: var(--accent); text-decoration: underline; }

/* Print: just the paper */
@media print {
  .paper { max-width: none; font-size: 10.5pt; padding: 0; }
  .crumb, .downloads, .to-toc { display: none; }
  .abstract, .note, .toc, .code, .table-wrap { background: none; break-inside: avoid; }
  .paper-body h2, .paper-body h3, .paper-body h4 { break-after: avoid; }
  .paper-body h2 { border: 0; padding-top: 0; }
}

/* Source listings written as <pre> */
.paper-body pre.code { white-space: pre; overflow-wrap: normal; tab-size: 8; margin: 1.1rem 0 1.3rem; font-size: .84rem; }

/* Epigraph under the byline */
.epigraph { margin: 1.5rem 0; padding: .1rem 0 .1rem 1.25rem; border-left: 3px solid var(--accent); color: var(--muted); font-style: italic; }

/* Annotated table of contents (section 0 of the "Vircing" paper) and numbered-reference lists */
.paper-body ul.atoc { list-style: none; padding: 0; font: .98rem/1.5 var(--sans); }
.paper-body ul.atoc > li { margin: .55rem 0; padding-left: 1rem; border-left: 2px solid var(--rule); }
.paper-body ol.refs { list-style: none; padding: 0; }
.paper-body ol.refs > li { margin: .9rem 0; padding-left: 1.1rem; border-left: 2px solid var(--rule); font-size: 1.02rem; line-height: 1.6; }

.source-note { margin: 3rem 0 0; padding-top: 1rem; border-top: 1px solid var(--rule); color: var(--muted); font: .88rem/1.5 var(--sans); }

/* ── Additions for the papers converted from Word documents ──────────────── */
.downloads a[href$=".docx"]::before { content: "DOC"; }
.byline .author { display: block; }
.byline .author + .author { margin-top: .9rem; }

.secnum { margin-right: .4em; color: var(--accent); font-variant-numeric: tabular-nums; }
.paper-body h5 .secnum, .paper-body h6 .secnum { color: inherit; }
.toc .secnum { color: var(--muted); font-weight: 400; }

.paper-body p.caption { margin: .5rem 0 1.5rem; text-align: center; color: var(--muted); font: 600 .9rem/1.4 var(--sans); }
.paper-body img.figure + p.caption, .paper-body p:has(> img.figure) { margin-bottom: .25rem; }
table.data caption { padding: .6rem .85rem; text-align: left; caption-side: top; }
table.data caption p.caption { margin: 0; text-align: left; }
table.data td p, table.data th p { margin: 0; }
table.data td p + p { margin-top: .4rem; }

.paper-body blockquote.letter {
  margin: 1.25rem 0; padding: .9rem 1.25rem; background: var(--surface);
  border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: 2px 8px 8px 2px;
  font-size: 1rem; line-height: 1.6;
}
.paper-body blockquote.letter p:last-child { margin-bottom: 0; }

.footnotes { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); color: var(--muted); font: .92rem/1.55 var(--sans); }
.footnotes ol { margin: 0; padding-left: 1.4rem; }
.footnotes p { margin: 0 0 .4rem; }
.footnote-ref { text-decoration: none; }
.footnote-back { margin-left: .35rem; text-decoration: none; }
.paper-body ol.refs > li::marker { content: none; }
