:root {
  --bg: #FBFAF9;
  --text: #1F2024;
  --muted: #7A7C84;
  --border: #E6E4E0;
  --accent: #1E7E5A;
  --code-bg: #F3F1EE;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Inter Tight", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --content-width: 720px;
  --wide-width: 1040px;
}

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

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.wrap {
  width: 100%;
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header / footer */

.preview-banner {
  background: #FFF4D6;
  color: #7A5A00;
  border-bottom: 1px solid #F1DFA6;
  text-align: center;
  font-size: 13px;
  padding: 8px 20px;
}

.site-header {
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 64px;
}

.site-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  color: var(--text);
  letter-spacing: -0.03em;
}

.site-title:hover {
  text-decoration: none;
  color: var(--accent);
}

.site-nav {
  display: flex;
  gap: 20px;
  font-size: 14px;
  font-weight: 500;
}

.site-nav a {
  color: var(--muted);
}

.site-nav a:hover {
  color: var(--text);
  text-decoration: none;
}

.site-main {
  padding: 48px 20px 80px;
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-top: 24px;
  padding-bottom: 24px;
}

.footer-left {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links a {
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--text);
}

/* Index / archives */

.index-header,
.archive-header {
  max-width: var(--content-width);
  margin: 0 auto 48px;
  text-align: left;
}

.index-title,
.archive-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
}

.index-description,
.archive-description {
  color: var(--muted);
  font-size: 16px;
  margin: 0;
}

.archive-kicker {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 8px;
}

.archive-count {
  color: var(--muted);
  font-size: 13px;
  margin: 12px 0 0;
}

.author-header .author-avatar-large {
  border-radius: 50%;
  margin-bottom: 16px;
}

.post-list {
  max-width: var(--content-width);
  margin: 0 auto;
  display: grid;
  gap: 40px;
}

.post-card {
  display: grid;
  gap: 16px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
}

.post-card:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.post-card-image img {
  border-radius: 6px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  width: 100%;
}

.post-card-tags,
.post-tags {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.post-card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
}

.post-card-title a {
  color: var(--text);
}

.post-card-title a:hover {
  color: var(--accent);
  text-decoration: none;
}

.post-card-excerpt {
  margin: 0 0 8px;
  color: #45474F;
}

.byline {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.byline a {
  color: var(--text);
  font-weight: 500;
}

.byline .dot {
  margin: 0 6px;
}

.byline .updated {
  color: var(--muted);
}

.empty {
  text-align: center;
  color: var(--muted);
}

.pagination {
  max-width: var(--content-width);
  margin: 48px auto 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}

.pagination-link:last-child {
  text-align: right;
}

.pagination-status {
  color: var(--muted);
  font-size: 13px;
}

/* Post */

.post {
  max-width: var(--content-width);
  margin: 0 auto;
}

.post-header {
  margin-bottom: 32px;
}

.post-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
}

.post-subtitle {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 21px;
  color: #45474F;
  margin: 0 0 16px;
  line-height: 1.45;
}

.post-feature {
  margin: 0 0 40px;
}

/* Table of contents: only rendered for posts with four or more sections */

.post-toc {
  margin: 0 0 40px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.5;
}

.post-toc-eyebrow {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.post-toc ol {
  margin: 0;
  padding-left: 1.5em;
}

.post-toc li + li {
  margin-top: 4px;
}

.post-toc a {
  color: var(--text);
}

.post-toc a:hover {
  color: var(--accent);
}

.post-feature img {
  border-radius: 6px;
  width: 100%;
}

.post-feature figcaption,
.post-content figcaption {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.post-content {
  font-size: 16px;
  line-height: 1.75;
}

.post-content > * + * {
  margin-top: 1.2em;
}

.post-content h2 {
  font-size: 21px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-top: 2.2em;
  margin-bottom: 0.6em;
}

.post-content h3 {
  font-size: 18px;
  font-weight: 600;
  margin-top: 1.8em;
  margin-bottom: 0.5em;
}

.post-content h4 {
  font-size: 16px;
  font-weight: 600;
  margin-top: 1.6em;
  margin-bottom: 0.4em;
}

.post-content p,
.post-content ul,
.post-content ol {
  margin-bottom: 0;
}

.post-content ul,
.post-content ol {
  padding-left: 1.4em;
}

.post-content li + li {
  margin-top: 0.4em;
}

.post-content a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(30, 126, 90, 0.35);
}

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

.post-content blockquote {
  margin: 1.6em 0;
  padding: 0 0 0 20px;
  border-left: 3px solid var(--accent);
  color: #45474F;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 20px;
  line-height: 1.5;
}

.post-content hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.4em auto;
  width: 120px;
}

.post-content img {
  border-radius: 6px;
  margin: 0 auto;
}

.post-content figure {
  margin: 2.4em 0;
}

.post-content figure img {
  width: 100%;
  border-radius: 6px;
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--code-bg);
  border-radius: 4px;
  padding: 0.12em 0.35em;
}

.post-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.6;
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* Tables: a scrolling block on phones, the full column width above that */

.post-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.5;
  display: block;
  overflow-x: auto;
}

@media (min-width: 641px) {
  .post-content table {
    display: table;
    overflow-x: visible;
  }
}

.post-content th,
.post-content td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}

.post-content th {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.post-content thead th {
  background: var(--code-bg);
}

.post-content tbody tr:nth-child(even) {
  background: #F8F7F5;
}

.post-content iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 0;
  border-radius: 6px;
}

/* Call to action: one bordered card, one filled button */

.post-cta {
  margin: 48px 0 0;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.post-cta-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

.post-cta-line {
  margin: 0 0 16px;
  color: #45474F;
}

.post-cta-actions {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.button-primary:hover {
  background: #196A4C;
  border-color: #196A4C;
  color: #fff;
}

.post-cta-secondary {
  color: var(--muted);
  font-size: 14px;
}

.post-cta-secondary:hover {
  color: var(--text);
}

/* FAQ and sources */

.post-faq {
  margin-top: 48px;
}

.post-faq h2,
.post-sources h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin: 0 0 0.6em;
}

.post-faq h3 {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  margin: 1.4em 0 0.4em;
}

.post-faq p {
  margin: 0;
  font-size: 16px;
  line-height: 1.75;
}

.post-sources {
  margin-top: 40px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.post-sources ol {
  margin: 0;
  padding-left: 1.5em;
}

.post-sources li {
  overflow-wrap: anywhere;
}

.post-sources li + li {
  margin-top: 6px;
}

.post-footer {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 24px;
}

.author-box {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.author-avatar {
  border-radius: 50%;
  flex: 0 0 auto;
  object-fit: cover;
}

.author-name {
  margin: 0 0 4px;
  font-weight: 600;
}

.author-name a {
  color: var(--text);
}

.author-bio {
  margin: 0 0 6px;
  color: #45474F;
  font-size: 14px;
}

.author-links {
  margin: 0;
  display: flex;
  gap: 14px;
  font-size: 13px;
}

.read-next {
  max-width: var(--content-width);
  margin: 72px auto 0;
  padding-top: 40px;
  border-top: 1px solid var(--border);
}

.section-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.03em;
  margin: 0 0 24px;
}

.read-next .post-card-title {
  font-size: 22px;
}

.not-found {
  max-width: var(--content-width);
  margin: 40px auto;
  text-align: center;
}

.button {
  display: inline-block;
  padding: 10px 18px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-weight: 500;
  font-size: 14px;
}

.button:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

/* Wide screens: figures step out of the text column to the wide width */

@media (min-width: 1100px) {
  .post-content figure {
    width: var(--wide-width);
    max-width: none;
    margin-left: calc((var(--content-width) - var(--wide-width)) / 2);
  }
}

@media (max-width: 640px) {
  .post-cta {
    padding: 20px;
  }

  .site-header-inner {
    height: auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .site-main {
    padding-top: 32px;
  }

  .index-title,
  .archive-title {
    font-size: 32px;
  }

  .post-title {
    font-size: 32px;
  }

  .post-card-title {
    font-size: 24px;
  }

  .pagination {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .pagination-link:last-child {
    text-align: center;
  }
}
