:root {
  --paper: #f7f5ef;
  --ink: #171714;
  --muted: #6e6d67;
  --hairline: rgba(23, 23, 20, 0.18);
  --link: #171714;
  --measure: 708px;
}

html[data-theme="dark"] {
  --paper: #1e1f1c;
  --ink: #f2efe6;
  --muted: #aaa79e;
  --hairline: rgba(242, 239, 230, 0.18);
  --link: #f2efe6;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', Times, serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 140ms ease, color 140ms ease;
}

::selection { background: rgba(215, 119, 87, .24); }

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover { text-decoration-thickness: 2px; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.page-shell {
  width: min(calc(100% - 48px), 760px);
  margin: 0 auto;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 22px 0 14px;
  font-size: 16px;
}

.site-name {
  flex: 0 0 auto;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  letter-spacing: -0.022em;
}

.header-actions,
.site-nav {
  display: flex;
  align-items: center;
}

.header-actions { gap: 0; }
.site-nav { gap: 18px; font-size: 15px; }
.site-nav a { text-decoration: none; }
.site-nav a:hover { text-decoration: underline; }

.theme-toggle {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0 0 0 24px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: none;
  color: inherit;
  cursor: pointer;
  flex: 0 0 auto;
}

.toggle-track {
  position: relative;
  width: 30px;
  height: 17px;
  border: 1px solid currentColor;
  border-radius: 999px;
  display: block;
}

.toggle-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: currentColor;
  transition: transform 150ms ease;
}

html[data-theme="dark"] .toggle-dot { transform: translateX(13px); }

.essay { padding: 50px 0 84px; }
.essay-header { margin-bottom: 44px; }

h1 {
  margin: 0;
  max-width: 690px;
  font-size: clamp(48px, 8vw, 72px);
  line-height: 0.99;
  letter-spacing: -0.045em;
  font-weight: 700;
}

.date {
  margin: 38px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.prose {
  max-width: var(--measure);
  font-size: 19px;
  line-height: 1.48;
  letter-spacing: -0.006em;
}

.prose p { margin: 0 0 24px; }
.prose .opening { font-size: 21px; }
.prose strong { font-weight: 700; }

h2 {
  margin: 58px 0 20px;
  font-size: 31px;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.method-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--hairline);
  border-left: 1px solid var(--hairline);
  margin: 30px 0 32px;
}

.method-grid--population { margin-bottom: 24px; }
.method-transition { margin: 0 0 24px !important; }
.method-grid--convention { margin-top: 0; }

.method-item {
  padding: 22px 22px 20px;
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}

.method-item h3 {
  margin: 0 0 10px;
  font-size: 19px;
  line-height: 1.15;
  letter-spacing: -0.012em;
}

.method-item p {
  margin: 0;
  font-size: 16px;
  line-height: 1.48;
}

.method-item.exit-item { grid-column: 1 / -1; }

.question-list {
  margin: 6px 0 10px;
  border-top: 1px solid var(--hairline);
}

.question-list p {
  margin: 0;
  padding: 18px 0 19px;
  border-bottom: 1px solid var(--hairline);
  font-size: 17px;
  line-height: 1.32;
  letter-spacing: -0.015em;
}

.artist-link { margin-top: 30px !important; }
.artist-link a { overflow-wrap: anywhere; }

footer {
  border-top: 1px solid var(--hairline);
  padding: 20px 0 42px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 620px) {
  .page-shell { width: min(calc(100% - 34px), 760px); }
  .site-header { padding-top: 14px; gap: 14px; }
  .site-name { font-size: 21px; }
  .site-nav { gap: 12px; font-size: 14px; }
  .theme-toggle { margin-left: 12px; }
  .essay { padding-top: 34px; padding-bottom: 68px; }
  .essay-header { margin-bottom: 36px; }
  h1 { font-size: clamp(44px, 14vw, 62px); }
  .date { margin-top: 30px; }
  .prose { font-size: 18px; line-height: 1.5; }
  .prose .opening { font-size: 19px; }
  h2 { font-size: 28px; margin-top: 50px; }
  .method-grid { grid-template-columns: 1fr; }
  .method-item { padding: 19px 18px 18px; }
  .method-item.exit-item { grid-column: auto; }
  .question-list p { font-size: 17px; }
}

@media (max-width: 470px) {
  .page-shell { width: calc(100% - 30px); }
  .site-header {
    align-items: flex-start;
    flex-wrap: wrap;
    padding-bottom: 8px;
  }
  .header-actions {
    width: 100%;
    min-width: 0;
  }
  .site-nav {
    gap: 16px;
    font-size: 14px;
    min-width: 0;
  }
  .theme-toggle {
    margin-left: auto;
    transform: translateX(7px);
  }
  .essay { padding-top: 30px; }
  h1 { font-size: clamp(43px, 13.5vw, 58px); }
  footer { flex-direction: column; gap: 6px; }
}

@media (max-width: 350px) {
  .site-nav { gap: 11px; font-size: 13px; }
  .theme-toggle { transform: translateX(6px); }
  h1 { font-size: 42px; }
  .question-list p { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body, .toggle-dot { transition: none; }
}
