:root {
  --ink: #101316;
  --paper: #f3f0e9;
  --paper-deep: #e6e0d4;
  --muted: #6c716f;
  --line: rgba(16, 19, 22, 0.16);
  --accent: #d6632d;
  --accent-deep: #9d3f1f;
  --signal: #9cab55;
  --shadow: 0 22px 60px rgba(16, 19, 22, 0.12);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 4%, rgba(214, 99, 45, 0.14), transparent 25rem),
    linear-gradient(120deg, rgba(156, 171, 85, 0.08), transparent 32rem), var(--paper);
  font-family: 'Avenir Next', 'Segoe UI', sans-serif;
  line-height: 1.65;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.24;
  background-image:
    linear-gradient(rgba(16, 19, 22, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 19, 22, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, black, transparent 88%);
}

a {
  color: inherit;
}
a:hover {
  color: var(--accent-deep);
}

.site-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 0 18px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--paper);
  background: var(--ink);
  border-radius: 50% 50% 50% 8px;
  font-family: Georgia, serif;
  font-size: 22px;
  transform: rotate(-8deg);
}
.brand-copy strong {
  display: block;
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.brand-copy span,
.eyebrow,
.meta,
.nav,
code {
  font-family: 'SFMono-Regular', Consolas, monospace;
}
.brand-copy span {
  color: var(--muted);
  font-size: 11px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.nav a {
  text-decoration: none;
}
.nav a[aria-current='page'] {
  color: var(--accent-deep);
  text-decoration: underline;
  text-underline-offset: 5px;
}

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 56px;
  padding: 92px 0 76px;
  align-items: end;
}
.eyebrow {
  color: var(--accent-deep);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
  font-family:
    Iowan Old Style,
    Palatino Linotype,
    Book Antiqua,
    Georgia,
    serif;
  font-weight: 500;
}
h1 {
  max-width: 760px;
  margin-top: 16px;
  font-size: clamp(48px, 8vw, 92px);
  letter-spacing: -0.055em;
}
h2 {
  font-size: clamp(30px, 4vw, 48px);
  letter-spacing: -0.04em;
}
h3 {
  font-size: 24px;
}
.lede {
  max-width: 650px;
  margin: 26px 0 0;
  color: #424846;
  font-size: clamp(18px, 2vw, 23px);
}
.hero-note {
  padding: 22px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  background: rgba(255, 255, 255, 0.42);
  box-shadow: var(--shadow);
}
.hero-note .meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  color: var(--muted);
  font-size: 11px;
  border-bottom: 1px solid var(--line);
}
.hero-note p {
  margin: 18px 0 0;
  font-family: Georgia, serif;
  font-size: 19px;
}

.section {
  padding: 58px 0;
  border-top: 1px solid var(--line);
}
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  align-items: end;
  margin-bottom: 28px;
}
.section-head p {
  max-width: 500px;
  margin: 0;
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.card {
  min-height: 210px;
  padding: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.4);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}
.card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-4px);
}
.card p {
  margin: 14px 0 0;
  color: var(--muted);
}
.card a {
  display: inline-block;
  margin-top: 20px;
  color: var(--accent-deep);
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 12px;
  text-decoration: none;
}

.diagram {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  align-items: stretch;
}
.node {
  position: relative;
  padding: 20px 16px;
  background: var(--ink);
  color: var(--paper);
  min-height: 128px;
}
.node::after {
  content: '→';
  position: absolute;
  right: -18px;
  top: 50%;
  color: var(--accent);
  font-size: 24px;
  transform: translateY(-50%);
}
.node:last-child::after {
  display: none;
}
.node strong {
  display: block;
  color: #fff;
  font-family: Georgia, serif;
  font-size: 21px;
  font-weight: 500;
}
.node span {
  display: block;
  margin-top: 9px;
  color: #bcc1bb;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
}
.node.accent {
  background: var(--accent-deep);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.panel {
  padding: 26px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.38);
}
.panel h3 {
  margin-bottom: 16px;
}
.panel ul {
  margin: 0;
  padding-left: 20px;
}
.panel li + li {
  margin-top: 8px;
}
.panel code,
code {
  padding: 2px 6px;
  background: rgba(16, 19, 22, 0.07);
  font-size: 0.88em;
}

.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th,
td {
  padding: 14px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
th {
  color: var(--accent-deep);
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.callout {
  padding: 24px 28px;
  border-left: 5px solid var(--signal);
  background: rgba(156, 171, 85, 0.12);
}
.callout strong {
  font-family: Georgia, serif;
  font-size: 21px;
  font-weight: 500;
}
.callout p {
  margin: 8px 0 0;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  padding: 34px 0 48px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
}
.footer p {
  margin: 0;
}
.footer a {
  color: var(--accent-deep);
}

.article {
  max-width: 880px;
  padding: 76px 0 90px;
}
.article h1 {
  max-width: none;
  font-size: clamp(46px, 7vw, 78px);
}
.article h2 {
  margin-top: 58px;
  margin-bottom: 18px;
}
.article h3 {
  margin-top: 32px;
  margin-bottom: 12px;
  font-size: 26px;
}
.article p,
.article li {
  color: #424846;
}
.article ul,
.article ol {
  padding-left: 23px;
}
.article li + li {
  margin-top: 8px;
}
.article .meta-line {
  margin: 22px 0 44px;
  color: var(--muted);
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 12px;
}
.article .quote {
  margin: 28px 0;
  padding: 20px 24px;
  border-left: 4px solid var(--accent);
  background: rgba(214, 99, 45, 0.08);
  font-family: Georgia, serif;
  font-size: 20px;
}

@media (max-width: 820px) {
  .site-shell {
    width: min(100% - 28px, 680px);
  }
  .topbar,
  .section-head,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }
  .hero,
  .split {
    grid-template-columns: 1fr;
    gap: 28px;
    padding-top: 58px;
  }
  .cards {
    grid-template-columns: 1fr;
  }
  .diagram {
    grid-template-columns: 1fr;
  }
  .node {
    min-height: 0;
  }
  .node::after {
    right: auto;
    left: 50%;
    top: auto;
    bottom: -22px;
    transform: translateX(-50%) rotate(90deg);
  }
  .node:last-child::after {
    display: none;
  }
}

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