:root {
  --bg: #fdfdfc;
  --text: #2d2923;
  --muted: #707478;
  --line: #dfe3e4;
  --link: #5f6870;
  --code: #f2f3f4;
  --shade: #f4efe5;
  --measure: 700px;
  --measure-article: 700px;
  --space-xs: 0.25rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.15rem;
  --space-xl: 2rem;
  --space-rule: 2.25rem;
  --space-2xl: 2.5rem;
  --space-nav: 0.9rem;
  --font-small: 0.85rem;
  --font-meta: 0.92rem;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 18px;
  text-size-adjust: 100%;
}

body {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Source Sans 3", sans-serif;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.site-header,
.page,
.site-footer {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--space-md);
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  padding-top: 1.8rem;
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--line);
  font-size: var(--font-small);
  line-height: 1.2;
}

h1,
h2,
.page-intro,
.page-about p,
.post {
  font-family: Lora, serif;
}

.site-nav {
  display: flex;
  gap: var(--space-nav);
  white-space: nowrap;
}

.page {
  padding-top: var(--space-xl);
  padding-bottom: 3rem;
}

.page-home {
  padding-bottom: var(--space-md);
}

h1,
h2 {
  margin-top: 0;
  font-weight: normal;
  line-height: 1.25;
}

h1 {
  margin-bottom: var(--space-md);
  font-size: 2.1rem;
}

h2 {
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-sm);
  font-size: 1.25rem;
}

p,
ul,
ol,
blockquote,
pre {
  margin-top: 0;
  margin-bottom: var(--space-lg);
}

.page-intro,
.post-header p {
  color: var(--muted);
}

a {
  color: var(--link);
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

a:hover,
a:focus {
  color: var(--text);
  text-decoration: underline;
}

.site-header a:hover,
.site-header a:focus,
.site-header a[aria-current="page"] {
  color: var(--text);
  text-decoration: none;
}

.site-title {
  color: var(--text);
  font-size: 1rem;
}

.site-nav a {
  color: var(--muted);
}

/* Serbian site: the script toggle at the end of the nav, set off by a
   hairline: one serif letter naming the script it switches to (its title
   shows on hover). */
.site-nav .script-toggle {
  padding-left: var(--space-nav);
  border-left: 1px solid var(--line);
  color: var(--text);
  font-family: Lora, serif;
  font-weight: 500;
}

.site-header .script-toggle:hover,
.site-header .script-toggle:focus {
  text-decoration: underline;
}

ul,
ol {
  padding-left: 1.25rem;
}

li + li {
  margin-top: var(--space-xs);
}

.writing-list {
  font-family: "Source Sans 3", sans-serif;
  font-size: var(--font-small);
  line-height: 1.55;
}

.writing-list time {
  color: var(--text);
}

.writing-list a {
  font-family: Lora, serif;
}

/* CV: a date column beside serif entries. Entries with more to say fold
   open with <details>, so the page stays one line per entry without JS. */
.cv-list {
  --cv-date: 6.5rem;
  padding-left: 0;
  list-style: none;
  font-family: Lora, serif;
  font-size: var(--font-small);
  line-height: 1.6;
}

.cv-list > li,
.cv-list summary {
  display: grid;
  grid-template-columns: var(--cv-date) 1fr 1rem;
  column-gap: var(--space-md);
  align-items: baseline;
}

.cv-list > li + li {
  margin-top: var(--space-sm);
}

.cv-list details {
  grid-column: 1 / -1;
}

.cv-list summary {
  cursor: pointer;
  list-style: none;
}

.cv-list summary::-webkit-details-marker {
  display: none;
}

/* Every caret sits in the same right-hand column, drawn rather than typed
   so it is the same size and turns about its own centre. */
.cv-list summary::after {
  content: "";
  grid-column: 3;
  align-self: center;
  justify-self: center;
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.cv-list details[open] summary::after {
  transform: rotate(45deg);
}

.cv-when {
  font-family: "Source Sans 3", sans-serif;
  font-variant-numeric: tabular-nums;
}

.cv-org {
  font-weight: 500;
}

.cv-list a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--line);
}

.cv-list a:hover,
.cv-list a:focus {
  text-decoration-color: var(--text);
}

.cv-list details ul {
  margin: var(--space-xs) 0 0;
  padding-left: calc(var(--cv-date) + var(--space-md) * 2);
  list-style: none;
}

.cv-list details ul .cv-when {
  margin-right: 0.4em;
}

.page-about,
.page-writing,
.page-post {
  max-width: var(--measure-article);
}

.page-about p {
  font-size: var(--font-small);
  line-height: 1.68;
}

.post {
  font-size: var(--font-small);
  line-height: 1.6;
}

.post p {
  margin-bottom: var(--space-md);
}

.post-header p {
  font-family: "Source Sans 3", sans-serif;
  font-size: var(--font-meta);
}

.post-header p:not(:last-child) {
  margin-bottom: var(--space-xs);
}

.post h2 {
  font-size: 1.15rem;
  font-weight: 500;
}

strong {
  font-weight: 500;
}

em {
  font-style: italic;
}

u {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

blockquote {
  margin-left: 0;
  padding-left: var(--space-md);
  border-left: 2px solid var(--line);
  color: var(--muted);
}

hr {
  margin: var(--space-rule) 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.note {
  max-width: 600px;
  margin-inline: auto;
  margin-bottom: var(--space-lg);
  border: 1px solid #3d3933;
  padding: 1.25rem 1.4rem;
}

.note-shaded {
  background: var(--shade);
}

.note-small p {
  font-size: 0.82rem;
  line-height: 1.6;
}

.note-small p:not(.note-title) {
  padding-left: 0.25rem;
}

.note .note-title {
  margin-bottom: var(--space-sm);
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.85rem;
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.note > :last-child {
  margin-bottom: 0;
}

.note-tight p:not(.note-title) {
  margin-bottom: 0.5rem;
}

.faq-question {
  margin-bottom: 0.3rem;
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.85rem;
  color: var(--muted);
}

.faq-answer {
  margin-bottom: var(--space-xl);
}

/* Paper: a page set like a math paper or an old textbook, in the site's own
   fonts. Centered title block, an abstract, book contents with dotted
   leaders, centered part openers, theorem-style framed boxes with run-in
   labels, justified text with timestamps as margin notes. Used by
   take-home/appendix/. */
.page-paper .paper-title {
  margin-bottom: var(--space-xl);
  text-align: center;
}

.page-paper .paper-title h1 {
  margin-bottom: var(--space-sm);
  font-variant: small-caps;
  letter-spacing: 0.02em;
}

.page-paper .paper-kicker {
  font-style: italic;
}

.page-paper .paper-author {
  color: var(--text);
  font-family: Lora, serif;
  font-size: 1rem;
}

.abstract {
  max-width: 34rem;
  margin: 0 auto var(--space-2xl);
  font-size: 0.82rem;
  line-height: 1.6;
  text-align: justify;
  hyphens: auto;
}

.abstract-label {
  margin-bottom: var(--space-xs);
  font-variant: small-caps;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-align: center;
}

.page-paper .contents-heading {
  font-variant: small-caps;
  letter-spacing: 0.04em;
  text-align: center;
}

.toc,
.part-sections {
  margin-bottom: 0;
  padding-left: 0;
  list-style: none;
}

.toc li + li,
.part-sections li + li {
  margin-top: 0.2rem;
}

.toc a,
.part-sections a {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  color: var(--text);
}

.toc a:hover,
.toc a:focus,
.part-sections a:hover,
.part-sections a:focus {
  text-decoration: none;
}

.toc a:hover .toc-title,
.toc a:focus .toc-title,
.part-sections a:hover .toc-title,
.part-sections a:focus .toc-title {
  text-decoration: underline;
}

.toc-num {
  min-width: 2.2rem;
  font-variant-numeric: tabular-nums;
}

.toc .toc-num {
  font-variant: small-caps;
}

.leader {
  flex: 1;
  min-width: 1rem;
  border-bottom: 1px dotted var(--muted);
  transform: translateY(-0.3em);
}

.toc-time,
.ts,
.range {
  font-family: "Source Sans 3", sans-serif;
  font-variant-numeric: tabular-nums;
}

.toc-time {
  color: var(--muted);
  font-size: 0.82rem;
}

.segment {
  margin-top: 3.5rem;
}

.part-head {
  margin-bottom: var(--space-lg);
  text-align: center;
}

.part-num {
  margin-bottom: var(--space-xs);
  font-variant: small-caps;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.part-head h2 {
  margin-top: 0;
  margin-bottom: var(--space-xs);
}

.part-range {
  color: var(--muted);
  font-family: "Source Sans 3", sans-serif;
  font-size: var(--font-small);
  font-variant-numeric: tabular-nums;
}

.part-range .range {
  color: var(--muted);
}

.note-section {
  max-width: none;
  text-align: justify;
  hyphens: auto;
}

.runin {
  font-weight: 500;
  font-style: italic;
}

.note-section .runin-label {
  margin-bottom: var(--space-xs);
}

.moments {
  margin-bottom: var(--space-md);
  padding-left: 0;
  list-style: none;
  text-align: left;
}

.part-sections {
  font-size: 0.82rem;
  text-align: left;
}

.ts {
  color: var(--muted);
  font-size: 0.78rem;
}

.subhead {
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-sm);
  font-family: Lora, serif;
  font-size: 1rem;
  font-weight: 500;
}

.subhead-num {
  margin-right: 0.35rem;
}

.transcript p {
  display: grid;
  grid-template-columns: 3.6rem minmax(0, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  text-align: justify;
  hyphens: auto;
}

.transcript .ts {
  padding-top: 0.12rem;
  text-align: left;
}

.back {
  font-family: "Source Sans 3", sans-serif;
  font-size: var(--font-small);
  text-align: right;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

code {
  background: var(--code);
  padding: 0.08rem 0.22rem;
  font-size: 0.9em;
}

pre {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--code);
  padding: var(--space-md);
  font-size: var(--font-small);
  line-height: 1.5;
  tab-size: 2;
}

pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
}

.site-footer {
  margin-top: auto;
  padding-top: var(--space-md);
  padding-bottom: var(--space-md);
  border-top: 1px solid var(--line);
  text-align: center;
}

.site-footer-home {
  max-width: 980px;
  padding-top: 1.25rem;
  border-top: 0;
}

.footer-illustration {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0.94;
}

.site-footer .footer-links,
.site-footer .copyright {
  margin: var(--space-sm) 0 0;
  font-size: var(--font-small);
}

.copyright {
  color: var(--muted);
  font-size: 0.8rem;
  opacity: 0.45;
}

::selection {
  background: #dce5eb;
}

@media (max-width: 640px) {
  html {
    font-size: 17px;
  }

  .site-header,
  .site-footer {
    max-width: none;
  }

  .site-header {
    padding-top: 1.25rem;
    padding-bottom: var(--space-md);
  }

  h1 {
    font-size: 1.8rem;
  }

  .transcript p {
    display: block;
  }

  .cv-list > li,
  .cv-list summary {
    grid-template-columns: 1fr 1rem;
  }

  .cv-when,
  .cv-when + span {
    grid-column: 1;
  }

  .cv-list summary::after {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .cv-list details ul {
    padding-left: var(--space-md);
  }

  .transcript .ts {
    display: block;
    padding-top: 0;
  }

  /* Justified text opens rivers on a phone's measure. */
  .abstract,
  .note-section,
  .transcript p {
    text-align: left;
  }

  .site-footer {
    padding-inline: 0;
  }

  .site-footer .footer-links,
  .site-footer .copyright {
    padding-inline: var(--space-md);
  }
}
