:root {
  color-scheme: light;
  --bg: #fbfaf7;
  --text: #1f1e1b;
  --muted: #6f6a60;
  --faint: #ddd8cf;
  --soft: #f2efe8;
  --link: #253f66;
  --measure: 42rem;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  font-size: 18px;
  line-height: 1.58;
}

a {
  color: var(--link);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
  max-width: 74rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 1rem;
}

.brand {
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.82rem;
  text-transform: uppercase;
}

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

.page-shell {
  display: grid;
  grid-template-columns: minmax(9rem, 13rem) minmax(0, var(--measure)) minmax(8rem, 11rem);
  gap: 3.5rem;
  max-width: 74rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.intro {
  grid-column: 2;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--faint);
}

.intro h1 {
  margin: 0.35rem 0 0;
  font-size: clamp(2.4rem, 7vw, 4.8rem);
  line-height: 0.95;
}

.quote,
.article-summary {
  color: var(--muted);
}

.topic-panel {
  grid-column: 1;
  grid-row: 2;
}

.feed {
  grid-column: 2;
  grid-row: 2;
}

.time-nav {
  grid-column: 3;
  grid-row: 2;
}

.topic-panel,
.time-nav {
  position: sticky;
  top: 1.5rem;
  align-self: start;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.88rem;
}

.topic-panel h2,
.time-nav h2,
.feed h2 {
  margin: 0 0 1rem;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.78rem;
  font-weight: 650;
  text-transform: uppercase;
}

.topic-list {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.topic-list a,
.time-nav a {
  color: var(--muted);
  text-decoration: none;
}

.time-nav nav {
  display: grid;
  gap: 0.3rem;
}

.post-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.2rem 1.25rem;
  padding: 1.4rem 0;
  border-top: 1px solid var(--faint);
}

.post-card:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.post-title {
  color: var(--text);
  font-size: 1.32rem;
  font-weight: 700;
  line-height: 1.18;
  text-decoration: none;
}

.post-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem 0.55rem;
  min-width: 0;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: baseline;
  gap: 0.45rem 0.55rem;
}

.post-meta,
.article-kicker,
.listing-kicker,
.article-meta,
.post-tags {
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.82rem;
}

.post-card time {
  white-space: nowrap;
}

.post-card-unfinished {
  opacity: 0.58;
}

.post-status,
.post-series,
.article-status,
.series-status {
  display: inline-block;
  margin-left: 0.55rem;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
}

.post-heading .post-series,
.post-meta .post-status {
  margin-left: 0;
}

.post-card p {
  grid-column: 1 / -1;
  max-width: 38rem;
  margin: 0.35rem 0 0;
  color: #3a3731;
}

.post-tags {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.7rem 0 0;
  padding: 0;
  list-style: none;
}

.post-tags li {
  padding: 0.08rem 0.42rem;
  border: 1px solid var(--faint);
  background: var(--soft);
}

.article-shell,
.listing-shell {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.article-header,
.listing-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--faint);
}

.article h1,
.listing-header h1 {
  margin: 0.2rem 0 0;
  font-size: clamp(2.1rem, 6vw, 3.9rem);
  line-height: 1;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.series-nav {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--faint);
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.86rem;
}

.series-nav p {
  margin: 0;
  color: var(--text);
  font-weight: 650;
}

.series-nav ol {
  display: grid;
  gap: 0.42rem;
  margin: 0.55rem 0 0;
  padding: 0;
  list-style: none;
}

.series-nav a,
.series-nav li[aria-current="page"] {
  display: grid;
  grid-template-columns: 4.2rem minmax(0, 1fr);
  gap: 0.65rem;
  align-items: baseline;
}

.series-nav a {
  text-decoration: none;
}

.series-nav li[aria-current="page"] {
  color: var(--text);
  font-weight: 650;
}

.series-item-unfinished {
  opacity: 0.62;
}

.series-part {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
  text-transform: uppercase;
}

.article-toc {
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--faint);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.86rem;
}

.article-toc summary {
  width: max-content;
  color: var(--text);
  cursor: pointer;
  font-weight: 650;
}

.article-toc-section summary {
  color: var(--muted);
  font-weight: 400;
}

.article-toc ol {
  display: grid;
  gap: 0.35rem;
  margin: 0.55rem 0 0;
  padding-left: 1.2rem;
}

.article-toc-section ol {
  margin-top: 0.35rem;
}

.article-toc a {
  color: var(--muted);
  text-decoration: none;
}

.article-toc a:hover {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4 {
  line-height: 1.15;
}

.article-body h1 {
  margin: 2.6rem 0 0.9rem;
  font-size: clamp(1.65rem, 3vw, 2.25rem);
}

.article-body h2 {
  margin: 2.2rem 0 0.7rem;
  font-size: clamp(1.3rem, 2.2vw, 1.6rem);
}

.article-body h3 {
  margin: 1.8rem 0 0.55rem;
  font-size: 1.15rem;
}

.article-body h4 {
  margin: 1.5rem 0 0.45rem;
  font-size: 1.05em;
}

.article-body pre,
.code-block {
  overflow-x: auto;
  padding: 1rem;
  border: 1px solid var(--faint);
  background: var(--soft);
  font-size: 0.88rem;
  line-height: 1.45;
}

.code-block--numbered {
  padding: 0;
}

.code-block--numbered code {
  display: block;
  min-width: 100%;
  width: max-content;
  white-space: normal;
}

.code-line {
  display: grid;
  grid-template-columns: 3.25rem max-content;
  min-width: 100%;
  width: max-content;
}

.code-line-number {
  user-select: none;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding: 0 0.75rem;
  border-right: 1px solid var(--faint);
}

.code-line-content {
  padding: 0 1rem;
  white-space: pre;
}

.code-line:first-child .code-line-number,
.code-line:first-child .code-line-content {
  padding-top: 1rem;
}

.code-line:last-child .code-line-number,
.code-line:last-child .code-line-content {
  padding-bottom: 1rem;
}

.code-block .hll {
  background-color: #fff8c5;
}

.code-block .c,
.code-block .ch,
.code-block .cm,
.code-block .cpf,
.code-block .c1,
.code-block .cs {
  color: #4f7870;
  font-style: italic;
}

.code-block .cp {
  color: #8d6200;
}

.code-block .err {
  border: 1px solid #c62828;
}

.code-block .k,
.code-block .kc,
.code-block .kd,
.code-block .kn,
.code-block .kr,
.code-block .nt {
  color: #137333;
  font-weight: 700;
}

.code-block .kp,
.code-block .nb,
.code-block .bp,
.code-block .sx {
  color: #137333;
}

.code-block .kt {
  color: #9d174d;
}

.code-block .o,
.code-block .ow,
.code-block .p {
  color: #5f6368;
}

.code-block .m,
.code-block .mb,
.code-block .mf,
.code-block .mh,
.code-block .mi,
.code-block .mo,
.code-block .il {
  color: #5f6368;
}

.code-block .s,
.code-block .sa,
.code-block .sb,
.code-block .sc,
.code-block .dl,
.code-block .s2,
.code-block .sh,
.code-block .s1 {
  color: #a33636;
}

.code-block .sd {
  color: #a33636;
  font-style: italic;
}

.code-block .se {
  color: #9b4d1f;
  font-weight: 700;
}

.code-block .si,
.code-block .sr {
  color: #8b4a6b;
}

.code-block .ss,
.code-block .nv,
.code-block .vc,
.code-block .vg,
.code-block .vi,
.code-block .vm {
  color: #3f4f9f;
}

.code-block .na,
.code-block .nl {
  color: #707000;
}

.code-block .nc,
.code-block .nf,
.code-block .nn,
.code-block .fm {
  color: #1a4fa3;
}

.code-block .no,
.code-block .nd {
  color: #7b2cbf;
}

.code-block .ni,
.code-block .go {
  color: #777;
}

.code-block .ne,
.code-block .gr {
  color: #c62828;
  font-weight: 700;
}

.code-block .gh {
  color: #253f66;
  font-weight: 700;
}

.code-block .gp {
  color: #253f66;
  font-weight: 700;
}

.code-block .gi {
  color: #137333;
}

.code-block .gd {
  color: #a33636;
}

.code-block .ge {
  font-style: italic;
}

.code-block .ges,
.code-block .gs {
  font-weight: 700;
}

.code-block .gu {
  color: #7b2cbf;
  font-weight: 700;
}

.code-block .gt {
  color: #1a4fa3;
}

.code-block .w {
  color: inherit;
}

.article-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.article-body figure {
  margin: 2rem 0;
}

.article-body figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.article-body figcaption {
  margin-top: 0.7rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 950px) {
  .page-shell {
    grid-template-columns: minmax(0, var(--measure)) minmax(8rem, 11rem);
    gap: 2.5rem;
  }

  .intro,
  .feed {
    grid-column: 1;
  }

  .topic-panel {
    grid-column: 1 / -1;
    grid-row: 2;
    position: static;
  }

  .topic-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem 0.9rem;
  }

  .feed {
    grid-row: 3;
  }

  .time-nav {
    grid-column: 2;
    grid-row: 3;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 17px;
  }

  .site-header {
    display: block;
    padding-top: 1.35rem;
  }

  .main-nav {
    margin-top: 0.7rem;
  }

  .page-shell {
    display: block;
    padding-top: 2rem;
  }

  .topic-panel,
  .time-nav {
    position: static;
    margin-top: 2rem;
  }

  .feed {
    margin-top: 2.4rem;
  }

  .time-nav nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .post-card {
    display: block;
  }

  .post-card time {
    display: block;
    margin-top: 0.25rem;
  }
}
