@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("../fonts/dm-sans.woff2") format("woff2");
}

@font-face {
  font-family: "Space Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/space-mono.woff2") format("woff2");
}

:root {
  --ink: #181713;
  --paper: #f3efe5;
  --cream: #fffaf0;
  --acid: #d9ff43;
  --blue: #4058ff;
  --soft-blue: #a6b7ff;
  --orange: #ffb35c;
  --pink: #ffb4d1;
  --line: rgba(24, 23, 19, 0.22);
  --paper-line: rgba(243, 239, 229, 0.26);
  --content-width: 1400px;
  --gutter: 48px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 84% 7%, rgba(64, 88, 255, 0.09), transparent 25rem),
    var(--paper);
  color: var(--ink);
  font-family: "DM Sans", Arial, sans-serif;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg,
video {
  display: block;
  height: auto;
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
}

.skip-link {
  background: var(--acid);
  border: 1px solid var(--ink);
  left: 16px;
  padding: 12px 16px;
  position: fixed;
  top: -100px;
  z-index: 100;
}

.skip-link:focus {
  top: 16px;
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}

.site-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 0 auto;
  max-width: var(--content-width);
  padding: 28px var(--gutter);
}

.wordmark {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.045em;
}

.wordmark span {
  color: var(--blue);
}

.desktop-nav {
  display: flex;
  gap: 34px;
}

.desktop-nav a,
.mobile-nav,
.mobile-nav a {
  font-family: "Space Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
}

.desktop-nav a:hover,
.desktop-nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 5px;
}

.mobile-nav {
  display: none;
  position: relative;
}

.mobile-nav summary {
  cursor: pointer;
  list-style: none;
}

.mobile-nav summary::-webkit-details-marker {
  display: none;
}

.mobile-nav nav {
  background: var(--cream);
  border: 1px solid var(--ink);
  box-shadow: 6px 6px 0 var(--blue);
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 180px;
  padding: 8px;
  position: absolute;
  right: 0;
  top: 30px;
  z-index: 20;
}

.mobile-nav nav a {
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.mobile-nav nav a:last-child {
  border-bottom: 0;
}

.kicker,
.section-number,
.breadcrumbs,
.post-meta,
.toc-label,
.card-topline,
.card-bottom,
.term-count,
.archive-number,
.pagination-status {
  font-family: "Space Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.kicker {
  align-items: center;
  display: flex;
}

.kicker::before {
  background: var(--blue);
  border-radius: 50%;
  content: "";
  height: 9px;
  margin-right: 10px;
  width: 9px;
}

.blog-hero {
  display: grid;
  gap: clamp(40px, 6vw, 96px);
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.72fr);
  margin: 0 auto;
  max-width: var(--content-width);
  min-height: calc(100vh - 84px);
  padding: clamp(70px, 10vh, 125px) var(--gutter) 110px;
}

.hero-copy {
  align-self: center;
}

.blog-hero h1,
.page-hero h1,
.article-hero h1,
.not-found h1 {
  font-size: clamp(62px, 8.8vw, 126px);
  font-weight: 650;
  letter-spacing: -0.075em;
  line-height: 0.85;
  margin: 30px 0 40px;
}

.lede {
  font-size: clamp(18px, 1.7vw, 24px);
  letter-spacing: -0.025em;
  line-height: 1.5;
  margin: 0;
  max-width: 720px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 42px;
}

.button {
  align-items: center;
  background: transparent;
  border: 1px solid var(--ink);
  display: inline-flex;
  font-family: "Space Mono", monospace;
  font-size: 12px;
  font-weight: 700;
  gap: 14px;
  justify-content: space-between;
  min-width: 190px;
  padding: 16px 18px;
  text-transform: uppercase;
  transition: box-shadow 160ms ease, transform 160ms ease;
}

.button:hover {
  box-shadow: 5px 5px 0 var(--ink);
  transform: translate(-3px, -3px);
}

.button-primary {
  background: var(--acid);
}

.tagline {
  font-family: Georgia, serif;
  font-size: 16px;
  font-style: italic;
  margin-top: 46px;
}

.latest-card {
  align-self: center;
  background: var(--cream);
  border: 1px solid var(--ink);
  box-shadow: 12px 12px 0 var(--blue);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 510px;
  padding: 24px;
  transform: rotate(1.25deg);
  transition: box-shadow 180ms ease, transform 180ms ease;
}

.latest-card:hover {
  box-shadow: 16px 16px 0 var(--blue);
  transform: rotate(0deg) translate(-3px, -3px);
}

.card-topline,
.card-bottom {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.latest-card .card-topline {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.latest-index {
  color: var(--blue);
  display: block;
  font-family: "Space Mono", monospace;
  font-size: 11px;
  margin-bottom: 12px;
}

.latest-card h2 {
  font-size: clamp(40px, 4.2vw, 66px);
  letter-spacing: -0.06em;
  line-height: 0.94;
  margin: 0 0 24px;
}

.latest-card p {
  font-size: 15px;
  line-height: 1.6;
  margin: 0;
}

.round-arrow {
  align-items: center;
  align-self: flex-end;
  border: 1px solid var(--ink);
  border-radius: 50%;
  display: flex;
  flex: 0 0 auto;
  font-size: 20px;
  height: 48px;
  justify-content: center;
  margin-top: 28px;
  width: 48px;
}

.posts-section {
  background: var(--ink);
  color: var(--paper);
  padding: 110px max(var(--gutter), calc((100vw - 1304px) / 2));
}

.section-heading {
  align-items: end;
  display: flex;
  justify-content: space-between;
  margin-bottom: 50px;
}

.section-heading h2 {
  font-size: clamp(42px, 6vw, 76px);
  letter-spacing: -0.06em;
  line-height: 0.95;
  margin: 0;
}

.section-number {
  color: var(--acid);
  margin: 0;
}

.post-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.post-card {
  border: 1px solid var(--paper);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 390px;
  padding: 24px;
  transition: box-shadow 180ms ease, transform 180ms ease;
}

.post-card:hover {
  box-shadow: 8px 8px 0 var(--paper);
  transform: translate(-4px, -4px);
}

.post-card.accent-0 {
  background: var(--acid);
}

.post-card.accent-1 {
  background: var(--soft-blue);
}

.post-card.accent-2 {
  background: var(--orange);
}

.post-card.accent-3 {
  background: var(--pink);
}

.post-card h3 {
  font-size: clamp(34px, 4vw, 58px);
  letter-spacing: -0.06em;
  line-height: 0.96;
  margin: 52px 0 22px;
}

.post-card h3 a::after {
  content: "";
  inset: 0;
  position: absolute;
}

.post-card {
  position: relative;
}

.post-card p {
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 40px;
  max-width: 630px;
}

.card-bottom {
  border-top: 1px solid currentColor;
  font-size: 9px;
  padding-top: 16px;
}

.card-bottom > span {
  max-width: 75%;
}

.card-bottom > a {
  position: relative;
  z-index: 2;
}

.pagination {
  align-items: center;
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr auto 1fr;
  margin-top: 54px;
}

.posts-section .pagination .button {
  border-color: var(--paper);
  color: var(--paper);
}

.pagination .button:last-child {
  justify-self: end;
}

.pagination-status {
  text-align: center;
}

.page-hero,
.article-hero {
  border-bottom: 1px solid var(--line);
  margin: 0 auto;
  max-width: var(--content-width);
  padding: 110px var(--gutter) 80px;
}

.breadcrumbs {
  margin: 0;
}

.breadcrumbs a {
  color: var(--blue);
}

.page-hero h1,
.article-hero h1 {
  max-width: 1180px;
}

.article-hero .post-meta {
  margin-top: 42px;
}

.post-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  letter-spacing: 0.03em;
}

.post-meta > span:not(.tag-list)::before {
  content: "•";
  margin-right: 18px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  background: var(--acid);
  border: 1px solid var(--ink);
  padding: 5px 8px;
}

.tag:hover {
  background: var(--blue);
  color: white;
}

.article-layout {
  display: grid;
  gap: clamp(42px, 6vw, 90px);
  grid-template-columns: minmax(190px, 260px) minmax(0, 800px);
  justify-content: center;
  margin: 0 auto;
  max-width: var(--content-width);
  padding: 90px var(--gutter) 130px;
}

.article-layout:has(.article-content:first-child) {
  grid-template-columns: minmax(0, 800px);
}

.toc-panel {
  align-self: start;
  border-top: 4px solid var(--blue);
  position: sticky;
  top: 32px;
}

.toc-label {
  margin: 16px 0;
}

.toc-panel nav {
  font-family: "Space Mono", monospace;
  font-size: 11px;
  line-height: 1.5;
}

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

.toc-panel ul ul {
  border-left: 1px solid var(--line);
  margin: 7px 0 0 5px;
  padding-left: 12px;
}

.toc-panel li + li {
  margin-top: 8px;
}

.toc-panel a:hover {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-content {
  font-size: 18px;
  line-height: 1.75;
  min-width: 0;
}

.article-content > :first-child {
  margin-top: 0;
}

.article-content h2,
.article-content h3,
.article-content h4 {
  line-height: 1.1;
  scroll-margin-top: 32px;
}

.article-content h2 {
  font-size: clamp(36px, 4.5vw, 58px);
  letter-spacing: -0.055em;
  margin: 84px 0 28px;
}

.article-content h3 {
  font-size: 30px;
  letter-spacing: -0.035em;
  margin: 58px 0 20px;
}

.article-content h4 {
  font-size: 22px;
  margin: 42px 0 16px;
}

.article-content p,
.article-content ul,
.article-content ol,
.article-content dl,
.article-content table,
.article-content pre,
.article-content blockquote,
.article-content figure {
  margin-bottom: 1.55em;
  margin-top: 1.55em;
}

.article-content li + li {
  margin-top: 0.55em;
}

.article-content a {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.article-content a:hover {
  text-decoration-thickness: 3px;
}

.article-content blockquote {
  background: var(--cream);
  border: 1px solid var(--ink);
  border-left: 9px solid var(--acid);
  font-size: 1.08em;
  margin-left: 0;
  margin-right: 0;
  padding: 22px 26px;
}

.article-content blockquote > :first-child {
  margin-top: 0;
}

.article-content blockquote > :last-child {
  margin-bottom: 0;
}

.article-content code {
  background: rgba(64, 88, 255, 0.1);
  border: 1px solid rgba(64, 88, 255, 0.18);
  font-family: "Space Mono", monospace;
  font-size: 0.83em;
  padding: 0.12em 0.3em;
}

.article-content pre {
  background: var(--ink);
  border-left: 8px solid var(--blue);
  color: var(--paper);
  max-width: 100%;
  overflow-x: auto;
  padding: 22px;
}

.article-content pre code {
  background: transparent;
  border: 0;
  color: inherit;
  padding: 0;
}

.article-content .highlight {
  margin: 1.55em 0;
}

.article-content .highlight pre {
  margin: 0;
}

.article-content table {
  border-collapse: collapse;
  display: block;
  font-size: 0.9em;
  overflow-x: auto;
  width: 100%;
}

.article-content th,
.article-content td {
  border: 1px solid var(--ink);
  padding: 10px 13px;
  text-align: left;
}

.article-content th {
  background: var(--acid);
  font-family: "Space Mono", monospace;
  font-size: 0.78em;
  text-transform: uppercase;
}

.article-content hr {
  border: 0;
  border-top: 1px solid var(--ink);
  margin: 64px 0;
}

.article-content figcaption {
  font-family: "Space Mono", monospace;
  font-size: 11px;
  margin-top: 10px;
}

.article-content .footnotes {
  border-top: 1px solid var(--ink);
  font-size: 0.82em;
  margin-top: 80px;
  padding-top: 24px;
}

.article-content .footnote-ref,
.article-content .footnote-backref {
  text-decoration: none;
}

.comments-section {
  margin: 0 auto 120px;
  max-width: var(--content-width);
  padding: 0 var(--gutter);
  width: 100%;
}

.comments-shell {
  border-top: 1px solid var(--ink);
  min-width: 0;
  padding-top: 48px;
  width: 100%;
}

.comments-heading {
  align-items: end;
  display: flex;
  justify-content: space-between;
  margin-bottom: 28px;
}

.comments-heading .section-number {
  color: var(--blue);
}

.comments-heading h2 {
  font-size: clamp(38px, 5vw, 64px);
  letter-spacing: -0.055em;
  line-height: 0.95;
  margin: 0;
}

.utterances-host {
  display: block;
  min-width: 0;
  width: 100%;
}

/* Utterances defaults to max-width: 760px. The discussion is deliberately
   wider than the prose column so threads and quoted code remain readable. */
.utterances,
.comments-section .utterances,
[data-asleson-comments] .utterances {
  display: block !important;
  flex: 1 1 100% !important;
  grid-column: 1 / -1 !important;
  justify-self: stretch !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  max-width: none !important;
  min-width: 0 !important;
  width: 100% !important;
}

.utterances-frame,
.comments-section .utterances-frame,
[data-asleson-comments] .utterances-frame {
  display: block !important;
  min-width: 100% !important;
  width: 100% !important;
}

.post-nav {
  border-top: 1px solid var(--ink);
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0 auto 130px;
  max-width: 1100px;
}

.post-nav a {
  min-height: 170px;
  padding: 28px;
  transition: background 160ms ease;
}

.post-nav a + a {
  border-left: 1px solid var(--ink);
  text-align: right;
}

.post-nav a:hover {
  background: var(--acid);
}

.post-nav span {
  display: block;
  font-family: "Space Mono", monospace;
  font-size: 10px;
  margin-bottom: 22px;
  text-transform: uppercase;
}

.post-nav strong {
  font-size: 22px;
  line-height: 1.2;
}

.archive-list-section,
.terms-section {
  margin: 0 auto;
  max-width: var(--content-width);
  padding: 80px var(--gutter) 130px;
}

.archive-list {
  border-top: 1px solid var(--ink);
}

.archive-row {
  align-items: start;
  border-bottom: 1px solid var(--ink);
  display: grid;
  gap: 34px;
  grid-template-columns: 45px minmax(0, 1fr) 48px;
  padding: 38px 0;
}

.archive-row h2 {
  font-size: clamp(34px, 4.7vw, 64px);
  letter-spacing: -0.055em;
  line-height: 0.98;
  margin: 22px 0;
}

.archive-row h2 a:hover {
  color: var(--blue);
}

.archive-row p {
  font-size: 16px;
  line-height: 1.65;
  margin: 0;
  max-width: 780px;
}

.archive-row .round-arrow {
  margin-top: 0;
}

.terms-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.term-card {
  background: var(--cream);
  border: 1px solid var(--ink);
  display: flex;
  flex-direction: column;
  min-height: 260px;
  padding: 22px;
  transition: box-shadow 160ms ease, transform 160ms ease;
}

.term-card:nth-child(4n + 1) {
  background: var(--acid);
}

.term-card:nth-child(4n + 2) {
  background: var(--soft-blue);
}

.term-card:nth-child(4n + 3) {
  background: var(--orange);
}

.term-card:nth-child(4n + 4) {
  background: var(--pink);
}

.term-card:hover {
  box-shadow: 7px 7px 0 var(--ink);
  transform: translate(-4px, -4px);
}

.term-name {
  font-size: 34px;
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 1;
}

.term-count {
  margin-top: 14px;
}

.term-card .round-arrow {
  margin-top: auto;
}

.about-section {
  align-items: start;
  display: grid;
  gap: clamp(42px, 7vw, 110px);
  grid-template-columns: 180px minmax(0, 680px);
  justify-content: center;
  margin: 0 auto;
  max-width: var(--content-width);
  padding: 90px var(--gutter) 130px;
}

.about-portrait {
  background: var(--acid);
  border: 1px solid var(--ink);
  box-shadow: 8px 8px 0 var(--blue);
  justify-self: center;
  max-width: 180px;
  padding: 14px;
  transform: rotate(-1.25deg);
  width: 100%;
}

.about-portrait img {
  aspect-ratio: 1;
  border: 1px solid var(--ink);
  object-fit: cover;
  width: 100%;
}

.about-profile {
  min-width: 0;
}

.about-profile .section-number {
  color: var(--blue);
  margin: 0 0 24px;
}

.about-profile h2 {
  font-size: clamp(48px, 6vw, 82px);
  letter-spacing: -0.065em;
  line-height: 0.92;
  margin: 0 0 46px;
}

.about-links {
  border-top: 1px solid var(--ink);
}

.about-links > a {
  align-items: center;
  border-bottom: 1px solid var(--ink);
  display: grid;
  gap: 24px;
  grid-template-columns: 90px minmax(0, 1fr);
  padding: 20px 4px;
  transition: background-color 160ms ease, padding 160ms ease;
}

.about-links > a:hover {
  background: var(--acid);
  padding-left: 14px;
  padding-right: 14px;
}

.about-links span,
.about-links strong {
  min-width: 0;
}

.about-links > a > span {
  font-family: "Space Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.about-links strong {
  overflow-wrap: anywhere;
}

.about-links strong > span {
  color: var(--blue);
  margin-left: 6px;
}

.about-copy {
  border-left: 8px solid var(--blue);
  margin-top: 42px;
  padding-left: 22px;
}

.about-copy > :last-child {
  margin-bottom: 0;
}

.not-found {
  margin: 0 auto;
  max-width: var(--content-width);
  min-height: 70vh;
  padding: 120px var(--gutter);
}

.not-found .lede {
  margin-bottom: 42px;
}

.site-footer {
  align-items: end;
  background: var(--ink);
  color: var(--paper);
  display: grid;
  gap: 30px;
  grid-template-columns: 1fr auto auto;
  padding: 70px max(var(--gutter), calc((100vw - 1304px) / 2)) 36px;
}

.site-footer p {
  font-family: "Space Mono", monospace;
  font-size: 10px;
  margin: 0;
  text-transform: uppercase;
}

.footer-mark {
  font-size: clamp(34px, 5vw, 68px);
}

@media (max-width: 980px) {
  :root {
    --gutter: 24px;
  }

  .blog-hero {
    grid-template-columns: 1fr;
    min-height: 0;
    padding-bottom: 100px;
  }

  .latest-card {
    min-height: 430px;
    width: 100%;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 28px;
  }

  .comments-heading {
    align-items: start;
    flex-direction: column;
    gap: 18px;
  }

  .article-layout {
    grid-template-columns: 1fr;
  }

  .toc-panel {
    background: var(--cream);
    border: 1px solid var(--ink);
    border-left: 8px solid var(--blue);
    padding: 18px 22px;
    position: static;
  }

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

  .about-section {
    grid-template-columns: 180px minmax(0, 1fr);
  }

  .site-footer {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .desktop-nav {
    display: none;
  }

  .mobile-nav {
    display: block;
  }

  .site-header {
    padding-bottom: 22px;
    padding-top: 22px;
  }

  .blog-hero {
    padding-top: 58px;
  }

  .blog-hero h1,
  .page-hero h1,
  .article-hero h1,
  .not-found h1 {
    font-size: clamp(52px, 15vw, 82px);
  }

  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .actions .button {
    width: 100%;
  }

  .latest-card {
    box-shadow: 7px 7px 0 var(--blue);
    min-height: 400px;
    padding: 18px;
  }

  .post-grid {
    grid-template-columns: 1fr;
  }

  .post-card {
    min-height: 350px;
  }

  .pagination {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .pagination .button,
  .pagination .button:last-child {
    justify-self: stretch;
  }

  .pagination-status {
    grid-row: 1;
  }

  .article-hero,
  .page-hero {
    padding-top: 70px;
  }

  .article-layout {
    padding-top: 54px;
  }

  .article-content {
    font-size: 17px;
  }

  .post-meta > span:not(.tag-list)::before {
    display: none;
  }

  .post-nav {
    grid-template-columns: 1fr;
    margin-left: var(--gutter);
    margin-right: var(--gutter);
  }

  .post-nav a + a {
    border-left: 0;
    border-top: 1px solid var(--ink);
  }

  .archive-row {
    gap: 20px;
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .archive-row .round-arrow {
    display: none;
  }

  .terms-grid {
    grid-template-columns: 1fr;
  }

  .about-section {
    grid-template-columns: 1fr;
    padding-top: 54px;
  }

  .about-portrait {
    box-shadow: 7px 7px 0 var(--blue);
    max-width: 180px;
  }

  .about-profile h2 {
    margin-bottom: 36px;
  }

  .about-links > a {
    align-items: start;
    gap: 6px;
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .site-header,
  .site-footer,
  .toc-panel,
  .post-nav,
  .actions {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .article-hero,
  .article-layout {
    display: block;
    max-width: none;
    padding: 1cm;
  }

  .article-content a {
    color: black;
  }
}
