:root {
  --bg: #f5f4ed;
  --text: #141413;
  --muted: #6b6a64;
  --accent: #b5462b;
  --rule: #dedcd1;
  --code-bg: #ebe9df;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #262624;
  --text: #faf9f5;
  --muted: #a6a39a;
  --accent: #e0714f;
  --rule: #3d3c38;
  --code-bg: #30302d;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #262624;
    --text: #faf9f5;
    --muted: #a6a39a;
    --accent: #e0714f;
    --rule: #3d3c38;
    --code-bg: #30302d;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.25;
}

h1 {
  font-size: 2.5rem;
  margin: 0 0 0.5rem;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
}

.header-right {
  display: flex;
  gap: 0.5rem;
}

.icon-link {
  display: inline-flex;
  padding: 0.4rem;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  cursor: pointer;
}

.icon-link:hover {
  color: var(--accent);
}

.theme-toggle svg {
  display: none;
}

[data-mode="light"] .icon-light,
[data-mode="dark"] .icon-dark,
[data-mode="system"] .icon-system {
  display: block;
}

main {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 5rem;
}

.meta {
  margin: 0 0 2rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.meta a {
  color: inherit;
}

.summary h2 {
  font-size: 2.1rem;
  margin: 0 0 0.4rem;
}

.summary h2 a {
  color: var(--text);
  text-decoration: none;
}

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

.summary .meta {
  margin-bottom: 1rem;
}

.more {
  font-size: 0.95rem;
}

.divider {
  width: 4rem;
  margin: 3.5rem auto;
  border: 0;
  border-top: 1px solid var(--rule);
}

.content h2 {
  font-size: 1.5rem;
  margin: 2.25rem 0 0.75rem;
}

.content h3 {
  font-size: 1.25rem;
  margin: 2rem 0 0.5rem;
}

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

.content img {
  max-width: 100%;
  height: auto;
}

.content blockquote {
  margin: 1.5rem 0;
  padding-left: 1.25rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.content code {
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.1em 0.3em;
  border-radius: 4px;
}

.content pre {
  background: var(--code-bg);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  line-height: 1.5;
}

.content pre code {
  background: none;
  padding: 0;
}

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

.pagination {
  display: flex;
  justify-content: space-between;
  margin-top: 4rem;
  font-size: 0.95rem;
}

.font-picker {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.75rem;
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  font: 13px/1.2 system-ui, sans-serif;
}

.font-picker label {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

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

  h1 {
    font-size: 2rem;
  }

  .summary h2 {
    font-size: 1.75rem;
  }

  .site-header {
    padding: 1rem;
  }

  main {
    padding: 1rem 1.25rem 4rem;
  }
}
