:root {
  --bg: #ffffff;
  --text: #1f2328;
  --muted: #5b6470;
  --line: #e3e6ea;
  --accent: #1f4e79;
  --note-bg: #f4f7fb;
  --note-line: #c9d7e8;
}

* { box-sizing: border-box; }

html { scroll-padding-top: 8rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.65;
  --lh: calc(18px * 1.65);
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header and tabs */
.site-header {
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  z-index: 10;
}

.site-header .wrap:first-child {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  padding-top: 1rem;
}

.site-name {
  margin: 0;
  font-weight: 600;
  font-size: 1.1rem;
}

.draft-tag {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.draft-tag::before {
  content: "— ";
}

.tabs {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  margin-top: 0.5rem;
  scrollbar-width: none;
}

.tabs a {
  flex: none;
  padding: 0.6rem 0.5rem;
  font-size: 0.92rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.tabs a:hover { color: var(--text); }

.tabs a[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* Content */
main.wrap { padding-top: 2rem; padding-bottom: 4rem; }

h1, h2, h3 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.3;
}

h1 { font-size: 1.9rem; margin: 0 0 1.25rem; }
h2 { font-size: 1.3rem; margin: 2.25rem 0 0.75rem; }
h3 { font-size: 1.05rem; margin: 0 0 0.25rem; }

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

.person {
  border-left: 3px solid var(--line);
  padding-left: 1rem;
  margin: 1.5rem 0;
}

.person p { margin-top: 0.25rem; }

.steps { padding-left: 1.4rem; }
.steps li { margin-bottom: 1rem; }

.cases { padding-left: 1.2rem; }
.cases li { margin-bottom: 1.25rem; }

.question {
  margin: 0.35rem 0 0;
  color: var(--accent);
  font-style: italic;
}

.format {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 1.25rem 0.5rem;
  margin: 1.5rem 0;
}

.format h2 { margin-top: 1.25rem; }

.subtitle {
  display: block;
  font-weight: 400;
  font-size: 0.95rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

dt {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

dd { margin: 0.15rem 0 1rem; }

/* Note for readers */
.reader-note {
  background: var(--note-bg);
  border: 1px solid var(--note-line);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.reader-note-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.reader-note p { margin: 0.6rem 0; }
.reader-note ul { margin: 0.25rem 0 0; padding-left: 1.2rem; }
.reader-note li { margin-bottom: 0.3rem; }

.note-close, .note-show {
  font: inherit;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.85rem;
  color: var(--accent);
  background: none;
  border: 1px solid var(--note-line);
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
}

.note-show { margin-bottom: 1.5rem; }

/* Paragraph numbers in the left margin */
section > p, section > ol, .cases > li, .person, .format { position: relative; }

.pnum {
  position: absolute;
  top: 0;
  left: -2.75rem;
  width: 2rem;
  text-align: right;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 12px;
  line-height: var(--lh);
  color: #a3aab3;
  user-select: none;
}

.cases > li > .pnum { left: calc(-2.75rem - 1.2rem); }
.format > .pnum { top: 1.25rem; left: calc(-2.75rem - 1px); line-height: 1.3; font-size: 12px; padding-top: 0.3em; }
.person > .pnum { line-height: 1.6; }

.reader-hint {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Closing questions */
.closing-note { margin-top: 2.5rem; }
.closing-note h2 { margin: 0 0 0.5rem; font-size: 1.1rem; }

/* Previous / next */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--line);
  margin-top: 3rem;
  padding-top: 1.25rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.95rem;
}

.pager a { text-decoration: none; }
.pager a[hidden] { display: block; visibility: hidden; }

/* Without room in the margin, make a narrow gutter for the numbers */
@media (max-width: 860px) {
  main.wrap { padding-left: 34px; }
  .pnum { left: -32px; width: 24px; }
  .cases > li > .pnum { left: calc(-32px - 1.2rem); }
  .format > .pnum { left: calc(-32px - 1px); }
}

@media (max-width: 600px) {
  body { font-size: 17px; --lh: calc(17px * 1.65); }
  h1 { font-size: 1.55rem; }
  .format { padding: 0 1rem 0.5rem; }
}
