:root {
  --bg: #fffff8;
  --fg: #111111;
  --muted: #58544c;
  --rule: #d6d0c2;
  --accent: #244c73;
  --link-ul: #9c978a;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151412;
    --fg: #e5e0d5;
    --muted: #9b9589;
    --rule: #2e2b25;
    --accent: #8ab4dc;
    --link-ul: #615c52;
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) .figure img {
    filter: invert(0.92) hue-rotate(180deg);
    mix-blend-mode: lighten;
  }
}

:root[data-theme="dark"] {
  --bg: #151412;
  --fg: #e5e0d5;
  --muted: #9b9589;
  --rule: #2e2b25;
  --accent: #8ab4dc;
  --link-ul: #615c52;
  color-scheme: dark;
}

:root[data-theme="dark"] .figure img {
  filter: invert(0.92) hue-rotate(180deg);
  mix-blend-mode: lighten;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "ETBook", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Liberation Serif", serif;
  font-size: 17px;
  line-height: 1.62;
  font-variant-numeric: oldstyle-nums;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 32px 68px;
}

nav.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 40px;
  font-size: 14.5px;
}

nav.top .brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--fg);
  text-decoration: none;
  border: none;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  font-size: 16.5px;
  font-weight: 600;
}

nav.top .brand svg {
  width: 24px;
  height: 24px;
  display: block;
  flex-shrink: 0;
}

nav.top .nav-right {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 18px;
}

nav.top .links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

nav.top .links a {
  color: var(--muted);
  text-decoration: none;
  border: none;
}

nav.top .links a:hover {
  color: var(--fg);
}

.theme-toggle {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  padding-left: 14px;
  border-left: 1px solid var(--rule);
  font-size: 12.5px;
  color: var(--muted);
}

.theme-toggle button {
  appearance: none;
  background: none;
  border: none;
  padding: 2px 4px;
  margin: 0;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle button:hover {
  color: var(--fg);
}

.theme-toggle button[aria-pressed="true"] {
  color: var(--fg);
  border-bottom: 1px solid var(--fg);
}

article {
  position: relative;
  max-width: 560px;
}

h1 {
  font-size: 35px;
  font-weight: 400;
  line-height: 1.15;
  margin: 0 0 10px;
}

h2 {
  font-size: 16px;
  font-weight: 600;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  margin: 46px 0 16px;
  padding-top: 12px;
  border-top: 1px solid var(--fg);
  clear: both;
}

h3 {
  font-size: 21px;
  font-weight: 400;
  font-style: italic;
  margin: 32px 0 6px;
  clear: both;
}

h1 a.anchor {
  display: none;
}

h2 a.anchor,
h3 a.anchor {
  opacity: 0;
  border: none;
  text-decoration: none;
  color: var(--muted);
  font-style: normal;
  font-weight: 400;
  margin-left: 6px;
}

h2:hover a.anchor,
h3:hover a.anchor,
h2 a.anchor:focus,
h3 a.anchor:focus {
  opacity: 1;
}

p {
  margin: 0 0 14px;
}

ul {
  margin: 8px 0 18px;
  padding-left: 20px;
}

li {
  margin-bottom: 5px;
  font-style: italic;
}

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--link-ul);
}

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

code {
  font-family: "Liberation Mono", "DejaVu Sans Mono", ui-monospace, monospace;
  font-size: 13px;
}

sup.sn-ref {
  font-size: 11px;
  line-height: 0;
  margin-left: 1px;
  color: var(--muted);
}

.sidenote {
  float: right;
  clear: right;
  width: 230px;
  margin-right: -272px;
  margin-top: 2px;
  margin-bottom: 14px;
  font-size: 13.5px;
  font-style: normal;
  line-height: 1.5;
  color: var(--muted);
}

.sidenote .sn-num {
  color: var(--fg);
  margin-right: 4px;
}

p:has(> .figure) {
  clear: both;
  margin: 24px 0 28px;
}

.figure {
  display: block;
  width: 760px;
  max-width: calc(100vw - 64px);
}

.figure img {
  display: block;
  width: 100%;
  height: auto;
  mix-blend-mode: multiply;
}

.figcaption {
  display: block;
  margin-top: 8px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 600px;
  font-style: italic;
}

table {
  clear: both;
  width: 740px;
  max-width: calc(100vw - 64px);
  border-collapse: collapse;
  margin: 14px 0 28px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

th, td {
  text-align: left;
  padding: 7px 14px 7px 0;
  vertical-align: top;
}

thead th {
  font-weight: 400;
  font-style: italic;
  color: var(--muted);
  border-top: 1px solid var(--fg);
  border-bottom: 1px solid var(--rule);
}

tbody tr:last-child td {
  border-bottom: 1px solid var(--fg);
}

td:nth-child(2) {
  color: var(--muted);
  white-space: nowrap;
}

footer {
  clear: both;
  margin-top: 44px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  max-width: 560px;
  font-size: 14px;
  color: var(--muted);
}

@media (max-width: 860px) {
  .page { padding: 20px 18px 48px; }
  article { max-width: 100%; }
  .figure, table { width: 100%; max-width: 100%; }
  .theme-toggle { padding-left: 0; border-left: none; }
  .sidenote {
    float: none;
    width: auto;
    margin: 6px 0 14px;
    padding-left: 12px;
    border-left: 1px solid var(--rule);
    display: block;
  }
}
