:root {
  --paper: #f2ead9;
  --paper-light: #faf5e9;
  --paper-deep: #e7dcc3;
  --ink: #29200f;
  --ink-soft: #554936;
  --clay: #934626;
  --clay-dark: #713318;
  --moss: #455535;
  --rule: rgba(41, 32, 15, 0.24);
  color-scheme: light;
  font-family: Georgia, 'Times New Roman', serif;
  font-synthesis: none;
  line-height: 1.65;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; }
a { color: var(--clay-dark); text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
a:hover { color: var(--clay); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--clay); outline-offset: 4px; }

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 10;
  transform: translateY(-200%);
  background: var(--ink);
  color: var(--paper-light);
  padding: 0.7rem 1rem;
}
.skip-link:focus { transform: none; color: var(--paper-light); }

.site-header,
.site-footer,
.index-hero,
.post-grid,
.article-shell,
.related,
.not-found {
  width: min(1120px, calc(100% - 2.5rem));
  margin-inline: auto;
}

.site-header {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  border-bottom: 1px solid var(--rule);
}
.brand { display: inline-flex; }
.brand img { width: 171px; height: auto; display: block; }
.site-header nav,
.site-footer nav {
  display: flex;
  align-items: center;
  gap: clamp(0.8rem, 2vw, 1.6rem);
  font: 600 0.73rem/1.2 system-ui, sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.site-header nav a,
.site-footer nav a { color: var(--ink); text-decoration: none; }
.site-header nav a[aria-current='page'] { border-bottom: 1px solid currentColor; }
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  background: var(--clay);
  border: 1px solid var(--clay-dark);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--paper-light) !important;
  padding: 0.72rem 1rem;
  font: 700 0.72rem/1.2 system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}
.button-link:hover { background: var(--clay-dark); }

.index-hero {
  padding: clamp(4.5rem, 11vw, 9rem) 0 clamp(3rem, 7vw, 5rem);
  border-bottom: 3px double var(--rule);
}
.eyebrow {
  margin: 0 0 1rem;
  color: var(--clay-dark);
  font: 700 0.72rem/1.4 system-ui, sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.index-hero h1,
.article-header h1,
.not-found h1 {
  max-width: 900px;
  margin: 0;
  font-size: clamp(2.7rem, 8vw, 6.8rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.98;
  text-wrap: balance;
}
.index-hero > p:last-child {
  max-width: 650px;
  margin: 1.8rem 0 0;
  color: var(--ink-soft);
  font-size: clamp(1.15rem, 2vw, 1.4rem);
}

.post-grid { padding: 3.5rem 0 6rem; }
.section-title {
  margin: 0 0 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
  font: 700 0.72rem/1.4 system-ui, sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.post-card {
  display: grid;
  grid-template-columns: minmax(9rem, 0.4fr) minmax(0, 1.3fr) minmax(14rem, 0.8fr);
  gap: clamp(1rem, 4vw, 3rem);
  align-items: baseline;
  padding: 2rem 0;
  border-bottom: 1px solid var(--rule);
}
.post-card .eyebrow { margin: 0; }
.post-card h2,
.post-card h3 { margin: 0; font-size: clamp(1.4rem, 2.6vw, 2rem); line-height: 1.14; font-weight: 520; }
.post-card h2 a,
.post-card h3 a { color: var(--ink); text-decoration: none; }
.post-card h2 a:hover,
.post-card h3 a:hover { color: var(--clay-dark); text-decoration: underline; }
.post-card > p:not(.eyebrow) { margin: 0; color: var(--ink-soft); }
.post-meta,
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  color: var(--ink-soft);
  font: 500 0.72rem/1.5 system-ui, sans-serif;
  letter-spacing: 0.04em;
}
.post-card .post-meta { grid-column: 2 / -1; }

.article-shell { padding-top: clamp(3rem, 8vw, 6rem); }
.back-link {
  display: inline-block;
  margin-bottom: 4rem;
  font: 650 0.75rem/1.4 system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.article-header { max-width: 940px; }
.article-header h1 { font-size: clamp(2.5rem, 7vw, 5.8rem); }
.dek {
  max-width: 760px;
  margin: 1.7rem 0 1.5rem;
  color: var(--ink-soft);
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
}
.article-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 700px);
  gap: clamp(2.5rem, 7vw, 6rem);
  align-items: start;
  margin-top: clamp(3.5rem, 8vw, 6rem);
}
.toc {
  position: sticky;
  top: 1.5rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-soft);
}
.toc > p {
  font: 700 0.69rem/1.4 system-ui, sans-serif;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.toc ol { margin: 0; padding-left: 1.1rem; }
.toc li { margin: 0.6rem 0; font-size: 0.9rem; }
.toc a { color: var(--ink-soft); }

.article-body { min-width: 0; font-size: clamp(1.06rem, 1.8vw, 1.18rem); }
.article-body > p:first-child { font-size: 1.18em; }
.article-body h2,
.article-body h3,
.article-body h4 {
  scroll-margin-top: 1.5rem;
  line-height: 1.15;
  text-wrap: balance;
}
.article-body h2 { margin: 3.4rem 0 1rem; font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 520; }
.article-body h3 { margin: 2.5rem 0 0.8rem; font-size: 1.45rem; }
.article-body h4 { margin: 2rem 0 0.7rem; font: 700 0.9rem/1.4 system-ui, sans-serif; letter-spacing: 0.06em; text-transform: uppercase; }
.article-body p { margin: 0 0 1.35rem; }
.article-body ul,
.article-body ol { margin: 0 0 1.6rem; padding-left: 1.4rem; }
.article-body li { margin: 0.55rem 0; padding-left: 0.25rem; }
.article-body blockquote {
  margin: 2.4rem 0;
  padding: 1.4rem 0 0.2rem 1.6rem;
  border-left: 4px solid var(--clay);
  color: var(--ink-soft);
  font-size: 1.16em;
  font-style: italic;
}
.article-body code {
  background: var(--paper-deep);
  border-radius: 3px;
  padding: 0.12em 0.28em;
  font: 0.86em/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
}
.article-body pre {
  overflow-x: auto;
  margin: 2rem 0;
  padding: 1.2rem;
  background: var(--ink);
  color: var(--paper-light);
}
.article-body pre code { padding: 0; background: transparent; color: inherit; }
.article-body hr { border: 0; border-top: 3px double var(--rule); margin: 3rem 0; }

.flow { margin: 2.6rem 0; }
.flow ol {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2rem;
  padding: 0;
  list-style: none;
  counter-reset: flow-step;
}
.flow li {
  position: relative;
  min-height: 8rem;
  padding: 2.8rem 1rem 1rem;
  border: 1px solid var(--rule);
  background: var(--paper-light);
  counter-increment: flow-step;
  font-size: 0.92rem;
}
.flow li::before {
  content: counter(flow-step, decimal-leading-zero);
  position: absolute;
  top: 0.8rem;
  left: 1rem;
  color: var(--clay-dark);
  font: 700 0.68rem/1 system-ui, sans-serif;
  letter-spacing: 0.12em;
}
.flow li:not(:last-child)::after {
  content: '→';
  position: absolute;
  right: -1.55rem;
  top: 42%;
  color: var(--clay-dark);
  font-family: system-ui, sans-serif;
}
.flow figcaption {
  margin-top: 0.8rem;
  color: var(--ink-soft);
  font: 500 0.75rem/1.5 system-ui, sans-serif;
}

.article-end {
  max-width: 700px;
  margin: clamp(4rem, 10vw, 8rem) 0;
  padding: clamp(2rem, 5vw, 3.5rem);
  border: 1px solid var(--rule);
  background: var(--paper-light);
  box-shadow: 6px 6px 0 var(--paper-deep);
}
.article-end h2 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.7rem); font-weight: 520; }
.article-end > p:not(.eyebrow) { max-width: 34rem; color: var(--ink-soft); }

.related { padding: 4rem 0 6rem; border-top: 3px double var(--rule); }
.related > h2 { font: 700 0.72rem/1.4 system-ui, sans-serif; letter-spacing: 0.18em; text-transform: uppercase; }
.related-grid .post-card { grid-template-columns: minmax(8rem, 0.3fr) minmax(0, 1fr); }
.related-grid .post-card > p:not(.eyebrow) { grid-column: 2; }
.related-grid .post-card .post-meta { grid-column: 2; }

.not-found { min-height: 70vh; padding: clamp(6rem, 16vw, 11rem) 0; }
.not-found h1 { font-size: clamp(2.8rem, 7vw, 5.8rem); }
.not-found > p:not(.eyebrow) { margin: 1.4rem 0 2rem; color: var(--ink-soft); font-size: 1.2rem; }

.site-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem 2rem;
  align-items: center;
  padding: 2.5rem 0;
  border-top: 1px solid var(--rule);
  color: var(--ink-soft);
}
.site-footer p { margin: 0; }
.site-footer small { grid-column: 1 / -1; font: 500 0.7rem/1.4 system-ui, sans-serif; }

@media (max-width: 780px) {
  .site-header { align-items: flex-start; padding: 1rem 0; }
  .site-header nav { justify-content: flex-end; flex-wrap: wrap; }
  .site-header nav > a:not(.button-link) { display: none; }
  .brand img { width: 148px; }
  .post-card { grid-template-columns: 1fr; gap: 0.7rem; }
  .post-card .post-meta,
  .related-grid .post-card > p:not(.eyebrow),
  .related-grid .post-card .post-meta { grid-column: 1; }
  .article-layout { grid-template-columns: 1fr; }
  .toc { position: static; }
  .flow ol { grid-template-columns: 1fr; gap: 1rem; }
  .flow li { min-height: auto; }
  .flow li:not(:last-child)::after { content: '↓'; right: 50%; top: auto; bottom: -1.15rem; }
  .site-footer { grid-template-columns: 1fr; }
  .site-footer nav { flex-wrap: wrap; }
}

@media (max-width: 420px) {
  .site-header,
  .site-footer,
  .index-hero,
  .post-grid,
  .article-shell,
  .related,
  .not-found { width: min(100% - 1.5rem, 1120px); }
  .site-header .button-link { padding-inline: 0.75rem; }
  .article-header h1,
  .index-hero h1 { overflow-wrap: anywhere; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media print {
  .site-header,
  .site-footer,
  .toc,
  .related,
  .article-end,
  .skip-link { display: none; }
  body { background: #fff; color: #000; }
  .article-shell { width: 100%; padding: 0; }
  .article-layout { display: block; margin-top: 2rem; }
  a { color: inherit; }
}
