:root {
  --paper: #f7f6f2;
  --ink: #222220;
  --muted: #706e67;
  --line: #d8d6ce;
  --accent: #c49b00;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Charter, "Bitstream Charter", Cambria, Georgia, serif;
  --mono: "SFMono-Regular", Consolas, monospace;
  --width: 42rem;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  width: min(calc(100% - 2.5rem), var(--width));
  margin: 0 auto;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: #f3d95b;
}

a {
  color: inherit;
  text-decoration-color: var(--line);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

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

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.site-header {
  display: flex;
  padding: 4rem 0 2rem;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  border-bottom: 1px solid var(--line);
}

.site-name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.site-header p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 0.95rem;
}

.site-header nav {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
}

.site-header nav a {
  color: var(--muted);
}

.home {
  padding: 4rem 0 6rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  padding: 0;
  border: 0;
  margin: -1px;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.feed-post {
  padding: 0 0 4rem;
  border-bottom: 1px solid var(--line);
}

.feed-post + .feed-post {
  padding-top: 4rem;
}

.feed-post-header h2 {
  margin: 0;
  font-size: clamp(1.65rem, 5vw, 2.25rem);
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.feed-post-header h2 a,
.post-header h1 a {
  text-decoration: none;
}

.feed-post-header h2 a:hover,
.post-header h1 a:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.18em;
}

.external-mark {
  color: var(--muted);
  font-size: 0.65em;
  font-weight: 400;
  vertical-align: 0.18em;
}

.feed-post-meta {
  display: flex;
  margin: 0.65rem 0 0;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.feed-post-meta a {
  text-decoration: none;
}

.feed-post-body {
  padding-top: 1.75rem;
}

.continue-reading {
  font-family: var(--sans);
  font-size: 0.78rem;
}

.continue-reading a {
  color: var(--muted);
  text-decoration: none;
}

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

.feed-post-footer {
  margin-top: 1.5rem;
}

.link-context {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
}

.link-context a {
  text-decoration: none;
}

.link-context .via-link {
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.link-context .via-link:hover {
  text-decoration-color: var(--accent);
}

.tags {
  display: flex;
  margin-top: 0.7rem;
  flex-wrap: wrap;
  gap: 0.65rem;
  font-family: var(--mono);
  font-size: 0.66rem;
}

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

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

.post {
  padding: 4rem 0 6rem;
}

.back {
  display: inline-block;
  margin-bottom: 4rem;
  color: var(--muted);
  font-size: 0.75rem;
  text-decoration: none;
}

.post-header {
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--line);
}

.post-header h1 {
  max-width: 15ch;
  margin: 0;
  font-size: clamp(2.5rem, 7vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.02;
}

.post-meta {
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.prose {
  padding-top: 3rem;
  color: #2d2c29;
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.75;
}

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

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre {
  margin: 1.5em 0;
}

.prose h2,
.prose h3 {
  margin: 2.4em 0 0.7em;
  color: var(--ink);
  font-family: var(--sans);
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.prose h2 {
  font-size: 1.65rem;
}

.prose h3 {
  font-size: 1.3rem;
}

.prose li + li {
  margin-top: 0.35em;
}

.prose blockquote {
  padding-left: 1.25rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}

.prose :not(pre) > code {
  padding: 0.1em 0.3em;
  border: 1px solid var(--line);
  border-radius: 0.2rem;
  font-family: var(--mono);
  font-size: 0.82em;
}

.prose pre {
  overflow-x: auto;
  padding: 1.2rem 1.3rem;
  border-radius: 0.25rem;
  background: #252522 !important;
  color: #f5f4ef;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.65;
}

.post-end {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
}

.back-to-writing {
  color: var(--muted);
  text-decoration: none;
}

.archive {
  padding: 4rem 0 6rem;
}

.archive > h1 {
  margin: 0 0 2rem;
  font-size: 1.6rem;
  letter-spacing: -0.025em;
}

.archive .back {
  margin-bottom: 3rem;
}

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

.archive-post {
  display: grid;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
  grid-template-columns: 7.2rem minmax(0, 1fr);
  gap: 1.25rem;
}

.archive-post-date {
  padding-top: 0.25rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  text-decoration: none;
}

.archive-post h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.archive-post h2 a {
  text-decoration: none;
}

.archive-post h2 a:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.18em;
}

.tag-list {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--ink);
  list-style: none;
}

.tag-list li {
  display: flex;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
  justify-content: space-between;
}

.tag-list a {
  font-size: 0.95rem;
  text-decoration: none;
}

.tag-list span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
}

@media (max-width: 34rem) {
  body {
    width: calc(100% - 2rem);
  }

  .site-header {
    padding-top: 2.5rem;
  }

  .home,
  .post,
  .archive {
    padding-top: 3rem;
  }

  .feed-post,
  .feed-post + .feed-post {
    padding-bottom: 3rem;
  }

  .feed-post + .feed-post {
    padding-top: 3rem;
  }

  .archive-post {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .archive-post-date {
    padding: 0;
  }

  .back {
    margin-bottom: 3rem;
  }
}

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