:root {
  --bg: #eef1f5;
  --surface: #e2e7ee;
  --ink: #18212d;
  --muted: #5c6878;
  --accent: #2b55e6;
  --rule: #c9d1dc;
  --code-bg: #dde3ec;

  --font-head: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --measure: 40rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141a22;
    --surface: #1d2531;
    --ink: #e6ebf2;
    --muted: #93a0b2;
    --accent: #7c9bff;
    --rule: #2c3644;
    --code-bg: #1d2531;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.7;
  padding: 0 1.25rem;
}

a { color: var(--accent); text-underline-offset: 0.2em; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.site-header,
main,
.site-footer {
  max-width: var(--measure);
  margin-inline: auto;
}

/* Шапка */
.site-header { padding: 3.5rem 0 2.5rem; }

.logo {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(2.75rem, 10vw, 4.5rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--ink);
  text-decoration: none;
}
.logo span { color: var(--accent); }

.tagline {
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-style: italic;
}

/* Список записей */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
}
.post-list li { border-bottom: 1px solid var(--rule); }

.post-list a {
  display: block;
  padding: 1.6rem 0.75rem;
  margin-inline: -0.75rem;
  color: inherit;
  text-decoration: none;
  border-radius: 6px;
  transition: background-color 0.15s;
}
.post-list a:hover,
.post-list a:focus-visible { background: var(--surface); }

.post-list h2 {
  margin: 0.15rem 0 0.35rem;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.6rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.post-list a:hover h2 { color: var(--accent); }
.post-list p { margin: 0; color: var(--muted); }

time {
  font-size: 0.9rem;
  color: var(--muted);
}

/* Страница записи */
.back {
  display: inline-block;
  margin-bottom: 2rem;
  font-size: 0.95rem;
  text-decoration: none;
}
.back:hover { text-decoration: underline; }

.post h1 {
  margin: 0.25rem 0 2rem;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

/* Содержимое markdown */
.prose > * { margin: 0 0 1.25em; }
.prose > :last-child { margin-bottom: 0; }

.prose h2, .prose h3 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-top: 2.2em;
}
.prose h2 { font-size: 1.6rem; }
.prose h3 { font-size: 1.25rem; }

.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.35em; }

.prose blockquote {
  margin-inline: 0;
  padding: 0.1em 0 0.1em 1.2em;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}

.prose img { max-width: 100%; height: auto; border-radius: 6px; }

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

.prose code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 4px;
}
.prose pre {
  background: var(--code-bg);
  padding: 1rem 1.1rem;
  border-radius: 6px;
  overflow-x: auto;
  line-height: 1.5;
}
.prose pre code { background: none; padding: 0; font-size: 0.875rem; }

.prose table { border-collapse: collapse; width: 100%; font-size: 0.95em; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 0.5em 0.8em; border-bottom: 1px solid var(--rule); }
.prose th { font-family: var(--font-head); font-weight: 600; }

/* Служебное */
.status { color: var(--muted); }

.site-footer {
  margin-top: 5rem;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer p { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}