:root {
  --bg: #fbf6ec;
  --fg: #1a1a1a;
  --fg-strong: #000;
  --muted: #6b6357;
  --rule: #e6dec9;
  --accent: #1a1a1a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

@media (min-width: 720px) {
  html, body { font-size: 18px; }
}

#shell {
  position: fixed;
  inset: 0;
  overflow-x: hidden;
  overflow-y: hidden;
  background: var(--bg);
}

#track {
  position: relative;
  width: 100%;
  height: 100%;
}

.page {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
  transform: translateX(100%);
  transition: transform 250ms ease;
  will-change: transform;
}

.page.is-current {
  transform: translateX(0);
}
.page.is-prev {
  transform: translateX(-100%);
}

@media (prefers-reduced-motion: reduce) {
  .page { transition: none; }
}

.col {
  max-width: 680px;
  margin: 0 auto;
  padding: 56px 20px 120px;
}

@media (min-width: 720px) {
  .col { padding: 72px 32px 140px; }
}

.kicker {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 18px;
  font-weight: 600;
}

.page h1 {
  font-size: 1.6rem;
  line-height: 1.25;
  margin: 0 0 1.4em;
  font-weight: 800;
  color: var(--fg-strong);
  letter-spacing: -0.01em;
}

.page h2 {
  font-size: 1.15rem;
  line-height: 1.35;
  margin: 2em 0 0.6em;
  font-weight: 700;
  color: var(--fg-strong);
  letter-spacing: -0.005em;
}

.page h3 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 1.8em 0 0.6em;
  font-weight: 700;
  color: var(--fg-strong);
}

.page p {
  margin: 0 0 1.1em;
}

.page strong, .page b {
  font-weight: 700;
  letter-spacing: 0.005em;
  color: var(--fg-strong);
}

.page em, .page i { font-style: italic; }

.page a {
  color: var(--fg-strong);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.page hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.2em 0;
}

.page ul, .page ol {
  margin: 0 0 1.2em;
  padding-left: 1.4em;
}

.page li {
  margin-bottom: 0.5em;
}

.page blockquote {
  margin: 0 0 1.2em;
  padding: 0.2em 0 0.2em 1em;
  border-left: 3px solid var(--rule);
  color: var(--muted);
  font-style: italic;
}

.page code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  background: rgba(0,0,0,0.05);
  padding: 0.08em 0.32em;
  border-radius: 3px;
}

.page pre {
  background: rgba(0,0,0,0.04);
  padding: 14px 16px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.92em;
  line-height: 1.55;
  margin: 0 0 1.2em;
}

.page pre code {
  background: transparent;
  padding: 0;
}

.page .footnotes {
  margin-top: 3em;
  padding-top: 1.4em;
  border-top: 1px solid var(--rule);
  font-size: 0.88em;
  color: var(--muted);
}

.page .footnotes ol {
  padding-left: 1.2em;
}

.page .footnotes p {
  margin: 0 0 0.4em;
  display: inline;
}

.page sup a {
  text-decoration: none;
  font-weight: 700;
}

.katex-display {
  margin: 1.2em 0 !important;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0;
}

#progress {
  position: fixed;
  bottom: 14px;
  right: 16px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  pointer-events: none;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 3px;
  z-index: 10;
}

/* Hide pages not in transition area to avoid bleed */
.page:not(.is-current):not(.is-prev):not(.is-next) {
  visibility: hidden;
}
.page.is-next {
  transform: translateX(100%);
}
