:root {
  --bg: #faf7f2;
  --text: #2a2622;
  --muted: #6b635a;
  --accent: #b8442b;
  --rule: #e6dfd4;
  --serif: "Iowan Old Style", "Charter", "Georgia", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 680px;
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
}

.hero {
  text-align: center;
  margin-bottom: 3rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--rule);
}

.hero h1 {
  font-size: 3rem;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--muted);
  margin: 0 0 1rem;
}

.byline {
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 0;
}

.letter-salutation {
  margin: 0 0 1.25rem;
  font-style: italic;
  font-size: 1.05rem;
}

.intro {
  text-align: justify;
  hyphens: auto;
}

.intro p {
  margin: 0 0 1.25rem;
}

.signoff {
  margin-top: 2rem;
  font-style: italic;
}

.intro ul {
  margin: 1.25rem 0;
  padding-left: 1.25rem;
}

.intro li {
  margin-bottom: 0.6rem;
}

.toc {
  margin: 3.5rem -4rem;
  padding: 1.75rem 2rem;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 4px;
}

.toc a {
  white-space: nowrap;
}

@media (max-width: 800px) {
  .toc {
    margin-left: 0;
    margin-right: 0;
  }
  .toc a {
    white-space: normal;
  }
}

.toc h2 {
  font-size: 1.1rem;
  font-family: var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.25rem;
  font-weight: 600;
}

.toc ol {
  margin: 0;
  padding-left: 1.25rem;
}

.toc li {
  margin-bottom: 0.4rem;
}

.toc ul {
  list-style: none;
  margin: 0.5rem 0 0.75rem;
  padding-left: 0;
}

.toc ul li {
  margin-bottom: 0.3rem;
  font-size: 0.95rem;
  color: var(--muted);
  position: relative;
  padding-left: 1rem;
}

.toc ul li::before {
  content: "›";
  position: absolute;
  left: 0;
  color: var(--muted);
}

.toc ul a {
  color: var(--muted);
}

.toc-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.toc-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  transition: transform 0.15s, background 0.15s;
  line-height: 1;
}

.toc-toggle:hover {
  background: var(--rule);
  color: var(--text);
}

.toc-section.open .toc-toggle {
  transform: rotate(90deg);
}

.toc-sub {
  display: block;
}

.toc-section.open > .toc-sub {
  display: block;
}

.toc a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

/* Top-level main sections: ALL CAPS, BOLD, slightly bigger */
.toc > ol > li > a,
.toc > ol > li > .toc-row > a {
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  font-size: 1.15rem;
}

/* Second-level subsections: BOLD */
.toc > ol > li > .toc-sub > li > a,
.toc > ol > li > .toc-sub > li > .toc-row > a {
  font-weight: 700;
  color: var(--text);
}

.toc a:hover {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

article h2 {
  font-size: 2rem;
  margin: 4rem 0 1.5rem;
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.5rem;
}

article h3 {
  font-family: var(--sans);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 3rem 0 1.5rem;
  font-weight: 600;
}

.entry {
  margin: 2rem 0;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}

.entry:last-child {
  border-bottom: none;
}

.entry h4 {
  font-size: 1.4rem;
  margin: 0 0 1rem;
  letter-spacing: -0.01em;
  font-weight: 700;
}

.entry p {
  margin: 0 0 1rem;
}

.takeaway {
  font-weight: 700;
  font-size: 1.05rem;
  border-left: 3px solid var(--accent);
  padding: 0.25rem 0 0.25rem 1rem;
  margin: 1.25rem 0;
  line-height: 1.5;
}

.gear-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.gear-list li {
  margin-bottom: 1.25rem;
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
}

.gear-list a {
  font-weight: 600;
}

a {
  color: var(--accent);
}

.placeholder {
  color: var(--muted);
  font-style: italic;
}

footer {
  margin-top: 6rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

#back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: #fff;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  line-height: 1;
  z-index: 100;
}

#back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

#back-to-top:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
}

@media (max-width: 600px) {
  body { font-size: 17px; }
  main { padding: 2rem 1.25rem 4rem; }
  .hero h1 { font-size: 2.25rem; }
  article h2 { font-size: 1.6rem; }
}
