:root {
  --bg: #f3eee4;
  --ink: #1e1914;
  --muted: #6d655c;
  --line: #d8d0c4;
  --accent: #8a372c;
  --btn: #fffdf8;
}

* {
  box-sizing: border-box;
}

figure {
  margin: 0;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.65;
}

.wrap {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.4rem 1.2rem 4.5rem;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 2.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.site-title {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.nav-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.nav-btns a {
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  background: var(--btn);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
}

.nav-btns a:hover,
.nav-btns a.active {
  border-color: var(--ink);
}

.skip-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.85rem 0 1.4rem;
}

.skip-btns a {
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  background: var(--btn);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.22rem 0.62rem;
}

.skip-btns a:hover {
  border-color: var(--ink);
  color: var(--ink);
}

h1 {
  margin: 0 0 0.35rem;
  font-size: 2.15rem;
  font-weight: 600;
  line-height: 1.15;
}

h2 {
  margin: 2.1rem 0 0.55rem;
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  scroll-margin-top: 1rem;
}

h4 {
  margin: 1.4rem 0 0.45rem;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.25;
}

p {
  margin: 0.7rem 0;
}

blockquote {
  margin: 1.4rem 0;
  padding: 0.15rem 0 0.15rem 1.15rem;
  border-left: 2px solid var(--accent);
}

blockquote p {
  font-style: italic;
}

.quote {
  margin: 1.5rem 0 1.8rem;
}

.quote blockquote {
  margin: 0;
}

.quote blockquote p:first-child {
  margin-top: 0;
}

.quote blockquote p:last-child {
  margin-bottom: 0;
}

.quote figcaption {
  margin: 0.8rem 0 0 1.15rem;
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.quote figcaption cite {
  font-style: italic;
  letter-spacing: 0;
  text-transform: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem 0;
}

.mri-gif-wrap {
  margin: 1rem 0;
}

.mri-gif {
  width: 100%;
  height: auto;
  display: block;
  margin: 0;
  border: 4px solid #4a3228;
}

.image-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.6rem;
  margin: 1rem 0;
  align-items: start;
}

.image-row img {
  width: 100%;
  height: auto;
  margin: 0;
}

.image-row figure {
  margin: 0;
}

.grad-eq {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.55rem;
  margin: 1.4rem 0 1.15rem;
}

.grad-eq figure {
  position: relative;
  margin: 0;
  flex: 1 1 6.2rem;
  max-width: 8.4rem;
}

.grad-eq figure.has-sq {
  padding-right: 0.85rem;
  padding-top: 0.2rem;
}

.grad-eq img {
  width: 100%;
  margin: 0;
  border: 1px solid var(--line);
}

.grad-eq .sq {
  position: absolute;
  top: -0.15rem;
  right: -0.2rem;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  pointer-events: none;
}

.grad-eq .op {
  flex: 0 0 auto;
  font-size: 1.55rem;
  line-height: 1;
  color: var(--ink);
  padding: 0 0.12rem 1.1rem;
}

.grad-eq.kernels {
  display: grid;
  grid-template-columns: minmax(0, 7.2rem) auto minmax(0, 7.2rem) auto minmax(0, 7.2rem);
  column-gap: 0.55rem;
  row-gap: 0.55rem;
  align-items: center;
  justify-content: center;
  justify-items: center;
}

.grad-eq.kernels figure {
  display: contents;
}

.grad-eq.kernels figure:nth-child(1) img {
  grid-column: 1;
  grid-row: 1;
}

.grad-eq.kernels figure:nth-child(1) figcaption {
  grid-column: 1;
  grid-row: 2;
}

.grad-eq.kernels .op:nth-child(2) {
  grid-column: 2;
  grid-row: 1;
}

.grad-eq.kernels figure:nth-child(3) img {
  grid-column: 3;
  grid-row: 1;
}

.grad-eq.kernels figure:nth-child(3) figcaption {
  grid-column: 3;
  grid-row: 2;
}

.grad-eq.kernels .op:nth-child(4) {
  grid-column: 4;
  grid-row: 1;
}

.grad-eq.kernels figure:nth-child(5) img {
  grid-column: 5;
  grid-row: 1;
}

.grad-eq.kernels figure:nth-child(5) figcaption {
  grid-column: 5;
  grid-row: 2;
}

.grad-eq.kernels img {
  width: 100%;
  max-width: 7.2rem;
  aspect-ratio: 1;
  height: auto;
  object-fit: contain;
  background: transparent;
  border: 0;
  image-rendering: pixelated;
}

.grad-eq.kernels .op {
  padding: 0 0.12rem;
}

.grad-eq.kernels.long {
  grid-template-columns: minmax(0, 4.4rem) auto minmax(0, 4.4rem) auto minmax(0, 4.4rem) auto minmax(0, 4.4rem) auto minmax(0, 4.4rem);
}

.grad-eq.kernels.long img {
  max-width: 4.4rem;
}

.grad-eq.kernels.kernel-solo {
  grid-template-columns: minmax(0, 7.2rem);
}

.grad-eq.kernels.long .op:nth-child(6) {
  grid-column: 6;
  grid-row: 1;
}

.grad-eq.kernels.long figure:nth-child(7) img {
  grid-column: 7;
  grid-row: 1;
}

.grad-eq.kernels.long figure:nth-child(7) figcaption {
  grid-column: 7;
  grid-row: 2;
}

.grad-eq.kernels.long .op:nth-child(8) {
  grid-column: 8;
  grid-row: 1;
}

.grad-eq.kernels.long figure:nth-child(9) img {
  grid-column: 9;
  grid-row: 1;
}

.grad-eq.kernels.long figure:nth-child(9) figcaption {
  grid-column: 9;
  grid-row: 2;
}

.image-row.long-cap figcaption {
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.image-row figcaption,
figure:not(.quote):not(.carousel) > figcaption {
  margin: 0.55rem 0 0;
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.carousel {
  margin: 1.5rem 0 1.8rem;
}

.stack-carousel {
  max-width: 18rem;
  margin-left: auto;
  margin-right: auto;
}

.carousel:focus {
  outline: none;
}

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

.carousel-viewport {
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.carousel-viewport::-webkit-scrollbar {
  display: none;
}

.carousel-track {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}

.carousel-slide {
  flex: 0 0 100%;
  min-width: 100%;
  scroll-snap-align: start;
}

.carousel-slide img {
  width: 100%;
  height: auto;
  margin: 0;
  border: 1px solid var(--line);
}

.carousel-caption {
  margin: 0.55rem 0 0;
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.carousel-stats {
  margin: 0.2rem 0 0;
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.carousel-btn {
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--btn);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.22rem 0.7rem;
  cursor: pointer;
  flex: 0 0 auto;
}

.carousel-btn:hover {
  border-color: var(--ink);
}

.carousel-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  max-width: 70%;
}

.carousel-dot {
  width: 0.55rem;
  height: 0.55rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--btn);
  cursor: pointer;
}

.carousel-dot[aria-current="true"] {
  background: var(--accent);
  border-color: var(--accent);
}

.carousel > figcaption {
  margin: 0.85rem 0 0;
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

main img {
  cursor: zoom-in;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(30, 25, 20, 0.88);
  cursor: zoom-out;
}

.lightbox.is-open {
  display: flex;
}

.lightbox img {
  max-width: min(96vw, 1200px);
  max-height: 92vh;
  width: auto;
  height: auto;
  margin: 0;
  cursor: zoom-out;
}

.lede {
  color: var(--muted);
  font-size: 1.12rem;
  margin: 0 0 0.4rem;
}

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

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

mjx-container {
  font-size: 1.02em;
}

mjx-container,
mjx-container * {
  box-sizing: content-box;
}

mjx-container[display="true"] {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.item {
  margin: 1rem 0 1.35rem;
}

.item-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}

.item-head strong {
  font-weight: 600;
}

.item-when {
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 0.82rem;
  white-space: nowrap;
}

.item-org {
  color: var(--muted);
}

.item p {
  margin: 0.25rem 0 0;
}

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

.list li {
  margin: 0;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.list a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
}

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

.list .meta {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
}

.list .excerpt {
  margin: 0.35rem 0 0;
  color: var(--ink);
  font-size: 0.98rem;
}

.empty {
  color: var(--muted);
}

.review ul,
.review ol {
  padding-left: 1.2rem;
}

.review li {
  margin: 0.25rem 0;
}

.review .back {
  margin-top: 2.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 0.85rem;
}

.review .back a {
  color: var(--muted);
  text-decoration: none;
}

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

.review-header {
  margin-bottom: 1.4rem;
}

.review-header .meta,
.meta {
  margin: 0;
  color: var(--muted);
}

.projects {
  display: grid;
  gap: 0.75rem;
}

.project-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--btn);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.9rem 1rem;
}

.project-card:hover {
  border-color: var(--ink);
}

.project-card.is-static:hover {
  border-color: var(--line);
}

.project-card h2 {
  margin: 0 0 0.25rem;
  font-family: inherit;
  font-size: 1.1rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}

.project-card p {
  margin: 0;
  color: var(--muted);
}

.soon {
  color: var(--muted);
  font-style: italic;
}

.week {
  margin: 0 0 1.6rem;
  padding-bottom: 1.35rem;
  border-bottom: 1px solid var(--line);
}

.week:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.week-topics {
  margin: 0.4rem 0 0.55rem;
  padding-left: 1.2rem;
}

.week-topics li {
  margin: 0.2rem 0;
}

.week-line {
  margin: 0.2rem 0 0;
  font-size: 0.98rem;
}

.week-label {
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 0.35rem;
}

.lab-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lab-list li {
  margin: 0;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}

.lab-list li:last-child {
  border-bottom: 0;
}

.lab-list .soon {
  margin-left: 0.45rem;
}

.lab-list .excerpt {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
}

:not(pre) > code {
  background: var(--btn);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.08em 0.38em;
}

div.highlighter-rouge {
  margin: 1.4rem 0;
  background: var(--btn);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

div.highlighter-rouge .highlight {
  color: var(--ink);
  background: transparent;
}

div.highlighter-rouge pre {
  margin: 0;
  padding: 0.95rem 1.05rem 1.05rem;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  tab-size: 4;
}

div.highlighter-rouge pre code {
  font-size: inherit;
  background: none;
  border: 0;
  padding: 0;
}

.highlight .c,
.highlight .ch,
.highlight .cd,
.highlight .cm,
.highlight .cp,
.highlight .cpf,
.highlight .c1,
.highlight .cs {
  color: var(--muted);
  font-style: italic;
}

.highlight .k,
.highlight .kd,
.highlight .kn,
.highlight .kp,
.highlight .kr,
.highlight .kt,
.highlight .kv {
  color: var(--accent);
}

.highlight .nf,
.highlight .fm,
.highlight .nc,
.highlight .nn,
.highlight .nd {
  color: var(--ink);
  font-weight: 600;
}

.highlight .nb,
.highlight .bp,
.highlight .nv,
.highlight .vc,
.highlight .vg,
.highlight .vi,
.highlight .vm,
.highlight .na {
  color: #5c4738;
}

.highlight .s,
.highlight .sa,
.highlight .sb,
.highlight .sc,
.highlight .dl,
.highlight .sd,
.highlight .s2,
.highlight .se,
.highlight .sh,
.highlight .sx,
.highlight .s1,
.highlight .ss,
.highlight .sr {
  color: #4e5a32;
}

.highlight .m,
.highlight .mb,
.highlight .mf,
.highlight .mh,
.highlight .mi,
.highlight .il,
.highlight .mo,
.highlight .mx,
.highlight .l,
.highlight .ld {
  color: #3d5348;
}

.highlight .o,
.highlight .ow,
.highlight .p {
  color: var(--ink);
}

sup {
  font-size: 0.7em;
  line-height: 0;
}

a.footnote {
  color: var(--accent);
  text-decoration: none;
  margin-left: 0.08em;
}

a.footnote:hover {
  color: var(--ink);
}

.footnotes {
  margin-top: 2.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
  color: var(--muted);
}

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

.footnotes li {
  margin: 0.35rem 0;
}

.footnotes p {
  margin: 0.35rem 0;
}

a.reversefootnote {
  color: var(--accent);
  text-decoration: none;
  margin-left: 0.2rem;
}

a.reversefootnote:hover {
  color: var(--ink);
}

.sharp-demo {
  margin: 1.15rem 0 1.4rem;
}

.sharp-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 0.75rem 1.25rem;
  margin: 0 0 0.35rem;
}

.sharp-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.28rem;
}

.sharp-control-label {
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.sharp-toggle {
  display: flex;
  gap: 0.35rem;
}

.sharp-toggle button {
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--btn);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.22rem 0.7rem;
  cursor: pointer;
}

.sharp-toggle button:hover {
  border-color: var(--ink);
}

.sharp-toggle button[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.sharp-toggle button:disabled {
  opacity: 0.4;
  cursor: default;
}

.blend-demo {
  margin: 1.15rem 0 1.8rem;
}

.stack-result.tall {
  max-width: 22rem;
}

.stack-result.wide {
  max-width: 90%;
  width: 90%;
}

.grad-eq.photos figure {
  flex: 1 1 7.2rem;
  max-width: 12.2rem;
}

.grad-eq.photos img {
  width: 100%;
  height: auto;
}

.grad-eq.photos .sq {
  top: -0.2rem;
  right: -0.45rem;
  font-size: 0.92rem;
}

.grad-eq.photos figure.has-sq {
  padding-right: 1.15rem;
}

.hybrid-pair {
  margin: 1.25rem 0 1.8rem;
}

.hybrid-trio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 0.55rem 0.7rem;
  align-items: stretch;
}

.hybrid-trio figcaption,
.hybrid-fft figcaption,
.stack-result figcaption {
  text-align: center;
}

.hybrid-sources {
  height: 0;
  min-height: 100%;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 0.55rem;
}

.hybrid-sources figure {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.hybrid-sources img {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  object-fit: contain;
}

.hybrid-result {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hybrid-result img {
  width: 100%;
  height: auto;
  display: block;
  transform-origin: center center;
  transition: transform 0.2s ease;
}

.image-row.fft {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 0.85rem;
}

.image-row.fft img {
  aspect-ratio: 1;
  object-fit: contain;
  background: #111;
}

.hybrid-fft {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1.15rem auto;
  max-width: 12.2rem;
}

.hybrid-fft img {
  width: 100%;
  height: auto;
  display: block;
}

.stack-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1.15rem auto 1.8rem;
  max-width: 18rem;
}

.stack-result img {
  width: 100%;
  height: auto;
  display: block;
}

@media (max-width: 540px) {
  h1 {
    font-size: 1.75rem;
  }

  .item-head {
    flex-direction: column;
    gap: 0.15rem;
  }
}
