:root {
  --ink: #1e1e1e;
  --body: #444;
  --muted: #999;
  --soft: #666;
  --paper: #fff;
  --link: #1a0dab;
  --rule: #ececec;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ededed;
    --body: #b9b9b9;
    --muted: #7d7d7d;
    --soft: #9a9a9a;
    --paper: #111;
    --link: #9db4ff;
    --rule: #262626;
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 10.5pt;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 60px 24px 80px;
}

/* Header */

.top-header {
  margin-bottom: 3em;
  display: flex;
  align-items: center;
  gap: 2.5em;
}

h1 {
  font-size: 46pt;
  font-weight: 400;
  letter-spacing: 0.1em;
  line-height: 1.15;
  margin-bottom: 0.25em;
}

.intro {
  color: var(--body);
  margin-bottom: 0.8em;
}

.contact {
  color: var(--soft);
  letter-spacing: 0.02em;
}

.figure {
  flex: none;
  width: 210px;
  height: 170px;
  color: var(--ink);
}

/* Sections */

.section-header {
  margin-top: 3.6em;
  margin-bottom: 1.4em;
}

h2 {
  font-size: 24pt;
  font-weight: 300;
  letter-spacing: 0.04em;
}

.rows {
  display: flex;
  flex-direction: column;
  gap: 1.2em;
}

.row {
  display: grid;
  grid-template-columns: 11em 1fr;
  column-gap: 1.8em;
  align-items: baseline;
}

.row-title {
  text-align: right;
  font-weight: 600;
}

.row-title a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--muted);
  transition: border-color 0.15s ease;
}

.row-title a:hover {
  border-bottom-color: var(--ink);
}

.row-date {
  text-align: right;
  font-size: 8.5pt;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.row-details {
  color: var(--body);
}

.more {
  white-space: nowrap;
}

/* Links */

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

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

/* Articles */

.article {
  max-width: 620px;
}

.back {
  display: inline-block;
  margin-bottom: 3em;
  color: var(--soft);
  text-decoration: none;
  letter-spacing: 0.02em;
}

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

.article h1 {
  font-size: 28pt;
  font-weight: 300;
  letter-spacing: 0.02em;
  line-height: 1.2;
  margin-bottom: 0.4em;
}

.article .meta {
  font-size: 8.5pt;
  color: var(--muted);
  margin-bottom: 2.6em;
}

.article h2 {
  font-size: 14pt;
  font-weight: 400;
  letter-spacing: 0;
  margin: 2em 0 0.6em;
}

.article p,
.article ul,
.article ol {
  font-size: 11.5pt;
  line-height: 1.7;
  color: var(--body);
  margin-bottom: 1.1em;
}

.article ul,
.article ol {
  padding-left: 1.3em;
}

.article li {
  margin-bottom: 0.4em;
}

.article strong {
  color: var(--ink);
  font-weight: 600;
}

.article-footer {
  margin-top: 3.5em;
  padding-top: 1.4em;
  border-top: 1px solid var(--rule);
  color: var(--soft);
}

/* Responsive */

@media (max-width: 640px) {
  .main {
    padding: 36px 16px 60px;
  }

  .top-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1.5em;
  }

  .figure {
    width: 100%;
    height: 150px;
  }

  h1 {
    font-size: 32pt;
  }

  .row {
    grid-template-columns: 1fr;
    gap: 0.2em;
  }

  .row-title {
    text-align: left;
  }

  .row.dated {
    grid-template-columns: 5.5em 1fr;
    column-gap: 1em;
  }

  .article h1 {
    font-size: 22pt;
  }
}

/* ---------- Shared article components ---------- */

:root {
  --accent: #2f5bea;
  --wash: #f6f6f4;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #8fa8ff;
    --wash: #191919;
  }
}

.wide {
  max-width: 880px;
}

.article.full {
  max-width: none;
}

.article.full > p,
.article.full > ul,
.article.full > h2,
.article.full > .lede {
  max-width: 620px;
}

/* Reveal on scroll (only when JS is running) */

.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: var(--d, 0s);
}

.js .reveal.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Stat rows */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 2.4em 0 2.8em;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.stats.three {
  grid-template-columns: repeat(3, 1fr);
}

.stats.two {
  grid-template-columns: repeat(2, 1fr);
}

.stats > div {
  padding: 1.3em 1.2em;
  border-left: 1px solid var(--rule);
}

.stats > div:first-child {
  border-left: 0;
  padding-left: 0;
}

.stats b {
  display: block;
  font-size: 22pt;
  font-weight: 300;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stats span {
  display: block;
  margin-top: 0.5em;
  font-size: 8.5pt;
  line-height: 1.45;
  color: var(--soft);
}

/* Figures */

.article figure {
  margin: 2.2em 0 2.4em;
}

.article figcaption {
  margin-top: 0.9em;
  font-size: 8.5pt;
  line-height: 1.5;
  color: var(--muted);
}

.article figure img {
  display: block;
  width: 100%;
  height: auto;
}

.frame {
  position: relative;
  padding: 7px;
  --c: var(--ink);
  background:
    linear-gradient(var(--c), var(--c)) top left / 12px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) top left / 1px 12px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 12px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 1px 12px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 12px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 1px 12px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 12px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 1px 12px no-repeat;
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.pair .label {
  margin-top: 0.7em;
  font-size: 8.5pt;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--soft);
}

.plot {
  background: #fff;
  padding: 6px;
}

/* Code */

.article pre {
  margin: 1.6em 0 2em;
  padding: 1.1em 1.25em;
  background: var(--wash);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow-x: auto;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 9pt;
  line-height: 1.65;
  color: var(--ink);
  tab-size: 2;
}

.article code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
}

.article p code,
.article li code,
.article td code {
  padding: 0.1em 0.35em;
  background: var(--wash);
  border-radius: 4px;
  color: var(--ink);
}

.article pre .c {
  color: var(--muted);
}

/* Flow diagrams */

.flow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 0;
  margin: 2em 0 2.4em;
  font-size: 9pt;
}

.flow span {
  position: relative;
  padding: 0.55em 0.95em;
  margin-right: 26px;
  border: 1px solid var(--muted);
  border-radius: 999px;
  color: var(--ink);
  white-space: nowrap;
}

.flow span::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 100%;
  width: 26px;
  height: 1px;
  background: var(--muted);
}

.flow span:last-child {
  margin-right: 0;
}

.flow span:last-child::after {
  display: none;
}

.flow span.human {
  border-style: dashed;
  color: var(--accent);
  border-color: var(--accent);
}

.flow span.auto {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

/* Tables */

.spec {
  width: 100%;
  margin: 1.6em 0 2.2em;
  border-collapse: collapse;
  font-size: 9.5pt;
}

.spec th,
.spec td {
  padding: 0.6em 0.8em 0.6em 0;
  text-align: left;
  border-bottom: 1px solid var(--rule);
  color: var(--body);
}

.spec th {
  font-weight: 400;
  font-size: 8.5pt;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.spec td.n {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.spec th.n {
  text-align: right;
}

/* Charts */

.chart {
  display: block;
  width: 100%;
  height: auto;
}

.chart .grid {
  stroke: var(--rule);
  stroke-width: 1;
}

.chart .mark {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.chart .tick {
  font-size: 9px;
  fill: var(--muted);
  font-family: inherit;
}

.chart .line {
  fill: none;
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.chart .train {
  stroke: var(--ink);
}

.chart .val {
  stroke: var(--accent);
}

.js .reveal .chart .line {
  stroke-dashoffset: 1;
}

.js .reveal.in .chart .line {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 2.2s ease 0.2s;
}

@media (prefers-reduced-motion: reduce) {
  .js .reveal .chart .line {
    stroke-dashoffset: 0;
  }
}

.legend {
  display: flex;
  gap: 1.6em;
  margin-bottom: 0.8em;
  font-size: 8.5pt;
  color: var(--soft);
}

.legend i {
  display: inline-block;
  width: 16px;
  height: 2px;
  margin-right: 0.5em;
  vertical-align: middle;
  background: var(--ink);
}

.legend i.val {
  background: var(--accent);
}

/* Article header with a picture */

.with-avatar {
  display: flex;
  align-items: center;
  gap: 1.6em;
  margin-bottom: 0.4em;
}

.avatar {
  flex: none;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.05);
  border: 1px solid var(--rule);
}

.with-avatar h1 {
  margin-bottom: 0;
}

/* ---------- Case studies ---------- */

.case {
  padding: 3.4em 0;
  border-top: 1px solid var(--rule);
}

.kicker {
  display: flex;
  gap: 1.6em;
  font-size: 8.5pt;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.case-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3.2em;
  align-items: start;
  margin-top: 1.4em;
}

.case h3 {
  font-size: 22pt;
  font-weight: 300;
  line-height: 1.2;
  letter-spacing: 0.005em;
  margin-bottom: 0.9em;
  color: var(--ink);
}

.big {
  font-size: 68pt;
  font-weight: 200;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.big-cap {
  margin-top: 0.9em;
  font-size: 8.5pt;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--soft);
}

.case .stats {
  margin: 2.2em 0 0;
  border-bottom: 0;
}

.case .stats b {
  font-size: 18pt;
}

.case p.note {
  margin-top: 1.8em;
  font-size: 10.5pt;
  line-height: 1.65;
  color: var(--body);
}

.shots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.shot img,
.profile-shot img {
  display: block;
  width: 100%;
  height: auto;
}

.shot img {
  aspect-ratio: 234 / 330;
  object-fit: cover;
}

.shot .views {
  margin-top: 0.5em;
  font-size: 8pt;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.shot .views b {
  margin-right: 0.35em;
  font-size: 15pt;
  font-weight: 300;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-transform: none;
}

.profile-shot img {
  background: #fff;
}

.cases-small {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 3.2em;
}

.cases-small .case {
  padding: 2.6em 0;
}

.cases-small .big {
  font-size: 44pt;
  margin-top: 0.5em;
}

.cases-small h3 {
  font-size: 15pt;
  font-weight: 400;
  margin: 1.1em 0 0.5em;
}

.cases-small p {
  font-size: 10.5pt;
  line-height: 1.6;
  color: var(--body);
}

.did {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.4em;
  margin: 2em 0 1em;
}

.did h3 {
  font-size: 8.5pt;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.8em;
}

.did p {
  font-size: 10.5pt;
  line-height: 1.65;
  color: var(--body);
}

.article h2.section-title {
  margin: 2.6em 0 0.6em;
  font-size: 24pt;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--ink);
}

@media (max-width: 720px) {
  .stats,
  .stats.three {
    grid-template-columns: 1fr 1fr;
  }

  .stats > div {
    padding: 1em 0.8em;
  }

  .stats > div:nth-child(odd) {
    border-left: 0;
    padding-left: 0;
  }

  .stats > div:nth-child(n + 3) {
    border-top: 1px solid var(--rule);
  }

  .case-grid,
  .cases-small,
  .did {
    grid-template-columns: 1fr;
    gap: 2em;
  }

  .cases-small {
    gap: 0;
  }

  .big {
    font-size: 48pt;
  }

  .with-avatar {
    gap: 1em;
  }

  .avatar {
    width: 64px;
    height: 64px;
  }

  .flow span {
    margin-right: 16px;
  }

  .flow span::after {
    width: 16px;
  }
}

.case-media {
  margin-top: 1.6em;
}

.case-media .shots {
  margin-top: 14px;
}

.case-media .shots:first-child {
  margin-top: 0;
}

.avatar.mark {
  border: 0;
  border-radius: 0;
  filter: none;
  color: var(--ink);
  overflow: visible;
}
