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

:root {
  --bg: #fdfcfa;
  --bg-subtle: #f7f6f3;
  --text: #1a1a1a;
  --text-dim: #767170;
  --text-mid: #5a5550;
  --accent: #8a7a5a;
  --border: #e8e6e1;
  --font: Garamond, 'Baskerville', 'Georgia', serif;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: normal;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout ── */

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header ── */

header {
  padding: 48px 0 40px;
}

.site-name {
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-name:hover {
  color: var(--accent);
  transition: color 0.2s ease;
}

/* ── Hero ── */

.hero {
  padding: 80px 0 64px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.hero-author {
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.hero-tagline {
  font-size: 15px;
  font-weight: normal;
  color: var(--text-mid);
  font-style: italic;
}

/* ── Sections ── */

.section-label {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 40px 0 0;
}

/* ── Book ── */

.book-block {
  padding: 24px 0 0;
}

.book-title {
  font-size: 20px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  line-height: 1.3;
}

.book-links {
  display: flex;
  gap: 24px;
  list-style: none;
}

.book-links a {
  font-size: 14px;
  font-weight: normal;
  color: var(--text-mid);
  text-decoration: none;
  transition: color 0.2s ease;
}

.book-links a:hover {
  color: var(--accent);
}

/* ── Essay list ── */

.essay-list {
  list-style: none;
}

.essay-year-group {
  display: contents;
}

.essay-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 0 24px;
  align-items: baseline;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}

.essay-row:hover .essay-title {
  color: var(--accent);
}

.essay-row:hover .essay-year {
  color: var(--text-mid);
}

.essay-year {
  font-size: 13px;
  font-weight: normal;
  color: var(--text-dim);
  letter-spacing: 0;
  padding-top: 2px;
  transition: color 0.15s ease;
}

.essay-year.hidden {
  visibility: hidden;
}

.essay-title {
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.01em;
  transition: color 0.15s ease;
  line-height: 1.5;
}

.essay-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-dim);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
  margin-left: 10px;
  vertical-align: middle;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  position: relative;
  top: -1px;
}

/* ── Essay page ── */

.essay-header {
  padding: 0 0 48px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 56px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.essay-meta {
  font-size: 13px;
  font-weight: normal;
  color: var(--text-dim);
  margin-bottom: 20px;
  letter-spacing: 0;
}

.essay-header h1 {
  font-size: 28px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.25;
}

/* ── Essay body ── */

.essay-body {
  max-width: 600px;
  margin: 0 auto;
}

.essay-body p {
  font-size: 16px;
  font-weight: normal;
  line-height: 1.75;
  color: var(--text);
  margin-bottom: 24px;
  letter-spacing: -0.005em;
}

.essay-body p:last-child {
  margin-bottom: 0;
}

.essay-body strong {
  font-weight: 500;
  color: var(--text);
}

.essay-body em {
  font-style: italic;
  color: var(--text-mid);
}

.essay-body blockquote {
  border-left: 2px solid var(--border);
  padding-left: 20px;
  margin: 32px 0;
  color: var(--text-mid);
  font-style: italic;
}

.essay-body blockquote p {
  color: var(--text-mid);
  margin-bottom: 0;
}

/* ── Footer ── */

footer {
  padding: 64px 0 48px;
  margin-top: 80px;
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-freely {
  font-size: 13px;
  font-weight: normal;
  color: var(--text-dim);
  font-style: italic;
}

.footer-links {
  display: flex;
  gap: 24px;
  list-style: none;
}

.footer-links a {
  font-size: 13px;
  font-weight: normal;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover,
.copy-email:hover {
  color: var(--text-mid);
}

/* ── Copy email ── */

.copy-email {
  position: relative;
  cursor: pointer;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  transition: color 0.2s ease;
}

.copy-tooltip,
.copy-confirm {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  white-space: nowrap;
  background: var(--text);
  color: var(--bg);
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  margin-bottom: 6px;
}

.copy-email:hover .copy-tooltip {
  opacity: 1;
}

.copy-email.copied .copy-tooltip {
  opacity: 0;
}

.copy-email.copied .copy-confirm {
  opacity: 1;
}

/* ── Back link ── */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: normal;
  color: var(--text-dim);
  text-decoration: none;
  margin-bottom: 16px;
  transition: color 0.2s ease;
  letter-spacing: 0;
}

.back-link:hover {
  color: var(--text-mid);
}

.back-link::before {
  content: '\2190';
  font-size: 13px;
}

/* ── Fade in ── */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.essay-list .essay-row {
  animation: fadeIn 0.4s ease both;
}

.essay-list .essay-row:nth-child(1) { animation-delay: 0.05s; }
.essay-list .essay-row:nth-child(2) { animation-delay: 0.09s; }
.essay-list .essay-row:nth-child(3) { animation-delay: 0.13s; }
.essay-list .essay-row:nth-child(4) { animation-delay: 0.17s; }
.essay-list .essay-row:nth-child(5) { animation-delay: 0.21s; }
.essay-list .essay-row:nth-child(6) { animation-delay: 0.25s; }
.essay-list .essay-row:nth-child(7) { animation-delay: 0.29s; }
.essay-list .essay-row:nth-child(8) { animation-delay: 0.33s; }

/* ── Responsive ── */

@media (max-width: 600px) {
  .essay-header h1 {
    font-size: 22px;
  }

  .essay-row {
    grid-template-columns: 44px 1fr;
    gap: 0 16px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .book-links {
    flex-direction: column;
    gap: 12px;
  }
}

/* ── Selection ── */

::selection {
  background: var(--accent);
  color: var(--bg);
}
