:root {
  --paper: #fffdf9;
  --ink: #28292d;
  --soft-ink: #3d4248;
  --muted: #737b84;
  --muted-light: #9299a1;
  --line: #e2ded5;
  --accent: #168878;
  --accent-soft: #e8f5f1;
  --green-bg: #eef8ee;
  --green-line: #33b249;
  --blue-bg: #edf6ff;
  --blue-line: #3b8fe8;
  --amber-bg: #fff7e5;
  --amber-line: #d89a19;
  --code-bg: #f3f0e9;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0 auto;
  max-width: none;
  padding: 42px 42px 78px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.72;
  display: grid;
  grid-template-columns: minmax(230px, 310px) minmax(0, 820px);
  column-gap: 62px;
  align-items: start;
  justify-content: center;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body > nav#TOC {
  grid-column: 1;
  grid-row: 1 / span 999;
  width: 100%;
  max-height: calc(100vh - 70px);
  overflow: auto;
  position: sticky;
  top: 34px;
  padding: 4px 24px 28px 0;
  margin: 0;
  border-right: 1px solid var(--line);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.38;
  scrollbar-width: thin;
  scrollbar-color: #cfc9bd transparent;
}

body > nav#TOC::before {
  content: "CONTENTS";
  display: block;
  margin: 0 0 12px 0;
  color: #56606b;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

nav#TOC ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

nav#TOC ul ul {
  padding-left: 18px;
}

nav#TOC a {
  color: var(--muted);
  display: block;
  padding: 3px 0 4px 14px;
  border-left: 3px solid transparent;
  text-decoration: none;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

nav#TOC a:hover,
nav#TOC a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

nav#TOC a.active {
  font-weight: 700;
  background: linear-gradient(90deg, var(--accent-soft), transparent 70%);
}

nav#TOC li {
  margin: 1px 0;
}

body > :not(nav#TOC) {
  grid-column: 2;
  width: 100%;
  max-width: 820px;
  min-width: 0;
}

#title-block-header {
  margin: 0 0 46px;
}

h1, h2, h3 {
  line-height: 1.1;
  letter-spacing: 0;
  font-family: var(--serif);
}

h1 {
  font-size: clamp(4rem, 7.2vw, 6.15rem);
  margin: 0 0 18px;
  font-weight: 800;
  letter-spacing: 0;
  color: #24252a;
}

.subtitle {
  margin: 0 0 36px;
  color: #666c73;
  font-style: italic;
  font-size: 1.45rem;
  line-height: 1.2;
}

.author,
.date {
  display: inline-block;
  width: min(46%, 300px);
  margin: 0 0 4px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.45;
}

.author::before,
.date::before {
  display: block;
  margin-bottom: 4px;
  color: var(--muted-light);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.author::before {
  content: "AUTHOR";
}

.date::before {
  content: "MODIFIED";
}

h2 {
  clear: none;
  font-size: 2.35rem;
  margin: 3.5rem 0 1.05rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--line);
  color: #303238;
}

h3 {
  font-size: 1.28rem;
  margin-top: 2rem;
  color: #3a3d43;
}

p, li {
  color: var(--ink);
}

p {
  margin: 0 0 1.35rem;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.13em;
}

code {
  background: var(--code-bg);
  border-radius: 4px;
  padding: 0.05rem 0.25rem;
  font-size: 0.9em;
}

.key-idea,
.source-grounding,
.paper-capsule {
  border: 1px solid var(--line);
  border-left-width: 6px;
  border-radius: 8px;
  margin: 1.45rem 0 2.05rem;
  overflow: hidden;
  background: #fffefa;
}

.key-idea {
  border-left-color: var(--green-line);
}

.source-grounding {
  border-left-color: var(--blue-line);
}

.paper-capsule {
  border-left-color: var(--amber-line);
}

.box-title {
  padding: 0.42rem 0.85rem;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.98rem;
}

.key-idea .box-title {
  background: var(--green-bg);
}

.source-grounding .box-title {
  background: var(--blue-bg);
}

.paper-capsule .box-title {
  background: var(--amber-bg);
}

.key-idea p,
.source-grounding p,
.paper-capsule p,
.source-grounding ul {
  padding: 0 0.95rem;
}

.source-grounding ul {
  margin-top: 0.75rem;
  padding-left: 2rem;
}

.paper-capsule p {
  margin: 0.8rem 0;
}

.references {
  font-size: 0.9rem;
}

@media (max-width: 980px) {
  body {
    padding: 24px 18px 52px;
    font-size: 18px;
    display: block;
    max-width: 820px;
  }

  body > nav#TOC {
    position: static;
    width: auto;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--line);
    margin: 0 0 24px;
    padding: 0 0 18px;
  }

  h1 {
    font-size: 3.15rem;
  }

  h2 {
    font-size: 2.1rem;
  }
}
