:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --text: #202428;
  --muted: #59636e;
  --rule: #d8dee4;
  --accent: #005f8f;
  --accent-hover: #004b72;
  --accent-visited: #6f4aa8;
  --quote-bg: #f6f8fa;
  --quote-text: #30363d;
  --popover-bg: #ffffff;
  --popover-shadow: 0 8px 24px rgb(31 35 40 / 0.14);
  --fn-highlight: #eef7fb;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --text: #e6edf3;
    --muted: #8b949e;
    --rule: #2a313c;
    --accent: #4ba3e3;
    --accent-hover: #70baf4;
    --accent-visited: #b392f0;
    --quote-bg: #161b22;
    --quote-text: #c9d1d9;
    --popover-bg: #161b22;
    --popover-shadow: 0 8px 24px rgb(0 0 0 / 0.55);
    --fn-highlight: rgba(75, 163, 227, 0.18);
  }
}

* {
  box-sizing: border-box;
}

::selection {
  background: rgba(0, 95, 143, 0.2);
}

@media (prefers-color-scheme: dark) {
  ::selection {
    background: rgba(75, 163, 227, 0.28);
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

html {
  font-size: 18px;
}

[id] {
  scroll-margin-top: 1.5rem;
}

body {
  margin: 0 auto;
  max-width: 42rem;
  padding: 1.5rem 1rem 3rem;
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.65;
  overflow-wrap: break-word;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

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

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#menu {
  margin-bottom: 2.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.92rem;
}

#menu ul {
  display: flex;
  gap: 1.25rem;
  align-items: baseline;
  margin: 0;
  padding-left: 0;
  list-style: none;
}

#menu a {
  color: var(--muted);
  text-decoration: none;
}

#menu a::before {
  display: block;
  height: 0;
  overflow: hidden;
  content: attr(data-label);
  font-weight: 650;
  visibility: hidden;
}

#menu a:hover,
#menu a:focus {
  color: var(--text);
}

#menu .site-title {
  margin-right: 0.1rem;
}

.nav_item {
  display: inline-block;
}

#menu .nav_item.is-active a {
  color: var(--text);
  font-weight: 650;
}

.section > *:first-child {
  margin-top: 0;
}

p,
ul,
ol,
blockquote,
hr {
  margin-top: 0;
  margin-bottom: 1.15rem;
}

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

li + li {
  margin-top: 0.25rem;
}

code,
kbd,
samp {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
  padding: 0.15em 0.35em;
  border-radius: 3px;
  background: var(--quote-bg);
}

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

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

table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
  font-size: 0.92rem;
  line-height: 1.5;
}

th,
td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
}

th {
  color: var(--text);
  font-weight: 650;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 2.1rem 0 0.75rem;
  font-weight: 650;
}

h1 {
  font-size: 1.9rem;
}

h2 {
  font-size: 1.3rem;
  padding-top: 0.35rem;
}

h3 {
  font-size: 1.08rem;
}

.title {
  margin-bottom: 0.35rem;
}

.post-date {
  margin-bottom: 1.4rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.links {
  margin-top: 2.15rem;
  color: var(--muted);
}

.home-context {
  margin-top: 2rem;
}

.selected-work {
  clear: both;
  margin: 2rem 0;
  padding: 1.25rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.selected-work h2 {
  margin: 0 0 1.1rem;
  padding: 0;
}

.selected-work ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.selected-work li + li {
  margin-top: 1.1rem;
}

.selected-work h3 {
  margin: 0 0 0.25rem;
}

.selected-work p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.all-essays {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.92rem;
}

.toc {
  margin: 1.3rem 0 2rem;
  padding: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.toc-toggle {
  display: inline-flex;
  width: auto;
  align-items: center;
  gap: 0.4rem;
  justify-content: flex-start;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0;
}

.toc-toggle::after {
  content: "+";
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0;
}

.toc.is-expanded .toc-toggle::after {
  content: "-";
}

.toc-body {
  margin-top: 0.65rem;
}

.toc.is-collapsed .toc-body {
  display: none;
}

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

.toc li {
  margin-top: 0;
}

.toc li + li {
  margin-top: 0.25rem;
}

.toc ol ol {
  margin: 0.2rem 0 0.45rem;
  padding-left: 1rem;
}

.toc ol ol a {
  color: var(--muted);
}

.toc a {
  display: block;
  padding-left: 0.45rem;
  border-left: 2px solid transparent;
  color: var(--accent);
}

.toc a[aria-current="location"],
.toc a[aria-current="location"]:visited {
  border-left-color: var(--accent);
  color: var(--text);
  font-weight: 650;
}

.toc a:hover,
.toc a:focus {
  color: var(--accent-hover);
}

@media (min-width: 86rem) {
  body {
    max-width: 68rem;
  }

  #menu,
  .section {
    max-width: 42rem;
    margin-right: auto;
    margin-left: auto;
  }

  .section {
    position: relative;
  }

  .toc {
    position: sticky;
    top: 1.5rem;
    float: left;
    width: 14.5rem;
    max-height: calc(100vh - 3rem);
    margin: 0 0 1.5rem -17rem;
    padding: 0.2rem 0 0.2rem 1rem;
    overflow: auto;
    border-top: 0;
    border-bottom: 0;
    border-left: 1px solid var(--rule);
    font-size: 0.78rem;
    line-height: 1.4;
  }

  .toc-toggle {
    border-bottom: 0;
    cursor: default;
    pointer-events: none;
  }

  .toc-toggle::after {
    content: "";
  }

  .toc.is-collapsed .toc-body {
    display: block;
  }

  .toc-body {
    margin-top: 0.55rem;
  }

  .toc ol ol {
    padding-left: 0.75rem;
  }

  .toc li + li {
    margin-top: 0.3rem;
  }
}

.post-list {
  display: grid;
  gap: 1.65rem;
  margin-top: 0.35rem;
}

.post-card {
  padding: 0;
}

.post-card h2 {
  margin: 0 0 0.3rem;
  padding: 0;
  font-size: 1.08rem;
  line-height: 1.3;
}

.post-card h2 a {
  color: var(--text);
}

.post-card h2 a:hover,
.post-card h2 a:focus {
  color: var(--accent);
  background: transparent;
}

.post-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.post-body a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

.post-body .footnote-reference a,
.post-body .footnote-backlinks a {
  text-decoration: none;
}

blockquote {
  margin-left: 0;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--rule);
  background: var(--quote-bg);
  color: var(--quote-text);
}

blockquote > *:last-child {
  margin-bottom: 0;
}

.author-note {
  margin: 1.6rem 0 1.9rem;
  padding: 0.9rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--quote-bg);
  color: var(--quote-text);
  font-size: 0.94rem;
  line-height: 1.55;
}

.author-note-label {
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

hr {
  height: 1px;
  margin: 2rem 0;
  border: 0;
  background: var(--rule);
}

img {
  display: block;
  max-width: min(100%, 34rem);
  height: auto;
  margin: 1.5rem auto;
}

.video-embed {
  position: relative;
  margin: 1.25rem 0 1.5rem;
  aspect-ratio: 16 / 9;
  background: #000000;
}

.video-embed iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.film-title {
  margin-bottom: 0.45rem;
}

.film-player-poster {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  background: #000000;
}

.film-player-poster img {
  width: 100%;
  max-width: 100%;
  height: 100%;
  margin: 0;
  border: 1px solid #172933;
  object-fit: cover;
}

.film-player-control {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  width: 3.1rem;
  height: 3.1rem;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(232, 182, 57, 0.9);
  border-radius: 50%;
  background: rgba(4, 11, 16, 0.86);
  transform: translate(-50%, -50%);
  transition: background-color 120ms ease, transform 120ms ease;
}

.film-player-icon {
  width: 0;
  height: 0;
  margin-left: 0.16rem;
  border-top: 0.4rem solid transparent;
  border-bottom: 0.4rem solid transparent;
  border-left: 0.65rem solid #e8b639;
}

.film-player-poster:hover .film-player-control,
.film-player-poster:focus .film-player-control {
  background: rgba(4, 11, 16, 0.96);
  transform: translate(-50%, -50%) scale(1.05);
}

.film-player-poster:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.film-meta {
  margin: 0 0 1.6rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.film-meta p {
  margin-bottom: 0;
}

.film-facts {
  display: block;
}

.film-facts span + span::before {
  margin: 0 0.45rem;
  color: var(--muted);
  content: "\00b7";
}

.film-selection {
  display: block;
  margin-top: 0.15rem;
}

.film-selection-label {
  color: inherit;
}

.film-selection a,
.film-selection a:visited {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

.film-selection a:hover,
.film-selection a:focus {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.essay-figure {
  clear: both;
  margin: 2rem 0;
}

.essay-figure img {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 2px;
}

.essay-figure.narrow img {
  max-width: min(100%, 24rem);
}

.essay-figure figcaption {
  max-width: 36rem;
  margin: 0.65rem auto 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.figure-credit {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.8rem;
}

.portrait {
  float: right;
  width: min(34%, 10rem);
  margin: 0.15rem 0 1.5rem 1.5rem;
}

.portrait img {
  width: 100%;
  max-width: none;
  margin: 0;
  image-rendering: pixelated;
}

sup {
  line-height: 0;
}

.footnote-reference {
  position: relative;
  white-space: nowrap;
}

.footnote-reference a {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15em;
  height: 1.15em;
  margin-left: 0.08em;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72em;
  font-weight: 700;
  line-height: 1;
}

.footnote-reference a:hover,
.footnote-reference a:focus-visible,
.footnote-reference.is-open > a {
  background: var(--fn-highlight);
  color: var(--accent);
}

.footnote-reference a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.footnote-popover {
  position: absolute;
  z-index: 10;
  bottom: 1.7em;
  left: 50%;
  width: max-content;
  max-width: min(20rem, calc(100vw - 2rem));
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--popover-bg);
  box-shadow: var(--popover-shadow);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translateX(-50%) translateY(0.25rem);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: normal;
}

.footnote-popover::before {
  position: absolute;
  right: 0;
  bottom: -0.7rem;
  left: 0;
  height: 0.7rem;
  content: "";
}

.footnote-popover p {
  margin-bottom: 0;
}

.footnote-reference:hover .footnote-popover,
.footnote-reference:focus-within .footnote-popover,
.footnote-reference.is-open .footnote-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.footnote-reference a,
.footnote-definition-label {
  color: var(--muted);
}

.footnotes,
.references {
  margin-top: 2.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
}

.footnotes h2,
.references h2 {
  margin-top: 0;
  padding-top: 0;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.footnote-definition {
  display: grid;
  grid-template-columns: 1.8rem 1fr;
  gap: 0.25rem;
  margin-top: 0.65rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.footnote-definition-label {
  padding-top: 0.08rem;
  font-weight: 700;
}

.footnote-definition p {
  margin-bottom: 0.6rem;
}

.footnote-backlinks {
  grid-column: 2;
  margin-top: -0.2rem;
  font-size: 0.82rem;
}

.footnote-backlinks a + a {
  margin-left: 0.45rem;
}

.references ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.references li {
  margin-top: 0.7rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

@media (max-width: 620px) {
  html {
    font-size: 16px;
  }

  body {
    padding: 1rem 0.9rem 2.5rem;
  }

  #menu {
    margin-bottom: 1.6rem;
  }

  h1 {
    font-size: 1.55rem;
  }

  blockquote {
    padding: 0.75rem 0.85rem;
  }

  .portrait {
    float: none;
    width: min(58%, 11rem);
    margin: 0 0 1.65rem;
  }

  .footnote-popover {
    bottom: auto;
    left: 0;
    top: 1.6em;
    max-width: min(18rem, calc(100vw - 2rem));
    transform: translateY(0.25rem);
  }

  .footnote-reference:hover .footnote-popover,
  .footnote-reference:focus-within .footnote-popover,
  .footnote-reference.is-open .footnote-popover {
    transform: translateY(0);
  }

  .footnote-definition {
    grid-template-columns: 1.4rem 1fr;
  }
}

@media print {
  body {
    max-width: 100%;
    padding: 0;
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt;
    line-height: 1.5;
  }

  #menu,
  .toc-toggle,
  .footnote-popover,
  .film-player-control {
    display: none !important;
  }

  .toc {
    position: static !important;
    float: none !important;
    width: 100% !important;
    margin: 1rem 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }

  .toc-body {
    display: block !important;
  }

  a {
    color: #000000 !important;
    text-decoration: underline !important;
  }

  blockquote,
  .author-note,
  pre {
    background: transparent !important;
    border-left: 2px solid #666666 !important;
    color: #000000 !important;
  }
}
