:root {
  --bg: #efece4;
  --fg: #1c1a17;
  --muted: #6b6459;
  --link: #1c1a17;
  --border: #d8d3c6;
}

:root[data-theme="dark"] {
  --bg: #171613;
  --fg: #e9e5da;
  --muted: #948c7c;
  --link: #e9e5da;
  --border: #34312a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: Georgia, Cambria, "Times New Roman", Times, serif;
  font-size: 18px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.home-link {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--fg);
  text-decoration: none;
}

.theme-toggle {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  padding: 2px;
}

.theme-toggle:hover {
  border-color: var(--muted);
}

.theme-toggle .knob {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--fg);
  color: var(--bg);
  transition: transform 0.15s ease;
}

:root[data-theme="dark"] .theme-toggle .knob {
  transform: translateX(18px);
}

.theme-toggle .icon-moon {
  display: none;
}

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

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

a {
  color: var(--link);
}

a:hover {
  opacity: 0.7;
}

h1,
h2,
h3 {
  line-height: 1.25;
}

.section {
  margin-top: 2.5rem;
}

.section h2 {
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
}

.intro p {
  margin: 0 0 1rem;
}

.intro p:last-child {
  margin-bottom: 0;
}

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

.list li {
  padding: 0.35rem 0;
}

.list li::before {
  content: "\2022";
  margin-right: 0.5rem;
  color: var(--muted);
}

.date,
.source {
  color: var(--muted);
  font-size: 0.9rem;
  margin-left: 0.5rem;
}

.empty {
  color: var(--muted);
}

.post .back {
  margin-bottom: 1.5rem;
}

.post .back a {
  text-decoration: none;
  font-size: 0.95rem;
  color: var(--muted);
}

.post h1 {
  margin-bottom: 0.25rem;
}

.post .meta {
  color: var(--muted);
  margin-top: 0;
  margin-bottom: 2rem;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote {
  margin: 0 0 1.25rem;
}

.prose img {
  max-width: 100%;
}

.prose blockquote {
  border-left: 2px solid var(--border);
  padding-left: 1rem;
  color: var(--muted);
}

.video-embed {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  margin-bottom: 1.5rem;
  background: #000;
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.audio-embed {
  margin-bottom: 1.5rem;
}

.audio-embed iframe {
  width: 100%;
  height: 152px;
  border: 0;
  border-radius: 12px;
}

.toc {
  display: none;
  position: fixed;
  top: 45%;
  transform: translateY(-50%);
  left: max(24px, calc(50% - 320px - 200px));
  width: 160px;
}

@media (min-width: 1150px) {
  .toc {
    display: block;
  }
}

.toc a {
  display: block;
  padding: 0.3rem 0 0.3rem 0.85rem;
  border-left: 2px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  line-height: 1.3;
}

.toc a.active {
  color: var(--fg);
  border-left-color: var(--fg);
  font-weight: bold;
}

.site-footer {
  margin-top: 4rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}
