:root {
  --background: oklch(0.985 0.008 85);
  --foreground: oklch(0.22 0.02 55);
  --muted: oklch(0.96 0.008 85);
  --muted-foreground: oklch(0.5 0.02 55);
  --border: oklch(0.9 0.012 85);
  --accent: oklch(0.45 0.07 250);
  --quote: oklch(0.32 0.03 55);
  --meta: oklch(0.66 0.012 55);
  --ring: oklch(0.45 0.07 250 / 0.35);
  --font-body: "Iowan Old Style", "Palatino Linotype", Palatino, "Songti SC", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
  --font-heading: var(--font-body);
  --font-site-title: var(--font-body);
  --font-ui: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;
  --content-max-width: 42rem;
  --site-padding: 1.5rem;
  --avatar-size: 28px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: oklch(0.18 0.012 70);
    --foreground: oklch(0.93 0.01 85);
    --muted: oklch(0.24 0.012 70);
    --muted-foreground: oklch(0.72 0.02 75);
    --border: oklch(0.32 0.015 70);
    --accent: oklch(0.78 0.06 250);
    --quote: oklch(0.9 0.015 85);
    --meta: oklch(0.58 0.01 75);
    --ring: oklch(0.78 0.06 250 / 0.4);
  }
}

* { box-sizing: border-box; }
html { color-scheme: light dark; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  min-height: 100vh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
img { max-width: 100%; height: auto; display: block; }

.wrap {
  width: min(var(--content-max-width), 100% - 2 * var(--site-padding));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in oklch, var(--background) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.brand:hover { text-decoration: none; }
.avatar {
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 50%;
  background: var(--foreground);
  color: var(--background);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 650;
  flex: 0 0 auto;
}
.brand-name {
  font-family: var(--font-site-title);
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}
.nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav a {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted-foreground);
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  text-decoration: none;
}
.nav a:hover, .nav a.is-active {
  color: var(--foreground);
  background: var(--muted);
  text-decoration: none;
}

.page { padding: 1.75rem 0 4rem; }
.section-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--meta);
  font-weight: 600;
  margin: 0 0 0.85rem;
}

.entry {
  padding: 0 0 1.85rem;
  margin-bottom: 1.85rem;
  border-bottom: 1px solid var(--border);
}
.entry:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}
.entry-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin: 0 0 0.35rem;
}
.entry-title a { color: inherit; }
@media (hover: hover) {
  .entry-title a:hover { color: var(--accent); text-decoration: none; }
}
.entry-date {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--meta);
  margin: 0 0 1rem;
  font-variant-numeric: tabular-nums;
}

.page-title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.4rem;
}

.prose {
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.prose > *:first-child { margin-top: 0; }
.prose > *:last-child { margin-bottom: 0; }
.prose p { margin: 0.7em 0; }
.prose h2, .prose h3 {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.prose ul, .prose ol { margin: 0.7em 0; padding-left: 1.4rem; }
.prose code, .prose pre { font-family: var(--font-mono); font-size: 0.9em; }
.prose pre {
  background: var(--muted);
  padding: 0.85rem 1rem;
  overflow: auto;
  border-radius: 8px;
}
.prose blockquote {
  margin: 1.25rem 0;
  padding-left: 1rem;
  border-left: 1px solid var(--border);
  color: var(--quote);
}

.site-footer {
  color: var(--muted-foreground);
  font-size: 0.8rem;
  padding: 0 0 2.5rem;
}
.empty { color: var(--muted-foreground); padding: 2rem 0; }

@media (max-width: 640px) {
  :root { --site-padding: 1.1rem; }
}
