:root {
  --bg: #faf8f4;
  --fg: #1c1c1c;
  --muted: #6b6b6b;
  --accent: #1c1c1c;
  --border: #e3ddd2;
  --hover: #efeae0;
  --max-width: 38rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15140f;
    --fg: #ece7dd;
    --muted: #9a948a;
    --accent: #ece7dd;
    --border: #2a2823;
    --hover: #20201a;
  }
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.site-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.site-header h1 {
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 0.25rem;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-style: italic;
  font-size: 1rem;
}

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.85rem 0.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  letter-spacing: 0.02em;
  margin-bottom: -1px;
}

.tab:hover {
  color: var(--fg);
  background: var(--hover);
}

.tab[aria-selected="true"] {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.letter {
  min-height: 200px;
}

.letter p {
  margin: 0 0 1.25rem;
  text-align: justify;
  hyphens: auto;
}

.letter p:first-child {
  font-style: italic;
  color: var(--muted);
  text-align: left;
}

.letter a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

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

.loading, .error {
  color: var(--muted);
  text-align: center;
  font-style: italic;
}

.error {
  color: #b03a2e;
}

.site-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 480px) {
  html, body { font-size: 17px; }
  .container { padding: 2rem 1.25rem 3rem; }
  .site-header h1 { font-size: 1.6rem; }
  .letter p { text-align: left; }
}
