@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600&family=Newsreader:opsz,wght@6..72,400;500;600&display=swap");

:root {
  --color-bg: #fbfbf8;
  --color-surface: #ffffff;
  --color-text: #111111;
  --color-muted: #5f5b53;
  --color-line: #d8d3c8;
  --color-code-bg: #f3f1ea;
  --color-code-text: #1f1d18;
  --color-table-border: #d7d2c7;
  --color-table-row-even: #f6f4ed;
  --color-table-row-odd: #ffffff;
  --color-shadow: rgba(17, 17, 17, 0.06);
  --color-toggle-accent: #111111;
  --reading-width: 44rem;
  --outer-width: 62rem;
}

html.dark {
  --color-bg: #0f0f0f;
  --color-surface: #171717;
  --color-text: #f3f0e8;
  --color-muted: #bdb7ab;
  --color-line: #303030;
  --color-code-bg: #1f1f1f;
  --color-code-text: #f3f0e8;
  --color-table-border: #343434;
  --color-table-row-even: #1b1b1b;
  --color-table-row-odd: #141414;
  --color-shadow: rgba(0, 0, 0, 0.35);
  --color-toggle-accent: #f3f0e8;
}

@media (prefers-color-scheme: dark) {
  :root:not(.dark) {
    --color-bg: #0f0f0f;
    --color-surface: #171717;
    --color-text: #f3f0e8;
    --color-muted: #bdb7ab;
    --color-line: #303030;
    --color-code-bg: #1f1f1f;
    --color-code-text: #f3f0e8;
    --color-table-border: #343434;
    --color-table-row-even: #1b1b1b;
    --color-table-row-odd: #141414;
    --color-shadow: rgba(0, 0, 0, 0.35);
    --color-toggle-accent: #f3f0e8;
  }
}

* {
  box-sizing: border-box;
}

html {
  background: var(--color-bg);
  color: var(--color-text);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top, rgba(17, 17, 17, 0.03), transparent 30%),
    var(--color-bg);
  color: var(--color-text);
  font-family: "Newsreader", Georgia, serif;
  font-size: 18px;
  line-height: 1.85;
}

a {
  color: inherit;
  text-decoration-color: rgba(17, 17, 17, 0.35);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

html.dark a {
  text-decoration-color: rgba(243, 240, 232, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root:not(.dark) a {
    text-decoration-color: rgba(243, 240, 232, 0.35);
  }
}

a:hover,
a:focus-visible {
  text-decoration-color: currentColor;
}

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

.site-shell {
  padding: 2rem 1.25rem 4rem;
}

.site-header,
.markdown-body {
  width: min(100%, var(--outer-width));
  margin: 0 auto;
}

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

.site-identity {
  max-width: 34rem;
}

.site-brand,
.site-nav,
.page-kicker,
.page-meta,
.post-meta,
.post-category,
.category-link,
.site-footer-links,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6,
small {
  font-family: "IBM Plex Sans", "Helvetica Neue", sans-serif;
}

.site-brand {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-decoration: none;
  text-transform: uppercase;
}

.site-description {
  margin: 0.7rem 0 0;
  color: var(--color-muted);
  font-size: 1rem;
  line-height: 1.55;
}

.site-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.85rem;
}

.site-nav,
.site-footer-links,
.category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1rem;
}

.site-nav a,
.site-footer-links a {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.markdown-body {
  max-width: var(--reading-width);
  margin-top: 2.75rem;
}

.page-header {
  margin-bottom: 2rem;
}

.page-kicker {
  margin: 0 0 0.9rem;
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  font-size: clamp(2.5rem, 7vw, 4.6rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.page-intro {
  max-width: 32rem;
  margin: 1.1rem 0 0;
  color: var(--color-muted);
  font-size: 1.15rem;
  line-height: 1.7;
}

.page-meta,
.post-preview-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.55rem 0.8rem;
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-meta {
  margin-top: 1.1rem;
  justify-content: space-between;
}

.category-nav {
  margin: 0 0 2.25rem;
}

.category-link {
  border: 1px solid var(--color-line);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.category-link.is-active {
  border-color: var(--color-text);
  color: var(--color-text);
}

.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-list > li + li {
  margin-top: 1.6rem;
}

.post-preview {
  padding-top: 1.6rem;
  border-top: 1px solid var(--color-line);
}

.post-preview-title {
  margin: 0.55rem 0 0;
  font-size: clamp(1.45rem, 4vw, 2.1rem);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.post-link {
  display: block;
  text-decoration: none;
}

.post-category {
  color: var(--color-muted);
}

.post,
.post-list,
.category-nav {
  width: 100%;
}

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

.article-body p,
.article-body li {
  font-size: 1.18rem;
}

.article-body p {
  margin: 0 0 1.2rem;
}

.article-body ul,
.article-body ol {
  margin: 0 0 1.4rem;
  padding-left: 1.3rem;
}

.article-body li + li {
  margin-top: 0.45rem;
}

.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin-top: 2.4rem;
  margin-bottom: 0.8rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.markdown-body h2 {
  font-size: 1.55rem;
}

.markdown-body h3 {
  font-size: 1.22rem;
}

.markdown-body hr {
  height: 1px;
  margin: 2.5rem 0;
  border: 0;
  background: var(--color-line);
}

.markdown-body blockquote {
  margin: 1.8rem 0;
  padding: 0.15rem 0 0.15rem 1.2rem;
  border-left: 2px solid var(--color-text);
  color: var(--color-muted);
}

.markdown-body table {
  width: 100%;
  margin: 1.8rem 0;
  border-collapse: collapse;
  font-size: 0.98rem;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--color-table-border);
  padding: 0.65rem 0.8rem;
  text-align: left;
}

.markdown-body table tr:nth-child(2n) {
  background: var(--color-table-row-even);
}

.markdown-body table tr:nth-child(2n + 1) {
  background: var(--color-table-row-odd);
}

.markdown-body code,
.markdown-body pre,
.markdown-body kbd {
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
}

.markdown-body code {
  background: var(--color-code-bg);
  color: var(--color-code-text);
  border-radius: 0.35rem;
  padding: 0.15rem 0.35rem;
  font-size: 0.88em;
}

.markdown-body pre {
  margin: 1.5rem 0;
  padding: 1rem 1.1rem;
  background: var(--color-code-bg);
  color: var(--color-code-text);
  border: 1px solid var(--color-line);
  border-radius: 0.9rem;
  box-shadow: 0 10px 24px var(--color-shadow);
  overflow-x: auto;
  line-height: 1.55;
}

.markdown-body pre code {
  padding: 0;
  background: transparent;
  border-radius: 0;
}

.site-footer {
  margin-top: 3.25rem;
}

.site-footer-line {
  height: 1px;
  background: var(--color-line);
}

.site-footer-links {
  padding-top: 1rem;
}

.site-footer-links a {
  color: var(--color-muted);
  text-decoration: none;
}

.h-6 {
  width: 1.2rem;
  height: 1.2rem;
}

.w-6 {
  width: 1.2rem;
}

#color-mode-switch {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--color-muted);
}

#color-mode-switch input[type="checkbox"] {
  width: 0;
  height: 0;
  visibility: hidden;
  position: absolute;
}

#color-mode-switch label {
  display: block;
  position: relative;
  width: 2.6rem;
  height: 1.45rem;
  border-radius: 999px;
  cursor: pointer;
  background: color-mix(in srgb, var(--color-toggle-accent) 18%, transparent);
  text-indent: -9999px;
}

#color-mode-switch label::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.16rem;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: var(--color-surface);
  border: 1px solid color-mix(in srgb, var(--color-toggle-accent) 25%, transparent);
  transition: transform 0.24s ease;
}

#color-mode-switch input:checked + label::after {
  transform: translateX(1.1rem);
}

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

pre.sourceCode,
div.sourceCode {
  background-color: var(--color-code-bg);
  border: 1px solid var(--color-line);
  border-radius: 0.9rem;
  padding: 1rem 1.1rem;
  overflow-x: auto;
}

div.sourceCode pre.sourceCode {
  background: transparent;
  border: 0;
  padding: 0;
}

code.sourceCode > span {
  display: inline;
}

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

  .site-shell {
    padding-top: 1.25rem;
    padding-bottom: 3rem;
  }

  .site-header {
    flex-direction: column;
    gap: 1.25rem;
  }

  .site-actions {
    width: 100%;
    align-items: flex-start;
  }

  .markdown-body {
    margin-top: 2rem;
  }

  .page-meta {
    gap: 0.5rem 0.8rem;
  }

  .article-body p,
  .article-body li {
    font-size: 1.07rem;
  }
}
