:root {
  --bg: #faf9f6;
  --fg: #1c1b19;
  --muted: #6b6862;
  --border: #e6e3dc;
  --accent: #1c1b19;
  --code-bg: #f1efe9;
  --max-width: 650px;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413;
    --fg: #e8e6e1;
    --muted: #9a968e;
    --border: #2a2926;
    --accent: #e8e6e1;
    --code-bg: #1f1e1c;
  }
}

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

html {
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  padding: 0 1.25rem;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-serif);
  line-height: 1.72;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3.5rem 0 5rem;
}

/* Header & Navigation */
header.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 3.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.site-title {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--fg);
}

/* Post List */
.intro {
  color: var(--muted);
  margin: -1.5rem 0 3rem;
  font-size: 0.98rem;
}

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

.post-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid transparent;
}

.post-item a {
  color: var(--fg);
  text-decoration: none;
  font-size: 1.05rem;
  line-height: 1.4;
}

.post-item a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

.post-date {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Article */
article h1 {
  font-size: 1.85rem;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 0 0 0.6rem;
  font-weight: 600;
}

.article-meta {
  font-family: var(--font-sans);
  font-size: 0.83rem;
  color: var(--muted);
  margin-bottom: 2.5rem;
}

.prose h2 {
  font-size: 1.35rem;
  line-height: 1.35;
  margin: 2.4rem 0 0.75rem;
  font-weight: 600;
}

.prose h3 {
  font-size: 1.12rem;
  margin: 2rem 0 0.5rem;
  font-weight: 600;
}

.prose p {
  margin: 0 0 1.35rem;
}

.prose a {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--muted);
  text-decoration-thickness: 1px;
}

.prose a:hover {
  text-decoration-color: var(--fg);
}

.prose ul,
.prose ol {
  margin: 0 0 1.35rem;
  padding-left: 1.4rem;
}

.prose li {
  margin-bottom: 0.35rem;
}

.prose blockquote {
  margin: 1.75rem 0;
  padding-left: 1.2rem;
  border-left: 2px solid var(--border);
  color: var(--muted);
  font-style: italic;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 4px;
}

.prose pre {
  background: var(--code-bg);
  padding: 1rem 1.15rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.6rem 0;
  line-height: 1.55;
}

.prose pre code {
  background: none;
  padding: 0;
  font-size: 0.8rem;
}

.prose img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 2rem auto;
  border-radius: 4px;
}

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

.embed-wrap {
  margin: 2rem -3rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #00060d;
}

.embed-wrap iframe {
  display: block;
  width: 100%;
  height: 540px;
  border: 0;
}

.embed-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0.9rem;
  background: var(--code-bg);
  border-top: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--muted);
}

.embed-bar a {
  color: var(--fg);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}

.embed-bar a:hover {
  text-decoration: underline;
}

@media (max-width: 780px) {
  .embed-wrap {
    margin: 1.75rem 0;
  }
  .embed-wrap iframe {
    height: 440px;
  }
  .embed-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
}

.back-link {
  display: inline-block;
  margin-top: 3rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
}

.back-link:hover {
  color: var(--fg);
}

footer.site-footer {
  margin-top: 4.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

footer.site-footer a:hover {
  color: var(--fg);
}

@media (max-width: 540px) {
  html {
    font-size: 16.5px;
  }
  .container {
    padding: 2.25rem 0 3.5rem;
  }
  .post-item {
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.85rem 0;
  }
}
