:root {
  --bg: #fff8ea;
  --text: #3a3226;
  --muted: #a09480;
  --accent: #6b5b3e;
  --accent-hover: #d4a017;
  --border: #e8dcc8;
  --border-light: #f2e9d8;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  line-height: 1.7;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ── Site header ── */
.site-header {
  text-align: center;
  padding: 2.5rem 1rem 1rem;
}
.site-header img {
  width: 160px;
  height: auto;
  margin-bottom: 1rem;
}
.site-header .site-title {
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: lowercase;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.page-title {
  font-size: 1.15rem;
  font-weight: 500;
  color: #5a4e3e;
  padding: 0 1rem 1rem;
  text-align: center;
}

/* ── Footer ── */
.site-footer {
  text-align: center;
  padding: 2rem 1rem 2.5rem;
  max-width: 520px;
  margin: 1rem auto 0;
  font-size: 0.75rem;
  line-height: 1.6;
  color: #b0a48e;
}

/* ── Index listing ── */
.essay-list {
  max-width: 800px;
  margin: 0 auto;
  padding: 0.5rem 1rem 1rem;
}
.essay-list table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: normal;
}
.essay-list th {
  text-align: left;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.essay-list th:hover { color: var(--accent); }
.essay-list th .sort-arrow {
  font-size: 0.65rem;
  margin-left: 0.25rem;
  opacity: 0.4;
}
.essay-list th.sorted .sort-arrow { opacity: 1; }
.essay-list td {
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: baseline;
}
.essay-list td a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.essay-list td a svg {
  flex-shrink: 0;
  opacity: 0.5;
}
.essay-list td a:hover svg { opacity: 0.85; }
.essay-list td.date {
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.8rem;
}
.essay-list td.actions {
  white-space: nowrap;
  font-size: 0.8rem;
}
.essay-list td.actions a {
  color: var(--muted);
  gap: 0.3rem;
}
.essay-list td.actions a:hover { color: var(--accent-hover); }
.essay-list td.nav {
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.essay-list td.nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.essay-list td.nav a svg {
  flex-shrink: 0;
  opacity: 0.5;
}
.essay-list td.nav a:hover svg { opacity: 0.85; }

/* ── Essay page ── */
.essay {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
}
.essay-meta {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.essay-meta h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #3a3226;
  line-height: 1.35;
  margin-bottom: 0.5rem;
}
.essay-meta .byline {
  font-size: 0.85rem;
  color: var(--muted);
}
.essay-meta .byline time {
  margin-left: 0.5rem;
}

.essay-body p {
  margin-bottom: 1.15rem;
  font-size: 1rem;
}
.essay-body blockquote {
  border-left: 3px solid var(--border);
  padding: 0.25rem 0 0.25rem 1.25rem;
  margin: 1.25rem 0;
  color: #5a4e3e;
  font-style: italic;
}
.essay-body h2, .essay-body h3 {
  margin: 1.75rem 0 0.75rem;
  color: #3a3226;
}
.essay-body h2 { font-size: 1.25rem; }
.essay-body h3 { font-size: 1.1rem; }
.essay-body ul, .essay-body ol {
  margin: 0.75rem 0 1.15rem 1.5rem;
}
.essay-body li { margin-bottom: 0.35rem; }
.essay-body img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 1rem 0;
}
.essay-body sup { font-size: 0.75rem; }
.essay-body a { text-decoration: underline; text-underline-offset: 2px; }
.essay-body .footnote-ref a { text-decoration: none; }
.essay-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* Footnotes section at the end */
.essay-body .footnotes,
.essay-body section.footnotes {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: #5a4e3e;
}

.essay-actions {
  text-align: center;
  margin: 2rem 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.essay-actions a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0.75rem;
}
.essay-actions a:hover { color: var(--accent-hover); }
.essay-actions a svg { opacity: 0.6; }
.essay-actions a:hover svg { opacity: 1; }
