:root {
  --paper: #f8f6f1;
  --paper-bright: #ffffff;
  --paper-sunken: #f1eee6;
  --ink: #211f1b;
  --ink-body: #33302a;
  --ink-muted: #6a6255;
  --line: #e4dfd3;
  --line-strong: #d2caba;
  --accent: #b7391f;
  --accent-dark: #7c2412;
  --accent-soft: #fdf4f1;
  --link: #2c4a7c;
  --success: #2f7361;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  color-scheme: light;
}

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

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

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 78% 4%, rgba(246, 233, 204, 0.7), transparent 29rem),
    linear-gradient(180deg, #fcfbf8 0%, var(--paper) 20rem);
  color: var(--ink-body);
  font: 14px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-color: currentColor;
}

img,
svg {
  display: block;
  max-width: 100%;
}

.topbar {
  border-bottom: 1px solid var(--line);
  background: rgba(248, 246, 241, 0.92);
}

.topbar-inner,
.hero,
.document-nav,
.document-shell {
  width: min(calc(100% - 32px), 1040px);
  margin-inline: auto;
}

.topbar-inner {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font: 500 19px/1 var(--display);
  letter-spacing: -0.015em;
  text-decoration: none;
}

.back-link {
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.topbar-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.back-link:hover {
  color: var(--ink);
}

.page {
  min-height: calc(100vh - 130px);
  padding-bottom: 80px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding-block: 64px 40px;
}

.hero-copy {
  max-width: 680px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.intro {
  margin: 0;
  color: var(--ink);
  font: 400 clamp(25px, 3.5vw, 39px) / 1.28 var(--display);
  letter-spacing: -0.015em;
}

.source-link {
  display: inline-flex;
  min-height: 40px;
  flex: none;
  align-items: center;
  padding-inline: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--paper-bright);
  box-shadow: 0 1px 2px rgba(33, 31, 27, 0.06);
  color: var(--ink-body);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.source-link:hover {
  border-color: #b0a794;
  color: var(--ink);
}

.document-nav {
  display: flex;
  gap: 8px;
  padding-bottom: 24px;
  overflow-x: auto;
}

.document-link {
  display: inline-flex;
  min-height: 40px;
  flex: none;
  align-items: center;
  padding-inline: 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.document-link:hover {
  background: var(--paper-sunken);
  color: var(--ink);
}

.document-link-active {
  border-color: var(--line-strong);
  background: var(--paper-bright);
  box-shadow: 0 1px 0 rgba(33, 31, 27, 0.04);
  color: var(--accent-dark);
}

.document-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-bright);
  box-shadow: 0 1px 2px rgba(33, 31, 27, 0.06);
}

.mirror-note {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding-inline: clamp(20px, 6vw, 64px);
  border-bottom: 1px solid var(--line);
  background: var(--paper-sunken);
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 500;
}

.mirror-note code {
  color: var(--ink-body);
  font-family: var(--mono);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px #d9eae3;
}

.article {
  max-width: 82ch;
  margin-inline: auto;
  padding: clamp(32px, 7vw, 80px) clamp(20px, 7vw, 80px);
  color: var(--ink-body);
  font: 400 16px/1.68 var(--display);
}

.article > :first-child {
  margin-top: 0;
}

.article > :last-child {
  margin-bottom: 0;
}

.article h1,
.article h2,
.article h3,
.article h4 {
  color: var(--ink);
  scroll-margin-top: 24px;
}

.article h1 {
  margin: 0 0 40px;
  font: 400 clamp(34px, 5vw, 52px) / 1.06 var(--display);
  letter-spacing: -0.025em;
}

.article h2 {
  margin: 64px 0 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font: 400 clamp(25px, 4vw, 34px) / 1.12 var(--display);
}

.article h3 {
  margin: 40px 0 16px;
  font: 600 19px/1.28 var(--ui);
}

.article h4 {
  margin: 32px 0 12px;
  font: 600 16px/1.28 var(--ui);
}

.article p,
.article ul,
.article ol,
.article pre,
.article table,
.article blockquote {
  margin-top: 0;
  margin-bottom: 24px;
}

.article ul,
.article ol {
  padding-left: 24px;
}

.article li {
  margin-bottom: 8px;
  padding-left: 4px;
}

.article li::marker {
  color: var(--accent);
  font-family: var(--ui);
}

.article strong {
  color: var(--ink);
  font-weight: 600;
}

.article a {
  overflow-wrap: anywhere;
  font-weight: 500;
}

.article blockquote {
  padding: 16px 20px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  font-style: italic;
}

.article blockquote > :last-child {
  margin-bottom: 0;
}

.article code {
  padding: 0.12em 0.35em;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--paper-sunken);
  color: var(--ink);
  font: 0.8em/1.4 var(--mono);
}

.article pre {
  padding: 20px;
  overflow-x: auto;
  border-radius: 5px;
  background: var(--ink);
  color: var(--paper);
}

.article pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 13px;
}

.article table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
  border-collapse: collapse;
  font: 400 13px/1.5 var(--ui);
}

.article th,
.article td {
  min-width: 145px;
  padding: 12px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.article th {
  background: var(--paper-sunken);
  color: var(--ink);
  font-weight: 600;
}

.article tr:last-child td {
  border-bottom: 0;
}

.article th:last-child,
.article td:last-child {
  border-right: 0;
}

.article img {
  width: 100%;
  height: auto;
  margin: 32px 0 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(33, 31, 27, 0.08);
}

.footer {
  display: flex;
  width: min(calc(100% - 32px), 1200px);
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-inline: auto;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 12px;
}

@media (max-width: 700px) {
  .topbar-inner,
  .hero,
  .document-nav,
  .document-shell {
    width: min(calc(100% - 20px), 1040px);
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
    padding-block: 40px 32px;
  }

  .topbar-links {
    justify-content: flex-end;
    gap: 12px;
  }

  .back-link {
    text-align: right;
  }

  .article {
    font-size: 15px;
  }

  .article h2 {
    margin-top: 48px;
  }

  .footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding-block: 20px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .hero,
  .document-nav,
  .mirror-note,
  .footer {
    display: none;
  }

  .page {
    padding: 0;
  }

  .document-shell {
    width: 100%;
    border: 0;
    box-shadow: none;
  }

  .article {
    max-width: none;
    padding: 0;
  }
}
