:root {
  color-scheme: light;
  --bg: #f7f4ed;
  --surface: #ffffff;
  --surface-soft: #f1eee6;
  --text: #17324d;
  --muted: #607080;
  --border: #d9d6ce;
  --accent: #bf5b3f;
  --accent-strong: #93442e;
  --code-bg: #17324d;
  --code-text: #e8edf7;
  --shadow: 0 18px 45px rgba(23, 32, 51, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.7;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration: underline;
}

.page-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 34px;
  max-width: 1220px;
  margin: 0 auto;
  padding: 36px 28px 56px;
}

.toc {
  position: sticky;
  top: 28px;
  align-self: start;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(23, 32, 51, 0.05);
}

.toc-title {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toc ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc a {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: #334155;
  font-size: 14px;
  line-height: 1.35;
}

.toc a:hover {
  background: var(--surface-soft);
  color: var(--accent-strong);
  text-decoration: none;
}

.document {
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  padding: 54px 58px 42px;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(135deg, rgba(191, 91, 63, 0.12), transparent 44%),
    linear-gradient(180deg, #ffffff, #f7f4ed);
}

.home-link {
  display: inline-block;
  margin-bottom: 38px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  max-width: 820px;
  margin: 0;
  color: var(--text);
  font-family: "Newsreader", Georgia, serif;
  font-size: 42px;
  line-height: 1.12;
  font-weight: 780;
}

.lead {
  max-width: 760px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.content {
  padding: 10px 58px 58px;
}

section {
  padding-top: 36px;
  scroll-margin-top: 24px;
}

.opening-section {
  margin-top: 30px;
  padding: 30px;
  background: linear-gradient(135deg, #f8e8e1, #f7f4ed 72%);
  border: 1px solid #e3b8a9;
  border-radius: var(--radius);
}

.opening-section h2 {
  color: var(--accent-strong);
}

.opening-section > p:nth-of-type(2) {
  margin: 20px 0;
}

.opening-section > p:nth-of-type(2) a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 9px 16px;
  color: #ffffff;
  background: var(--accent);
  border-radius: 6px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(191, 91, 63, 0.2);
}

.opening-section > p:nth-of-type(2) a:hover {
  background: var(--accent-strong);
  text-decoration: none;
}

.opening-section .image-frame {
  margin-bottom: 0;
  background: #ffffff;
}

h2 {
  margin: 0 0 14px;
  color: var(--text);
  font-family: "Newsreader", Georgia, serif;
  font-size: 25px;
  line-height: 1.25;
  font-weight: 740;
}

h3 {
  margin: 28px 0 10px;
  color: var(--text);
  font-size: 19px;
  line-height: 1.35;
  font-weight: 720;
}

h4 {
  margin: 24px 0 8px;
  color: var(--accent-strong);
  font-size: 15px;
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

p {
  margin: 0 0 16px;
  color: var(--text);
}

ul,
ol {
  margin: 0 0 20px;
  padding-left: 24px;
}

li + li {
  margin-top: 6px;
}

.checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.checklist li {
  margin: 0;
  padding: 12px 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: #263246;
  font-weight: 600;
}

.image-frame {
  margin: 22px 0 28px;
  overflow: hidden;
  background: #eef2f7;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 14px 34px rgba(23, 32, 51, 0.09);
}

.image-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.caption {
  margin: 0;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  background: #ffffff;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.94em;
}

p code,
td code {
  padding: 2px 5px;
  color: var(--accent-strong);
  background: #f8e8e1;
  border-radius: 5px;
}

pre {
  margin: 16px 0 22px;
  overflow-x: auto;
  background: var(--code-bg);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

pre code {
  display: block;
  padding: 18px 20px;
  color: var(--code-text);
  line-height: 1.6;
  white-space: pre;
}

table {
  width: 100%;
  margin: 16px 0 24px;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

th,
td {
  padding: 13px 15px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--text);
  background: var(--surface-soft);
  font-size: 14px;
  font-weight: 720;
}

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

blockquote {
  margin: 18px 0 24px;
  padding: 15px 16px;
  color: #2d3748;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-left: 4px solid #f97316;
  border-radius: var(--radius);
}

blockquote p {
  margin: 0;
}

.footer {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 940px) {
  .page-shell {
    display: block;
    padding: 18px;
  }

  .toc {
    position: static;
    margin-bottom: 18px;
  }

  .toc ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero,
  .content {
    padding-left: 28px;
    padding-right: 28px;
  }

  h1 {
    font-size: 34px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .page-shell {
    padding: 0;
  }

  .toc {
    margin: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .toc ul,
  .checklist {
    grid-template-columns: 1fr;
  }

  .document {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .hero {
    padding: 36px 22px 30px;
  }

  .home-link {
    margin-bottom: 28px;
  }

  .content {
    padding: 0 22px 40px;
  }

  .opening-section {
    margin-top: 22px;
    padding: 22px 18px;
  }

  h1 {
    font-size: 30px;
  }

  h2 {
    font-size: 22px;
  }
}
