/* ------------------------------------------------------------------
   Tokens. Change these to restyle the whole site.
   ------------------------------------------------------------------ */
:root {
  --paper: #f6f2ea;
  --paper-2: #ede7db;
  --ink: #1d1b18;
  --ink-2: #57514a;
  --ink-3: #8a8379;
  --rule: #d8d0c2;
  /* --accent: #b23a12; */
  --accent: #e2001a;
  --accent-light: #f07f8c;
  --accent-soft: #b23a1218;
  --code-string: #4d7a3a;
  --code-number: #2f5f8a;
  --code-fn: #7a4a8c;
  --trail: #b0452a;

  --serif: 'ETBembo', serif;
  --mono: 'IBM Plex Mono', monospace;

  --measure: 38rem;
  --margin: 15rem;
  /* width of the sidenote column on wide screens */
  --gutter: 1rem;
}

@font-face {
  font-family: 'ETBembo';
  src: url('ETBembo-BoldLF.woff2') format('woff2'),
    url('ETBembo-BoldLF.woff') format('woff');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'ETBembo';
  src: url('ETBembo-DisplayItalic.woff2') format('woff2'),
    url('ETBembo-DisplayItalic.woff') format('woff');
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'ETBembo';
  src: url('ETBembo-RomanLF.woff2') format('woff2'),
    url('ETBembo-RomanLF.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ------------------------------------------------------------------
   Base
   ------------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-optical-sizing: auto;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

::selection {
  /* background: var(--accent-light); */
  /* color: var(--paper); */
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 120ms;
}

a:hover {
  color: var(--accent);
}

h1,
h2,
h3 {
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 {
  font-size: 2.4rem;
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 1.45rem;
  margin: 2.5rem 0 0.75rem;
}

h3 {
  font-size: 1.15rem;
  margin: 2rem 0 0.5rem;
}

p {
  margin: 0 0 1.1rem;
  text-wrap: pretty;
}

/* Small mono labels: dates, tags, section kickers */
.label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

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

/* ------------------------------------------------------------------
   Page frame
   ------------------------------------------------------------------ */
.frame {
  max-width: calc(var(--measure) + var(--margin) + 3rem + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.content {
  max-width: var(--measure);
}

main {
  padding: 3rem 0 4rem;
}

/* ------------------------------------------------------------------
   Prose (blog posts)
   ------------------------------------------------------------------ */
.prose {
  position: relative;
}

.prose img:not(.leaflet-tile) {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 2px;
}

.prose p>picture img,
.prose p>img {
  margin: 1.5rem 0;
}

/* Figures from the {% figure %} shortcode */
.prose .photo {
  margin: 2rem 0;
}

.prose .photo img {
  width: 100%;
}

.prose .photo figcaption {
  font-size: 0.85rem;
  color: var(--ink-3);
  margin-top: 0.5rem;
}

@media (min-width: 66rem) {

  /* "wide": run into the sidenote column. clear: right starts it below any
  sidenote still running down the margin, so it never covers one. */
  .prose .photo.wide { width: calc(100% + var(--margin) + 3rem); clear: right; }
}

.prose blockquote {
  margin: 1.5rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--accent);
  color: var(--ink-2);
  font-style: italic;
}

.prose ul,
.prose ol {
  padding-left: 1.25rem;
  margin: 0 0 1.1rem;
}

.prose li {
  margin-bottom: 0.3rem;
}

.prose li::marker {
  color: var(--ink-3);
}

code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: var(--paper-2);
  padding: 0.1em 0.3em;
  border-radius: 3px;
}

pre {
  font-size: 0.85rem;
  line-height: 1.5;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 4px;
  margin: 1.5rem 0;
}

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

/* Syntax highlighting (Prism tokens), drawn from the site palette so it
   follows light/dark mode automatically. */
pre[class*='language-'] {
  background: var(--paper-2);
  color: var(--ink);
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: var(--ink-3);
  font-style: italic;
}

.token.keyword,
.token.atrule,
.token.important,
.token.selector {
  color: var(--accent);
}

.token.string,
.token.char,
.token.attr-value,
.token.regex {
  color: var(--code-string);
}

.token.number,
.token.boolean,
.token.constant,
.token.symbol {
  color: var(--code-number);
}

.token.function,
.token.class-name,
.token.builtin {
  color: var(--code-fn);
}

.token.operator,
.token.punctuation {
  color: var(--ink-2);
}

.token.property,
.token.tag,
.token.attr-name {
  color: var(--code-fn);
}

/* Math */
.katex {
  font-size: 1.05em;
}

.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.25rem 0;
}

/* Tables */
.prose table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.prose th,
.prose td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--rule);
}

.prose th {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
  font-weight: 400;
}

/* Footnotes from Markdown */
.prose .footnote-ref a {
  font-family: var(--mono);
  font-size: 0.75em;
  text-decoration: none;
  color: var(--accent);
}

.prose .footnote-ref a::before {
  content: '[';
}

.prose .footnote-ref a::after {
  content: ']';
}

.prose .footnotes-sep {
  display: none;
}

.footnotes::before {
  content: 'Footnotes';
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.5rem;
}

.footnotes ol {
  padding-left: 1.25rem;
  margin: 0;
}

.footnote-backref {
  text-decoration: none;
}

.footnotes {
  font-size: 0.85rem;
  color: var(--ink-2);
  margin-top: 3rem;
  border-top: 1px solid var(--rule);
  padding-top: 1rem;
}

.footnotes h2 {
  font-size: 0.7rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin: 0 0 0.5rem;
  font-weight: 400;
}

/* ------------------------------------------------------------------
   Sidenotes (Tufte-style). In the margin on wide screens,
   tap-to-expand inline on narrow ones.
   ------------------------------------------------------------------ */
.sidenote-ref::after {
  content: attr(data-n);
  font-family: var(--mono);
  font-size: 0.65em;
  vertical-align: super;
  line-height: 0;
  color: var(--accent);
  padding-left: 0.1em;
}

/* A sidenote directly after another one: "1,2" instead of "12". */
.sidenote-ref-next::after {
  content: ',' attr(data-n);
  padding-left: 0;
}

.sidenote-toggle {
  display: none;
}

.sidenote {
  display: none;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--ink-2);
}

.sidenote-text::before {
  content: attr(data-n) '. ';
  font-family: var(--mono);
  font-size: 0.75em;
  color: var(--accent);
}

label.sidenote-ref {
  cursor: pointer;
}

/* Images inside sidenotes */
.prose .sidenote img:not(.leaflet-tile) {
  width: 100%;
  margin: 0.2rem 0 0.45rem;
}

.sidenote-text img:not(.leaflet-tile) {
  margin-top: 0.45rem;
}

.sidenote-toggle:checked+.sidenote {
  display: block;
  margin: 0.5rem 0 0.75rem 1rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--rule);
}

@media (min-width: 66rem) {
  label.sidenote-ref {
    cursor: default;
  }

  .sidenote,
  .sidenote-toggle:checked+.sidenote {
    display: block;
    float: right;
    clear: right;
    width: var(--margin);
    margin: 0.3rem calc(-1 * (var(--margin) + 3rem)) 1rem 0;
    padding: 0;
    border: 0;
  }
}