:root {
  --bg: #faf7f2;
  --bg-alt: #f1ece3;
  --surface: #ffffff;
  --border: #e4dccd;
  --text: #1f1b14;
  --text-muted: #5c5345;
  --accent: #8a3a2a;
  --accent-hover: #6d2c1f;
  --link: #6d2c1f;
  --focus: #b0582a;
  --radius: 4px;
  --measure: 65ch;
  --max: 1140px;
  --gap: 1.25rem;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16130e;
    --bg-alt: #1f1b14;
    --surface: #1c1811;
    --border: #322c22;
    --text: #ece4d3;
    --text-muted: #a79a80;
    --accent: #d87a62;
    --accent-hover: #e89079;
    --link: #e89079;
    --focus: #e89079;
  }
}

* { box-sizing: border-box; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.15em;
}
a:hover { color: var(--accent-hover); }
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  line-height: 1.25;
  color: var(--text);
  margin: 2.2rem 0 0.85rem;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(1.9rem, 1.3rem + 2vw, 2.75rem); margin-top: 0.5rem; }
h2 { font-size: clamp(1.4rem, 1.1rem + 1vw, 1.85rem); }
h3 { font-size: 1.2rem; }

p, ul, ol { margin: 0 0 1.1rem; }
ul, ol { padding-left: 1.3rem; }
li { margin-bottom: 0.35rem; }

blockquote {
  margin: 1.5rem 0;
  padding: 0.3rem 1.1rem;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
  font-style: italic;
}

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

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -40px;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 0.9rem;
  z-index: 1000;
  border-radius: var(--radius);
  text-decoration: none;
}
.skip-link:focus { top: 0.5rem; }

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
}

.brand {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--accent); }
.brand .dot { color: var(--accent); }

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9rem;
}
.nav-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.main-nav ul {
  list-style: none;
  display: flex;
  gap: 1.4rem;
  margin: 0;
  padding: 0;
}
.main-nav a {
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.98rem;
  padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
}
.main-nav a:hover,
.main-nav a[aria-current="page"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; align-items: center; gap: 0.4rem; }
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1.25rem 1rem;
  }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; gap: 0.2rem; }
  .main-nav a {
    display: block;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
  }
  .main-nav li:last-child a { border-bottom: 0; }
}

main { display: block; }

.hero {
  padding: 3rem 0 2rem;
  background: linear-gradient(180deg, var(--bg-alt) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}
.hero .lede {
  font-size: 1.18rem;
  color: var(--text-muted);
  max-width: 60ch;
}

.page-head {
  padding: 2.4rem 0 1.4rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}
.page-head p.lede {
  font-size: 1.12rem;
  color: var(--text-muted);
  max-width: 65ch;
  margin-bottom: 0;
}

.prose {
  max-width: var(--measure);
}
.prose h2 { margin-top: 2.6rem; }
.prose h3 { margin-top: 1.8rem; }

article section { margin-bottom: 1.5rem; }

.breadcrumbs {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 1rem 0 0;
}
.breadcrumbs ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.breadcrumbs li::after {
  content: "›";
  margin-left: 0.3rem;
  color: var(--border);
}
.breadcrumbs li:last-child::after { content: ""; }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs [aria-current="page"] { color: var(--text); }

.grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  margin: 2rem 0 2.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem 1.3rem;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.card:hover { border-color: var(--accent); }
.card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.18rem;
}
.card h3 a {
  text-decoration: none;
  color: var(--text);
}
.card h3 a:hover { color: var(--accent); }
.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.98rem;
}
.card .meta {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.related {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 2rem 0;
  margin: 3rem 0 0;
}
.related h2 { margin-top: 0; }

.site-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  margin-top: 3.5rem;
  padding: 2.4rem 0 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.94rem;
  color: var(--text-muted);
}
.footer-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 1.8rem;
}
.footer-grid h4 {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  margin: 0 0 0.6rem;
}
.footer-grid ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-grid li { margin-bottom: 0.35rem; }
.footer-grid a {
  text-decoration: none;
  color: var(--text-muted);
}
.footer-grid a:hover { color: var(--accent); }

.footer-base {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.timeline {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 2rem;
  border-left: 2px solid var(--border);
}
.timeline li {
  padding: 0.25rem 0 0.75rem 1.1rem;
  position: relative;
  margin-bottom: 0.4rem;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 0.7rem;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
}
.timeline strong {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.sitemap-list {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin: 1.5rem 0 2.5rem;
}
.sitemap-list h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
}
.sitemap-list ul { list-style: none; padding: 0; margin: 0; }
.sitemap-list li { margin-bottom: 0.3rem; }

.meta-box {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin: 0 0 2rem;
  font-family: var(--font-sans);
  font-size: 0.93rem;
}
.meta-box dt {
  font-weight: 600;
  display: inline;
  color: var(--text);
}
.meta-box dd {
  display: inline;
  margin: 0 0 0 0.3rem;
  color: var(--text-muted);
}
.meta-box dd::after { content: "\A"; white-space: pre; }

.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin: 0 0 2rem;
  font-family: var(--font-sans);
  font-size: 0.94rem;
}
.toc h2 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-sans);
}
.toc ol { margin: 0; padding-left: 1.2rem; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }
