:root {
  color-scheme: light;
  --paper: #fff;
  --ink: #201d24;
  --muted: #635969;
  --accent: #5c14a4;
  --rule: #ddd3e2;
  --panel: #f6f0f8;
  --body: "Crimson Text", Georgia, serif;
  --heading: "Avenir Next", "Helvetica Neue", sans-serif;
  --measure: 52rem;
  --wrap: 72rem;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
a { color: var(--accent); text-underline-offset: .2em; }
a:focus-visible, select:focus-visible, input:focus-visible, iframe:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
h1, h2, h3 { font-family: var(--heading); margin: 0; line-height: 1.06; text-wrap: balance; }
p { margin: 0; }
.preview-bar {
  display: flex; align-items: center; gap: .65rem; min-height: 2.7rem;
  padding: .45rem max(1rem, calc((100% - 72rem) / 2));
  background: #241b2d; color: #fff; font: 500 .875rem/1.2 system-ui, sans-serif;
}
.preview-bar a { margin-right: auto; color: #fff; }
.preview-bar select { font: inherit; max-width: 52vw; color: #241b2d; background: #fff; border: 0; border-radius: .25rem; padding: .25rem .5rem; }
.gallery { width: min(72rem, calc(100% - 3rem)); margin: 4.5rem auto; }
.gallery h1 { font-size: clamp(2.5rem, 7.2vw, 6rem); letter-spacing: -.075em; }
.gallery-intro { margin: 1rem 0 2.5rem; font: 1.125rem/1.55 var(--body); }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 1.35rem; }
.sample { display: block; color: var(--ink); text-decoration: none; border: 1px solid var(--rule); background: var(--paper); }
.sample:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.sample-preview { display: grid; min-height: 12.5rem; align-content: center; gap: .7rem; padding: 1.35rem; background: var(--paper); color: var(--ink); border-bottom: 1px solid var(--rule); }
.sample-preview span { font: 650 .75rem var(--heading); color: var(--accent); }
.sample-preview strong { font: 760 1.55rem/1.05 var(--heading); }
.sample-preview small { font: .875rem var(--body); }
.sample-name { display: grid; gap: .3rem; padding: .95rem 1.35rem; background: #fff; color: #211b25; font: .875rem/1.3 system-ui, sans-serif; }
.sample-name strong { font-size: 1rem; }
.sample-name span { color: #584e60; }

.masthead, .blog { width: min(var(--wrap), calc(100% - 3rem)); margin-inline: auto; }
.masthead {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem 2rem;
  padding-block: 1.8rem; border-bottom: 1px solid var(--rule); font: 600 .875rem var(--heading);
}
.site-name { display: inline-flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; font-size: clamp(1.35rem, 2.5vw, 1.65rem); }
.site-name img { width: 1.65rem; height: 1.65rem; object-fit: contain; flex: none; border-radius: 50%; }
.masthead nav { display: flex; flex-wrap: wrap; gap: .65rem 1.15rem; }
.masthead nav a { color: var(--muted); text-decoration: none; }
.masthead nav a:hover, .masthead nav a[aria-current] { color: var(--accent); text-decoration: underline; }
.blog { padding-block: clamp(2rem, 7vw, 6.5rem); }
.post-list { margin-top: 2rem; }
.story { border-top: 1px solid var(--rule); padding: 1.75rem 0; }
.story h2 { font-size: clamp(1.4rem, 3.5vw, 2.7rem); letter-spacing: -.04em; margin: .5rem 0; }
.story h2 a { color: inherit; text-decoration: none; }
.story h2 a:hover { color: var(--accent); text-decoration: underline; }
.story p, .dek { color: var(--muted); font: 1.15rem/1.55 var(--body); text-wrap: pretty; }
.metadata { font: 650 .875rem/1.45 var(--heading); color: var(--accent); }

.article { padding: clamp(2.25rem, 7vw, 6rem) 0 6rem; }
.article-heading, .prose, .next-post { width: min(var(--measure), calc(100% - 3rem)); margin-inline: auto; }
.article-heading { margin-bottom: 2.5rem; }
.article-heading h1 { font-size: clamp(2.25rem, 6.25vw, 4.65rem); letter-spacing: -.055em; margin: .55rem 0 .7rem; }
.prose { font: clamp(1.08rem, 1.6vw, 1.25rem)/1.66 var(--body); overflow-wrap: anywhere; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.1em; }
.prose h2 { margin: 1.8em 0 .65em; font-size: 1.55em; letter-spacing: -.035em; }
.prose h3 { margin: 1.65em 0 .5em; font-size: 1.25em; }
.prose img { display: block; margin: 1.5rem auto; max-width: 100%; height: auto; }
.prose pre, .prose .MathJax_Display { overflow: auto; }
.next-post { margin-top: 2.5rem; padding-top: 1.3rem; border-top: 1px solid var(--rule); font: 650 1rem var(--heading); }
.interactive { margin: 2rem auto; color: var(--ink); font: .925rem/1.55 var(--heading); }
.interactive h3 { margin: 0 0 .4rem; font-size: 1.25rem; }
.interactive figcaption { padding-top: .65rem; color: var(--muted); }
.payoff { padding: clamp(.8rem, 3vw, 1.5rem); border: 1px solid var(--rule); background: var(--panel); }
.payoff canvas { display: block; width: 100%; height: clamp(13rem, 27vw, 18rem); margin-block: .75rem; }
.controls { display: flex; flex-wrap: wrap; gap: .85rem 1.3rem; }
.controls label { flex: 1 1 12rem; font-weight: 650; }
.controls output { float: right; color: var(--accent); }
.controls input { display: block; width: 100%; height: 1.7rem; margin: .25rem 0 0; accent-color: var(--accent); }

/* Lecture Notes */
[data-style="lecture"] { --paper: #fff; --wrap: 67rem; --measure: 52rem; }
body[data-style="lecture"] .masthead { border: 0; }
body[data-style="lecture"] .blog { max-width: 59rem; }
body[data-style="lecture"] .article-heading { border-block: 1px solid var(--rule); padding-block: 1.4rem; }
body:is([data-style="lecture"], [data-style="editorial"], [data-style="centered"]) .article-heading h1 {
  font-size: clamp(1.95rem, 4.6vw, 3.1rem);
  font-weight: 600;
  letter-spacing: -.035em;
}
.meta-category { display: inline-block; margin-inline-start: .65em; white-space: nowrap; }
body:is([data-style="lecture"], [data-style="editorial"], [data-style="centered"]) :is(.story h2, .prose h2, .full-sec h2) {
  font-family: var(--heading);
  font-size: clamp(1.35rem, 2.6vw, 1.75rem);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -.025em;
}
body:is([data-style="lecture"], [data-style="editorial"], [data-style="centered"]) :is(.prose h3, .chart-title) {
  font-family: var(--heading);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.01em;
}
body[data-style="lecture"] .payoff { border-inline: 0; background: transparent; }
.sample[data-style="lecture"] .sample-preview strong { font-weight: 600; letter-spacing: -.025em; }

@media (max-width: 38rem) {
  .masthead, .blog, .article-heading, .prose, .next-post { width: calc(100% - 2rem); }
  .masthead { padding-block: 1.1rem; gap: .6rem; }
  .masthead nav { gap: .45rem .85rem; }
  .gallery { margin-block: 2.5rem; }
  .story p, .dek { font-size: 1.05rem; }
}

/* Shared reading layout */
.preview-bar { position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.font-control:not([hidden]) { display: flex; align-items: center; gap: .5rem; }
.preview-bar select { max-width: 43vw; }
.blog { padding-top: clamp(1.25rem, 3vw, 2.75rem); }
.post-list { margin-top: 0; }
.article { padding-top: clamp(1.75rem, 4.5vw, 4.5rem); }
.article h2[id] { scroll-margin-top: 6rem; }
.article-heading h1 { font-size: clamp(2.1rem, 5vw, 3.9rem); }
.orbit-loading { width: min(52rem, calc(100% - 2rem)); margin: 2rem auto; font: 1rem var(--heading); }

/* Research Editorial */
:is([data-style="editorial"], [data-style="centered"]) { --wrap: 76rem; --measure: 54rem; }
body:is([data-style="editorial"], [data-style="centered"]) .masthead,
body:is([data-style="editorial"], [data-style="centered"]) .blog { max-width: 64rem; }
body:is([data-style="editorial"], [data-style="centered"]) .masthead { border-bottom: 0; }
body:is([data-style="editorial"], [data-style="centered"]) .story { padding: 1.5rem 0; }
body:is([data-style="editorial"], [data-style="centered"]) .article-heading { border-bottom: 1px solid var(--rule); padding-bottom: 1.3rem; margin-bottom: 1rem; }
body:is([data-style="editorial"], [data-style="centered"]) :is(.metadata, .wd-post .eyebrow) { color: var(--accent); font-weight: 550; }
body:is([data-style="editorial"], [data-style="centered"]) .payoff { background: #fff; border-radius: .3rem; }
.article-contents {
  width: min(var(--measure), calc(100% - 2rem)); margin: 0 auto 2rem;
  padding: .5rem 0 .8rem; border-bottom: 1px solid var(--rule);
  font: 400 .875rem/1.5 var(--heading);
}
.article-contents summary { cursor: pointer; color: var(--muted); }
.article-contents a { color: var(--muted); text-decoration: none; }
.article-contents a:hover,
.article-contents a:focus-visible { color: var(--accent); text-decoration: underline; }
.article-contents ul { padding-inline-start: 1.1em; list-style: disc outside; }
.article-contents li + li { margin-block-start: .55rem; }
.article-contents li::marker { color: var(--muted); font-size: .8em; }
.sample[data-style="editorial"] .sample-preview { border-top: 3px solid var(--accent); }
body[data-font="crimson"] { --body: "Crimson Text", Georgia, serif; --heading: "Avenir Next", "Helvetica Neue", sans-serif; }
body[data-font="charter"] { --body: Charter, "Bitstream Charter", Georgia, serif; --heading: "Helvetica Neue", Arial, sans-serif; }
body[data-font="georgia"] { --body: Georgia, serif; --heading: system-ui, sans-serif; }
body[data-font="sans"] { --body: system-ui, sans-serif; --heading: system-ui, sans-serif; }
@media (max-width: 44rem) {
  .preview-bar { gap: .35rem .55rem; }
  .preview-bar label { font-size: .8rem; }
  .preview-bar select { font-size: .8rem; }
}

#color-mode {
  padding: .25rem .55rem;
  border: 1px solid #bca7c8;
  border-radius: .25rem;
  color: #fff;
  background: transparent;
  font: inherit;
  cursor: pointer;
}
#color-mode[aria-pressed="true"] { background: #ebdaf5; color: #251831; }
#color-mode:focus-visible { outline: 2px solid #ebdaf5; outline-offset: 3px; }

body[data-mode="dark"] {
  color-scheme: dark;
  --paper: #17141c;
  --ink: #f0eaf3;
  --muted: #c5b7cd;
  --accent: #d9aaf4;
  --rule: #473b50;
  --panel: #251e2e;
}
body[data-mode="dark"] .sample-name,
body[data-mode="dark"] .sample-preview,
body[data-mode="dark"] .controls label,
body[data-mode="dark"] .story,
body[data-mode="dark"] .article-heading,
body[data-mode="dark"] .payoff { background: var(--paper); color: var(--ink); }
body[data-mode="dark"] .sample-preview span { color: #d9aaf4; }
body[data-mode="dark"] .sample-name span { color: var(--muted); }

body:is([data-style="editorial"], [data-style="centered"]) .article { --figure-width: min(72rem, calc(100vw - 2.5rem)); }
.article-splash {
  width: min(var(--figure-width), 60rem); margin: 1.75rem auto 2.5rem;
  display: grid; place-items: center;
}
.article-splash img { display: block; width: 100%; height: auto; max-height: 22rem; object-fit: contain; }
body:is([data-style="editorial"], [data-style="centered"]) .prose :is(.wide-figure, .payoff) {
  width: var(--figure-width); margin-inline: 50% 0; transform: translateX(-50%);
}
body:is([data-style="editorial"], [data-style="centered"]) .wide-figure img { width: auto !important; max-width: 100%; background: white; }
body:is([data-style="editorial"], [data-style="centered"]) .wd-post > :is(.chart-frame, .full-sec) { width: var(--figure-width); }
@media (min-width: 82rem) {
  body:is([data-style="editorial"], [data-style="centered"]) .article { --figure-width: min(72rem, calc(100vw - 27rem)); }
  body[data-style="lecture"] .article { --figure-width: min(67rem, calc(100vw - 27rem)); }
  body[data-style="lecture"] .wd-post > :is(.chart-frame, .full-sec) { width: var(--figure-width); }
  .contents-rail {
    position: sticky; top: 5rem; z-index: 2; height: 0;
    width: 11rem; margin-inline-start: max(1rem, calc((100% - var(--figure-width)) / 2 - 12.5rem));
  }
  .contents-rail .article-contents {
    width: 100%; margin: 0; max-height: calc(100vh - 6rem); overflow: auto;
    padding: 0 .65rem .5rem 0; border: 0; font-size: .8125rem;
  }
}

/* Editorial blog index */
body:is([data-style="editorial"], [data-style="centered"]) .post-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 2.5vw, 1.75rem);
}
body:is([data-style="editorial"], [data-style="centered"]) .story {
  position: relative;
  display: grid;
  align-content: start;
  padding: 0;
  border: 1px solid var(--rule);
}
body:is([data-style="editorial"], [data-style="centered"]) .story.featured {
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  align-items: center;
}
body:is([data-style="editorial"], [data-style="centered"]) .story-copy {
  padding: clamp(1rem, 2.7vw, 1.9rem);
}
body:is([data-style="editorial"], [data-style="centered"]) .story h2 a::after {
  content: "";
  position: absolute;
  inset: 0;
}
body:is([data-style="editorial"], [data-style="centered"]) .blog:not(.compact-index) .story:focus-within,
body:is([data-style="editorial"], [data-style="centered"]) .blog:not(.compact-index) .story:hover { border-color: var(--accent); }
body:is([data-style="editorial"], [data-style="centered"]) .story-cover {
  display: grid;
  place-items: center;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  min-width: 0;
  margin: 0;
  padding: clamp(.5rem, 2vw, 1.15rem);
  background: var(--paper);
}
body:is([data-style="editorial"], [data-style="centered"]) .story-cover img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  background: white;
}
body:is([data-style="editorial"], [data-style="centered"]) .story.featured .story-cover { aspect-ratio: 2.25 / 1; }
@media (prefers-reduced-motion: no-preference) {
  body:is([data-style="editorial"], [data-style="centered"]) .story-cover img { transition: transform .22s ease; }
  body:is([data-style="editorial"], [data-style="centered"]) .story:hover .story-cover img { transform: scale(1.025); }
}
@media (max-width: 39rem) {
  body:is([data-style="editorial"], [data-style="centered"]) :is(.post-list, .story.featured) { grid-template-columns: minmax(0, 1fr); }
}

.masthead nav { align-items: center; }
.masthead nav .external-link,
.masthead nav .social-link { display: inline-flex; align-items: center; }
.masthead nav .external-link { gap: .3rem; }
.masthead nav .social-link { justify-content: center; min-width: 1.75rem; min-height: 1.75rem; }

/* Crimson Text has a smaller apparent size at the same CSS font size. */
body:is([data-font=""], [data-font="crimson"]) .prose {
  font-size: clamp(1.16rem, 1.75vw, 1.375rem);
  line-height: 1.58;
}
body:is([data-font=""], [data-font="crimson"]) :is(.story p, .dek) {
  font-size: clamp(1.12rem, 1.55vw, 1.24rem);
}

.footnotes {
  margin-top: 2rem;
  border-top: 1px solid var(--rule);
  padding-top: .65rem;
  color: var(--muted);
}
.footnotes ol { padding-inline-start: 1.25em; }
.prose :is(a.footnote, .footnotes li) { scroll-margin-top: 6rem; }

@media (min-width: 82rem) {
  .has-margin-footnotes { position: relative; min-height: var(--footnote-bottom, 0px); }
  .has-margin-footnotes .footnotes {
    position: absolute;
    inset-block-start: var(--footnote-offset, 0px);
    inset-inline-start: calc(50% + var(--figure-width) / 2 + 1.5rem);
    width: 11rem;
    margin: 0;
    font: .875rem/1.5 var(--heading);
  }
}

/* Centered Editorial */
.sample[data-style="centered"] .sample-preview { text-align: center; }
body[data-style="centered"] .article-heading {
  text-align: center; border: 0; padding: 0; margin-bottom: 1.75rem;
}
body[data-style="centered"] .article-heading h1 { margin: 0 auto .85rem; }
body[data-style="centered"] .article-heading :is(.metadata, .eyebrow) {
  font: 500 .9rem/1.5 var(--heading);
  color: var(--muted); text-transform: none; letter-spacing: 0;
}
body[data-style="centered"] .article-splash { margin-block: 0 2.5rem; }
body[data-style="centered"] .article-splash img { max-height: 25rem; }
.centered-intro { width: min(var(--measure), calc(100% - 2rem)); margin: 0 auto 1.5rem; }

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .5rem;
  margin-bottom: 1rem;
  font: 500 .875rem/1.35 var(--heading);
}
.tag-filter button {
  padding: .32rem .65rem;
  border: 1px solid transparent;
  border-radius: 1rem;
  color: var(--muted);
  background: transparent;
  font: inherit;
  cursor: pointer;
}
.tag-filter button:hover,
.tag-filter button[aria-pressed="true"] { border-color: var(--rule); color: var(--accent); }
.tag-filter button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.post-list > .story[hidden] { display: none; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.published-editorial nav #color-mode {
  display: inline-grid; place-items: center; min-width: 1.75rem; min-height: 1.75rem;
  padding: 0; border: 0; color: var(--muted); background: transparent;
}
.published-editorial nav #color-mode:hover { color: var(--accent); }
.published-editorial #color-mode svg {
  display: none; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
#color-mode[data-theme="system"] [data-icon="system"],
#color-mode[data-theme="light"] [data-icon="light"],
#color-mode[data-theme="dark"] [data-icon="dark"] { display: block; }
.published-editorial .prose :is(table, pre) { display: block; max-width: 100%; overflow-x: auto; }
.published-editorial .prose :is(video, iframe, object) { max-width: 100%; }
.published-editorial .prose .left { float: left; }
.published-editorial .prose .right { float: right; }
@media (max-width: 38rem) {
  .published-editorial .prose :is(.left, .right) { float: none; }
}

.prose div.highlight {
  background: transparent;
  color: inherit;
}
.prose pre {
  --code-bg: #f8f8fa;
  --code-rule: #e1dfe5;
  --code-accent: #6d3d91;
  --code-string: #326650;
  --code-number: #8b4c1d;
  --code-function: #265f87;
  margin: 1.25rem 0;
  padding: .8rem 1rem;
  border-inline-start: 2px solid var(--code-rule);
  background: var(--code-bg);
  color: var(--ink);
  font: .8125rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
  tab-size: 4;
}
body[data-mode="dark"] .prose pre {
  --code-bg: #201c25;
  --code-rule: #473b50;
  --code-accent: #d8afea;
  --code-string: #a1cdb2;
  --code-number: #e5af80;
  --code-function: #a0c9e8;
}
.prose pre code { font: inherit; }
.prose pre.highlight code span { color: inherit; }
.prose pre.highlight code :is(.c, .c1, .cm, .cs, .cp, .gp) { color: var(--muted); }
.prose pre.highlight code :is(.k, .kc, .kd, .kn, .kp, .kr, .kt) { color: var(--code-accent); }
.prose pre.highlight code :is(.nf, .nc, .nb) { color: var(--code-function); }
.prose pre.highlight code :is(.s, .s1, .s2, .sa, .sb, .sd, .se, .si) { color: var(--code-string); }
.prose pre.highlight code :is(.m, .mi, .mf, .mh, .mo) { color: var(--code-number); }

.index-controls {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: .45rem 1rem; margin-bottom: 1rem;
}
.index-controls .tag-filter { margin: 0; }
.card-meta {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: .35rem .9rem;
  margin: .35rem 0 .55rem; color: var(--muted); font: .85rem/1.4 var(--heading);
}
.card-tags { color: var(--muted); }

.published-editorial .masthead { padding-block: 1.15rem .85rem; }
.published-editorial .compact-index { padding-block-start: .85rem; }
.published-editorial .compact-index .post-list { grid-template-columns: minmax(0, 1fr); gap: 0; }
.published-editorial .compact-index .story { border: 0; border-top: 1px solid var(--rule); padding: .85rem 0; }
.published-editorial .compact-index .story-copy { padding: 0; }
.recent-post { margin-inline-start: .25em; color: var(--accent); font: 550 .75rem var(--heading); white-space: nowrap; }

.archive-page {
  width: min(54rem, calc(100% - 2rem));
  margin-inline: auto;
}
.editorial-footer { width: min(64rem, calc(100% - 3rem)); margin-inline: auto; }
@media (max-width: 38rem) {
  .editorial-footer { width: calc(100% - 2rem); }
}
.editorial-footer {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .7rem 1rem;
  border-top: 1px solid var(--rule);
  padding: 1.2rem 0 2rem;
  color: var(--muted);
  font: .875rem var(--heading);
}
.index-archive-row { border-top: 1px solid var(--rule); padding-top: .85rem; }
.index-archive {
  display: inline-block;
  color: var(--muted);
  font: 600 clamp(1.35rem, 2.6vw, 1.75rem)/1.2 var(--heading);
  text-decoration: none;
}
.index-archive:hover, .index-archive:focus-visible { color: var(--accent); text-decoration: underline; }
.editorial-footer small { font-size: inherit; }
.archive-page { padding-block: 2.5rem 4rem; }
.archive-page h1 {
  margin-bottom: 1.5rem;
  color: var(--muted);
  font: 600 clamp(1.95rem, 4.6vw, 3.1rem)/1.15 var(--heading);
  letter-spacing: -.035em;
}
.archive-year + .archive-year { margin-top: 1.7rem; }
.archive-year h2 { margin-bottom: .5rem; color: var(--muted); font: 600 1.05rem/1.35 var(--heading); }
.archive-entry {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .25rem 1rem;
  flex-wrap: wrap;
  padding: .3rem 0;
  font: 500 1.05rem/1.45 var(--heading);
}
.archive-entry a { color: var(--ink); text-decoration: none; }
.archive-entry a:hover, .archive-entry a:focus-visible { color: var(--accent); text-decoration: underline; }
.archive-entry time, .archived-label { color: var(--muted); font: .85rem/1.5 var(--heading); }
.archived-label { margin-bottom: .35rem; }
