:root {
  color-scheme: light;
  --background: #fff;
  --surface: #f6f7f9;
  --text: #202124;
  --muted: #667085;
  --link: #075985;
  --border: #e4e7ec;
  --focus: #d97706;
  --content-width: 46rem;
  --page-width: 72rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--text);
  background: var(--background);
  font: 17px/1.7 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--link);
  text-underline-offset: 0.16em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

.container {
  width: min(calc(100% - 2rem), var(--page-width));
  margin-inline: auto;
}

.site-header {
  border-bottom: 1px solid var(--border);
}

.header-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 4rem;
}

.brand {
  flex: 0 0 auto;
  color: var(--text);
  font-weight: 750;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 1rem;
  min-width: 0;
  overflow-x: auto;
  padding-block: 0.75rem;
  white-space: nowrap;
  scrollbar-width: thin;
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  font-weight: 650;
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 0 0 auto;
  margin-inline-start: auto;
}

.language-link {
  font-weight: 650;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  color: var(--text);
  background: var(--background);
  cursor: pointer;
}

.theme-toggle:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.theme-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

.theme-icon-sun,
:root[data-theme="dark"] .theme-icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-icon-sun {
  display: block;
}

.page,
.article-container {
  padding-block: 3rem 5rem;
}

.article-container {
  width: min(calc(100% - 2rem), var(--content-width));
  margin-inline: auto;
}

h1,
h2,
h3,
h4 {
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 6vw, 3.25rem);
}

.prose h2 {
  margin: 2.75rem 0 0.75rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.prose h3 {
  margin: 2rem 0 0.5rem;
  font-size: 1.3rem;
}

.article-date,
time,
.empty {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.post-list > li {
  padding-block: 1.5rem;
  border-top: 1px solid var(--border);
}

.post-preview h2 {
  margin: 0;
  font-size: 1.35rem;
}

.post-preview p {
  margin: 0.4rem 0;
  color: var(--muted);
}

.prose p,
.prose li {
  overflow-wrap: break-word;
}

.prose img,
.prose video {
  display: block;
  max-width: 100%;
  height: auto;
  margin-block: 2rem;
}

blockquote {
  margin: 1.75rem 0;
  padding: 0.75rem 1.25rem;
  border-inline-start: 4px solid var(--link);
  background: var(--surface);
}

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

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

pre {
  max-width: 100%;
  margin: 1.5rem 0;
  padding: 1rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  font: 0.9rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  tab-size: 4;
}

pre code {
  padding: 0;
  color: inherit;
  background: none;
  white-space: pre;
}

:not(pre) > code {
  padding: 0.15em 0.35em;
  border-radius: 0.25rem;
  background: var(--surface);
  font-size: 0.9em;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-section,
.hljs-link {
  color: #9c36b5;
}

.hljs-string,
.hljs-title,
.hljs-name,
.hljs-type,
.hljs-attribute,
.hljs-symbol,
.hljs-bullet,
.hljs-addition,
.hljs-variable,
.hljs-template-tag,
.hljs-template-variable {
  color: #087f5b;
}

.hljs-comment,
.hljs-quote,
.hljs-deletion,
.hljs-meta {
  color: #7b8794;
}

.hljs-number,
.hljs-regexp,
.hljs-built_in,
.hljs-params {
  color: #c2410c;
}

.back-link {
  margin-top: 3rem;
}

.site-footer {
  padding-block: 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-content {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.footer-content p,
.footer-content h2 {
  margin: 0;
}

.footer-content h2 {
  color: var(--text);
  font-size: 1rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.skip-link {
  position: absolute;
  top: -5rem;
  left: 1rem;
}

.skip-link:focus {
  top: 1rem;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  background: var(--background);
}

.error-code {
  margin: 0;
  color: var(--muted);
  font-size: 1.25rem;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #151719;
  --surface: #202428;
  --text: #edf0f2;
  --muted: #aab2bd;
  --link: #7dd3fc;
  --border: #333941;
  --focus: #fbbf24;
}

:root[data-theme="dark"] .hljs-keyword,
:root[data-theme="dark"] .hljs-selector-tag,
:root[data-theme="dark"] .hljs-literal,
:root[data-theme="dark"] .hljs-section,
:root[data-theme="dark"] .hljs-link {
  color: #d8b4fe;
}

:root[data-theme="dark"] .hljs-string,
:root[data-theme="dark"] .hljs-title,
:root[data-theme="dark"] .hljs-name,
:root[data-theme="dark"] .hljs-type,
:root[data-theme="dark"] .hljs-attribute,
:root[data-theme="dark"] .hljs-symbol,
:root[data-theme="dark"] .hljs-bullet,
:root[data-theme="dark"] .hljs-addition,
:root[data-theme="dark"] .hljs-variable,
:root[data-theme="dark"] .hljs-template-tag,
:root[data-theme="dark"] .hljs-template-variable {
  color: #6ee7b7;
}

:root[data-theme="dark"] .hljs-number,
:root[data-theme="dark"] .hljs-regexp,
:root[data-theme="dark"] .hljs-built_in,
:root[data-theme="dark"] .hljs-params {
  color: #fdba74;
}

@media (max-width: 40rem) {
  body {
    font-size: 16px;
  }

  .header-row {
    gap: 0.75rem;
  }

  .page,
  .article-container {
    padding-block: 2rem 4rem;
  }
}
