/* ── Reset ─────────────────────────────────────────────────────── */

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

/* ── Tokens ────────────────────────────────────────────────────── */

:root {
  --font-body: Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", monospace;
  --font-ui: system-ui, -apple-system, sans-serif;

  --color-bg: #fafaf8;
  --color-text: #1a1a1a;
  --color-text-muted: #555;
  --color-link: #1a5276;
  --color-link-hover: #0d3652;
  --color-border: #e0e0de;
  --color-code-bg: #f0f0ee;

  --width-content: 740px;
}

/* ── Document ──────────────────────────────────────────────────── */

html {
  font-size: 18px;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  max-width: var(--width-content);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ── Links ─────────────────────────────────────────────────────── */

a {
  color: var(--color-link);
  text-decoration: none;
}

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

/* ── Headings ──────────────────────────────────────────────────── */

h1,
h2,
h3,
h4 {
  font-family: var(--font-ui);
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

h1 {
  font-size: 1.8rem;
  margin-top: 0;
}

h2 {
  font-size: 1.4rem;
}

h3 {
  font-size: 1.15rem;
}

/* ── Prose ─────────────────────────────────────────────────────── */

p,
.paragraph p {
  margin-bottom: 1rem;
}

blockquote {
  border-left: 3px solid var(--color-border);
  padding-left: 1rem;
  color: var(--color-text-muted);
  margin: 1.5rem 0;
}

ul,
ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.3rem;
}

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

/* ── Code ──────────────────────────────────────────────────────── */

code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--color-code-bg);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
}

pre {
  background: var(--color-code-bg);
  padding: 1rem 1.2rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1.5rem 0;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
}

/* ── Tables ────────────────────────────────────────────────────── */

table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

th,
td {
  border: 1px solid var(--color-border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

th {
  font-family: var(--font-ui);
  font-weight: 600;
  background: var(--color-code-bg);
}

/* ── Images ────────────────────────────────────────────────────── */

img {
  max-width: 100%;
  height: auto;
}

/* ── Shared header ─────────────────────────────────────────────── */

.site-header {
  font-family: var(--font-ui);
  margin-bottom: 3rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.site-header a {
  color: var(--color-text);
  font-weight: 600;
  font-size: 1.1rem;
}

/* ── Responsive ────────────────────────────────────────────────── */

@media (max-width: 800px) {
  body {
    padding: 2rem 1.25rem 3rem;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 16px;
  }

  body {
    padding: 1.5rem 1rem 2.5rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  pre {
    padding: 0.75rem 1rem;
    border-radius: 0;
    margin-left: -1rem;
    margin-right: -1rem;
    width: calc(100% + 2rem);
  }

  table {
    font-size: 0.85rem;
  }

  th,
  td {
    padding: 0.4rem 0.5rem;
  }
}
