/* === Tokens (light) === */
:root {
  --radius: 0.5rem;
  --background: oklch(0.99 0.002 95);
  --foreground: oklch(0.18 0.01 260);
  --muted: oklch(0.96 0.005 95);
  --muted-foreground: oklch(0.48 0.012 260);
  --border: oklch(0.9 0.005 260);
  --accent: oklch(0.95 0.01 260);
  --accent-foreground: oklch(0.2 0.01 260);
  --primary: oklch(0.2 0.015 260);
  --primary-foreground: oklch(0.98 0.002 95);
  --card: oklch(1 0 0);
  --link: oklch(0.45 0.15 250);

  --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  --container: 42rem;
}

/* === Tokens (dark via prefers-color-scheme) === */
@media (prefers-color-scheme: dark) {
  :root {
    --background: oklch(0.16 0.008 260);
    --foreground: oklch(0.94 0.005 95);
    --muted: oklch(0.22 0.01 260);
    --muted-foreground: oklch(0.68 0.012 260);
    --border: oklch(0.28 0.01 260);
    --accent: oklch(0.24 0.012 260);
    --accent-foreground: oklch(0.94 0.005 95);
    --primary: oklch(0.94 0.005 95);
    --primary-foreground: oklch(0.18 0.01 260);
    --card: oklch(0.19 0.008 260);
    --link: oklch(0.78 0.13 240);
  }
}

/* === Base === */
*, *::before, *::after { box-sizing: border-box; }
html {
  color-scheme: light dark;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.6;
}
a { color: inherit; }
button { font: inherit; cursor: pointer; }
img { max-width: 100%; height: auto; }
hr { border: 0; border-top: 1px solid var(--border); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--foreground); color: var(--background);
  padding: 0.5rem 1rem; z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* === Layout === */
.site-container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.site-main { display: block; }

/* === Header === */
.site-header {
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 1.5rem 0;
}
.site-brand {
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--foreground);
  text-decoration: none;
}
.site-brand span { color: var(--muted-foreground); }
.site-nav ul {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; gap: 1.5rem;
  font-size: 0.9rem;
}
.site-nav a {
  color: var(--muted-foreground);
  text-decoration: none;
  transition: color 0.15s;
}
.site-nav a:hover { color: var(--foreground); }
.site-nav a[aria-current="page"] { color: var(--foreground); }

/* === Footer === */
.site-footer {
  margin-top: 6rem;
  border-top: 1px solid var(--border);
}
.site-footer__inner {
  display: flex; flex-wrap: wrap; gap: 1rem;
  justify-content: space-between;
  padding: 2rem 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}
.site-footer__copy p { margin: 0.15rem 0; }
.site-footer__attribution a { color: var(--link); text-decoration: none; }
.site-footer__attribution a:hover { text-decoration: underline; }
.site-footer__nav ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; gap: 1.25rem;
}
.site-footer__nav a {
  color: var(--muted-foreground);
  text-decoration: none;
}
.site-footer__nav a:hover { color: var(--foreground); }

/* === Intro / hero === */
.intro {
  padding: 4rem 1.5rem 1.5rem;
}
.intro--centered { text-align: center; }
.intro h1 {
  font-size: 1.875rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.2;
}
.intro__copy {
  margin-top: 0.75rem;
  color: var(--muted-foreground);
  font-size: 1rem;
}
.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin: 0 0 0.5rem;
}

/* === Post list === */
.post-section { padding: 2rem 1.5rem 4rem; }
.post-list {
  list-style: none; margin: 0; padding: 0;
}
.post-list__item + .post-list__item {
  border-top: 1px solid var(--border);
}
.post-card {
  display: block;
  padding: 1.5rem 0;
  text-decoration: none;
  color: inherit;
}
.post-card__row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
}
.post-card__title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--foreground);
}
.post-card:hover .post-card__title { text-decoration: underline; text-underline-offset: 4px; }
.post-card__date {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted-foreground);
}
.post-card__excerpt {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--muted-foreground);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card__tags {
  margin-top: 0.65rem;
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  font-size: 0.7rem; color: var(--muted-foreground);
}

/* === Post page === */
.post { padding: 3rem 1.5rem 4rem; }
.back-link {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  text-decoration: none;
  transition: color 0.15s;
}
.back-link:hover { color: var(--foreground); }
.post__header { margin: 2rem 0 2.5rem; }
.post__title {
  font-size: 2.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}
.post__meta {
  margin-top: 1rem;
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  font-size: 0.875rem; color: var(--muted-foreground);
}
.post__tags {
  margin-top: 3rem;
  display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.post__tags a {
  font-size: 0.75rem;
  padding: 0.25rem 0.55rem;
  border-radius: 0.375rem;
  background: var(--muted);
  color: var(--muted-foreground);
  text-decoration: none;
}
.post__tags a:hover { color: var(--foreground); }
.post__rule { margin: 4rem 0; }

/* === Page === */
.page { padding: 3rem 1.5rem 4rem; }
.page__header { margin-bottom: 2rem; }
.page__header h1 {
  font-size: 2rem; font-weight: 600; letter-spacing: -0.02em;
  margin: 0;
}

/* === Post nav === */
.post-nav {
  margin-top: 3rem;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.post-nav__link {
  display: flex; flex-direction: column; gap: 0.25rem;
  text-decoration: none;
  color: inherit;
  font-size: 0.95rem;
}
.post-nav__link--next { text-align: right; }
.post-nav__label { font-size: 0.75rem; color: var(--muted-foreground); }
.post-nav__link strong { font-weight: 500; }
.post-nav__link:hover strong { text-decoration: underline; }

/* === Pagination === */
.pagination {
  margin-top: 3rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  font-size: 0.875rem;
}
.pagination__edge {
  color: var(--foreground); text-decoration: none;
}
.pagination__edge:hover { text-decoration: underline; }
.pagination__edge.is-disabled { color: var(--muted-foreground); pointer-events: none; }
.pagination__pages { display: flex; gap: 0.4rem; align-items: center; }
.pagination__page {
  padding: 0.25rem 0.55rem;
  border-radius: 0.375rem;
  text-decoration: none;
  color: var(--muted-foreground);
}
.pagination__page.is-current {
  background: var(--accent);
  color: var(--accent-foreground);
}
.pagination__gap { color: var(--muted-foreground); }

/* === Archive === */
.archive-group { margin-top: 2.5rem; }
.archive-group__label {
  font-size: 0.875rem; font-weight: 500;
  color: var(--muted-foreground);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 0.75rem;
}
.archive-list { list-style: none; margin: 0; padding: 0; }
.archive-list__item {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.archive-list__item a { text-decoration: none; color: var(--foreground); }
.archive-list__item a:hover { text-decoration: underline; }
.archive-list__item time {
  font-size: 0.8rem; color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}

/* === Comments === */
.comments-block {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.comments-shell[hidden] { display: none; }
.zp-comments {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.zp-comments__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.zp-comments__heading h2 {
  margin: 0;
  font-size: 1.25rem;
}
.zp-comments__heading .section-kicker,
.zp-comments__countline,
.zp-comment-form__copy {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}
.zp-comments__feedback {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.zp-comment-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
.zp-comment-form__intro h3 { margin: 0; }
.zp-comment-form__row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.zp-comment-form__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}
.zp-comment-form__field input,
.zp-comment-form__field textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: var(--background);
  color: var(--foreground);
  font: inherit;
  resize: vertical;
}
.zp-comment-form__field input:focus,
.zp-comment-form__field textarea:focus {
  outline: 2px solid var(--link);
  outline-offset: 1px;
  border-color: transparent;
}
.zp-comment-form__field textarea { min-height: 8rem; }
.zp-comment-form__honeypot {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.zp-comment-form__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
.zp-comment-form__submit,
.zp-comments__load-more {
  width: fit-content;
  padding: 0.55rem 1.1rem;
  border: 0;
  border-radius: 0.375rem;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.875rem;
  font-weight: 500;
}
.zp-comment-form__submit:hover,
.zp-comments__load-more:hover { opacity: 0.88; }
.zp-comment-form__secondary,
.zp-comment__action {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted-foreground);
}
.zp-comment-form__secondary:hover,
.zp-comment__action:hover { color: var(--foreground); }
.zp-comments__list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.zp-comment {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.75rem;
}
.zp-comment__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-foreground);
  font-size: 0.75rem;
  font-weight: 500;
}
.zp-comment__body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}
.zp-comment__meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem;
}
.zp-comment__author { color: var(--foreground); }
.zp-comment__date {
  color: var(--muted-foreground);
  font-size: 0.75rem;
}
.zp-comment__content {
  overflow-wrap: anywhere;
  line-height: 1.6;
}
.zp-comment__actions {
  display: flex;
  gap: 0.75rem;
}
.zp-comment__replies {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 0.5rem;
  padding-left: 1rem;
  border-left: 1px solid var(--border);
}
.zp-comments__pagination { text-align: center; }
.zp-comments-empty,
.zp-comment-error,
.zp-comment-success {
  margin: 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.zp-comments-empty { color: var(--muted-foreground); }
.zp-comment-error { color: #b42318; }
.zp-comment-success { color: var(--foreground); }

@media (min-width: 640px) {
  .zp-comment-form__row { grid-template-columns: 1fr 1fr; }
}

/* === Article prose === */
.prose {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--foreground);
  max-width: 65ch;
}
.prose > * + * { margin-top: 1.25em; }
.prose h1 { font-family: var(--font-sans); font-size: 2.25rem; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; margin-top: 2em; }
.prose h2 { font-family: var(--font-sans); font-size: 1.6rem; font-weight: 600; line-height: 1.25; letter-spacing: -0.015em; margin-top: 2em; }
.prose h3 { font-family: var(--font-sans); font-size: 1.25rem; font-weight: 600; margin-top: 1.75em; }
.prose h4 { font-family: var(--font-sans); font-size: 1.05rem; font-weight: 600; margin-top: 1.5em; }
.prose p { margin-top: 1em; }
.prose a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose strong { font-weight: 600; color: var(--foreground); }
.prose em { font-style: italic; }
.prose blockquote {
  border-left: 3px solid var(--border);
  padding: 0.25em 0 0.25em 1.25em;
  color: var(--muted-foreground);
  font-style: italic;
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--muted);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}
.prose pre {
  font-family: var(--font-mono);
  background: var(--muted);
  padding: 1em 1.25em;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.6;
}
.prose pre code { background: transparent; padding: 0; font-size: 1em; }
.prose ul, .prose ol { padding-left: 1.5em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin-top: 0.4em; }
.prose hr { margin: 2.5em 0; }
.prose img { border-radius: 8px; }
.prose kbd {
  font-family: var(--font-mono);
  font-size: 0.85em;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.1em 0.4em;
  background: var(--muted);
}
.prose table { width: 100%; border-collapse: collapse; font-family: var(--font-sans); font-size: 0.95rem; }
.prose th, .prose td { border-bottom: 1px solid var(--border); padding: 0.6em 0.8em; text-align: left; }
.prose th { font-weight: 600; }

/* GFM task lists */
.prose .contains-task-list { list-style: none; padding-left: 0.25em; }
.prose .task-list-item { display: flex; gap: 0.5em; align-items: baseline; }
.prose .task-list-item-checkbox { transform: translateY(2px); }

/* GitHub alerts */
.prose .zp-alert {
  border-left: 3px solid var(--border);
  padding: 0.75em 1em;
  margin-top: 1.5em;
  background: var(--muted);
  border-radius: 0 6px 6px 0;
  font-style: normal;
  color: var(--foreground);
}
.prose .zp-alert__title {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 0.4em;
  color: var(--muted-foreground);
}
.prose .zp-alert--note { border-left-color: oklch(0.6 0.15 240); }
.prose .zp-alert--tip { border-left-color: oklch(0.65 0.15 150); }
.prose .zp-alert--important { border-left-color: oklch(0.6 0.18 290); }
.prose .zp-alert--warning { border-left-color: oklch(0.7 0.16 80); }
.prose .zp-alert--caution { border-left-color: oklch(0.6 0.2 25); }

@media (max-width: 480px) {
  .post-card__row { flex-direction: column; gap: 0.25rem; }
  .post__title { font-size: 1.75rem; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav__link--next { text-align: left; }
}
/* WordPress-compatible authored image alignment. */
.prose::after {
  display: table;
  clear: both;
  content: '';
}

.prose img.alignleft {
  float: left;
  margin: 0 1.5rem 1rem 0;
}

.prose img.aligncenter {
  display: block;
  clear: both;
  float: none;
  margin-right: auto;
  margin-left: auto;
}

.prose img.alignright {
  float: right;
  margin: 0 0 1rem 1.5rem;
}

@media (max-width: 640px) {
  .prose img.alignleft,
  .prose img.alignright {
    display: block;
    clear: both;
    float: none;
    margin-right: auto;
    margin-left: auto;
  }
}
