/* Plain CSS, system fonts, no third-party anything. Light and dark from prefers-color-scheme. */
:root {
  color-scheme: light dark;
  --bg: #fdfdfc;
  --surface: #f4f5f6;
  --text: #1d2125;
  --muted: #566069;
  --link: #0b57b0;
  --link-hover: #083f80;
  --border: #dfe2e6;
  --accent: #0b57b0;
  --on-accent: #ffffff;
  --pill-bg: #e8eef7;
  --pill-text: #1c3f73;
  --code-bg: #f1f2f4;
  --ok-bg: #e7f5ea;
  --ok-text: #14532d;
  --err-bg: #fdecea;
  --err-text: #7a1c12;
  --focus: #b45309;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --surface: #1c2024;
    --text: #e6e8ea;
    --muted: #a3acb4;
    --link: #8ab4f8;
    --link-hover: #b3cdfa;
    --border: #2d333a;
    --accent: #8ab4f8;
    --on-accent: #0c1116;
    --pill-bg: #25303f;
    --pill-text: #c4d8f7;
    --code-bg: #1d2227;
    --ok-bg: #16301f;
    --ok-text: #b7e4c2;
    --err-bg: #3a1c19;
    --err-text: #f6c7c1;
    --focus: #fbbf24;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

.wrap {
  max-width: 68ch;
  margin: 0 auto;
  padding: 0 1rem;
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

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

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  background: var(--accent);
  color: var(--on-accent);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  z-index: 10;
}

.skip:focus {
  top: 0.5rem;
}

/* header and footer */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 0;
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1.25rem;
}

.brand {
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
}

.brand:hover {
  color: var(--text);
  text-decoration: underline;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  font-size: 0.95rem;
}

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

.site-header nav a:hover {
  color: var(--text);
  text-decoration: underline;
}

main.wrap {
  padding-top: 1.75rem;
  padding-bottom: 3rem;
  min-height: 60vh;
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9375rem;
  padding: 1.25rem 0 2rem;
}

.site-footer p {
  margin: 0;
}

/* headings and text */
h1,
h2,
h3 {
  line-height: 1.25;
  margin: 2rem 0 0.6rem;
}

h1 {
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  margin-top: 0;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.45rem;
}

h3 {
  font-size: 1.2rem;
}

p,
ul,
ol,
blockquote,
pre,
figure {
  margin: 0 0 1.1rem;
}

.page-title {
  margin-bottom: 0.5rem;
}

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

.meta {
  font-size: 0.9375rem;
  margin: 0.25rem 0 0.75rem;
}

/* tag pills */
.pills {
  display: inline-flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.pill {
  display: inline-block;
  background: var(--pill-bg);
  color: var(--pill-text);
  font-size: 0.8125rem;
  line-height: 1.5;
  padding: 0.05rem 0.65rem;
  border-radius: 999px;
  text-decoration: none;
}

.pill:hover {
  color: var(--pill-text);
  text-decoration: underline;
}

/* post list */
.cards {
  display: grid;
  gap: 1.75rem;
}

.card {
  display: grid;
  gap: 0.9rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.card:last-child {
  border-bottom: 0;
}

.card h2 {
  margin: 0;
  font-size: 1.35rem;
}

.card h2 a {
  color: var(--text);
  text-decoration: none;
}

.card h2 a:hover {
  text-decoration: underline;
}

.card .summary {
  margin: 0;
}

.card .meta {
  margin: 0.2rem 0 0.5rem;
}

.thumb img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 14rem;
  object-fit: cover;
  border-radius: 6px;
  background: var(--surface);
}

@media (min-width: 40rem) {
  .card.has-thumb {
    grid-template-columns: 9rem 1fr;
    align-items: start;
  }

  .thumb img {
    height: 7rem;
  }
}

.pager,
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  font-size: 0.9375rem;
}

.pager span:nth-child(2) {
  color: var(--muted);
}

.post-nav {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

.post-nav a {
  display: block;
  max-width: 48%;
  text-decoration: none;
}

.post-nav a span {
  display: block;
  color: var(--muted);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.post-nav a[rel="next"] {
  margin-left: auto;
  text-align: right;
}

/* post body */
.prose img {
  max-width: 100%;
  height: auto;
}

.cover,
.prose figure {
  margin-left: 0;
  margin-right: 0;
}

.cover img,
.prose figure img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  background: var(--surface);
}

figcaption {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.4rem;
}

blockquote {
  border-left: 4px solid var(--border);
  padding: 0.1rem 0 0.1rem 1rem;
  color: var(--muted);
}

blockquote p:last-child {
  margin-bottom: 0;
}

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

code,
pre {
  font-family: var(--mono);
  font-size: 0.9rem;
}

code {
  background: var(--code-bg);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  line-height: 1.5;
  tab-size: 4;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

pre:focus-visible {
  outline-offset: 0;
}

/* comments */
.comments {
  margin-top: 3rem;
  border-top: 1px solid var(--border);
}

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

.comment {
  background: var(--surface);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.9rem;
}

.comment p {
  margin: 0 0 0.6rem;
}

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

.comment-head {
  color: var(--muted);
  font-size: 0.9375rem;
}

.comment-head strong {
  color: var(--text);
}

/* status messages: hidden until the redirect lands on their #id (no JavaScript) */
.notice {
  display: none;
  padding: 0.7rem 1rem;
  border-radius: 6px;
  font-weight: 600;
}

.notice:target {
  display: block;
}

.notice.ok {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.notice.err {
  background: var(--err-bg);
  color: var(--err-text);
}

.comment-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.comment-form input[type="text"],
.comment-form textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--muted);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
}

.comment-form textarea {
  resize: vertical;
  min-height: 8rem;
}

.comment-form button {
  font: inherit;
  font-weight: 600;
  color: var(--on-accent);
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  padding: 0.6rem 1.25rem;
  cursor: pointer;
}

.comment-form button:hover {
  filter: brightness(1.1);
}

.form-note {
  color: var(--muted);
  font-size: 0.9375rem;
}

/* honeypot: off-screen, still labelled for screen readers */
.hp {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}

@media print {
  .site-header nav,
  .comment-form,
  .post-nav,
  .skip {
    display: none;
  }
}
