:root {
  --paper: oklch(97% 0.008 240);
  --paper-deep: oklch(92% 0.018 244);
  --surface: oklch(99% 0.005 240);
  --ink: oklch(23% 0.045 250);
  --muted: oklch(47% 0.035 246);
  --rule: oklch(83% 0.025 244);
  --accent: oklch(53% 0.15 250);
  --accent-dark: oklch(42% 0.13 250);
  --display: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  --body: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Code", Consolas, monospace;
  --reading-measure: 48rem;
}

html {
  min-width: 0;
  background: var(--paper);
  color-scheme: light;
}

body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  overflow-x: clip;
  background-color: var(--paper);
  background-image: linear-gradient(180deg, var(--paper-deep) 0, var(--paper) 26rem);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent);
  color: var(--surface);
}

a {
  color: var(--accent-dark);
  text-decoration-color: color-mix(in oklch, var(--accent) 55%, transparent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

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

.post__content a,
.post-preview__content a,
.page a {
  text-decoration-line: underline;
}

a:focus-visible,
button:focus-visible {
  outline: 0.2rem solid var(--accent);
  outline-offset: 0.2rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--ink);
  font-family: var(--display);
  font-weight: 750;
  line-height: 1.1;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.25rem, 7vw, 3.6rem);
  letter-spacing: -0.045em;
}

h2 {
  margin-top: 2.5rem;
  font-size: clamp(1.65rem, 4vw, 2.25rem);
  letter-spacing: -0.025em;
}

h3 {
  margin-top: 2rem;
  font-size: clamp(1.3rem, 3vw, 1.7rem);
}

p,
li {
  color: var(--ink);
}

/* wireframe.min.css thins these to weight 200/300, which is illegible on mobile */
small,
.small,
.lead {
  font-weight: 400;
}

hr {
  margin-block: 2.5rem;
  border: 0;
  border-top: 1px solid var(--rule);
}

img,
svg,
video,
iframe {
  max-width: 100%;
}

img,
video {
  height: auto;
}

iframe[src*="youtube.com/embed"],
iframe[src*="youtube-nocookie.com/embed"] {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

figure {
  margin: 2rem 0;
}

figcaption {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.82rem;
}

code,
kbd,
pre,
samp {
  font-family: var(--mono);
}

:not(pre) > code {
  padding: 0.1em 0.28em;
  border-radius: 0.2rem;
  background: var(--paper-deep);
  color: var(--accent-dark);
  font-size: 0.9em;
}

pre {
  max-width: 100%;
  margin-block: 1.5rem;
  padding: 1rem;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 0.45rem;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.6;
  overscroll-behavior-inline: contain;
}

pre code {
  white-space: pre;
}

.highlight .c,
.highlight .c1,
.highlight .cm,
.highlight .cs {
  color: var(--muted);
}

blockquote {
  margin: 2rem 0;
  padding: 1rem 1.25rem;
  border-left: 0.25rem solid var(--accent);
  background: var(--paper-deep);
  color: var(--ink);
}

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

table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-color: var(--rule);
}

.blog-nav {
  padding-block: 0.65rem;
  border-bottom: 1px solid var(--rule);
  background: color-mix(in oklch, var(--surface) 92%, transparent);
}

.blog-nav__inner {
  min-width: 0;
}

.blog-nav__brand {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.blog-nav__toggle {
  min-width: 2.75rem;
  min-height: 2.75rem;
  border-color: var(--rule);
}

.blog-nav__links {
  justify-content: flex-end;
}

.blog-nav__link {
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  padding-inline: 0.8rem;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
}

.blog-nav__link:hover,
.blog-nav__link[aria-current="page"] {
  color: var(--ink);
}

.blog-shell {
  width: min(calc(100% - 2rem), var(--reading-measure));
  min-width: 0;
  margin-inline: auto;
  padding-block: clamp(3rem, 8vw, 6rem);
}

.blog-shell > *,
.post__content > *,
.post-preview__content > * {
  min-width: 0;
}

.blog-shell .row {
  margin-inline: 0;
}

.post-preview {
  padding-bottom: clamp(3.5rem, 8vw, 6rem);
  border-bottom: 1px solid var(--rule);
}

.post-preview + .post-preview {
  padding-top: clamp(3.5rem, 8vw, 6rem);
}

.post-preview h1,
.post__header h1 {
  margin-bottom: 0.65rem;
}

.post-preview h1 a {
  color: var(--ink);
  text-decoration: none;
}

.post-preview h1 a:hover {
  color: var(--accent-dark);
}

.post-preview time,
.post__header time,
.related-posts time {
  display: block;
  color: var(--accent-dark);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.post-preview__content,
.post__content,
.page {
  margin-top: 2rem;
  font-size: clamp(1rem, 1.5vw, 1.08rem);
}

.post-preview__content p,
.post__content p,
.page p {
  margin-bottom: 1.3rem;
}

.post__header {
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}

.related-posts {
  margin-top: clamp(4rem, 10vw, 7rem);
  padding-top: 2rem;
  border-top: 1px solid var(--ink);
}

.related-posts h2 {
  margin: 0 0 1rem;
  font-size: 1.35rem;
}

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

.related-posts li {
  display: grid;
  gap: 0.2rem;
  padding-block: 0.9rem;
  border-top: 1px solid var(--rule);
}

.related-posts a {
  color: var(--ink);
  font-weight: 700;
}

.blog-pagination {
  padding-top: 2rem;
}

.pagination .page-link {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  border-color: var(--rule);
  background: var(--surface);
  color: var(--ink);
}

.pagination .page-link:hover {
  background: var(--ink);
  color: var(--paper);
}

.site-footer {
  border-top: 1px solid var(--rule);
}

.site-footer__inner {
  display: grid;
  gap: 0.35rem;
  padding-block: 2rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.site-footer__inner a {
  width: fit-content;
  color: var(--ink);
  font-weight: 700;
}

@media (min-width: 48rem) {
  .blog-nav__links {
    gap: 0.25rem;
  }

  .site-footer__inner {
    grid-template-columns: 1fr auto auto;
    gap: 2rem;
  }
}

@media (max-width: 47.99rem) {
  .blog-nav__inner {
    padding-inline: 1rem;
  }

  .blog-nav__links {
    width: 100%;
    padding-top: 0.65rem;
    border-top: 1px solid var(--rule);
  }

  .blog-nav__link {
    justify-content: center;
    border-bottom: 1px solid color-mix(in oklch, var(--rule) 70%, transparent);
  }

  .blog-shell {
    padding-block: 2.75rem 4rem;
  }

  pre {
    font-size: 0.8rem;
  }
}

@media (max-width: 22rem) {
  .blog-shell {
    width: min(calc(100% - 1.25rem), var(--reading-measure));
  }
}

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

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