:root {
  --bg: #f6f4ee;
  --surface: #ffffff;
  --surface-2: #fbfaf5;
  --ink: #1c211c;
  --ink-soft: #4a5148;
  --muted: #7c8378;
  --line: #dedad0;
  --line-soft: #e8e4da;
  --accent: #33513c;
  --accent-strong: #274031;
  --accent-soft: #e4ebe2;
  --clay: #a5522f;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(28, 33, 28, 0.04), 0 1px 3px rgba(28, 33, 28, 0.06);
  --shadow-card: 0 2px 8px rgba(28, 33, 28, 0.06), 0 8px 24px rgba(28, 33, 28, 0.05);
  --content-width: 44rem;
  --page-width: 70rem;
  --sidebar-width: 17rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141713;
    --surface: #1b1f1a;
    --surface-2: #171b16;
    --ink: #eceae2;
    --ink-soft: #c3c9bc;
    --muted: #8a9184;
    --line: #2c3128;
    --line-soft: #242820;
    --accent: #8fb89a;
    --accent-strong: #a9ccb2;
    --accent-soft: #202920;
    --clay: #d98a63;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

.wrap { max-width: var(--content-width); margin: 0 auto; padding: 0 1.5rem; }
.page { max-width: var(--page-width); margin: 0 auto; padding: 0 1.5rem; }

/* ---------- Header / nav ---------- */
header.site {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
header.site .bar {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
header.site .brand {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
header.site nav {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}
header.site nav::-webkit-scrollbar { display: none; }
header.site nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
}
header.site nav a:hover,
header.site nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

main { padding: 2.75rem 0 4.5rem; }

/* ---------- Home / listing ---------- */
.hero { margin-bottom: 2.5rem; max-width: 46rem; }
.hero h1 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1.14;
  letter-spacing: -0.015em;
  margin: 0 0 0.6rem;
  text-wrap: balance;
}
.hero p.lede { font-size: 1.1rem; color: var(--ink-soft); max-width: 40rem; margin: 0; }

.section-label {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 1rem;
}

.featured {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.75rem;
  margin-bottom: 2.5rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.featured:hover { box-shadow: var(--shadow-card); transform: translateY(-2px); }
.featured h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  line-height: 1.2;
  margin: 0.5rem 0 0.6rem;
  color: var(--ink);
}
.featured p { margin: 0; color: var(--ink-soft); }

/* Explicit column counts (not auto-fill) so a full-width in-feed ad can
   reliably span the row with `grid-column: 1 / -1`. */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.4rem;
}
@media (min-width: 38rem) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 60rem) { .card-grid { grid-template-columns: repeat(3, 1fr); } }
.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.3rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.card:hover { box-shadow: var(--shadow-card); transform: translateY(-2px); }
.card h3 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  font-size: 1.22rem;
  line-height: 1.3;
  margin: 0.45rem 0 0.5rem;
  color: var(--ink);
}
.card p { margin: 0 0 1rem; color: var(--ink-soft); font-size: 0.96rem; flex: 1; }

.eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--clay);
  font-weight: 700;
}
.card-meta { font-size: 0.8rem; color: var(--muted); }

/* ---------- Article ---------- */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3rem;
}
@media (min-width: 62rem) {
  .article-layout { grid-template-columns: minmax(0, 1fr) var(--sidebar-width); }
}
.article-main { min-width: 0; max-width: var(--content-width); }

article.post h1 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  font-size: clamp(1.9rem, 4.5vw, 2.5rem);
  line-height: 1.18;
  letter-spacing: -0.01em;
  margin: 0.35rem 0 0.7rem;
  text-wrap: balance;
}
.article-meta {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1.75rem;
}
.article-meta .dot { opacity: 0.5; }
article.post .dek {
  font-size: 1.08rem;
  color: var(--ink-soft);
  margin: 0 0 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--line);
}

.toc { margin: 0 0 2rem; }
.toc > summary {
  cursor: pointer;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  list-style: none;
}
.toc > summary::-webkit-details-marker { display: none; }
.toc > summary::before { content: "▸ "; }
.toc[open] > summary::before { content: "▾ "; }
.toc ol { margin: 0.75rem 0 0; padding-left: 1.1rem; }
.toc li { margin: 0.3rem 0; }
.toc a { color: var(--ink-soft); text-decoration: none; }
.toc a:hover { color: var(--accent); text-decoration: underline; }

article.post .body h1 { display: none; }
article.post .body h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  font-size: 1.5rem;
  margin: 2.4rem 0 0.75rem;
  scroll-margin-top: 5rem;
}
article.post .body h3 { font-size: 1.15rem; font-weight: 700; margin: 1.85rem 0 0.6rem; scroll-margin-top: 5rem; }
article.post .body p { margin: 0 0 1.2rem; }
article.post .body ul, article.post .body ol { margin: 0 0 1.2rem; padding-left: 1.4rem; }
article.post .body li { margin-bottom: 0.45rem; }
article.post .body blockquote {
  margin: 1.6rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 3px solid var(--accent);
  color: var(--ink-soft);
  font-style: italic;
}
article.post .body strong { color: var(--ink); }

.tags { margin-top: 2.5rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tags .tag {
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-weight: 600;
}
.back-link { display: inline-block; margin-top: 2.5rem; font-weight: 600; }

/* ---------- Read next ---------- */
.read-next { margin-top: 3.5rem; padding-top: 2.5rem; border-top: 1px solid var(--line); }
.read-next h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  font-size: 1.4rem;
  margin: 0 0 1.25rem;
}

/* ---------- Sidebar ---------- */
.sidebar { display: flex; flex-direction: column; gap: 1.75rem; }
@media (min-width: 62rem) {
  .sidebar { position: sticky; top: 5rem; align-self: start; }
}
.sidebar-block { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 1.1rem 1.2rem; }
.sidebar-block h2 {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 0.8rem;
}
.sidebar-block ol, .sidebar-block ul { margin: 0; padding-left: 1.1rem; }
.sidebar-block li { margin: 0.45rem 0; }
.sidebar-block a { color: var(--ink-soft); text-decoration: none; font-size: 0.92rem; }
.sidebar-block a:hover { color: var(--accent); }
.sidebar .toc-desktop { display: none; }
@media (min-width: 62rem) {
  .toc-mobile { display: none; }
  .sidebar .toc-desktop { display: block; }
}

/* ---------- Ad slots ---------- */
.ad-slot {
  margin: 2.25rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}
.ad-slot::before {
  content: "Advertisement";
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.ad-slot .adsbygoogle { display: block; width: 100%; }
.ad-slot__placeholder {
  width: 100%;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.8rem;
}
.ad-slot--sidebar { margin: 0; }
.ad-slot--sidebar .ad-slot__placeholder { min-height: 240px; }
.ad-slot--infeed { grid-column: 1 / -1; }

/* ---------- Social ---------- */
.social-row { list-style: none; display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0; padding: 0; }
.social-row a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.social-row a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }

/* ---------- Footer ---------- */
footer.site { border-top: 1px solid var(--line); background: var(--surface-2); margin-top: 2rem; }
footer.site .inner {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 2.25rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 0.85rem;
}
footer.site .foot-left { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1.25rem; }
footer.site .inner nav { display: flex; flex-wrap: wrap; gap: 1rem; }
footer.site .inner a { color: var(--ink-soft); text-decoration: none; }
footer.site .inner a:hover { color: var(--accent); }
