:root {
  --bg: #f5f2ec;
  --bg2: #eceae3;
  --surface: #ffffff;
  --border: #d8d4cb;
  --text: #1a1916;
  --muted: #7a7567;
  --body: #3b3933;
  --teal: #1a6b72;
  --teal-light: #d0ebec;
  --amber: #c4760d;
  --mono: "DM Mono", monospace;
  --display: "Instrument Sans", sans-serif;
  --serif: "Lora", serif;
  --radius: 6px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.6;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

header {
  padding: 3.5rem 0 2.5rem;
  border-bottom: 1.5px solid var(--border);
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.25rem;
}

.header-text {
  flex: 1;
}

.subheadline {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.subheadline:empty {
  display: none;
}

.wordmark {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: 0.03em;
}

.wordmark .teal {
  color: var(--teal);
}

.controls {
  flex-shrink: 0;
}

.back-button {
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 0.4em 0.75em;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  color: var(--text);
  text-decoration: none;
  display: inline-block;
}

.back-button:hover {
  background: #e4e0d7;
}

.content-wrapper {
  margin-top: 1.5rem;
  padding: 0.4rem 0 0.2rem;
  color: var(--body)
}

.source {
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-family: var(--mono);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
  word-break: break-word;
}

.content h1,
.content h2,
.content h3,
.content h4,
.content h5,
.content h6 {
  font-family: var(--display);
  line-height: 1.3;
  margin-top: 1.4rem;
  margin-bottom: 0.6rem;
}

.content > :first-child {
  margin-top: 0;
}

.content p,
.content ul,
.content ol,
.content blockquote {
  color: var(--body);
  margin: 0.8rem 0;
}

.content ul,
.content ol {
  padding-left: 1.3rem;
}

.content li + li {
  margin-top: 0.2rem;
}

.content a {
  color: var(--teal);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--teal) 45%, transparent);
  text-underline-offset: 0.12em;
}

.content a:hover {
  text-decoration-color: var(--teal);
}

.content hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.2rem 0;
}

.content blockquote {
  border-left: 3px solid var(--teal-light);
  background: #faf9f6;
  padding: 0.65rem 0.9rem;
  border-radius: 4px;
}

.content pre {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem;
  overflow-x: auto;
  margin: 0.95rem 0;
}

.content code {
  font-family: var(--mono);
  font-size: 0.92rem;
}

.content :not(pre) > code {
  background: #f1eee7;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.06em 0.3em;
  font-size: 0.84em;
}

.content img {
  width: min(50%, 100%);
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: block;
  margin: 1rem auto;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.875rem;
}

.content th {
  background: var(--bg2);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
}

.content td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  color: var(--body);
}

.content tbody tr:hover {
  background: var(--bg2);
}

.index-list {
  list-style: none;
  padding: 0;
  margin-top: 1rem;
}

.index-list li {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  flex-wrap: wrap;
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--border);
}

.index-list a {
  font-family: var(--mono);
  text-decoration: none;
  color: var(--teal);
}

.index-list a:hover {
  text-decoration: underline;
}

.index-path {
  color: var(--muted);
  font-weight: normal;
}

.index-source {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.79rem;
}

footer {
  border-top: 1.5px solid var(--border);
  padding: 2rem 0;
  margin-top: 3rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-date:empty {
  display: none;
}

@media (max-width: 860px) {
  .container {
    padding: 0 1rem;
  }

  header {
    padding: 2rem 0 1.5rem;
    flex-direction: column;
    align-items: flex-start;
  }

  .content-wrapper {
    padding: 0.35rem 0 0.2rem;
  }
}
