:root {
  --bg: #faf6ef;
  --surface: #fffdf9;
  --fg: #201c17;
  --muted: #6f665b;
  --faint: #9c9184;
  --accent: #b8482e;
  --accent-soft: rgba(184, 72, 46, 0.09);
  --border: #e7ded1;
  --tag-bg: #f0e9dd;
  --max-width: 56rem;
  --wide: 68rem;
  --reading-width: 40rem;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Charter", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15120e;
    --surface: #1d1913;
    --fg: #ece4d8;
    --muted: #a89d8d;
    --faint: #6f6658;
    --accent: #e28a6c;
    --accent-soft: rgba(226, 138, 108, 0.13);
    --border: #2c2620;
    --tag-bg: #221d16;
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-soft); }

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

/* Compact header (post pages) */
.site-header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 1.5rem;
}
.site-title {
  display: inline-block;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}
.site-title:hover { color: var(--accent); }

/* Hero (homepage) */
.site-hero {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 4.5rem 1.5rem 3rem;
}
.hero-eyebrow {
  margin: 0 0 1.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hero-eyebrow a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}
.hero-eyebrow a:hover { color: var(--accent); }
.hero-heading {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.6rem, 6.5vw, 3.7rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--fg);
}
.hero-heading em {
  font-style: italic;
  color: var(--accent);
}
.hero-text {
  max-width: 34rem;
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.6;
}

/* Jump navigation between sections */
.section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 auto 2.5rem;
  padding: 0 1rem;
}
.section-nav a {
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.section-nav a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Home top: theme boards (left) + featured rail (right) */
.home-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16rem;
  gap: 2.25rem;
  margin-bottom: 3.5rem;
  padding: 0 1rem;
}
/* Main post feed (large blocks with intro text) */
.feed { display: flex; flex-direction: column; }
.feed-item { border-bottom: 1px solid var(--border); }
.feed-item-link {
  display: block;
  padding: 1.9rem 0;
  text-decoration: none;
  color: var(--fg);
}
.feed-item:first-child .feed-item-link { padding-top: 0; }
.feed-item-cat {
  display: inline-block;
  margin-bottom: 0.75rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.feed-item-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  transition: color 0.15s ease;
}
.feed-item-link:hover .feed-item-title { color: var(--accent); }
.feed-item-excerpt {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.6;
}
.feed-item-more {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
}
.feed-item-arrow {
  display: inline-block;
  margin-left: 0.35rem;
  transition: transform 0.18s ease;
}
.feed-item-link:hover .feed-item-arrow { transform: translateX(4px); }
.feed-empty { color: var(--muted); }

.featured-rail { align-self: start; }
.rail-label {
  margin: 0 0 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.featured-list { display: flex; flex-direction: column; }
.featured-item {
  display: block;
  padding: 0.95rem 0;
  border-top: 1px solid var(--border);
  text-decoration: none;
  color: var(--fg);
}
.featured-item:first-child { border-top: none; padding-top: 0; }
.featured-item-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.25;
  transition: color 0.15s ease;
}
.featured-item:hover .featured-item-title { color: var(--accent); }
.featured-item-excerpt {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .home-top { grid-template-columns: 1fr; gap: 2.5rem; }
}

/* Single post */
.post {
  max-width: var(--reading-width);
  margin: 1.5rem auto 4rem;
}
.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.post-title {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin: 0;
}

/* Tags */
.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1rem 0 0;
  padding: 0;
}
.tag {
  background: var(--tag-bg);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
}

/* Post body content */
.post-body {
  font-family: var(--serif);
  font-size: 1.2rem;
  line-height: 1.75;
}
.post-body > :first-child { margin-top: 0; }
.post-body p { margin: 0 0 1.4rem; }
.post-body h2 {
  font-family: var(--sans);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 2.75rem 0 1rem;
}
.post-body h3 {
  font-family: var(--sans);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 2rem 0 0.75rem;
}
.post-body ul, .post-body ol { padding-left: 1.4rem; margin: 0 0 1.4rem; }
.post-body li { margin: 0.35rem 0; }
.post-body img { max-width: 100%; height: auto; border-radius: 8px; }
.post-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}
.post-body pre {
  background: var(--tag-bg);
  padding: 1rem 1.2rem;
  border-radius: 10px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.6;
}
.post-body code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--tag-bg);
  padding: 0.12rem 0.4rem;
  border-radius: 5px;
}
.post-body pre code { background: none; padding: 0; font-size: inherit; }
.post-body blockquote {
  margin: 1.8rem 0;
  padding: 0.2rem 0 0.2rem 1.4rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}
.post-body blockquote p:last-child { margin-bottom: 0; }
.post-body .scorecard {
  margin: 0 0 1.6rem;
  overflow-x: auto;
}
.post-body table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.92rem;
  line-height: 1.45;
}
.post-body th,
.post-body td {
  text-align: left;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.post-body thead th {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
  border-bottom: 1px solid var(--fg);
}
.post-body tbody th {
  font-weight: 700;
  color: var(--fg);
  white-space: nowrap;
}
.post-body td strong { color: var(--accent); }
.post-body tbody tr:last-child th,
.post-body tbody tr:last-child td { border-bottom: none; }

.back {
  margin-top: 3.5rem;
  font-family: var(--sans);
  font-size: 0.95rem;
}
.back a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.back a:hover { text-decoration: underline; }

/* Footer */
.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3.5rem;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 0.85rem;
}
.site-footer-home { max-width: var(--wide); }
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 1rem;
}
.contact-links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}
.contact-links a:hover { color: var(--accent); }
.collab-note {
  margin: 0.4rem 0 0;
  color: var(--faint);
  font-size: 0.8rem;
}

@media (max-width: 640px) {
  body { font-size: 17px; }
  .post-title { font-size: 2rem; }
  .post-body { font-size: 1.12rem; }
  .site-header { padding-top: 2.5rem; }
}
